Skip to content

Commit

Permalink
Merge branch 'master' into feature/comment-list
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Mar 26, 2016
2 parents 5843874 + 651699e commit e8fbff0
Show file tree
Hide file tree
Showing 26 changed files with 1,902 additions and 1,825 deletions.
4 changes: 1 addition & 3 deletions public_html/404.php
Expand Up @@ -2,7 +2,7 @@

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.6 |
// | Geeklog 2.1 |
// +---------------------------------------------------------------------------+
// | 404.php |
// | |
Expand Down Expand Up @@ -34,5 +34,3 @@
require_once 'lib-common.php';

COM_handle404();

?>
178 changes: 90 additions & 88 deletions public_html/article.php
Expand Up @@ -2,7 +2,7 @@

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.7 |
// | Geeklog 2.1 |
// +---------------------------------------------------------------------------+
// | article.php |
// | |
Expand Down Expand Up @@ -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)) {
Expand All @@ -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 != '') {
Expand Down Expand Up @@ -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');
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -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) &&
Expand All @@ -446,32 +443,37 @@
($story->displayElements('day') < time ())) {
$url = $_CONF['site_admin_url']
. '/trackback.php?mode=sendall&amp;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);

?>
10 changes: 4 additions & 6 deletions public_html/comment.php
Expand Up @@ -2,7 +2,7 @@

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.8 |
// | Geeklog 2.1 |
// +---------------------------------------------------------------------------+
// | comment.php |
// | |
Expand Down Expand Up @@ -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);

?>

0 comments on commit e8fbff0

Please sign in to comment.