Esempio n. 1
0
function showThread($thr, $visitors, $comments, $categoryID, $categoryUser, $threadMembers, $threadID, $userID)
{
    $counter = 0;
    foreach ($threadMembers as $tm) {
        $author = $thr->author;
        if ($tm->thread_id == $threadID and $tm->user_id == $userID or $author == $userID) {
            $counter = $counter + 1;
        } else {
            foreach ($categoryUser as $catUS) {
                if ($catUS->category_id == $categoryID and $catUS->user_id == $userID) {
                    $counter = $counter + 1;
                }
            }
        }
    }
    if ($counter > 0) {
        echo "\n\t\t\t\t<tr>\n                    <td>\n                        <div class='thread-list-title'>\n                            <h4>" . anchor('thread/view/' . $thr->id, $thr->title) . "\n                                        <small class='label label-default'><i class='fa fa-lock'></i> Close Group</small>\n                    \t\t</h4>\n                        </div>\n                        <div class='thread-list-meta'>\n                            <ul>\n                                <li>\n                                    " . countViewer($visitors, $thr->id) . " Views\n                                </li>\n                                <li>\n                                    " . countComments($comments, $thr->id) . " Comments\n                                </li>\n                                <li>\n                                    Started by <a href='#'>" . user($thr->author)->full_name . "</a>\n                                </li>\n                                <li>\n                                    " . $thr->created_at . "\n                                </li>\n                                <li>\n                                    in <a href='#'>" . $thr->category_name . "</a>\n                                </li>\n                            </ul>\n                        </div>\n                    </td>\n                </tr>\n\t\t\t";
    } else {
    }
}
Esempio n. 2
0
                                echo '<small class="label label-default"><i class="fa fa-lock"></i> Close Group</small>';
                            }
                            ?>
                                                                                                    </h4>
                                                                                                </div>
                                                                                                <div class="thread-list-meta">
                                                                                                    <ul>
                                                                                                        <li>
                                                                                                            <?php 
                            echo countViewer($visitors, $thr->id);
                            ?>
 Views
                                                                                                        </li>
                                                                                                        <li>
                                                                                                            <?php 
                            echo countComments($comments, $thr->id);
                            ?>
 Comments
                                                                                                        </li>
                                                                                                        <li>
                                                                                                            Started by <a href="#"><?php 
                            echo user($thr->author)->full_name;
                            ?>
</a>
                                                                                                        </li>
                                                                                                        <li>
                                                                                                            <?php 
                            echo Carbon\Carbon::parse($thr->created_at)->format('d F Y H:i');
                            ?>
                                                                                                        </li>
                                                                                                        <li>
Esempio n. 3
0
if ($page == "") {
    $page = "1";
}
$currentpage = $page;
STemplate::assign('page', $page);
if ($page >= 2) {
    $pagingstart = ($page - 1) * $config['items_per_page'];
} else {
    $pagingstart = "0";
}
$query1 = "SELECT count(*) as total from posts A, members B where A.active='1' AND A.USERID=B.USERID AND A.phase>'1' order by A.htime desc limit {$config['maximum_results']}";
$query2 = "SELECT A.*, B.username from posts A, members B where A.active='1' AND A.USERID=B.USERID AND A.phase>'1' order by A.htime desc limit {$pagingstart}, {$config['items_per_page']}";
$executequery1 = $conn->Execute($query1);
$totalvideos = $executequery1->fields['total'];
if ($totalvideos > 0) {
    if ($executequery1->fields['total'] <= $config[maximum_results]) {
        $total = $executequery1->fields['total'];
    } else {
        $total = $config[maximum_results];
    }
    $toppage = ceil($total / $config[items_per_page]);
    if ($page <= $toppage) {
        $executequery2 = $conn->Execute($query2);
        $posts = $executequery2->getrows();
        $posts = getTags($posts);
        $posts = countComments($posts);
        $posts = getHash($posts);
        STemplate::assign('posts', $posts);
        STemplate::display('posts_bit_more.tpl');
    }
}
 public function __construct($database, $page)
 {
     $this->db = $database;
     $this->page = intval($page);
     $this->commentsCount = countComments($database);
 }
Esempio n. 5
0
            echo $project['project_id'];
            ?>
"  style="display: none;" title="Unroute">Routed</a>
                            <a href="#" class="project-action-btn" id="route_project" data-id="<?php 
            echo $project['project_id'];
            ?>
