$stories = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}"); $link = new Link(); //$user = new User; if ($stories) { foreach ($stories as $dblink) { $link->id = $dblink->link_id; $cached_links[$dblink->link_id] = $dblink; $link->read(); $live_item['link_date'] = txt_time_diff($link->date); $live_item['link_title'] = $link->title; if (Voting_Method == 2) { $live_item['link_votes'] = $link->rating($link->id) / 2; } else { $live_item['link_votes'] = $link->votes; } $live_item['link_username'] = $dblink->user_login; $live_item['link_category'] = GetCatName($link->category); $live_item['link_category_url'] = getmyurl("queuedcategory", $link->category_safe_name()); # $live_item['link_category_url'] = $link->category_safe_name(); $live_item['link_url'] = $link->get_internal_url(); $live_items[] = $live_item; } $main_smarty->assign('live_items', $live_items); } // pagination $main_smarty->assign('live_pagination', do_pages($rows, $top_users_size, "unpublished", true)); // sidebar $main_smarty = do_sidebar($main_smarty); // show the template $main_smarty->assign('tpl_center', $the_template . '/live_unpublished_center'); $main_smarty->display($the_template . '/pligg.tpl');
require_once 'header.php'; ?> <!-- /header--> <!-- banner--> <div class="subBanner"> <img src="templates/default/images/banner-ir.png" /> </div> <!-- /banner--> <!-- notice--> <div class="subnotice"><strong>网站公告:</strong> <?php echo Info(1); ?> </div> <!-- /notice--> <!-- mainbody--> <div class="subBody"> <div class="subTitle"> <span class="catname"><?php echo GetCatName($cid); ?> </span> <a href="javascript:history.go(-1);" class="goback">>> 返回</a> <span class="fr">您当前所在位置:<?php echo GetPosStr($cid, $id); ?> </span> <div class="cl"></div> </div> <div class="OneOfTwo"> <!-- 详细区域开始 --> <div class="listConts"> <?php //检测文档正确性 $r = $dosql->GetOne("SELECT * FROM `#@__infoimg` WHERE id={$id}"); if (@$r) { //增加一次点击量
function tree_to_array($root, $table, $showRoot = TRUE) { // showRoot -- Do we want to include the "root" category named "all" in our results -- all subcats WILL appear regardless global $db; $sql = 'SELECT lft, rgt FROM `' . $table . '` WHERE category__auto_id=' . $root . ';'; $result = mysql_query($sql); $row = mysql_fetch_array($result); $right = array(); $sql = 'SELECT * FROM `' . $table . '` WHERE lft BETWEEN ' . $row['lft'] . ' AND ' . $row['rgt'] . ' and category_enabled <> 0 ORDER BY lft ASC;'; $result = mysql_query($sql); $i = 0; $lastspacer = 0; while ($row = mysql_fetch_array($result)) { if (count($right) > 0) { // check if we should remove a node from the stack while ($right[count($right) - 1] < $row['rgt']) { array_pop($right); } } $array[$i]['spacercount'] = count($right); $array[$i]['lastspacercount'] = $lastspacer; $array[$i]['spacerdiff'] = abs($lastspacer - count($right)); $array[$i]['auto_id'] = $row['category__auto_id']; $array[$i]['name'] = $row['category_name']; $array[$i]['safename'] = $row['category_safe_name']; $array[$i]['color'] = $row['category_color']; $array[$i]['parent'] = $row['category_parent']; $array[$i]['parent_name'] = GetCatName($row['category_parent']); $array[$i]['subcat_count'] = GetSubCatCount($row['category__auto_id']); $array[$i]['parent_subcat_count'] = GetSubCatCount($row['category_parent']); $lastspacer = count($right); $i = $i + 1; $right[] = $row['rgt']; } if ($showRoot == FALSE) { $array = my_array_unset($array, 0); } return $array; }
function tree_to_array($root, $table, $showRoot = TRUE) { // showRoot -- Do we want to include the "root" category named "all" in our results -- all subcats WILL appear regardless global $db; $row = get_cached_category_data('category__auto_id', $root); if (!$row) { $sqlfix = "UPDATE " . table_categories . " SET `category__auto_id` = '0' WHERE `category_name` = 'all' LIMIT 1;"; $db->query($sqlfix); $row = $db->get_row($sql); if (!$row) { die('There is a problem with the categories table. Error CA:001.'); } } $right = array(); $result = get_cached_between($row->lft, $row->rgt); $i = 0; $lastspacer = 0; // added @ thanks to `parterburn` - http://www.pligg.com/forum/showthread.php?t=4888 foreach ($result as $row) { if (count($right) > 0) { // check if we should remove a node from the stack while ($right[count($right) - 1] < $row->rgt) { if (array_pop($right) == NULL) { break; // We've reached the top of the category chain } } } $array[$i]['principlecat'] = $row->rgt - $row->lft - 1; $array[$i]['spacercount'] = count($right); $array[$i]['lastspacercount'] = $lastspacer; $array[$i]['spacerdiff'] = abs($lastspacer - count($right)); $array[$i]['id'] = $row->category_id; $array[$i]['auto_id'] = $row->category__auto_id; $array[$i]['name'] = $row->category_name; $array[$i]['safename'] = $row->category_safe_name; $array[$i]['order'] = $row->category_order; $array[$i]['left'] = $row->lft; $array[$i]['right'] = $row->rgt; $array[$i]['leftrightdiff'] = $row->rgt - $row->lft; $array[$i]['authorlevel'] = $row->category_author_level; // DB 11/12/08 $array[$i]['authorgroup'] = $row->category_author_group; ///// if (isset($row->category_color)) { $array[$i]['color'] = $row->category_color; } if (isset($row->category_parent)) { $array[$i]['parent'] = $row->category_parent; $array[$i]['parent_name'] = GetCatName($row->category_parent); $array[$i]['parent_subcat_count'] = GetSubCatCount($row->category_parent); } $array[$i]['subcat_count'] = GetSubCatCount($row->category__auto_id); $lastspacer = count($right); $right[] = $row->rgt; if ($array[$i]['leftrightdiff'] != 1) { for ($j = 0; $j <= $array[$i]['leftrightdiff']; $j++) { $array[$i]['subcatalign'] = 1; } } $i++; } if ($showRoot == FALSE) { array_splice($array, 0, 1); } return $array; }
function do_sidebar($var_smarty, $navwhere = '') { // show the categories in the sidebar global $db, $dblang, $globals, $the_cats; if ($navwhere == '') { global $navwhere; } // fix for 'undefined index' errors if (!isset($navwhere['text4'])) { $navwhere['text4'] = ''; } else { $navwhere['text4'] = htmlspecialchars($navwhere['text4']); } if (!isset($navwhere['text3'])) { $navwhere['text3'] = ''; } else { $navwhere['text3'] = htmlspecialchars($navwhere['text3']); } if (!isset($navwhere['text2'])) { $navwhere['text2'] = ''; } else { $navwhere['text2'] = htmlspecialchars($navwhere['text2']); } if (!isset($navwhere['text1'])) { $navwhere['text1'] = ''; } else { $navwhere['text1'] = htmlspecialchars($navwhere['text1']); } if (!isset($navwhere['link4'])) { $navwhere['link4'] = ''; } if (!isset($navwhere['link3'])) { $navwhere['link3'] = ''; } if (!isset($navwhere['link2'])) { $navwhere['link2'] = ''; } if (!isset($navwhere['link1'])) { $navwhere['link1'] = ''; } $var_smarty->assign('navbar_where', $navwhere); $var_smarty->assign('body_args', ''); // fix for 'undefined index' errors $_caching = $var_smarty->cache; // get the current cache settings $var_smarty->cache = true; // cache has to be on otherwise is_cached will always be false $var_smarty->cache_lifetime = -1; // lifetime has to be set to something otherwise is_cached will always be false $thetpl = $var_smarty->get_template_vars('the_template_sidebar_modules') . '/categories.tpl'; // check to see if the category sidebar module is already cached // if it is, use it if (isset($_GET['category'])) { $thecat = sanitize($_GET['category'], 3); } else { $thecat = ''; } if ($var_smarty->is_cached($thetpl, 'sidebar|category|' . $thecat)) { $var_smarty->assign('cat_array', 'x'); // this is needed. sidebar.tpl won't include the category module if cat_array doesnt have some data } else { if (isset($_GET['category'])) { $thecat = get_cached_category_data('category_safe_name', urlencode(sanitize($_GET['category'], 1))); $thecat = $thecat->category_name; } $var_smarty->assign('UrlMethod', urlmethod); foreach ($the_cats as $cat) { if ($cat->category_id == $thecat && $cat->category_lang == $dblang && $cat->category_parent == 0) { $globals['category_id'] = $cat->category_id; $globals['category_name'] = $cat->category_name; } } $pos = strrpos($_SERVER["SCRIPT_NAME"], "/"); $script_name = substr($_SERVER["SCRIPT_NAME"], $pos + 1, 100); $script_name = str_replace(".php", "", $script_name); include_once 'dbtree.php'; $login_user = $db->escape(sanitize($_COOKIE['mnm_user'], 3)); if ($login_user) { /////// for user set category----sorojit. $sqlGeticategory = $db->get_var("SELECT user_categories from " . table_users . " where user_login = '******';"); $array1 = "SELECT * from " . table_categories . " where category__auto_id in ({$sqlGeticategory})"; $result = mysql_query($array1); $array = array(); while ($row = mysql_fetch_array($result)) { //print_r($row); $row[] = $row; } $right = array(); $array1 = "SELECT * from " . table_categories . " where category__auto_id in ({$sqlGeticategory}) ORDER BY lft"; $result1 = mysql_query($array1); while ($row = mysql_fetch_object($result1)) { $a[] = $row; } $result = $a; $i = 0; $lastspacer = 0; // added @ thanks to `parterburn` - http://www.pligg.com/forum/showthread.php?t=4888 foreach ($result as $row) { if (count($right) > 0) { // check if we should remove a node from the stack while ($right[count($right) - 1] < $row->rgt) { if (array_pop($right) == NULL) { break; // We've reached the top of the category chain } } } $array[$i]['principlecat'] = $row->rgt - $row->lft - 1; $array[$i]['spacercount'] = count($right); $array[$i]['lastspacercount'] = $lastspacer; $array[$i]['spacerdiff'] = abs($lastspacer - count($right)); $array[$i]['auto_id'] = $row->category__auto_id; $array[$i]['name'] = $row->category_name; $array[$i]['safename'] = $row->category_safe_name; if (isset($row->category_color)) { $array[$i]['color'] = $row->category_color; } if (isset($row->category_parent)) { $array[$i]['parent'] = $row->category_parent; $array[$i]['parent_name'] = GetCatName($row->category_parent); $array[$i]['parent_subcat_count'] = GetSubCatCount($row->category_parent); } $array[$i]['subcat_count'] = GetSubCatCount($row->category__auto_id); $lastspacer = count($right); $i = $i + 1; $right[] = $row->rgt; } ///////end of for user set category $var_smarty->assign('start', 0); } else { $array = tree_to_array(0, table_categories); $var_smarty->assign('start', 1); } $var_smarty->assign('lastspacer', 0); $var_smarty->assign('cat_array', $array); // use the 'totals' table now $published_count = get_story_count('published'); $var_smarty->assign('published_count', $published_count); // $sql = "select *, count(*) as count from " . table_links . ", " . table_categories . " where category_lang='$dblang' and category_id=link_category group by link_category ORDER BY category_name ASC"; // $categorylist = object_2_array($db->get_results($sql)); // $var_smarty->assign('categorylist', $categorylist); $var_smarty->assign('category_url', getmyurl('maincategory')); } $var_smarty->cache = $_caching; // set cache back to original value $vars = ''; check_actions('do_sidebar', $vars); return $var_smarty; }
function tree_to_array($root, $table, $showRoot = TRUE) { // showRoot -- Do we want to include the "root" category named "all" in our results -- all subcats WILL appear regardless global $db, $cached_categories; $row = get_cached_category_data('category__auto_id', $root); if (!$row) { $sqlfix = "UPDATE " . table_categories . " SET `category__auto_id` = '0' WHERE `category_name` = 'all' LIMIT 1;"; $db->query($sqlfix); $cached_categories = loadCategoriesForCache(); $row = get_cached_category_data('category__auto_id', $root); if (!$row) { die('There is a problem with the categories table. Error CA:001.'); } } $right = array(); $left = array(); $result = get_cached_between($row->lft, $row->rgt); $i = 0; $lastspacer = 0; foreach ($result as $row) { if (count($right) > 0) { // check if we should remove a node from the stack while ($right[count($right) - 1] < $row->rgt) { array_pop($left); if (array_pop($right) == NULL) { break; // We've reached the top of the category chain } } } $array[$i]['first'] = $row->lft - 1 == $left[sizeof($left) - 1]; $array[$i]['last'] = $row->rgt + 1 == $right[sizeof($right) - 1]; $array[$i]['principlecat'] = $row->rgt - $row->lft - 1; $array[$i]['spacercount'] = count($right); $array[$i]['lastspacercount'] = $lastspacer; $array[$i]['spacerdiff'] = abs($lastspacer - count($right)); $array[$i]['id'] = $row->category_id; $array[$i]['auto_id'] = $row->category__auto_id; $array[$i]['name'] = $row->category_name; $array[$i]['safename'] = $row->category_safe_name; $array[$i]['order'] = $row->category_order; $array[$i]['left'] = $row->lft; $array[$i]['right'] = $row->rgt; $array[$i]['leftrightdiff'] = $row->rgt - $row->lft; $array[$i]['authorlevel'] = $row->category_author_level; $array[$i]['authorgroup'] = $row->category_author_group; $array[$i]['votes'] = $row->category_votes; $array[$i]['karma'] = $row->category_karma; $array[$i]['description'] = $row->category_desc; $array[$i]['keywords'] = $row->category_keywords; if (isset($row->category_color)) { $array[$i]['color'] = $row->category_color; } if (isset($row->category_parent)) { $array[$i]['parent'] = $row->category_parent; $array[$i]['parent_name'] = GetCatName($row->category_parent); $array[$i]['parent_subcat_count'] = GetSubCatCount($row->category_parent); } $array[$i]['subcat_count'] = GetSubCatCount($row->category__auto_id); $lastspacer = count($right); $right[] = $row->rgt; $left[] = $row->lft; if ($array[$i]['leftrightdiff'] != 1) { for ($j = 0; $j <= $array[$i]['leftrightdiff']; $j++) { $array[$i]['subcatalign'] = 1; } } $i++; } if ($showRoot == FALSE) { array_splice($array, 0, 1); } return $array; }
$linkres->id = $link_id = sanitize($_POST['id'], 3); if (!is_numeric($link_id)) { die; } $linkres->read(); // if notify link submitter is selected if (isset($_POST["notify"])) { if (sanitize($_POST["notify"], 3) == "yes") { $link_author = $db->get_col("SELECT link_author FROM " . table_links . " WHERE link_id=" . $theid . ";"); $user = $db->get_row("SELECT * FROM " . table_users . " WHERE user_id=" . $link_author[0] . ";"); $to = $user->user_email; $subject = $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_Subject'); $body = $user->user_login . ", \r\n\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_AdminMadeChange') . "\r\n"; $body = $body . strtolower(strtok($_SERVER['SERVER_PROTOCOL'], '/')) . '://' . $_SERVER['HTTP_HOST'] . getmyurl('story', sanitize($_POST['id'], 3)) . "\r\n\r\n"; if ($linkres->category != sanitize($_POST["category"], 3)) { $body = $body . $main_smarty->get_config_vars('PLIGG_Visual_Submit2_Category') . " change\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_PreviousText') . ": " . GetCatName($linkres->category) . "\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_NewText') . ": " . GetCatName(sanitize($_POST["category"], 3)) . "\r\n\r\n"; } if ($linkres->title != sanitize($_POST["title"], 4, $Story_Content_Tags_To_Allow)) { $body = $body . $main_smarty->get_config_vars('PLIGG_Visual_Submit2_Title') . " change\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_PreviousText') . ": " . $linkres->title . "\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_NewText') . ": " . sanitize($_POST["title"], 3) . "\r\n\r\n"; } if ($linkres->content != sanitize($_POST["bodytext"], 4, $Story_Content_Tags_To_Allow)) { $body = $body . $main_smarty->get_config_vars('PLIGG_Visual_Submit2_Description') . " change\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_PreviousText') . ": " . $linkres->content . "\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_NewText') . ": " . sanitize($_POST["bodytext"], 3) . "\r\n\r\n"; } if ($linkres->tags != tags_normalize_string(sanitize($_POST['tags'], 3))) { $body = $body . $main_smarty->get_config_vars('PLIGG_Visual_Submit2_Tags') . " change\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_PreviousText') . ": " . $linkres->tags . "\r\n" . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_NewText') . ": " . tags_normalize_string(sanitize($_POST['tags'], 3)) . "\r\n\r\n"; } $body = $body . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Email_ReasonText') . ": "; if (sanitize($_POST["reason"], 3) == "other") { $body = $body . sanitize($_POST["otherreason"], 3); } else { $body = $body . $main_smarty->get_config_vars('PLIGG_Visual_EditStory_Reason_' . sanitize($_POST["reason"], 3));