Skip to content

Commit

Permalink
Fixing display of file field, fixing API issue showing outside of res…
Browse files Browse the repository at this point in the history
…ult array
  • Loading branch information
woxxy committed May 8, 2012
1 parent 590813c commit fe24e1b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
4 changes: 3 additions & 1 deletion application/controllers/api/chan_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function thread_get()

if ($thread !== FALSE)
{
$this->response($thread, 200); // 200 being the HTTP response code
$this->response($thread['result'], 200); // 200 being the HTTP response code
}
else
{
Expand Down Expand Up @@ -290,6 +290,8 @@ function thread_ghosts_posts_get()
get_selected_radix(), $num,
array('realtime' => TRUE, 'type' => 'from_doc_id', 'type_extra' => array('latest_doc_id' => $latest_doc_id))
);

$thread = $thread['result'];

if ($thread !== FALSE)
{
Expand Down
30 changes: 26 additions & 4 deletions application/controllers/chan.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,13 @@ public function thread($num = 0, $limit = 0)

// check if we can determine if posting is disabled
$tools_reply_box = TRUE;
$disable_image_upload = FALSE;

// no image posting in archive, hide the file input
if(get_selected_radix()->archive)
{
$disable_image_upload = TRUE;
}

// in the archive you can only ghostpost, so it's an easy check
if(get_selected_radix()->archive && get_selected_radix()->disable_ghost)
Expand All @@ -709,8 +716,11 @@ public function thread($num = 0, $limit = 0)
else
{
// we're only interested in knowing if we should display the reply box
if(isset($thread_check['ghost_disabled']))
if(isset($thread_check['ghost_disabled']) && $thread_check['ghost_disabled'] == TRUE)
$tools_reply_box = FALSE;

if(isset($thread_check['disable_image_upload']) && $thread_check['disable_image_upload'] == TRUE)
$disable_image_upload = TRUE;
}

// Set template variables required to build the HTML.
Expand All @@ -719,7 +729,8 @@ public function thread($num = 0, $limit = 0)
array(
'thread_id' => $num,
'posts' => $thread,
'is_thread' => TRUE
'is_thread' => TRUE,
'disable_image_upload' => $disable_image_upload
),
array(
'tools_reply_box' => $tools_reply_box,
Expand Down Expand Up @@ -791,6 +802,13 @@ public function last50($num = 0)

// check if we can determine if posting is disabled
$tools_reply_box = TRUE;
$disable_image_upload = FALSE;

// no image posting in archive, hide the file input
if(get_selected_radix()->archive)
{
$disable_image_upload = TRUE;
}

// in the archive you can only ghostpost, so it's an easy check
if(get_selected_radix()->archive && get_selected_radix()->disable_ghost)
Expand All @@ -800,8 +818,11 @@ public function last50($num = 0)
else
{
// we're only interested in knowing if we should display the reply box
if(isset($thread_check['ghost_disabled']))
if(isset($thread_check['ghost_disabled']) && $thread_check['ghost_disabled'] == TRUE)
$tools_reply_box = FALSE;

if(isset($thread_check['disable_image_upload']) && $thread_check['disable_image_upload'] == TRUE)
$disable_image_upload = TRUE;
}

// Set template variables required to build the HTML.
Expand All @@ -812,7 +833,8 @@ public function last50($num = 0)
'section_title' => _('Showing the last 50 posts for Thread No.') . $num,
'is_last50' => TRUE,
'thread_id' => $num,
'posts' => $thread
'posts' => $thread,
'disable_image_upload' => $disable_image_upload
),
array(
'tools_reply_box' => $tools_reply_box,
Expand Down
4 changes: 2 additions & 2 deletions content/themes/default/views/tools_reply_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
</div>


<?php if(!get_selected_radix()->archive) : ?>
<?php if(!isset($disable_image_upload) || !$disable_image_upload) : ?>
<div class="input-prepend">
<label class="add-on" for="reply_file"><?php echo _('File') ?></label><?php
echo form_upload(array(
'name' => 'file_image',
'id' => 'file_image',
));
echo form_hidden('MAX_FILE_SIZE', 3072);
echo form_hidden('MAX_FILE_SIZE', get_selected_radix()->max_image_size_kilobytes);
?>
</div>
<?php endif; ?>
Expand Down

0 comments on commit fe24e1b

Please sign in to comment.