Example #1
0
$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");
$smarty->assign('thumb_size', $config_vars['thumb_size']['maxsize']);
$smarty->assign('title_page', $lang['view_cat']);
$smarty->assign('title_name', htmlspecialchars($category->get_name()));
$end_time = getmicrotime();
$execution_time = $end_time - $start_time;
$smarty->display($userdata['photo_user_template'] . "/{$template_file}.tpl");
$template_end_time = getmicrotime();
$template_execution_time = $template_end_time - $end_time;
echo "execution_time: {$execution_time} seconds<br>";
echo "template_execution_time: {$template_execution_time} seconds<br>";
$execution_time = $end_time - $start_time + $template_execution_time;
echo "gesamt execution_time: {$execution_time} seconds<br>";
}
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());
$smarty->assign('current_rating', $content->get_current_rating());
$smarty->assign('cat_id', $HTTP_GET_VARS['cat_id']);
$smarty->assign('redirect', PHREAKPIC_PATH . 'view_content.php');
$smarty->assign('additional_infos', $content->get_additinal_infos());
//calculate first_content
if ($HTTP_SESSION_VARS['content_per_page'] > 0) {
    $first_content = (int) ($surrounding_content['place'] / $HTTP_SESSION_VARS['content_per_page']) * $HTTP_SESSION_VARS['content_per_page'];