function about_screen() { $render = new nel_render(); $render->add_data('header_type', 'ABOUT'); nel_render_header(array(), $render, array()); $render->output(TRUE); echo ' <div class="text-center"> <p> <span style="font-weight: bold; font-size: 1.25em; color: blue;">Nelliel Imageboard</span><br> Version: ' . NELLIEL_VERSION . ' </p> <p class="text-center"> Copyright (c) 2010-2015, <a href="http://www.nelliel.com">Nelliel Project</a><br> All rights reserved. </p> <div class="nelliel-license-div"> <p style="max-width: 40em;"> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: </p> <p> 1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. </p> <p> 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. </p> <p> 3) Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. </p> <img src="board_files/imagez/luna_canterlot_disclaimer.png" alt="Canterlot Voice Disclaimer" width="320" height="180" style="float: left; padding-right: 8px;"> <p style="margin-left: 330px;"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </p> <br> <hr class="clear"> <p> Default filetype icons are from the Soft Scraps pack made by <a href="http://deleket.deviantart.com/" title="Deleket">Deleket</a> </p> <p> <a href="http://pageconfig.com/post/portable-utf8" title="Portable UTF-8">Portable UTF-8</a> library created by <a href="http://pageconfig.com">Hamid Sarfraz</a>. </p> <p class="text-center"> <a href="' . PHP_SELF2 . PHP_EXT . '">' . nel_stext('LINK_RETURN') . '</a> </p> </div> </div> <hr> </body> </html>'; }
function nel_derp($error_id, $error_data) { static $diagnostic; if ($error_id === 'retrieve') { return $diagnostic[$error_data]; } if ($error_id === 'update') { $diagnostic[$error_data[0]] = $error_data[1]; return; } $diagnostic['error-id'] = $error_id; $diagnostic['error-message'] = nel_stext('ERROR_' . $error_id); $diagnostic['origin'] = $error_data['origin']; if (!is_null($error_data['files'])) { $diagnostic['bad-filename'] = $error_data['bad-filename']; $diagnostic['files'] = $error_data['files']; foreach ($diagnostic['files'] as $file) { unlink($file['dest']); } } require_once INCLUDE_PATH . 'output/error-page-generation.php'; nel_render_derp($diagnostic); die; }
function nel_process_new_post($dataforce, $plugins, $dbh) { global $enabled_types, $fgsfds, $plugins; $new_thread_dir = ''; // Get time $time = get_millisecond_time(); $reply_delay = $time - BS_REPLY_DELAY * 1000; // Check if post is ok $post_count = nel_is_post_ok($dataforce, $time, $dbh); // Process FGSFDS if (!is_null($dataforce['fgsfds'])) { if (utf8_strripos($dataforce['fgsfds'], 'noko') !== FALSE) { $fgsfds['noko'] = TRUE; } if (utf8_strripos($dataforce['fgsfds'], 'sage') !== FALSE) { $fgsfds['sage'] = TRUE; } $fgsfds = $plugins->plugin_hook('fgsfds_field', FALSE, array($fgsfds)); } // Start collecting file info $files = nel_process_file_info(); $there_is_no_spoon = TRUE; $poster_info = array('name' => $dataforce['name'], 'email' => $dataforce['email'], 'subject' => $dataforce['subject'], 'comment' => $dataforce['comment'], 'tripcode' => '', 'secure_tripcode' => ''); if (!empty($files)) { $files_count = count($files); $there_is_no_spoon = FALSE; } else { $files = array(); $files_count = 0; if (!$poster_info['comment']) { nel_derp(10, array('origin' => 'POST')); } if (BS1_REQUIRE_IMAGE_ALWAYS) { nel_derp(8, array('origin' => 'POST')); } if (BS1_REQUIRE_IMAGE_START && $dataforce['response_to'] === 0) { nel_derp(9, array('origin' => 'POST')); } } // Cancer-fighting tools and lulz if (utf8_strlen($poster_info['comment']) > BS_MAX_COMMENT_LENGTH || utf8_strlen($poster_info['name']) > BS_MAX_NAME_LENGTH || utf8_strlen($poster_info['email']) > BS_MAX_EMAIL_LENGTH || utf8_strlen($poster_info['subject']) > BS_MAX_SUBJECT_LENGTH || utf8_strlen($dataforce['file_source']) > BS_MAX_SOURCE_LENGTH || utf8_strlen($dataforce['file_license']) > BS_MAX_LICENSE_LENGTH) { nel_derp(11, array('origin' => 'POST')); } if (isset($dataforce['pass'])) { $cpass = $dataforce['pass']; $hashed_pass = nel_hash($dataforce['pass'], $plugins); $dataforce['pass'] = utf8_substr($hashed_pass, 0, 16); } else { $cpass = utf8_substr(rand(), 0, 8); } nel_banned_text($poster_info['comment'], $files); // Name and tripcodes $modpostc = 0; $cookie_name = $poster_info['name']; if ($poster_info['name'] !== '' && !BS1_FORCE_ANONYMOUS) { nel_banned_name($poster_info['name'], $files); $faggotry = utf8_strpos($poster_info['name'], nel_stext('THREAD_MODPOST')); if ($faggotry) { $poster_info['name'] = nel_stext('FAKE_STAFF_ATTEMPT'); } $faggotry = utf8_strpos($poster_info['name'], nel_stext('THREAD_ADMINPOST')); if ($faggotry) { $poster_info['name'] = nel_stext('FAKE_STAFF_ATTEMPT'); } $faggotry = utf8_strpos($poster_info['name'], nel_stext('THREAD_JANPOST')); if ($faggotry) { $poster_info['name'] = nel_stext('FAKE_STAFF_ATTEMPT'); } preg_match('/^([^#]*)(#(?!#))?([^#]*)(##)?(.*)$/', $poster_info['name'], $name_pieces); $poster_info['name'] = $name_pieces[1]; if ($name_pieces[5] !== '') { if ($name_pieces[5] === $_SESSION['settings']['staff_trip']) { if ($_SESSION['perms']['perm_post']) { if ($_SESSION['settings']['staff_type'] === 'admin') { $modpostc = 3; } else { if ($_SESSION['settings']['staff_type'] === 'moderator') { $modpostc = 2; } else { if ($_SESSION['settings']['staff_type'] === 'janitor') { $modpostc = 1; } } } } if ($_SESSION['perms']['perm_sticky'] && utf8_strripos($dataforce['fgsfds'], 'sticky') !== FALSE) { $fgsfds['sticky'] = TRUE; } if ($modpostc > 0) { break; } } } if ($name_pieces[3] !== '' && BS1_ALLOW_TRIPKEYS) { $cap = utf8_strtr($name_pieces[3], '&', '&'); $cap = utf8_strtr($cap, ',', ','); $salt = utf8_substr($cap . 'H.', 1, 2); $salt = preg_replace('#[^\\.-z]#', '.#', $salt); $salt = utf8_strtr($salt, ':;<=>?@[\\]^_`', 'ABCDEFGabcdef'); $poster_info['tripcode'] = utf8_substr(crypt($cap, $salt), -10); } $poster_info = $plugins->plugin_hook('tripcode-processing', TRUE, array($poster_info, $name_pieces)); if ($name_pieces[5] !== '' || $modpostc > 0) { $trip = nel_hash($name_pieces[5], $plugins); $poster_info['secure_tripcode'] = utf8_substr(crypt($trip, '42'), -12); } $poster_info = $plugins->plugin_hook('secure-tripcode-processing', TRUE, array($poster_info, $name_pieces, $modpostc)); if ($name_pieces[1] === '' || !empty($_SESSION) && $_SESSION['perms']['perm_post_anon']) { $poster_info['name'] = nel_stext('THREAD_NONAME'); $poster_info['email'] = ''; } } else { $poster_info['name'] = nel_stext('THREAD_NONAME'); $poster_info['email'] = ''; } // Cookies OM NOM NOM NOM setcookie('pwd-' . CONF_BOARD_DIR, $cpass, time() + 30 * 24 * 3600, '/'); // 1 month cookie expiration setcookie('name-' . CONF_BOARD_DIR, $cookie_name, time() + 30 * 24 * 3600, '/'); // 1 month cookie expiration $poster_info = $plugins->plugin_hook('after-post-info-processing', TRUE, array($poster_info)); $i = 0; while ($i < $files_count) { if (file_exists($files[$i]['dest'])) { $files[$i]['md5'] = md5_file($files[$i]['dest']); nel_banned_md5($files[$i]['md5'], $files[$i]); $prepared = $dbh->prepare('SELECT post_ref FROM ' . FILETABLE . ' WHERE md5=:md5 LIMIT 1'); $prepared->bindParam(':md5', $files[$i]['md5'], PDO::PARAM_STR); if ($prepared->execute()) { $post_ref = $prepared->fetchColumn(); unset($prepared); if ($dataforce['response_to'] === 0) { $prepared = $dbh->prepare('SELECT COUNT(*) FROM ' . POSTTABLE . ' WHERE post_number=:postref AND response_to=0'); $prepared->bindParam(':postref', $post_ref, PDO::PARAM_INT); } else { $prepared = $dbh->prepare('SELECT COUNT(*) FROM ' . POSTTABLE . ' WHERE post_number=:postref AND response_to=:respto'); $prepared->bindParam(':postref', $post_ref, PDO::PARAM_INT); $prepared->bindParam(':respto', $dataforce['response_to'], PDO::PARAM_INT); } if ($prepared->execute()) { $same_thread = $prepared->fetchColumn(); if ($same_thread > 0) { nel_derp(12, array('origin' => 'POST', 'bad-filename' => $files[i]['basic_filename'] . $files[i]['ext'], 'files' => $files)); } } unset($prepared); } } ++$i; } // // Go ahead and put post into database // $prepared = $dbh->prepare('INSERT INTO ' . POSTTABLE . ' (name, tripcode, secure_tripcode, email, subject, comment, host, password, post_time, last_update, response_to, last_response, post_count, sticky, mod_post, mod_comment, archive_status, locked) VALUES (:name, :tripcode, :secure_tripcode, :email, :subject, :comment, :host, :password, :time, :last_update, :respto, 0, 1, :sticky, :modpost, :mcomment, 0, 0)'); $prepared->bindValue(':name', $poster_info['name'], PDO::PARAM_STR); if ($poster_info['tripcode'] === '') { $prepared->bindValue(':tripcode', NULL, PDO::PARAM_NULL); } else { $prepared->bindValue(':tripcode', $poster_info['tripcode'], PDO::PARAM_STR); } if ($poster_info['secure_tripcode'] === '') { $prepared->bindValue(':secure_tripcode', NULL, PDO::PARAM_NULL); } else { $prepared->bindValue(':secure_tripcode', $poster_info['secure_tripcode'], PDO::PARAM_STR); } $prepared->bindValue(':email', $poster_info['email'], PDO::PARAM_STR); $prepared->bindValue(':subject', $poster_info['subject'], PDO::PARAM_STR); $prepared->bindValue(':comment', $poster_info['comment'], PDO::PARAM_STR); $prepared->bindValue(':host', @inet_pton($_SERVER["REMOTE_ADDR"]), PDO::PARAM_STR); $prepared->bindValue(':password', $dataforce['pass'], PDO::PARAM_STR); $prepared->bindValue(':time', $time, PDO::PARAM_STR); $prepared->bindValue(':last_update', $time, PDO::PARAM_STR); $prepared->bindValue(':respto', $dataforce['response_to'], PDO::PARAM_INT); if ($fgsfds['sticky']) { $prepared->bindValue(':sticky', 1, PDO::PARAM_INT); } else { $prepared->bindValue(':sticky', 0, PDO::PARAM_INT); } $prepared->bindValue(':modpost', $modpostc, PDO::PARAM_INT); $prepared->bindValue(':mcomment', NULL, PDO::PARAM_NULL); $prepared->execute(); unset($prepared); $result = $dbh->query('SELECT post_number FROM ' . POSTTABLE . ' WHERE post_time=' . $time . ' AND response_to=' . $dataforce['response_to'] . ''); $row = $result->fetch(); $post_number = $row[0]; unset($result); if ($dataforce['response_to'] === 0) { $fgsfds['noko_topic'] = $post_number; $new_thread_dir = $post_number; nel_create_thread_directories($new_thread_dir); } else { $fgsfds['noko_topic'] = $dataforce['response_to']; $new_thread_dir = $dataforce['response_to']; } $srcpath = SRC_PATH . $new_thread_dir . '/'; $thumbpath = THUMB_PATH . $new_thread_dir . '/'; // // Make thumbnails and do final file processing // $i = 0; while ($i < $files_count) { $files[$i]['im_x'] = 0; $files[$i]['im_y'] = 0; $files[$i]['pre_x'] = 0; $files[$i]['pre_y'] = 0; if ($files[$i]['subtype'] === 'SWF' || $files[$i]['supertype'] === 'GRAPHICS' && !BS1_USE_MAGICK) { $dim = getimagesize($files[$i]['dest']); $files[$i]['im_x'] = $dim[0]; $files[$i]['im_y'] = $dim[1]; $ratio = min(BS_MAX_HEIGHT / $files[$i]['im_y'], BS_MAX_WIDTH / $files[$i]['im_x']); $files[$i]['pre_x'] = $files[$i]['im_x'] > BS_MAX_WIDTH ? intval($ratio * $files[$i]['im_x']) : $files[$i]['im_x']; $files[$i]['pre_y'] = $files[$i]['im_y'] > BS_MAX_HEIGHT ? intval($ratio * $files[$i]['im_y']) : $files[$i]['im_y']; } if (BS1_USE_THUMB && $files[$i]['supertype'] === 'GRAPHICS') { exec("convert -version", $out, $rescode); if ($rescode === 0 && BS1_USE_MAGICK) { $cmd_getinfo = 'identify -format "%wx%h" ' . escapeshellarg($files[$i]['dest'] . '[0]'); exec($cmd_getinfo, $res); $dims = explode('x', $res[0]); $files[$i]['im_x'] = $dims[0]; $files[$i]['im_y'] = $dims[1]; $ratio = min(BS_MAX_HEIGHT / $files[$i]['im_y'], BS_MAX_WIDTH / $files[$i]['im_x']); $files[$i]['pre_x'] = $files[$i]['im_x'] > BS_MAX_WIDTH ? intval($ratio * $files[$i]['im_x']) : $files[$i]['im_x']; $files[$i]['pre_y'] = $files[$i]['im_y'] > BS_MAX_HEIGHT ? intval($ratio * $files[$i]['im_y']) : $files[$i]['im_y']; if ($files[$i]['subtype'] === 'GIF') { $files[$i]['thumbfile'] = $files[$i]['basic_filename'] . '-preview.gif'; $cmd_coalesce = 'convert ' . escapeshellarg($files[$i]['dest']) . ' -coalesce ' . escapeshellarg($thumbpath . 'tmp' . $files[$i]['thumbfile']); $cmd_resize = 'convert ' . escapeshellarg($thumbpath . 'tmp' . $files[$i]['thumbfile']) . ' -resize ' . BS_MAX_WIDTH . 'x' . BS_MAX_HEIGHT . '\\> -layers optimize ' . escapeshellarg($thumbpath . $files[$i]['thumbfile']); exec($cmd_coalesce); exec($cmd_resize); unlink($thumbpath . 'tmp' . $files[$i]['thumbfile']); chmod($thumbpath . $files[$i]['thumbfile'], 0644); } else { if (BS1_USE_PNG_THUMB) { $files[$i]['thumbfile'] = $files[$i]['basic_filename'] . '-preview.png'; $cmd_resize = 'convert ' . escapeshellarg($files[$i]['dest']) . ' -resize ' . BS_MAX_WIDTH . 'x' . BS_MAX_HEIGHT . '\\> -quality 00 -sharpen 0x0.5 ' . escapeshellarg($thumbpath . $files[$i]['thumbfile']); } else { $files[$i]['thumbfile'] = $files[$i]['basic_filename'] . '-preview.jpg'; $cmd_resize = 'convert ' . escapeshellarg($files[$i]['dest']) . ' -resize ' . BS_MAX_WIDTH . 'x' . BS_MAX_HEIGHT . '\\> -quality ' . BS_JPEG_QUALITY . ' -sharpen 0x0.5 ' . escapeshellarg($thumbpath . $files[$i]['thumbfile']); } exec($cmd_resize); chmod($thumbpath . $files[$i]['thumbfile'], 0644); } } else { // Test is really only for GIF support, which had a long absence // If your GD is somehow so old (or dumb) it can't do JPEG or PNG get a new host. Srsly. $gd_test = gd_info(); switch ($files[$i]['subtype']) { case 'JPEG': $image = imagecreatefromjpeg($files[$i]['dest']); break; case 'GIF': if ($gd_test['GIF Read Support']) { $image = imagecreatefromgif($files[$i]['dest']); } break; case 'PNG': $image = imagecreatefrompng($files[$i]['dest']); break; } $files[$i]['thumbnail'] = imagecreatetruecolor($files[$i]['pre_x'], $files[$i]['pre_y']); $files[$i]['thumbfile'] = $files[$i]['basic_filename'] . '-preview.jpg'; imagecopyresampled($files[$i]['thumbnail'], $image, 0, 0, 0, 0, $files[$i]['pre_x'], $files[$i]['pre_y'], $files[$i]['im_x'], $files[$i]['im_y']); if (BS1_USE_PNG_THUMB) { imagepng($files[$i]['thumbnail'], $thumbpath . $files[$i]['thumbfile'], -1); // Quality } else { imagejpeg($files[$i]['thumbnail'], $thumbpath . $files[$i]['thumbfile'], BS_JPEG_QUALITY); } } } clearstatcache(); if (!file_exists($srcpath . $files[$i]['basic_filename'] . $files[$i]['ext'])) { rename($files[$i]['dest'], $srcpath . $files[$i]['basic_filename'] . '.' . $files[$i]['ext']); } else { $files[$i]['basic_filename'] = "cc" . utf8_substr($time, -4) . "--" . $files[$i]['basic_filename']; rename($files[$i]['dest'], $srcpath . $files[$i]['basic_filename'] . '.' . $files[$i]['ext']); } ++$i; } // // Update post info and add file data if applicable // if ($dataforce['response_to'] === 0) { $parent_id = $post_number; } else { $parent_id = $dataforce['response_to']; } if ($dataforce['response_to'] !== 0 && !$fgsfds['sage'] && $post_count < BS_MAX_BUMPS) { ++$post_count; $dbh->query('UPDATE ' . POSTTABLE . ' SET last_update=' . $time . ', last_response=' . $post_number . ', post_count=' . $post_count . ' WHERE post_number=' . $dataforce['response_to'] . ''); $dbh->query('UPDATE ' . POSTTABLE . ' SET last_update=0 WHERE post_number=' . $post_number . ''); $parent_id = $dataforce['response_to']; } if (!$there_is_no_spoon) { $i = 0; while ($i < $files_count) { $dbh->query('UPDATE ' . POSTTABLE . ' SET has_file=1 WHERE post_number=' . $post_number . ''); $prepared = $dbh->prepare('INSERT INTO ' . FILETABLE . ' (parent_thread,post_ref,file_order,supertype,subtype,mime,filename,extension,filesize,md5,source,license) VALUES (' . '' . $parent_id . ',' . '' . $post_number . ',' . '"' . ($i + 1) . '",' . '"' . $files[$i]['supertype'] . '",' . '"' . $files[$i]['subtype'] . '",' . '"' . $files[$i]['mime'] . '",' . '"' . $files[$i]['basic_filename'] . '",' . '"' . $files[$i]['ext'] . '",' . '"' . $files[$i]['fsize'] . '",' . '"' . $files[$i]['md5'] . '",' . '"' . $files[$i]['file_source'] . '",' . '"' . $files[$i]['file_license'] . '")'); $prepared->execute(); unset($prepared); if ($files[$i]['supertype'] === 'GRAPHICS') { $dbh->query('UPDATE ' . FILETABLE . ' SET image_width=' . $files[$i]['im_x'] . ', image_height=' . $files[$i]['im_y'] . ', preview_name="' . $files[$i]['thumbfile'] . '", preview_width=' . $files[$i]['pre_x'] . ', preview_height=' . $files[$i]['pre_y'] . ', md5="' . $files[$i]['md5'] . '" WHERE post_ref=' . $post_number . ' AND file_order=' . ($i + 1) . ''); } else { if ($files[$i]['subtype'] === 'SWF') { $dbh->query('UPDATE ' . FILETABLE . ' SET image_width=' . $files[$i]['im_x'] . ', image_height=' . $files[$i]['im_y'] . ', md5="' . $files[$i]['md5'] . '" WHERE post_ref=' . $post_number . ' AND file_order=' . ($i + 1) . ''); } } ++$i; } } // // Run the archiving routine if this is a new thread or deleted/expired thread // nel_update_archive_status($dataforce, $dbh); // // Generate response page if it doesn't exist, otherwise update // if (!empty($_SESSION)) { $temp = $_SESSION['ignore_login']; } $return_res = $dataforce['response_to'] === 0 ? $new_thread_dir : $dataforce['response_to']; nel_regen($dataforce, $return_res, 'thread', FALSE, $dbh); $dataforce['archive_update'] = TRUE; nel_regen($dataforce, NULL, 'main', FALSE, $dbh); if (!empty($_SESSION)) { $_SESSION['ignore_login'] = $temp; } return $return_res; }
function nel_render_post($dataforce, $render, $response, $partial, $gen_data, $treeline, $dbh) { global $link_resno; $render->add_data('insert_hr', $gen_data['insert_hr']); $post_data = $treeline[$gen_data['post_counter']]; $render->add_multiple_data($post_data); if ($partial) { $link_resno = 0; } else { $link_resno = $dataforce['response_id']; } $render->add_data('expand_post', $gen_data['expand_post']); $render->add_data('first100', $gen_data['first100']); $render->add_data('response_id', $dataforce['response_id']); $render->add_data('tripcode', !is_null($post_data['tripcode']) ? BS_TRIPKEY_MARKER . $post_data['tripcode'] : ''); $render->add_data('secure_tripcode', !is_null($post_data['secure_tripcode']) ? BS_TRIPKEY_MARKER . BS_TRIPKEY_MARKER . $post_data['secure_tripcode'] : ''); $post_data['comment'] = nel_newline_cleanup($post_data['comment']); $post_data['comment'] = preg_replace('#(^|>)(>[^<]*|ÅÑ[^<]*)#', '$1<span class="post-quote">$2</span>', $post_data['comment']); $post_data['comment'] = preg_replace_callback('#>>([0-9]+)#', 'nel_parse_links', $post_data['comment']); if (nel_clear_whitespace($post_data['comment']) === '') { $post_data['comment'] = nel_stext('THREAD_NOTEXT'); } $render->add_sanitized_data('comment-part', utf8_str_replace('>><a href="../"', '>><a href="', $post_data['comment'])); $render->add_sanitized_data('comment', $post_data['comment']); $render->add_sanitized_data('name', $post_data['name']); $render->add_sanitized_data('email', $post_data['email']); $render->add_sanitized_data('subject', $post_data['subject']); $render->add_data('sticky', (bool) $post_data['sticky']); $temp_dot = $partial ? '' : $dataforce['dotdot']; $post_id = $response ? $post_data['response_to'] : $post_data['post_number']; if (!$dataforce['omitted_done']) { $render->add_data('omitted_count', $gen_data['post_count'] - BS_ABBREVIATE_THREAD); $render->add_data('omitted_posts', TRUE); } else { $render->add_data('omitted_posts', FALSE); } if ($gen_data['has_file']) { $render->add_data('has_file', TRUE); $filecount = count($gen_data['files']); $render->add_data('multifile', $filecount > 1 ? TRUE : FALSE); $i = 0; $files = $gen_data['files']; while ($i < $filecount) { $files[$i]['img_dim'] = !is_null($files[$i]['image_width']) && !is_null($files[$i]['image_height']) ? TRUE : FALSE; $files[$i]['file_location'] = $temp_dot . SRC_DIR . $post_id . '/' . $files[$i]['filename'] . "." . $files[$i]['extension']; $files[$i]['filesize'] = round((int) $files[$i]['filesize'] / 1024, 2); if (BS1_USE_THUMB) { if (isset($files[$i]['preview_name'])) { $files[$i]['has_preview'] = TRUE; $files[$i]['preview_location'] = $temp_dot . THUMB_DIR . $post_id . '/' . $files[$i]['preview_name']; if ($files[$i]['preview_width'] != 0) { if ($files[$i]['preview_width'] > BS_MAX_MULTI_WIDTH || $files[$i]['preview_height'] > BS_MAX_MULTI_HEIGHT) { $ratio = min(BS_MAX_MULTI_HEIGHT / $files[$i]['preview_height'], BS_MAX_MULTI_WIDTH / $files[$i]['preview_width']); $files[$i]['preview_width'] = intval($ratio * $files[$i]['preview_width']); $files[$i]['preview_height'] = intval($ratio * $files[$i]['preview_height']); } } } else { if (BS1_USE_FILE_ICON && file_exists(BOARD_FILES . 'imagez/nelliel/filetype/' . utf8_strtolower($files[$i]['supertype']) . '/' . utf8_strtolower($files[$i]['subtype']) . '.png')) { $files[$i]['has_preview'] = TRUE; $files[$i]['preview_location'] = $temp_dot . BOARD_FILES . '/imagez/nelliel/filetype/' . utf8_strtolower($files[$i]['supertype']) . '/' . utf8_strtolower($files[$i]['subtype']) . '.png'; $files[$i]['preview_width'] = BS_MAX_WIDTH < 64 ? BS_MAX_WIDTH : '128'; $files[$i]['preview_height'] = BS_MAX_HEIGHT < 64 ? BS_MAX_HEIGHT : '128'; } else { $files[$i]['has_preview'] = FALSE; } } } else { $files[$i]['has_preview'] = FALSE; } $files[$i]['source'] = nel_cleanse_the_aids($files[$i]['source']); $files[$i]['license'] = nel_cleanse_the_aids($files[$i]['license']); $files[$i]['endline'] = ($i + 1) % BS_MAX_FILES_ROW == 0 ? TRUE : FALSE; ++$i; } $render->add_data('files', $files); } else { $render->add_data('multifile', FALSE); } $curr_time = floor($render->retrieve_data('post_time') / 1000); switch (BS_DATE_FORMAT) { case 'ISO': $render->add_data('post_time', date("Y", $curr_time) . BS_DATE_SEPARATOR . date("m", $curr_time) . BS_DATE_SEPARATOR . date("d (D) H:i:s", $curr_time)); break; case 'US': $render->add_data('post_time', date("m", $curr_time) . BS_DATE_SEPARATOR . date("d", $curr_time) . BS_DATE_SEPARATOR . date("Y (D) H:i:s", $curr_time)); break; case 'COM': $render->add_data('post_time', date("d", $curr_time) . BS_DATE_SEPARATOR . date("m", $curr_time) . BS_DATE_SEPARATOR . date("Y (D) H:i:s", $curr_time)); break; } switch ($render->retrieve_data('mod_post')) { case '1': $render->add_data('staff_post', nel_stext('THREAD_JANPOST')); $render->add_data('secure_tripcode', ''); break; case '2': $render->add_data('staff_post', nel_stext('THREAD_MODPOST')); $render->add_data('secure_tripcode', ''); break; case '3': $render->add_data('staff_post', nel_stext('THREAD_ADMINPOST')); $render->add_data('secure_tripcode', ''); break; default: $render->add_data('staff_post', ''); } $render->add_data('logged_in', FALSE); $render->add_data('page_ref1', PHP_SELF2 . PHP_EXT); $render->add_data('page_ref2', ''); if (!empty($_SESSION) && !$_SESSION['ignore_login']) { $render->add_data('logged_in', TRUE); $render->add_data('host', @inet_ntop($render->retrieve_data('host')) ? inet_ntop($render->retrieve_data('host')) : 'Unknown'); $render->add_data('perm_ban', $_SESSION['perms']['perm_ban']); $render->add_data('page_ref1', PHP_SELF . '?mode=display&page=0'); $render->add_data('page_ref2', PHP_SELF . '?page='); $render->add_data('the_session', session_id()); } if ($response) { $render->parse('response_post.tpl', ''); } else { $render->parse('op_post.tpl', ''); } }
function nel_cache_rules($dbh) { $gmode = ''; $amode = ''; $vmode = ''; $dmode = ''; $rmode = ''; $omode = ''; $result = $dbh->query('SELECT * FROM ' . CONFIGTABLE . ' WHERE config_type IN ("filetype_allow_g","filetype_allow_a","filetype_allow_o","filetype_allow_p","filetype_allow_d","filetype_allow_r")'); $config_list = $result->fetchALL(PDO::FETCH_ASSOC); $result_count = count($config_list); $config_list2 = array(); foreach ($config_list as $array) { if (array_search('enable_graphics', $array) !== FALSE) { $config_list2['graphics'] = $array['setting']; } else { if (array_search('enable_audio', $array) !== FALSE) { $config_list2['audio'] = $array['setting']; } else { if (array_search('enable_video', $array) !== FALSE) { $config_list2['video'] = $array['setting']; } else { if (array_search('enable_other', $array) !== FALSE) { $config_list2['other'] = $array['setting']; } else { if (array_search('enable_package', $array) !== FALSE) { $config_list2['package'] = $array['setting']; } else { if (array_search('enable_document', $array) !== FALSE) { $config_list2['document'] = $array['setting']; } else { if (array_search('enable_archive', $array) !== FALSE) { $config_list2['archive'] = $array['setting']; } } } } } } } } $i = 0; while ($i < $result_count) { $t_element = utf8_str_replace('enable_', '', $config_list[$i]['config_name']); if ($config_list[$i]['setting'] !== '1') { ++$i; continue; } if ($config_list[$i]['config_type'] === 'filetype_allow_g' && $t_element !== 'graphics' && $config_list2['graphics'] === '1') { $gmode = $gmode . $t_element . ', '; } else { if ($config_list[$i]['config_type'] === 'filetype_allow_a' && $t_element !== 'audio' && $config_list2['audio'] === '1') { $amode = $amode . $t_element . ', '; } else { if ($config_list[$i]['config_type'] === 'filetype_allow_v' && $t_element !== 'video' && $config_list2['video'] === '1') { $vmode = $vmode . $t_element . ', '; } else { if ($config_list[$i]['config_type'] === 'filetype_allow_o' && $t_element !== 'other' && $config_list2['other'] === '1') { $omode = $omode . $t_element . ', '; } else { if ($config_list[$i]['config_type'] === 'filetype_allow_d' && $t_element !== 'document' && $config_list2['document'] === '1') { $dmode = $dmode . $t_element . ', '; } else { if ($config_list[$i]['config_type'] === 'filetype_allow_r' && $t_element !== 'archive' && $config_list2['archive'] === '1') { $rmode = $rmode . $t_element . ', '; } } } } } } ++$i; } $rule_list = ''; if ($gmode !== '') { $gmode = utf8_substr($gmode, 0, -2); $rule_list .= '<li>' . nel_stext('FILES_GRAPHICS') . utf8_strtoupper($gmode) . '</li>'; } if ($amode !== '') { $amode = utf8_substr($amode, 0, -2); $rule_list .= ' <li>' . nel_stext('FILES_AUDIO') . utf8_strtoupper($amode) . '</li>'; } if ($vmode !== '') { $vmode = utf8_substr($vmode, 0, -2); $rule_list .= ' <li>' . nel_stext('FILES_VIDEO') . utf8_strtoupper($vmode) . '</li>'; } if ($dmode !== '') { $dmode = utf8_substr($dmode, 0, -2); $rule_list .= ' <li>' . nel_stext('FILES_DOCUMENT') . utf8_strtoupper($dmode) . '</li>'; } if ($rmode !== '') { $rmode = utf8_substr($rmode, 0, -2); $rule_list .= ' <li>' . nel_stext('FILES_ARCHIVE') . utf8_strtoupper($rmode) . '</li>'; } if ($omode !== '') { $omode = utf8_substr($omode, 0, -2); $rule_list .= ' <li>' . nel_stext('FILES_OTHER') . utf8_strtoupper($omode) . '</li>'; } return $rule_list; }
setup_check($dbh); generate_auth_file($plugins); require_once INCLUDE_PATH . 'authorize.php'; $authorize = new nel_authorization(); require_once INCLUDE_PATH . 'language.php'; require_once INCLUDE_PATH . 'template.php'; require_once INCLUDE_PATH . 'render.php'; //nel_render_add_default('dotdot', ''); $template_info = array(); $dataforce = array(); $enabled_types = array(); $dataforce['page_gen'] = 'main'; $dataforce['archive_update'] = FALSE; $dataforce['post_links'] = ''; $dataforce['sp_field1'] = !empty($_POST[nel_stext('TEXT_SPAMBOT_FIELD1')]) ? $_POST[nel_stext('TEXT_SPAMBOT_FIELD1')] : NULL; $dataforce['sp_field2'] = !empty($_POST[nel_stext('TEXT_SPAMBOT_FIELD2')]) ? $_POST[nel_stext('TEXT_SPAMBOT_FIELD2')] : NULL; $dataforce['mode'] = NULL; $dataforce['get_mode'] = NULL; if (!empty($_POST)) { if (isset($_POST['mode'])) { $mode = explode('->', $_POST['mode']); } else { $mode = array(); } $dataforce['mode'] = isset($mode[0]) ? $mode[0] : NULL; $dataforce['sub_mode'] = isset($mode[1]) ? $mode[1] : NULL; $dataforce['mode_action'] = isset($mode[2]) ? $mode[2] : NULL; $dataforce['mode_extra'] = isset($_POST['mode2']) ? $_POST['mode2'] : NULL; $dataforce['admin_mode'] = isset($_POST['adminmode']) ? $_POST['adminmode'] : NULL; $dataforce['name'] = !empty($_POST['notanonymous']) ? $_POST['notanonymous'] : ''; $dataforce['email'] = !empty($_POST['spamtarget']) ? $_POST['spamtarget'] : '';