$valid = 0; } if (is_null($autoorder)) { $autoorder = 0; } $sql = "update {$plugin_table} set autoorder={$autoorder},valid={$valid} where name='{$path}'"; if ($dbo->exeUpdate($sql) !== false) { comp_plugins_position(); echo "<script>parent.Dialog.alert('" . $pl_langpackage->pl_update_suc . "')</script>"; } else { echo "<script>parent.Dialog.alert('" . $pl_langpackage->pl_update_false . "')</script>"; } } if (!is_null($path)) { //检测是不是有数据库文件 dbtarget('r', $dbServs); $sql = "select * from {$plugin_table} where name='{$path}'"; $plugin = $dbo->getRs($sql); if (is_array($plugin)) { if (isset($plugin[0]['autoorder']) && $plugin[0]['autoorder'] == 1) { $autoorder = "checked"; } else { $autoorder = ""; } if (isset($plugin[0]['valid']) && $plugin[0]['valid'] == 1) { $valid = "checked"; } else { $valid = ""; } echo <<<EOD <form method="post" name="uploadform" action="?path={$path}&operator=update">
$m_langpackage = new modulelp(); $ad_langpackage = new adminmenulp(); require "../foundation/fback_search.php"; $is_check = check_rights("c28"); if (!$is_check) { echo $m_langpackage->m_no_pri; exit; } $com_type_select = array("blog_comment" => $m_langpackage->m_blog, "group_subject_comment" => $m_langpackage->m_subject, "album_comment" => $m_langpackage->m_album, "photo_comment" => $m_langpackage->m_photo, "poll_comment" => $m_langpackage->m_poll, "share_comment" => $m_langpackage->m_share, "mood_comment" => $m_langpackage->m_mood); $com_type = array("photo_comment" => "photo_id", "mood_comment" => "mood_id", "share_comment" => "s_id", "poll_comment" => "p_id", "group_subject_comment" => "subject_id", "album_comment" => "album_id", "blog_comment" => "log_id"); $idtype = get_argg('idtype'); $com_table_str = $idtype ? $idtype : "blog_comment"; $t_table = $tablePreStr . $com_table_str; $con_id = $com_type[$com_table_str]; $dbo = new dbex(); dbtarget('w', $dbServs); //当前页面参数 $page_num = trim(get_argg('page')); //变量区 $c_orderby = short_check(get_argg('order_by')); $c_ordersc = short_check(get_argg('order_sc')); $c_perpage = get_argg('perpage') ? intval(get_argg('perpage')) : 20; $eq_array = array('host_id', 'visitor_id', 'visitor_name', $con_id); $like_array = array('content'); $date_array = array("add_time"); $num_array = array(); $sql = spell_sql($t_table, $eq_array, $like_array, $date_array, $num_array, $c_orderby, $c_ordersc); $dbo->setPages($c_perpage, $page_num); //设置分页 $com_rs = $dbo->getRs($sql); $page_total = $dbo->totalPage;
function paper_get_unread_papers($user_id) { global $tablePreStr; global $dbServs; $dbo = new dbex(); $t_comments = $tablePreStr . "comments"; $t_papers = $tablePreStr . "papers"; dbtarget('r', $dbServs); $data = array(); if (null == $user_id) { return $data; } $datasql = "select {$t_papers}.* from {$t_papers} where {$t_papers}.paper_id in \n(select distinct {$t_comments}.paper_id as unread_count from {$t_comments} \n\twhere (({$t_comments}.paper_id in (select {$t_papers}.paper_id from {$t_papers} where {$t_papers}.user_id = {$user_id}) and {$t_comments}.comment_type=1) \n\t\t\t or ({$t_comments}.commenter_id=1 and {$t_comments}.comment_type=2)) \n\t\tand {$t_comments}.comment_status = 0)"; $data = $dbo->getAll($datasql); return $data; }
function paper_related_update_paper_unread($user_id, $paper_id, $is_user_paper) { global $tablePreStr; global $dbServs; $dbo = new dbex(); $t_comments = $tablePreStr . "comments"; dbtarget('w', $dbServs); $updateSql = ""; if (1 === $is_user_paper) { $updateSql = "update {$t_comments} set {$t_comments}.comment_status=1 \n\t\t\t\twhere {$t_comments}.paper_id={$paper_id} and {$t_comments}.comment_type=1"; } else { $updateSql = "update {$t_comments} set {$t_comments}.comment_status=1 \n\t\t\t\twhere {$t_comments}.paper_id={$paper_id} and {$t_comments}.commenter_id = {$user_id} and {$t_comments}.comment_type=2"; } if ($dbo->exeUpdate($updateSql)) { return true; } return false; }
function comp_plugins($match) { if ($match[1] != '') { global $dbo; global $tablePreStr; global $dbServs; if (!isset($dbServs)) { require "configuration.php"; require $webRoot . $baseLibsPath . "conf/dbconf.php"; require $webRoot . $baseLibsPath . "fdbtarget.php"; require $webRoot . $baseLibsPath . "libs_inc.php"; require $webRoot . $baseLibsPath . "cdbex.class.php"; } $plugin_ids = explode(",", $match[1]); $sql_str = ''; foreach ($plugin_ids as $rs) { if ($sql_str != '') { $sql_str .= ","; } $sql_str .= "'" . $rs . "'"; } dbtarget('r', $dbServs); $dbo = new dbex(); $plugins_array = array(); $t_plugins = $tablePreStr . "plugins"; $t_plugin_url = $tablePreStr . "plugin_url"; $sql = "SELECT b.* FROM {$t_plugins} a,{$t_plugin_url} b WHERE a.name=b.name and a.valid=1 and b.layout_id in({$sql_str})"; $rows = $dbo->getRs($sql); foreach ($rows as $row) { $plugins_array["{$row['layout_id']}"][] = $row; } $str = serialize($plugins_array); return "{sta:\$plugins=unserialize('{$str}');/}"; } }
function dbplugin($rw) { global $dbServs; dbtarget($rw, $dbServs); }