">Route</a>
                        <?php 
        }
        ?>

                        <a href="#" class="project-action-btn" id="comment_project" data-id="<?php 
        echo $project['project_id'];
        ?>
">Comment &nbsp;<span><?php 
        echo countComments($project['project_id']);
        ?>
</span></a>

                        <?php 
        if (checkLikedProject($project['project_id'], $_SESSION['uid'])) {
            ?>
                            <a href="#" class="project-action-btn" id="liked_project" data-id="<?php 
            echo $project['project_id'];
            ?>
" title="Unlike">Liked &nbsp; <span class="totalLikes"><?php 
            echo getLikes($project['project_id']);
            ?>
</span></a>
                            <a href="#" class="project-action-btn" id="like_project" data-id="<?php 
            echo $project['project_id'];
Esempio n. 6
0
        }
        //usort($canteen_info,"compare");
        $json = getJsonResponse(0, 'success', $canteen_info);
        $cache->set($cachename, $json);
        //计算食物排名
        $food_info = $db->query("select canteens.canteen_id,canteenname,food.food_id,foodname,price,favor,dislike,imageurl,canteen_food.grade\n\t\t\t\t\tfrom canteens,food,canteen_food\n\t\t\t\t\twhere canteens.canteen_id=canteen_food.canteen_id and food.food_id=canteen_food.food_id and \n\t\t\t\t\tcanteen_food.canteen_id in \n\t\t\t\t\t(select canteen_id from school_canteen where school_id={$value['school_id']})\n\t\t\t\t\torder by grade desc limit 0,10;");
        if ($food_info === false) {
            Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
            //echo $db->error;
            exit;
        } else {
            if (empty($food_info)) {
                continue;
            }
            foreach ($food_info as &$value3) {
                countComments($db, $value3);
            }
        }
        //usort($food_info,"compare");
        $json2 = getJsonResponse(0, 'success', $food_info);
        $cachename = "ranking.php" . md5("getfood&schoolid={$value['school_id']}") . '.txt';
        $cache->set($cachename, $json2);
        //echo json2;
    }
}
function countfood(&$db, &$value)
{
    $res = $db->query("select count(*) from canteen_food where canteen_id={$value['canteen_id']};");
    if ($res === false) {
        Log::error_log('database error:' . $db->error . ' in ' . basename(__FILE__));
        $db->close();
Esempio n. 7
0
                           data-id="<?php 
        echo $project['project_id'];
        ?>
">Route</a>

                        <!--                        --><?php 
        //}
        ?>

                        <a href="#" class="project-action-btn" id="comment_project"
                           data-id="<?php 
        echo $project['project_id'];
        ?>
">Comment
                            &nbsp;<span><?php 
        $cmt = countComments($project['project_id']);
        ?>
</span></a>

                        <?php 
        if (checkLikedProject($project['project_id'], $_SESSION['uid'])) {
            ?>
                            <a href="#" class="project-action-btn" id="liked_project"
                               data-id="<?php 
            echo $project['project_id'];
            ?>
" title="Unlike">Liked &nbsp; <span
                                    class="totalLikes"><?php 
            echo getLikes($project['project_id']);
            ?>
</span></a>
Esempio n. 8
0
 $output = str_replace("{author}", $my_author, $output);
 if ($news_arr[5] != "") {
     $output = str_replace("{avatar}", "<img alt=\"\" src=\"{$news_arr['5']}\" style=\"border: none;\" />", $output);
 } else {
     $output = str_replace("{avatar}", "", $output);
 }
 $output = str_replace("{avatar-url}", "{$news_arr['5']}", $output);
 # Music hack by rilmith 3 lines below.
 if ($news_arr[7] != "") {
     $output = str_replace("{music}", $news_arr[7], $output);
 } else {
     $output = str_replace("{music}", "", $output);
 }
 $output = str_replace("[link]", "<a title=\"{$lang_article_linktext}\" href=\"{$PHP_SELF}?aj_go=more&amp;id={$news_arr['0']}&amp;archive={$archive}&amp;start_from={$my_start_from}&amp;ucat={$news_arr['6']}&amp;{$user_query}\">", $output);
 $output = str_replace("[/link]", "</a>", $output);
 $output = str_replace("{comments-num}", countComments($news_arr[0], $archive), $output);
 #MORE HACK
 $content = explode('<!--more-->', $news_arr[3]);
 if ($allow_rss == TRUE) {
     #		$content[0] = str_replace(array("\r", "\n", "\t","{nl}"), "", $content[0]);
     $content[0] = strip_tags($content[0]);
 }
 $short_story = run_filters('news-entry-content', $content[0]);
 if ($allow_rss == TRUE) {
     #		$content[0] = str_replace(array("\r", "\n", "\t","{nl}"), "", $content[0]);
     $short_story = strip_tags($short_story);
 }
 $output = str_replace("{short-story}", $short_story, $output);
 $output = str_replace("{full-story}", run_filters('news-entry-content', $content[1]), $output);
 $output = str_replace("{category}", $cat[$news_arr[6]], $output);
 $output = str_replace("{category-id}", $news_arr[6], $output);
Esempio n. 9
0
 $title = word_truncate($title, 75);
 // It's prospect article
 $prosrev = false;
 if ($item_db[NEW_ID] > time() && $source != 'postponed') {
     $prosrev = getpart('post_rev');
 }
 // Enable Up/Down without sorting
 if (!isset($_REQUEST['ord_title']) and !isset($_REQUEST['ord_date'])) {
     $up = $PHP_SELF . build_uri('mod,action,direct,id,source,start_from,news_per_page,category,author', array('editnews', 'move', 'up', $item_db[0]));
     $down = $PHP_SELF . build_uri('mod,action,direct,id,source,start_from,news_per_page,category,author', array('editnews', 'move', 'down', $item_db[0]));
     $ORDER = getpart('editnews_order', array($up, $down));
 } else {
     $ORDER = '-';
 }
 $the_oneln = array('id' => $item_db[NEW_ID], 'title' => str_replace(array('<', '>'), array('&lt;', '&gt;'), $title), 'bg' => $bg, 'source' => $source, 'pros' => $prosrev, 'order' => $ORDER);
 $count_comments = countComments($item_db[NEW_ID], $source);
 if ($count_comments) {
     $the_oneln['comments'] = $count_comments;
 } else {
     $the_oneln['comments'] = "<span style='color:gray;'>" . $count_comments . "</span>";
 }
 // Make category names
 if (empty($item_db[NEW_CAT])) {
     $the_oneln['category'] = "<span style='color: gray;'>---</span>";
 } elseif (strstr($item_db[NEW_CAT], ',')) {
     $my_multy_cat_labels = array();
     $all_this_cats_arr = spsep($item_db[NEW_CAT]);
     foreach ($all_this_cats_arr as $this_single_cat) {
         $my_multy_cat_labels[] = $cat[$this_single_cat];
     }
     $my_multy_cat_labels = join(', ', $my_multy_cat_labels);
Esempio n. 10
0
function template_replacer_news($news_arr, $output)
{
    // Predefined Globals
    global $config_timestamp_active, $config_http_script_dir, $config_comments_popup, $config_comments_popup_string, $config_full_popup, $config_full_popup_string, $rss_news_include_url, $my_names, $my_start_from, $cat, $action, $cat_icon, $archive, $name_to_nick, $template, $user_query, $member_db, $_SESS, $PHP_SELF;
    // Short Story not exists
    if (empty($news_arr[NEW_FULL]) and strpos($output, '{short-story}') === false) {
        $news_arr[NEW_FULL] = $news_arr[NEW_SHORT];
    }
    $output = more_fields($news_arr[NEW_MF], $output);
    // Date Formatting [year, month, day, hour, minute, date=$config_timestamp_active]
    list($output, $news_arr) = hook('template_replacer_news_before', array($output, $news_arr));
    $output = embedateformat($news_arr[NEW_ID], $output);
    // Replace news content
    $output = str_replace("{title}", hesc($news_arr[NEW_TITLE]), $output);
    $output = str_replace("{author}", $my_names[$news_arr[NEW_USER]] ? $my_names[$news_arr[NEW_USER]] : $news_arr[NEW_USER], $output);
    $output = str_replace("{author-name}", hesc($name_to_nick[$news_arr[NEW_USER]]), $output);
    $output = str_replace("{short-story}", hesc($news_arr[NEW_SHORT]), $output);
    $output = str_replace("{full-story}", hesc($news_arr[NEW_FULL]), $output);
    // Replace system information
    $output = str_replace("{avatar-url}", $news_arr[NEW_AVATAR], $output);
    $output = str_replace("{category}", hesc(catid2name($news_arr[NEW_CAT])), $output);
    $output = str_replace("{category-url}", linkedcat($news_arr[NEW_CAT]), $output);
    $output = str_replace("{page-views}", false, $output);
    $output = str_replace("{phpself}", $PHP_SELF, $output);
    $output = str_replace("{index-link}", '<a href="' . $PHP_SELF . '">' . lang('Go back') . '</a>', $output);
    $output = str_replace("{back-previous}", '<a href="javascript:history.go(-1)">Go back</a>', $output);
    $output = str_replace("{cute-http-path}", $config_http_script_dir, $output);
    $output = str_replace("{news-id}", $news_arr[NEW_ID], $output);
    $output = str_replace("{category-id}", $news_arr[NEW_CAT], $output);
    $output = str_replace("{comments-num}", countComments($news_arr[NEW_ID], $archive), $output);
    $output = str_replace("{archive-id}", $archive, $output);
    $output = str_replace("{category-icon}", caticon($news_arr[NEW_CAT], $cat_icon, $cat), $output);
    $mf_for_avatar = options_extract($news_arr[NEW_MF]);
    if (array_key_exists('_avatar_width', $mf_for_avatar)) {
        $width_for_avatar = 'width:' . $mf_for_avatar['_avatar_width'] . ';';
    }
    if (array_key_exists('_avatar_height', $mf_for_avatar)) {
        $height_for_avatar = 'height:' . $mf_for_avatar['_avatar_height'] . ';';
    }
    $output = str_replace("{avatar}", $news_arr[NEW_AVATAR] ? '<img alt="" src="' . $news_arr[NEW_AVATAR] . '" style="border: none;' . $width_for_avatar . $height_for_avatar . '" />' : '', $output);
    $output = preg_replace('/\\[loggedin\\](.*?)\\[\\/loggedin\\]/is', empty($_SESS['user']) ? '' : '\\1', $output);
    // social plugins
    $output = str_replace('{fb-comments}', show_social_code('fb', $news_arr), $output);
    $output = str_replace('{fb-like}', show_social_code('fb-like', $news_arr), $output);
    $output = str_replace('{twitter}', show_social_code('twitter', $news_arr), $output);
    // in RSS we need the date in specific format
    if ($template == 'rss') {
        $output = str_replace("{date}", date("r", $news_arr[0]), $output);
        $output = str_replace("{rss-news-include-url}", $rss_news_include_url ? $rss_news_include_url : $config_http_script_dir . '/router.php', $output);
    } else {
        $output = str_replace("{date}", date($config_timestamp_active, $news_arr[NEW_ID]), $output);
    }
    // Star Rating
    if (empty($archive)) {
        $output = str_replace("{star-rate}", rating_bar($news_arr[NEW_ID], $news_arr[NEW_RATE]), $output);
    } else {
        $output = str_replace("{star-rate}", false, $output);
    }
    // Mail Exist in mailist ---------------------------------------------------- [mail]...[/mail]
    if (!empty($my_mails[$news_arr[NEW_USER]])) {
        $output = str_replace(array("[mail]", '[/mail]'), array('<a href="mailto:' . $my_mails[$news_arr[NEW_USER]] . '">', ''), $output);
    } else {
        $output = str_replace(array("[mail]", '[/mail]'), '', $output);
    }
    // By click to comments - popup window -------------------------------------- [com-link]...[/com-link]
    if ($config_comments_popup == "yes") {
        $URL = build_uri('subaction,id,ucat,start_from,template,archive', array('showcomments', $news_arr[NEW_ID], $news_arr[NEW_CAT], $my_start_from));
        $output = str_replace(array('[com-link]', '[/com-link]'), array('<a href="#" onclick="window.open(\'' . $config_http_script_dir . '/router.php' . $URL . '\', \'News\', \'' . $config_comments_popup_string . '\'); return false;">', '</a>'), $output);
    } else {
        if ($archive) {
            $URL = RWU('archreadcomm', $PHP_SELF . build_uri('subaction,id,ucat,title,template,archive', array('showcomments', $news_arr[NEW_ID], $news_arr[NEW_CAT], titleToUrl($news_arr[NEW_TITLE]))));
        } else {
            $URL = RWU('readcomm', $PHP_SELF . build_uri('subaction,id,ucat,title,template', array('showcomments', $news_arr[NEW_ID], $news_arr[NEW_CAT], titleToUrl($news_arr[NEW_TITLE]))));
        }
        $output = str_replace(array("[com-link]", '[/com-link]'), array("<a href=\"{$URL}\">", '</a>'), $output);
    }
    // Open link --------------------------------------------------------------- [link]...[/link]
    $URL = build_uri('subaction,id,start_from,ucat,archive,template', array('showfull', $news_arr[NEW_ID], $my_start_from, $news_arr[NEW_CAT]));
    $URL .= "&amp;#disqus_thread";
    $output = preg_replace('/\\[link target\\=([a-z0-9_]+?)\\](.*?)\\[\\/link\\]/is', '<a href="' . $PHP_SELF . $URL . '" target="\\1">\\2</a>', $output);
    $output = str_replace(array("[link]", "[/link]"), array('<a href="' . $PHP_SELF . $URL . '">', "</a>"), $output);
    // With Action = showheadlines -------------------------------------------- [full-link]...[/full-link]
    if ($news_arr[NEW_FULL] or $action == "showheadlines") {
        if ($config_full_popup == "yes") {
            $URL = build_uri('subaction,id,archive,template', array('showfull', $news_arr[NEW_ID], $archive, $template));
            // Popup string
            $attrlink = "href='#' onclick=\"window.open('{$config_http_script_dir}/router.php{$URL}', '_News', '{$config_full_popup_string}'); return false;\"";
            $output = preg_replace('/\\[full\\-link target\\=([a-z0-9_]+?)\\](.*?)\\[\\/full\\-link\\]/is', "<a {$attrlink} target='\\1'>\\2</a>", $output);
            $output = str_replace('[full-link]', "<a {$attrlink}>", $output);
        } else {
            $template = $template == 'Default' ? '' : $template;
            if ($archive) {
                $URL = RWU('archreadmore', $PHP_SELF . build_uri('subaction,id,archive,ucat,title,template', array('showfull', $news_arr[0], $archive, $news_arr[NEW_CAT], titleToUrl($news_arr[NEW_TITLE]), $template)) . "&amp;{$user_query}");
            } else {
                $URL = RWU('readmore', $PHP_SELF . build_uri('subaction,id,ucat,title,template', array('showfull', $news_arr[0], $news_arr[NEW_CAT], titleToUrl($news_arr[NEW_TITLE]), $template)) . "&amp;{$user_query}");
            }
            // Target string
            $attrlink = "href='{$URL}'";
            $output = preg_replace('/\\[full\\-link target\\=([a-z0-9_]+?)\\](.*?)\\[\\/full\\-link\\]/is', "<a {$attrlink} target='\\1'>\\2</a>", $output);
            $output = str_replace("[full-link]", "<a {$attrlink}>", $output);
        }
        $output = str_replace("[/full-link]", "</a>", $output);
    } else {
        $output = preg_replace('~\\[full-link.*?\\].*?\\[/full-link\\]~si', '<!-- no full story-->', $output);
    }
    // Admin can edit for news ------------------------------------------------ [edit]...[/edit]
    $DREdit = false;
    if (empty($_SESS['user']) == false) {
        $member_db = user_search($_SESS['user']);
        if (in_array($member_db[UDB_ACL], array(ACL_LEVEL_ADMIN, ACL_LEVEL_JOURNALIST))) {
            $url = '/index.php' . build_uri('mod,action,id,source', array('editnews', 'editnews', $news_arr[NEW_ID], $archive));
            $output = preg_replace('/\\[edit\\]/i', '<a target="_blank" href="' . $config_http_script_dir . $url . '">', $output);
            $output = preg_replace('/\\[\\/edit\\]/i', '</a>', $output);
            $DREdit = true;
        }
    }
    // If not used, replace [edit]..[/edit]
    if ($DREdit == false) {
        $output = preg_replace('~\\[edit\\].*?\\[/edit\\]~si', '', $output);
    }
    list($output, $news_arr) = hook('template_replacer_news_middle', array($output, $news_arr));
    $output = replace_news("show", $output);
    list($output) = hook('template_replacer_news_after', array($output, $news_arr));
    return $output;
}