} else { $op['text'] = $value; } $selector_options[] = $op; } $smarty->assign('selectable_content_per_page', $selector_options); } $smarty->assign('cat_id', $HTTP_GET_VARS['cat_id']); // proceed comments $comment_type = 'cat'; include 'includes/proceed_comment.inc.php'; //Show comments $root_comments = get_comments_of_cat($HTTP_GET_VARS['cat_id']); if (sizeof($root_comments) > 0) { for ($i = 0; $i < sizeof($root_comments); $i++) { make_comments($root_comments[$i], 0, check_cat_action_allowed($HTTP_GET_VARS['cat_id'], $userdata['user_id'], 'comment_edit')); } $smarty->assign('comments', $comments); } else { $smarty->assign('comments', 'false'); } //link where to go when back to thumbs $HTTP_SESSION_VARS['thumb_link'] = "view_cat.php?cat_id={$HTTP_GET_VARS['cat_id']}"; $smarty->assign('thumb_link', $HTTP_SESSION_VARS['thumb_link']); $smarty->assign('current_page', $HTTP_SESSION_VARS['thumb_link']); //thats for the index.php who needs another template file. index.php just set the $template_file to another value and includes this file if (!isset($template_file)) { $template_file = 'view_cat'; } $smarty->assign('nav_string', build_nav_string($HTTP_GET_VARS['cat_id'])); $smarty->assign('redirect', PHREAKPIC_PATH . "{$template_file}.php");
function make_comments($comment, $level, $editable) { global $comments, $userdata, $board_config, $lang; $comment_infos['level'] = $level; $comment_infos['id'] = $comment->id; //get_id(); $comment_infos['text'] = nl2br(htmlspecialchars($comment->get_feedback())); $comment_userdata = get_userdata(intval($comment->get_user_id())); $comment_infos['username'] = $comment_userdata['username']; switch ($comment_userdata['user_avatar_type']) { case USER_AVATAR_UPLOAD: $poster_avatar = $board_config['allow_avatar_upload'] ? '<img src="' . PHPBB_PATH . $board_config['avatar_path'] . '/' . $comment_userdata['user_avatar'] . '" alt="" border="0" />' : ''; break; case USER_AVATAR_REMOTE: $poster_avatar = $board_config['allow_avatar_remote'] ? '<img src="' . $comment_userdata['user_avatar'] . '" alt="" border="0" />' : ''; break; case USER_AVATAR_GALLERY: $poster_avatar = $board_config['allow_avatar_local'] ? '<img src="' . PHPBB_PATH . $board_config['avatar_gallery_path'] . '/' . $comment_userdata['user_avatar'] . '" alt="" border="0" />' : ''; break; } $comment_infos['avatar'] = $poster_avatar; $comment_infos['topic'] = htmlspecialchars($comment->get_topic()); $comment_infos['creation_date'] = date($userdata['user_dateformat'], strtotime($comment->get_creation_date())); $comment_infos['changed_count'] = $comment->get_changed_count(); $comment_infos['last_changed_date'] = date($userdata['user_dateformat'], strtotime($comment->get_last_changed_date())); $comment_infos['poster_name'] = htmlspecialchars($comment->get_poster_name()); $comment_infos['comment_has_been_changed'] = sprintf($lang['comment_has_been_changed'], $comment_infos['changed_count'], $comment_infos['last_changed_date']); if ($comment_userdata['user_id'] == $userdata['user_id'] or $editable) { $comment_infos['editable'] = true; } // check if comment is new $newest = strtotime($comment->get_creation_date()); if (strtotime($comment->get_last_changed_date()) > $newest) { $newest = strtotime($comment->get_last_changed_date()); } //echo date("Y-m-d H:i:s",$userdata['user_lastvisit'])."<br>"; if ($userdata['user_lastvisit'] < $newest) { $comment_infos['new'] = true; } $comments[] = $comment_infos; //echo ($comment->get_feedback()."<br>"); $comment_childs = $comment->get_childs(); if (is_array($comment_childs)) { for ($i = 0; $i < sizeof($comment_childs); $i++) { make_comments($comment_childs[$i], $level + 1, $editable); } } }
$smarty->assign('oontent_id_string', "&content_id={$content_id}"); } // get parent comments $class = $HTTP_GET_VARS['type'] . "_comment"; // get root comment $root_parent_id = $HTTP_GET_VARS['parent_id']; while ($root_parent_id != 0) { $parent_comment = new $class(); $parent_comment->generate_from_id($root_parent_id); $root_parent_id = $parent_comment->get_parent_id(); $root_id = $parent_comment->id; } if ($root_id != 0) { $root_comment = new $class(); $root_comment->generate_from_id($root_id); make_comments($root_comment, 0, false); $crop_rest = false; for ($i = 0; $i < sizeof($comments); $i++) { if ($crop_rest) { unset($comments[$i]); } if ($comments[$i]['id'] == $HTTP_GET_VARS['parent_id']) { $crop_rest = true; } } $smarty->assign('comments', $comments); } $smarty->assign('cat_id', $HTTP_GET_VARS['cat_id']); //there is no usefull title_name... //$smarty->assign('title_name',''); if ($HTTP_GET_VARS['mode'] == "add") {
} $smarty->assign('edit_info', $edit_info); // Check if user has content_remove rights on this categorie $cat_obj = new categorie(); $cat_obj->generate_from_id($HTTP_GET_VARS['cat_id']); if (check_cat_action_allowed($cat_obj->get_catgroup_id(), $userdata['user_id'], 'content_remove')) { $smarty->assign('allow_content_remove', 1); } if ($redirect_to_cat) { $header_location = @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ? "Refresh: 0; URL=" : "Location: "; header($header_location . append_sid("view_cat.php?cat_id={$HTTP_GET_VARS['cat_id']}", true)); } //Show comments $root_comments = get_comments_of_content($HTTP_GET_VARS['content_id']); for ($i = 0; $i < sizeof($root_comments); $i++) { make_comments($root_comments[$i], 0, $content->check_perm('comment_edit')); } $smarty->assign('comments', $comments); if (check_content_action_allowed($content->get_contentgroup_id(), $userdata['user_id'], 'comment_edit')) { $smarty->assign('allow_comment_edit', true); } // show content $nav_string = build_nav_string($HTTP_GET_VARS['cat_id']); $nav_content['name'] = htmlspecialchars($content->get_name()); $nav_string[] = $nav_content; $smarty->assign('nav_string', $nav_string); $content->inc_views(); $smarty->assign('html', $content->get_html()); $smarty->assign('name', htmlspecialchars($content->get_name())); $smarty->assign('content_id', $content->get_id()); $smarty->assign('views', $content->get_views());