diff --git a/public_html/404.php b/public_html/404.php index c6cb94fec..e456c2b9d 100644 --- a/public_html/404.php +++ b/public_html/404.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.6 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | 404.php | // | | @@ -34,5 +34,3 @@ require_once 'lib-common.php'; COM_handle404(); - -?> diff --git a/public_html/article.php b/public_html/article.php index 3d1f4dd32..31618526f 100644 --- a/public_html/article.php +++ b/public_html/article.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.7 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | article.php | // | | @@ -66,81 +66,80 @@ $reply = ''; $page = 0; $mode = ''; -if (isset ($_POST['mode'])) { - $mode = COM_applyFilter ($_POST['mode']); -} else if (isset ($_POST['format'])) { - $mode = COM_applyFilter ($_POST['format']); +if (isset($_POST['mode'])) { + $mode = COM_applyFilter($_POST['mode']); +} elseif (isset($_POST['format'])) { + $mode = COM_applyFilter($_POST['format']); } if (!empty($mode)) { - if (isset ($_POST['story'])) { - $sid = COM_applyFilter ($_POST['story']); + if (isset($_POST['story'])) { + $sid = COM_applyFilter($_POST['story']); } - if (isset ($_POST['order'])) { - $order = COM_applyFilter ($_POST['order']); + if (isset($_POST['order'])) { + $order = COM_applyFilter($_POST['order']); } - if (isset ($_POST['query'])) { + if (isset($_POST['query'])) { $query = $_POST['query']; } - if (isset ($_POST['reply'])) { - $reply = COM_applyFilter ($_POST['reply']); + if (isset($_POST['reply'])) { + $reply = COM_applyFilter($_POST['reply']); } - if (isset ($_POST['cpage'])) { - $page = COM_applyFilter ($_POST['cpage'], true); + if (isset($_POST['cpage'])) { + $page = COM_applyFilter($_POST['cpage'], true); } } else { - COM_setArgNames (array ('story', 'mode')); - $sid = COM_applyFilter (COM_getArgument ('story')); - $mode = COM_applyFilter (COM_getArgument ('mode')); - if (isset ($_GET['order'])) { - $order = COM_applyFilter ($_GET['order']); + COM_setArgNames (array('story', 'mode')); + $sid = COM_applyFilter(COM_getArgument('story')); + $mode = COM_applyFilter(COM_getArgument('mode')); + if (isset($_GET['order'])) { + $order = COM_applyFilter($_GET['order']); } - if (isset ($_GET['query'])) { + if (isset($_GET['query'])) { $query = $_GET['query']; } - if (isset ($_GET['reply'])) { - $reply = COM_applyFilter ($_GET['reply']); + if (isset($_GET['reply'])) { + $reply = COM_applyFilter($_GET['reply']); } - if (isset ($_GET['cpage'])) { - $page = COM_applyFilter ($_GET['cpage'], true); + if (isset($_GET['cpage'])) { + $page = COM_applyFilter($_GET['cpage'], true); } } -if (!empty ($_REQUEST['sid'])) { - $sid = COM_applyFilter ($_REQUEST['sid']); +if (!empty($_REQUEST['sid'])) { + $sid = COM_applyFilter($_REQUEST['sid']); } -if (empty ($sid) && !empty ($_POST['cmt_sid'])) { - $sid = COM_applyFilter ($_POST['cmt_sid']); +if (empty($sid) && !empty($_POST['cmt_sid'])) { + $sid = COM_applyFilter($_POST['cmt_sid']); } -if (empty ($sid)) { +if (empty($sid)) { COM_handle404(); } // Get topic TOPIC_getTopic('article', $sid); -if ((strcasecmp ($order, 'ASC') != 0) && (strcasecmp ($order, 'DESC') != 0)) { +if ((strcasecmp($order, 'ASC') !== 0) && (strcasecmp($order, 'DESC') !== 0)) { $order = ''; } -$result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE sid = '$sid'" . COM_getPermSql ('AND')); +$result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE sid = '$sid'" . COM_getPermSql('AND')); $A = DB_fetchArray($result); if ($A['count'] > 0) { - $story = new Story(); - $args = array ( - 'sid' => $sid, - 'mode' => 'view' - ); + $args = array( + 'sid' => $sid, + 'mode' => 'view' + ); $output = STORY_LOADED_OK; $result = PLG_invokeService('story', 'get', $args, $output, $svc_msg); - if($result == PLG_RET_OK) { - /* loadFromArray cannot be used, since it overwrites the timestamp */ + if ($result == PLG_RET_OK) { + // loadFromArray cannot be used, since it overwrites the timestamp reset($story->_dbFields); - while (list($fieldname,$save) = each($story->_dbFields)) { + while (list($fieldname, $save) = each($story->_dbFields)) { $varname = '_' . $fieldname; if (array_key_exists($fieldname, $output)) { @@ -154,9 +153,9 @@ if ($output == STORY_PERMISSION_DENIED) { $display = COM_showMessageText($LANG_ACCESS['storydenialmsg'], $LANG_ACCESS['accessdenied']); $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG_ACCESS['accessdenied'])); - } elseif ( $output == STORY_INVALID_SID ) { + } elseif ($output == STORY_INVALID_SID ) { COM_handle404(); - } elseif (($mode == 'print') && ($_CONF['hideprintericon'] == 0)) { + } elseif (($mode === 'print') && ($_CONF['hideprintericon'] == 0)) { $story_template = COM_newTemplate($_CONF['path_layout'] . 'article'); $story_template->set_file('article', 'printable.thtml'); if (XHTML != '') { @@ -297,30 +296,29 @@ } // Display whats related - $story_template = COM_newTemplate($_CONF['path_layout'] . 'article'); $story_template->set_file('article','article.thtml'); $story_template->set_var('story_id', $story->getSid()); $story_template->set_var('story_title', $pagetitle); - $story_options = array (); + $story_options = array(); if (($_CONF['hideemailicon'] == 0) && (!COM_isAnonUser() || (($_CONF['loginrequired'] == 0) && ($_CONF['emailstoryloginrequired'] == 0)))) { $emailUrl = $_CONF['site_url'] . '/profiles.php?sid=' . $story->getSid() . '&what=emailstory'; $story_options[] = COM_createLink($LANG11[2], $emailUrl); - $story_template->set_var ('email_story_url', $emailUrl); - $story_template->set_var ('lang_email_story', $LANG11[2]); - $story_template->set_var ('lang_email_story_alt', $LANG01[64]); + $story_template->set_var('email_story_url', $emailUrl); + $story_template->set_var('lang_email_story', $LANG11[2]); + $story_template->set_var('lang_email_story_alt', $LANG01[64]); } - $printUrl = COM_buildUrl ($_CONF['site_url'] + $printUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid() . '&mode=print'); if ($_CONF['hideprintericon'] == 0) { $story_options[] = COM_createLink($LANG11[3], $printUrl, array('rel' => 'nofollow')); - $story_template->set_var ('print_story_url', $printUrl); - $story_template->set_var ('lang_print_story', $LANG11[3]); - $story_template->set_var ('lang_print_story_alt', $LANG01[65]); + $story_template->set_var('print_story_url', $printUrl); + $story_template->set_var('lang_print_story', $LANG11[3]); + $story_template->set_var('lang_print_story_alt', $LANG01[65]); } if ($_CONF['backend'] == 1) { $tid = $story->displayElements('tid'); @@ -332,7 +330,7 @@ $feedTitle = sprintf($LANG11[6], $title); $feedType = SYND_getMimeType($format); $feedClass = 'feed-link'; - if (!empty($LANG_DIRECTION) && ($LANG_DIRECTION == 'rtl')) { + if (!empty($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl')) { $feedClass .= '-rtl'; } $story_options[] = COM_createLink($feedTitle, $feedUrl, @@ -365,38 +363,38 @@ if (true) { // can subscribe $commentSubscribeURL = ''; $story_options[] = COM_createLink('Nubbies', $commentSubscribeURL, array('rel' => 'nofollow')); - $story_template->set_var ('comment_subscribe_url', $commentSubscribeURL); - $story_template->set_var ('lang_comment_subscribe', 'Nubbies'); + $story_template->set_var('comment_subscribe_url', $commentSubscribeURL); + $story_template->set_var('lang_comment_subscribe', 'Nubbies'); } */ $related = STORY_whatsRelated($story->displayElements('related'), $story->displayElements('uid'), $story->getSid()); - if (!empty ($related)) { - $related = COM_startBlock ($LANG11[1], '', - COM_getBlockTemplate ('whats_related_block', 'header')) + if (!empty($related)) { + $related = COM_startBlock($LANG11[1], '', + COM_getBlockTemplate('whats_related_block', 'header')) . $related - . COM_endBlock (COM_getBlockTemplate ('whats_related_block', + . COM_endBlock(COM_getBlockTemplate('whats_related_block', 'footer')); } if (count ($story_options) > 0) { - $optionsblock = COM_startBlock ($LANG11[4], '', - COM_getBlockTemplate ('story_options_block', 'header')) - . COM_makeList ($story_options, 'list-story-options') - . COM_endBlock (COM_getBlockTemplate ('story_options_block', + $optionsblock = COM_startBlock($LANG11[4], '', + COM_getBlockTemplate('story_options_block', 'header')) + . COM_makeList($story_options, 'list-story-options') + . COM_endBlock(COM_getBlockTemplate('story_options_block', 'footer')); } else { $optionsblock = ''; } - $story_template->set_var ('whats_related', $related); - $story_template->set_var ('story_options', $optionsblock); - $story_template->set_var ('whats_related_story_options', + $story_template->set_var('whats_related', $related); + $story_template->set_var('story_options', $optionsblock); + $story_template->set_var('whats_related_story_options', $related . $optionsblock); // Another option here could be to figure out if story is first on page $tmpl = $_CONF['showfirstasfeatured'] ? 'featuredstorytext.thtml' : ''; - $story_template->set_var ('formatted_article', - STORY_renderArticle ($story, 'n', $tmpl, $query)); + $story_template->set_var('formatted_article', + STORY_renderArticle($story, 'n', $tmpl, $query)); // display comments or not? if ($_CONF['allow_page_breaks'] == 1) { @@ -407,18 +405,18 @@ $mode = ''; } - if( $story_page <= 0 ) { + if ($story_page <= 0) { $story_page = 1; } - $article_arr = explode( '[page_break]', $story->displayElements('bodytext')); + $article_arr = explode('[page_break]', $story->displayElements('bodytext')); $page_break_count = count($article_arr); if ($page_break_count > 1) { $conf = $_CONF['page_break_comments']; - if ( - ($conf == 'all') or - ( ($conf =='first') and ($story_page == 1) ) or - ( ($conf == 'last') and ($page_break_count == $story_page) ) + if ( + ($conf ==='all') || + (($conf ==='first') && ($story_page == 1)) || + (($conf === 'last') && ($page_break_count == $story_page)) ) { $show_comments = true; } else { @@ -432,11 +430,10 @@ } // Display the comments, if there are any .. - if (($story->displayElements('commentcode') >= 0) and $show_comments) { - $delete_option = (SEC_hasRights('story.edit') && ($story->getAccess() == 3) - ? true : false); - $story_template->set_var ('commentbar', - CMT_userComments ($story->getSid(), $story->displayElements('title'), 'article', + if (($story->displayElements('commentcode') >= 0) && $show_comments) { + $delete_option = (SEC_hasRights('story.edit') && ($story->getAccess() == 3)); + $story_template->set_var('commentbar', + CMT_userComments($story->getSid(), $story->displayElements('title'), 'article', $order, $mode, 0, $page, false, $delete_option, $story->displayElements('commentcode'))); } if ($_CONF['trackback_enabled'] && ($story->displayElements('trackbackcode') >= 0) && @@ -446,32 +443,37 @@ ($story->displayElements('day') < time ())) { $url = $_CONF['site_admin_url'] . '/trackback.php?mode=sendall&id=' . $story->getSid(); - $story_template->set_var ('send_trackback_link', + $story_template->set_var('send_trackback_link', COM_createLink($LANG_TRB['send_trackback'], $url)); - $story_template->set_var ('send_trackback_url', $url); - $story_template->set_var ('lang_send_trackback_text', + $story_template->set_var('send_trackback_url', $url); + $story_template->set_var('lang_send_trackback_text', $LANG_TRB['send_trackback']); } } - $permalink = COM_buildUrl ($_CONF['site_url'] + $permalink = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid()); - $story_template->set_var ('trackback', - TRB_renderTrackbackComments ($story->getSID(), 'article', + $story_template->set_var('trackback', + TRB_renderTrackbackComments($story->getSID(), 'article', $story->displayElements('title'), $permalink)); } else { - $story_template->set_var ('trackback', ''); + $story_template->set_var('trackback', ''); } - $display .= $story_template->finish ($story_template->parse ('output', 'article')); + $display .= $story_template->finish($story_template->parse('output', 'article')); $breadcrumbs = TOPIC_breadcrumbs('article', $story->getSid()); - $display = COM_createHTMLDocument($display, array('pagetitle' => $pagetitle, 'breadcrumbs' => $breadcrumbs, 'headercode' => $headercode)); + $display = COM_createHTMLDocument( + $display, + array( + 'pagetitle' => $pagetitle, + 'breadcrumbs' => $breadcrumbs, + 'headercode' => $headercode + ) + ); } } else { COM_handle404(); } COM_output($display); - -?> diff --git a/public_html/comment.php b/public_html/comment.php index df136094e..d605f5477 100644 --- a/public_html/comment.php +++ b/public_html/comment.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.8 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | comment.php | // | | @@ -65,17 +65,15 @@ $display = ''; // If reply specified, force comment submission form -if (isset ($_REQUEST['reply'])) { +if (isset($_REQUEST['reply'])) { $_REQUEST['mode'] = ''; } $mode = ''; -if (!empty ($_REQUEST['mode'])) { - $mode = COM_applyFilter ($_REQUEST['mode']); +if (!empty($_REQUEST['mode'])) { + $mode = COM_applyFilter($_REQUEST['mode']); } $display .= CMT_handleComment($mode); COM_output($display); - -?> diff --git a/public_html/directory.php b/public_html/directory.php index 9c49b1a5e..5b4a3e41b 100644 --- a/public_html/directory.php +++ b/public_html/directory.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.6 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | directory.php | // | | @@ -40,14 +40,17 @@ $conf_list_current_month = false; // name of this script -define ('THIS_SCRIPT', 'directory.php'); +define('THIS_SCRIPT', 'directory.php'); $display = ''; if (COM_isAnonUser() && (($_CONF['loginrequired'] == 1) || ($_CONF['directoryloginrequired'] == 1))) { - $display = COM_createHTMLDocument(SEC_loginRequiredForm(), - array('pagetitle' => $LANG_DIR['title'])); + $display = COM_createHTMLDocument( + SEC_loginRequiredForm(), + array('pagetitle' => $LANG_DIR['title'] + ) + ); COM_output($display); exit; } @@ -124,7 +127,7 @@ function DIR_monthLink($dir_topic, $year, $month, $count) { global $_CONF, $LANG_MONTH; - $retval = $LANG_MONTH[$month] . ' (' . COM_numberFormat ($count) . ')' . LB; + $retval = $LANG_MONTH[$month] . ' (' . COM_numberFormat($count) . ')' . LB; if ($count > 0) { $month_url = COM_buildUrl($_CONF['site_url'] . '/' @@ -203,7 +206,7 @@ function DIR_navBar($dir_topic, $year, $month = 0) $retval .= ' | '; $url = $_CONF['site_url'] . '/' . THIS_SCRIPT; - if ($dir_topic != 'all') { + if ($dir_topic !== 'all') { $url = COM_buildUrl($url . '?topic=' . urlencode($dir_topic)); } @@ -228,14 +231,14 @@ function DIR_navBar($dir_topic, $year, $month = 0) /** * Display month view * -* @param ref &$template reference of the template -* @param string $dir_topic current topic -* @param int $year year to display -* @param int $month month to display -* @return string list of articles for the given month +* @param Template $template reference of the template +* @param string $dir_topic current topic +* @param int $year year to display +* @param int $month month to display +* @return string list of articles for the given month * */ -function DIR_displayMonth(&$template, $dir_topic, $year, $month) +function DIR_displayMonth($template, $dir_topic, $year, $month) { global $_CONF, $_TABLES, $LANG_MONTH, $LANG_DIR; @@ -258,7 +261,7 @@ function DIR_displayMonth(&$template, $dir_topic, $year, $month) WHERE (date >= '$start') AND (date <= '$end') AND (draft_flag = 0) AND (date <= NOW()) AND ta.type = 'article' AND ta.id = sid "; - if ($dir_topic != 'all') { + if ($dir_topic !== 'all') { // Retrieve list of inherited topics $tid_list = TOPIC_getChildList($dir_topic); $sql['mysql'] .= " AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$dir_topic}')))"; @@ -326,13 +329,13 @@ function DIR_displayMonth(&$template, $dir_topic, $year, $month) /** * Display year view * -* @param ref &$template reference of the template -* @param string $dir_topic current topic -* @param int $year year to display -* @return string list of months (+ number of stories) for given year +* @param Template $template reference of the template +* @param string $dir_topic current topic +* @param int $year year to display +* @return string list of months (+ number of stories) for given year * */ -function DIR_displayYear(&$template, $dir_topic, $year) +function DIR_displayYear($template, $dir_topic, $year) { global $_CONF, $_TABLES, $LANG_MONTH, $LANG_DIR; @@ -361,7 +364,7 @@ function DIR_displayYear(&$template, $dir_topic, $year) WHERE (date >= '$start') AND (date <= '$end') AND (draft_flag = 0) AND (date <= NOW()) AND ta.type = 'article' AND ta.id = sid "; - if ($dir_topic != 'all') { + if ($dir_topic !== 'all') { // Retrieve list of inherited topics $tid_list = TOPIC_getChildList($dir_topic); $monthsql['mysql'] .= " AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '{$dir_topic}')))"; @@ -425,12 +428,12 @@ function DIR_displayYear(&$template, $dir_topic, $year) * year for which a story has been posted. Can optionally display a list of * the stories for the current month at the top of the page. * -* @param ref &$template reference of the template -* @param string $dir_topic current topic -* @return string list of all the years in the db +* @param Template $template reference of the template +* @param string $dir_topic current topic +* @return string list of all the years in the db * */ -function DIR_displayAll(&$template, $dir_topic) +function DIR_displayAll($template, $dir_topic) { global $_TABLES, $LANG_DIR; @@ -507,7 +510,7 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) $parts .= "&year=$year&month=$month"; } elseif ($year != 0) { $parts .= "&year=$year"; - } elseif ($dir_topic == 'all') { + } elseif ($dir_topic === 'all') { $tp = ''; } $url = COM_buildUrl($script . $tp . $parts); @@ -536,7 +539,7 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) // Topic stuff already set in lib-common but need to double check if URL_Write is_a enabled //Set topic for rest of site -if ($dir_topic == 'all') { +if ($dir_topic === 'all') { $topic = ''; } else { $topic = $dir_topic; @@ -544,7 +547,7 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) // See if user has access to view topic. if ($topic != '') { $test_topic = DB_getItem($_TABLES['topics'], 'tid', "tid = '$topic' " . COM_getPermSQL('AND')); - if (strtolower($topic) != strtolower($test_topic)) { + if (strtolower($topic) !== strtolower($test_topic)) { $topic = ''; $dir_topic = 'all'; } else { @@ -563,7 +566,7 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) } $dir_topicName = ''; -if ($dir_topic != 'all') { +if ($dir_topic !== 'all') { $dir_topicName = DB_getItem($_TABLES['topics'], 'topic', "tid = '" . DB_escapeString($dir_topic) . "'"); } @@ -580,7 +583,7 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) if (($year != 0) && ($month != 0)) { $title = sprintf ($LANG_DIR['title_month_year'], $LANG_MONTH[$month], $year); - if ($dir_topic != 'all') { + if ($dir_topic !== 'all') { $title .= ': ' . $dir_topicName; } $headercode = DIR_canonicalLink($dir_topic, $year, $month); @@ -590,9 +593,9 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) $val_year = $year; $val_month = $month; -} else if ($year != 0) { +} elseif ($year != 0) { $title = sprintf($LANG_DIR['title_year'], $year); - if ($dir_topic != 'all') { + if ($dir_topic !== 'all') { $title .= ': ' . $dir_topicName; } $headercode = DIR_canonicalLink($dir_topic, $year); @@ -604,7 +607,7 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) } else { $title = $LANG_DIR['title']; - if ($dir_topic != 'all') { + if ($dir_topic !== 'all') { $title .= ': ' . $dir_topicName; } $headercode = DIR_canonicalLink($dir_topic); @@ -652,8 +655,11 @@ function DIR_canonicalLink($dir_topic, $year = 0, $month = 0) $display .= COM_endBlock(); } -$display = COM_createHTMLDocument($display, array('pagetitle' => $title, - 'headercode' => $headercode)); +$display = COM_createHTMLDocument( + $display, + array( + 'pagetitle' => $title, + 'headercode' => $headercode + ) +); COM_output($display); - -?> diff --git a/public_html/getimage.php b/public_html/getimage.php index 0e83670bb..993d52ba8 100644 --- a/public_html/getimage.php +++ b/public_html/getimage.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.6 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | getimage.php | // | | @@ -43,18 +43,17 @@ require_once $_CONF['path_system'] . 'classes/downloader.class.php'; $downloader = new downloader(); - $downloader->setLogFile($_CONF['path_log'] . 'error.log'); - $downloader->setLogging(true); - -$downloader->setAllowedExtensions(array('gif' => 'image/gif', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'png' => 'image/png', - 'png' => 'image/x-png' - ) - ); +$downloader->setAllowedExtensions( + array( + 'gif' => 'image/gif', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'png' => 'image/png', + 'png' => 'image/x-png' + ) +); COM_setArgNames(array('mode', 'image')); $mode = COM_applyFilter(COM_getArgument('mode')); @@ -73,12 +72,15 @@ case 'articles': $downloader->setPath($_CONF['path_images'] . 'articles/'); break; + case 'topics': $downloader->setPath($_CONF['path_images'] . 'topics/'); break; + case 'userphotos': $downloader->setPath($_CONF['path_images'] . 'userphotos/'); break; + default: // Hrm, got a bad path, just die exit; @@ -87,7 +89,6 @@ // Let's see if we don't have a legit file. If not bail $pathToImage = $downloader->getPath() . $image; if (is_file($pathToImage)) { - // support conditional GET, if possible $st = @stat($pathToImage); if (is_array($st)) { @@ -115,7 +116,7 @@ header('ETag: ' . $etag); } - if ($mode == 'show') { + if ($mode === 'show') { echo ''; } else { $downloader->downloadFile($image); @@ -127,9 +128,7 @@ header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); - if ($mode == 'show') { + if ($mode === 'show') { echo COM_createHTMLDocument($display); } } - -?> diff --git a/public_html/index.php b/public_html/index.php index 0608aee55..c16cec121 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.6 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | index.php | // | | @@ -38,8 +38,8 @@ /** * Update array if need be with correct topic. * -* @param array A Array of articles from db -* @param string tid_list List of child topics of current topic +* @param array $A Array of articles from db +* @param string $tid_list List of child topics of current topic * */ function fixTopic(&$A, $tid_list) @@ -98,20 +98,19 @@ function fixTopic(&$A, $tid_list) } } - $displayall = false; -if (isset ($_GET['display'])) { - if (($_GET['display'] == 'all') && (empty ($topic))) { +if (isset($_GET['display'])) { + if (($_GET['display'] == 'all') && (empty($topic))) { $displayall = true; } } // Retrieve the archive topic - currently only one supported -$archivetid = DB_getItem ($_TABLES['topics'], 'tid', "archive_flag=1"); +$archivetid = DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1"); $page = 1; -if (isset ($_GET['page'])) { - $page = COM_applyFilter ($_GET['page'], true); +if (isset($_GET['page'])) { + $page = COM_applyFilter($_GET['page'], true); if ($page == 0) { $page = 1; } @@ -121,19 +120,19 @@ function fixTopic(&$A, $tid_list) if (!$displayall) { // give plugins a chance to replace this page entirely - $newcontent = PLG_showCenterblock (0, $page, $topic); - if (!empty ($newcontent)) { + $newcontent = PLG_showCenterblock(0, $page, $topic); + if (!empty($newcontent)) { COM_output($newcontent); exit; } } -if (isset ($_GET['msg'])) { +if (isset($_GET['msg'])) { $plugin = ''; - if (isset ($_GET['plugin'])) { - $plugin = COM_applyFilter ($_GET['plugin']); + if (isset($_GET['plugin'])) { + $plugin = COM_applyFilter($_GET['plugin']); } - $display .= COM_showMessage (COM_applyFilter ($_GET['msg'], true), $plugin); + $display .= COM_showMessage(COM_applyFilter($_GET['msg'], true), $plugin); } if (SEC_inGroup('Root') && ($page == 1)) { @@ -168,16 +167,16 @@ function fixTopic(&$A, $tid_list) // Show any Plugin formatted blocks // Requires a plugin to have a function called plugin_centerblock_ -$displayBlock = PLG_showCenterblock (1, $page, $topic); // top blocks -if (!empty ($displayBlock)) { +$displayBlock = PLG_showCenterblock(1, $page, $topic); // top blocks +if (!empty($displayBlock)) { $display .= $displayBlock; // Check if theme has added the template which allows the centerblock // to span the top over the rightblocks if (file_exists($_CONF['path_layout'] . 'topcenterblock-span.thtml')) { $topspan = COM_newTemplate($_CONF['path_layout']); - $topspan->set_file (array ('topspan'=>'topcenterblock-span.thtml')); - $topspan->parse ('output', 'topspan'); - $display .= $topspan->finish ($topspan->get_var('output')); + $topspan->set_file(array('topspan'=>'topcenterblock-span.thtml')); + $topspan->parse('output', 'topspan'); + $display .= $topspan->finish($topspan->get_var('output')); $GLOBALS['centerspan'] = true; } } @@ -193,8 +192,8 @@ function fixTopic(&$A, $tid_list) if ($U['maxstories'] >= $_CONF['minnews']) { $maxstories = $U['maxstories']; } -if ((!empty ($topic)) && ($maxstories == 0)) { - $topiclimit = DB_getItem ($_TABLES['topics'], 'limitnews', +if ((!empty($topic)) && ($maxstories == 0)) { + $topiclimit = DB_getItem($_TABLES['topics'], 'limitnews', "tid = '{$topic}'"); if ($topiclimit >= $_CONF['minnews']) { $maxstories = $topiclimit; @@ -212,29 +211,29 @@ function fixTopic(&$A, $tid_list) // Scan for any stories that have expired and should be archived or deleted $asql = "SELECT sid,ta.tid,title,expire,statuscode FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta "; $asql .= "WHERE (expire <= NOW()) AND ta.type = 'article' AND ta.id = sid AND ta.tdefault = 1 AND (statuscode = " . STORY_DELETE_ON_EXPIRE; -if (empty ($archivetid)) { +if (empty($archivetid)) { $asql .= ')'; } else { $asql .= ' OR statuscode = ' . STORY_ARCHIVE_ON_EXPIRE . ") AND ta.tid != '$archivetid'"; } $expiresql = DB_query($asql); -while (list ($sid, $expiretopic, $title, $expire, $statuscode) = DB_fetchArray ($expiresql)) { +while (list($sid, $expiretopic, $title, $expire, $statuscode) = DB_fetcharray($expiresql)) { if ($statuscode == STORY_ARCHIVE_ON_EXPIRE) { - if (!empty ($archivetid) ) { + if (!empty($archivetid) ) { COM_errorLog("Archive Story: $sid, Topic: $archivetid, Title: $title, Expired: $expire"); // Delete all topic references to story except topic default $asql = "DELETE FROM {$_TABLES['topic_assignments']} WHERE type = 'article' AND id = '{$sid}' AND tdefault = 0"; - DB_query ($asql); + DB_query($asql); // Now move over story to archive topic $asql = "UPDATE {$_TABLES['stories']} s, {$_TABLES['topic_assignments']} ta SET ta.tid = '$archivetid', s.frontpage = '0', s.featured = '0' WHERE s.sid='{$sid}' AND ta.type = 'article' AND ta.id = s.sid AND ta.tdefault = 1"; - DB_query ($asql); + DB_query($asql); } - } else if ($statuscode == STORY_DELETE_ON_EXPIRE) { + } elseif ($statuscode == STORY_DELETE_ON_EXPIRE) { COM_errorLog("Delete Story and comments: $sid, Topic: $expiretopic, Title: $title, Expired: $expire"); STORY_doDeleteThisStoryNow($sid); } @@ -243,8 +242,8 @@ function fixTopic(&$A, $tid_list) // Figure out different settings to display stories in a topic $sql = " (date <= NOW()) AND (draft_flag = 0)"; -if (empty ($topic)) { - $sql .= COM_getLangSQL ('tid', 'AND', 'ta'); +if (empty($topic)) { + $sql .= COM_getLangSQL('tid', 'AND', 'ta'); } // if a topic was provided only select those stories. @@ -266,7 +265,7 @@ function fixTopic(&$A, $tid_list) $sql .= " AND ta.tid != '{$archivetid}' "; } -$sql .= COM_getPermSQL ('AND', 0, 2, 's'); +$sql .= COM_getPermSQL('AND', 0, 2, 's'); if (!empty($U['aids'])) { $sql .= " AND s.uid NOT IN (" . str_replace( ' ', ",", $U['aids'] ) . ") "; @@ -276,7 +275,7 @@ function fixTopic(&$A, $tid_list) $sql .= " AND ta.tid NOT IN ('" . str_replace( ' ', "','", $U['tids'] ) . "') "; } -$sql .= COM_getTopicSQL ('AND', 0, 'ta') . ' '; +$sql .= COM_getTopicSQL('AND', 0, 'ta') . ' '; $offset = ($page - 1) * $limit; $userfields = 'u.uid, u.username, u.fullname'; @@ -316,71 +315,70 @@ function fixTopic(&$A, $tid_list) ta.type = 'article' AND ta.id = s.sid " . COM_getLangSQL('sid', 'AND', 's') . " AND {$sql} GROUP BY s.sid, ta.tid, expireunix, {$userfields}, t.topic, t.imageurl ORDER BY featured DESC, date DESC LIMIT {$offset}, {$limit}"; -$result = DB_query ($msql); +$result = DB_query($msql); //Figure out number of total pages -$data = DB_query ("SELECT s.sid FROM {$_TABLES['stories']} AS s, {$_TABLES['topic_assignments']} AS ta WHERE ta.type = 'article' AND ta.id = s.sid AND $sql GROUP BY s.sid"); -$nrows = DB_numRows ($data); -$num_pages = ceil ($nrows / $limit); +$data = DB_query("SELECT s.sid FROM {$_TABLES['stories']} AS s, {$_TABLES['topic_assignments']} AS ta WHERE ta.type = 'article' AND ta.id = s.sid AND $sql GROUP BY s.sid"); +$nrows = DB_numRows($data); +$num_pages = ceil($nrows / $limit); $breadcrumbs = ''; -if ( $A = DB_fetchArray( $result ) ) { +if ($A = DB_fetchArray($result)) { fixTopic($A, $tid_list); $story = new Story(); $story->loadFromArray($A); - if ( $_CONF['showfirstasfeatured'] == 1 ) { + if ($_CONF['showfirstasfeatured'] == 1) { $story->_featured = 1; } - // Display breadcrumb trail if (!empty($topic)) { $breadcrumbs = TOPIC_breadcrumbs('topic', $topic); - if ($_CONF['supported_version_theme'] == '1.8.1') { + if ($_CONF['supported_version_theme'] === '1.8.1') { $display .= $breadcrumbs; } } // display first article - $display .= STORY_renderArticle ($story, 'y'); + $display .= STORY_renderArticle($story, 'y'); // get plugin center blocks after featured article if ($story->DisplayElements('featured') == 1) { - $display .= PLG_showCenterblock (2, $page, $topic); + $display .= PLG_showCenterblock(2, $page, $topic); } // get remaining stories - while ($A = DB_fetchArray ($result)) { + while ($A = DB_fetcharray($result)) { fixTopic($A, $tid_list); $story = new Story(); $story->loadFromArray($A); - $display .= STORY_renderArticle ($story, 'y'); + $display .= STORY_renderArticle($story, 'y'); } // get plugin center blocks that follow articles - $display .= PLG_showCenterblock (3, $page, $topic); // bottom blocks + $display .= PLG_showCenterblock(3, $page, $topic); // bottom blocks // Print Google-like paging navigation - if (!isset ($_CONF['hide_main_page_navigation']) || + if (!isset($_CONF['hide_main_page_navigation']) || ($_CONF['hide_main_page_navigation'] == 0)) { - if (empty ($topic)) { + if (empty($topic)) { $base_url = $_CONF['site_url'] . '/index.php'; } else { $base_url = $_CONF['site_url'] . '/index.php?topic=' . $topic; } - $display .= COM_printPageNavigation ($base_url, $page, $num_pages); + $display .= COM_printPageNavigation($base_url, $page, $num_pages); } } else { // no stories to display if ($page == 1) { - if (!isset ($_CONF['hide_no_news_msg']) || + if (!isset($_CONF['hide_no_news_msg']) || ($_CONF['hide_no_news_msg'] == 0)) { - $display .= COM_startBlock ($LANG05[1], '', - COM_getBlockTemplate ('_msg_block', 'header')) . $LANG05[2]; - $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer')); + $display .= COM_startBlock($LANG05[1], '', + COM_getBlockTemplate('_msg_block', 'header')) . $LANG05[2]; + $display .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer')); } - $display .= PLG_showCenterblock (3, $page, $topic); // bottom blocks + $display .= PLG_showCenterblock(3, $page, $topic); // bottom blocks } else { $topic_url = ''; if (!empty($topic)) { @@ -392,12 +390,11 @@ function fixTopic(&$A, $tid_list) $header = ''; -if ($topic) -{ +if ($topic) { // Meta Tags if ($_CONF['meta_tags'] > 0) { - $result = DB_query ("SELECT meta_description, meta_keywords FROM {$_TABLES['topics']} WHERE tid = '{$topic}'"); - $A = DB_fetchArray ($result); + $result = DB_query("SELECT meta_description, meta_keywords FROM {$_TABLES['topics']} WHERE tid = '{$topic}'"); + $A = DB_fetcharray($result); $header .= LB . PLG_getMetaTags( 'homepage', '', array( @@ -414,9 +411,14 @@ function fixTopic(&$A, $tid_list) } } -$display = COM_createHTMLDocument($display, array('breadcrumbs' => $breadcrumbs, 'headercode' => $header, 'rightblock' => true)); +$display = COM_createHTMLDocument( + $display, + array( + 'breadcrumbs' => $breadcrumbs, + 'headercode' => $header, + 'rightblock' => true + ) +); // Output page COM_output($display); - -?> diff --git a/public_html/layout/denim/admin/story/storyeditor_advanced.thtml b/public_html/layout/denim/admin/story/storyeditor_advanced.thtml index 7d6566587..fb5f26191 100644 --- a/public_html/layout/denim/admin/story/storyeditor_advanced.thtml +++ b/public_html/layout/denim/admin/story/storyeditor_advanced.thtml @@ -62,18 +62,18 @@
-
-
@@ -93,18 +93,18 @@
-
-