示例#1
0
	/**
	 * 删除队列信息
	 */
	public function delete() {
		$idarr = isset($_POST['id']) ? $_POST['id'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
		$where = to_sqls($idarr, '', 'id');
		if ($this->db->delete($where)) {
			showmessage(L('operation_success'), HTTP_REFERER);
		} else {
			showmessage(L('operation_failure'), HTTP_REFERER);
		}
	}
示例#2
0
 /**
  * 查询多条数据并分页
  * @param $where
  * @param $order
  * @param $page
  * @param $pagesize
  * @return unknown_type
  */
 public final function listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key = '', $setpages = 10, $urlrule = '', $array = array())
 {
     $where = to_sqls($where);
     $this->number = $this->count($where);
     $page = max(intval($page), 1);
     $offset = $pagesize * ($page - 1);
     $this->pages = pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);
     $array = array();
     return $this->select($where, '*', "{$offset}, {$pagesize}", $order, '', $key);
 }
示例#3
0
	/**
	 * 查询多条数据并分页
	 * @param $where
	 * @param $order
	 * @param $page
	 * @param $pagesize
	 * @return unknown_type
	 */
	final public function listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array(), $data = '*') {
		$where = to_sqls($where);
		$this->number = $this->count($where);
		$page = max(intval($page), 1);
		$offset = $pagesize*($page-1);
		$this->pages = pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);
		$array = array();
		if ($this->number > 0) {
			return $this->select($where, $data, "$offset, $pagesize", $order, '', $key);
		} else {
			return array();
		}
	}
示例#4
0
 /**
  * 首页
  */
 public function init()
 {
     if (isset($_POST['dosubmit'])) {
         $denyusername = isset($_POST['denyusername']) ? new_stripslashes(trim($_POST['denyusername'])) : '';
         $denyemail = isset($_POST['denyemail']) ? new_stripslashes(trim($_POST['denyemail'])) : '';
         $denyemaildata = array2string(explode("\r\n", $denyemail));
         $denyusernamedata = array2string(explode("\r\n", $denyusername));
         $this->db->insert(array('name' => 'denyemail', 'data' => $denyemaildata), 1, 1);
         $this->db->insert(array('name' => 'denyusername', 'data' => $denyusernamedata), 1, 1);
         /*写入缓存*/
         setcache('settings', array('denyemail' => explode("\r\n", $denyemail), 'denyusername' => explode("\r\n", $denyusername)));
         showmessage(L('operation_success'), HTTP_REFERER);
     }
     $where = to_sqls(array('denyemail', 'denyusername'), '', 'name');
     $settingarr = $this->db->listinfo($where);
     foreach ($settingarr as $v) {
         $setting[$v['name']] = string2array($v['data']);
     }
     include $this->admin_tpl('system');
 }
示例#5
0
 public final function get_all($data = '*', $from = '', $where = '', $order = '', $limit = '')
 {
     if (!$from) {
         $from = $this->table_name;
     }
     $sql = 'SELECT ' . $data . ' FROM ' . $from;
     if ($where) {
         $where = to_sqls($where);
         $sql .= ' WHERE ' . $where;
     }
     if ($order) {
         $sql .= ' ORDER BY ' . $order;
     }
     if ($limit) {
         $limitNums = explode(',', $limit);
         $sql .= ' LIMIT ' . intval($limitNums[0]) . ',' . $limitNums[1];
     }
     $arr = $this->selectBySql($sql);
     return $arr;
 }
示例#6
0
文件: model.class.php 项目: cfhb/MIS
 public final function my_listinfo($where = '', $order = '', $page = 1, $pagesize = 20, $key = '', $setpages = 10, $urlrule = '', $array = array())
 {
     if (is_array($where)) {
         $number = $this->query('select count(*) as num ' . substr($where['sql'], strpos($where['sql'], 'from')));
         $num = $this->fetch_array($number);
         $this->number = $num[0]['num'];
     } else {
         $where = to_sqls($where);
         $this->number = $this->count($where);
     }
     $page = max(intval($page), 1);
     $offset = $pagesize * ($page - 1);
     $this->pages = my_pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);
     $array = array();
     if ($this->number > 0) {
         if (is_array($where)) {
             return $this->queryAll($where['sql'] . " order by {$order} limit {$offset}, {$pagesize}");
         } else {
             return $this->select($where, '*', "{$offset}, {$pagesize}", $order, '', $key);
         }
     } else {
         return array();
     }
 }
 function getSql($avs, $siteID)
 {
     //properties
     $num = intval($avs['totalNum']);
     $start = $avs['startNum'] == null ? 0 : intval($avs['startNum']) - 1;
     $channelSql = '';
     if ($avs['channelIndex']) {
         $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], 1);
         $channelids = array();
         if (intval($thisChannel->id)) {
             $channelSql = ' AND A.channel_id=' . $thisChannel->id;
             array_push($channelids, $thisChannel->id);
             if ($avs['scope'] && $avs['scope'] == 'children') {
                 $channels = $channelObj->getChannelsByParentID($thisChannel->id);
                 if ($channels) {
                     foreach ($channels as $c) {
                         array_push($channelids, $c->id);
                     }
                 }
             }
             $channelSql = ' AND ' . to_sqls($channelids, '', 'A.channel_id');
         }
         //
     }
     if (!intval($avs['city'])) {
         return 'SELECT A.autoid,A.id,A.site,A.link,A.externallink,A.thumb,CC.title,CC.title AS subtitle,A.title AS atitle,A.subtitle AS asubtitle,A.intro,A.source,A.author,A.time,A.keywords,A.pagecount FROM ' . TABLE_PREFIX . 'contentgroup_content CC,' . TABLE_PREFIX . 'article A WHERE groupid=' . $avs['id'] . ' AND A.id=CC.contentid' . $channelSql . ' AND A.time<{sysTime} ORDER BY CC.taxis DESC LIMIT ' . $start . ',' . $num;
     } else {
         return 'SELECT A.autoid,A.id,A.site,A.link,A.externallink,A.thumb,CC.title,CC.title AS subtitle,A.title AS atitle,A.subtitle AS asubtitle,A.intro,A.source,A.author,A.time,A.keywords,A.pagecount FROM ' . TABLE_PREFIX . 'contentgroup_content CC,' . TABLE_PREFIX . 'article A WHERE groupid=' . $avs['id'] . ' AND CC.geoid=' . intval($avs['city']) . ' AND A.id=CC.contentid' . $channelSql . ' AND A.time<{sysTime} ORDER BY CC.taxis DESC LIMIT ' . $start . ',' . $num;
     }
 }
示例#8
0
文件: index.php 项目: baowzh/renfang
 /**
  * 关键词搜索
  */
 public function init()
 {
     //获取siteid
     $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;
     $SEO = seo($siteid);
     //搜索配置
     $search_setting = getcache('search');
     $setting = $search_setting[$siteid];
     $search_model = getcache('search_model_' . $siteid);
     $type_module = getcache('type_module_' . $siteid);
     if (isset($_GET['q'])) {
         if (trim($_GET['q']) == '') {
             header('Location: ' . APP_PATH . 'index.php?m=search');
             exit;
         }
         $typeid = empty($_GET['typeid']) ? 48 : intval($_GET['typeid']);
         $time = empty($_GET['time']) || !in_array($_GET['time'], array('all', 'day', 'month', 'year')) ? 'all' : trim($_GET['time']);
         $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
         $pagesize = 10;
         $q = safe_replace(trim($_GET['q']));
         $q = htmlspecialchars(strip_tags($q));
         $q = str_replace('%', '', $q);
         //过滤'%',用户全文搜索
         $search_q = $q;
         //搜索原内容
         //按时间搜索
         if ($time == 'day') {
             $search_time = SYS_TIME - 86400;
             $sql_time = ' AND adddate > ' . $search_time;
         } elseif ($time == 'week') {
             $search_time = SYS_TIME - 604800;
             $sql_time = ' AND adddate > ' . $search_time;
         } elseif ($time == 'month') {
             $search_time = SYS_TIME - 2592000;
             $sql_time = ' AND adddate > ' . $search_time;
         } elseif ($time == 'year') {
             $search_time = SYS_TIME - 31536000;
             $sql_time = ' AND adddate > ' . $search_time;
         } else {
             $search_time = 0;
             $sql_time = '';
         }
         if ($page == 1 && !$setting['sphinxenable']) {
             //精确搜索
             $commend = $this->db->get_one("`typeid` = '{$typeid}' {$sql_time} AND `data` like '%{$q}%'");
         } else {
             $commend = '';
         }
         //如果开启sphinx
         if ($setting['sphinxenable']) {
             $sphinx = pc_base::load_app_class('search_interface', '', 0);
             $sphinx = new search_interface();
             $offset = $pagesize * ($page - 1);
             $res = $sphinx->search($q, array($siteid), array($typeid), array($search_time, SYS_TIME), $offset, $pagesize, '@weight desc');
             $totalnums = $res['total'];
             //如果结果不为空
             if (!empty($res['matches'])) {
                 $result = $res['matches'];
             }
         } else {
             pc_base::load_sys_class('segment', '', 0);
             $segment = new segment();
             //分词结果
             $segment_q = $segment->get_keyword($segment->split_result($q));
             //如果分词结果为空
             if (!empty($segment_q)) {
                 $sql = "`siteid`= '{$siteid}' AND `typeid` = '{$typeid}' {$sql_time} AND MATCH (`data`) AGAINST ('{$segment_q}' IN BOOLEAN MODE)";
             } else {
                 $sql = "`siteid`= '{$siteid}' AND `typeid` = '{$typeid}' {$sql_time} AND `data` like '%{$q}%'";
             }
             $result = $this->db->listinfo($sql, 'searchid DESC', $page, 10);
         }
         //如果开启相关搜索功能
         if ($setting['relationenble']) {
             //如果关键词长度在8-16之间,保存关键词作为relation search
             $this->keyword_db = pc_base::load_model('search_keyword_model');
             if (strlen($q) < 17 && strlen($q) > 5 && !empty($segment_q)) {
                 $res = $this->keyword_db->get_one(array('keyword' => $q));
                 if ($res) {
                     //关键词搜索数+1
                     //$this->keyword_db->update(array('searchnums'=>'+=1'), array('keyword'=>$q));
                 } else {
                     //关键词转换为拼音
                     pc_base::load_sys_func('iconv');
                     $pinyin = gbk_to_pinyin($q);
                     if (is_array($pinyin)) {
                         $pinyin = implode('', $pinyin);
                     }
                     $this->keyword_db->insert(array('keyword' => $q, 'searchnums' => 1, 'data' => $segment_q, 'pinyin' => $pinyin));
                 }
             }
             //相关搜索
             if (!empty($segment_q)) {
                 $relation_q = str_replace(' ', '%', $segment_q);
             } else {
                 $relation_q = $q;
             }
             $relation = $this->keyword_db->select("MATCH (`data`) AGAINST ('%{$relation_q}%' IN BOOLEAN MODE)", '*', 10, 'searchnums DESC');
         }
         //如果结果不为空
         if (!empty($result) || !empty($commend['id'])) {
             //开启sphinx后文章id取法不同
             if ($setting['sphinxenable']) {
                 foreach ($result as $_v) {
                     $sids[] = $_v['attrs']['id'];
                 }
             } else {
                 foreach ($result as $_v) {
                     $sids[] = $_v['id'];
                 }
             }
             if (!empty($commend['id'])) {
                 $sids[] = $commend['id'];
             }
             $sids = array_unique($sids);
             $where = to_sqls($sids, '', 'id');
             //获取模型id
             $model_type_cache = getcache('type_model_' . $siteid, 'search');
             $model_type_cache = array_flip($model_type_cache);
             $modelid = $model_type_cache[$typeid];
             //是否读取其他模块接口
             if ($modelid) {
                 $this->content_db->set_model($modelid);
                 /**
                  * 如果表名为空,则为黄页模型
                  */
                 if (empty($this->content_db->model_tablename)) {
                     $this->content_db = pc_base::load_model('yp_content_model');
                     $this->content_db->set_model($modelid);
                 }
                 if ($setting['sphinxenable']) {
                     $data = $this->content_db->listinfo($where, 'id DESC', 1, $pagesize);
                     $pages = pages($totalnums, $page, $pagesize);
                 } else {
                     $data = $this->content_db->select($where, '*');
                     $pages = $this->db->pages;
                     $totalnums = $this->db->number;
                 }
                 //如果分词结果为空
                 if (!empty($segment_q)) {
                     $replace = explode(' ', $segment_q);
                     foreach ($replace as $replace_arr_v) {
                         $replace_arr[] = '<font color=red>' . $replace_arr_v . '</font>';
                     }
                     foreach ($data as $_k => $_v) {
                         $data[$_k]['title'] = str_replace($replace, $replace_arr, $_v['title']);
                         $data[$_k]['description'] = str_replace($replace, $replace_arr, $_v['description']);
                     }
                 } else {
                     foreach ($data as $_k => $_v) {
                         $data[$_k]['title'] = str_replace($q, '<font color=red>' . $q . '</font>', $_v['title']);
                         $data[$_k]['description'] = str_replace($q, '<font color=red>' . $q . '</font>', $_v['description']);
                     }
                 }
             } else {
                 //读取专辑搜索接口
                 $special_api = pc_base::load_app_class('search_api', 'special');
                 $data = $special_api->get_search_data($sids);
                 $totalnums = count($data);
             }
         }
         $execute_time = execute_time();
         $pages = isset($pages) ? $pages : '';
         $totalnums = isset($totalnums) ? $totalnums : 0;
         $data = isset($data) ? $data : '';
         include template('search', 'list');
     } else {
         include template('search', 'index');
     }
 }
示例#9
0
 /**
  * 根据模板中的pageContents标签获取每页的数量值,仅生成静态页时有效
  *
  * @param unknown_type $channelID
  * @return unknown
  */
 public function getChannelTotalPage($channelID)
 {
     $tpl = bpBase::loadAppClass('template', 'template', 1);
     //channel
     $channelID = intval($channelID);
     $thisChannel = $this->getChannelByID($channelID);
     //分析模板
     $template = $tpl->get($thisChannel->channeltemplate);
     if (!file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template->id . '.parsed.tpl.php')) {
         $tpl->createChannelPageR($channelid);
     }
     //只有生成静态页的情况下,下面的代码才有效
     $totalPage = 1;
     if (file_exists(ABS_PATH . '/templatesCache/' . $template->id . '.tags.tpl.php')) {
         @(require ABS_PATH . '/templatesCache/' . $template->id . '.tags.tpl.php');
         $pageSize = 20;
         //判断是否有分页标签
         $isPagination = false;
         if ($tagsArr) {
             foreach ($tagsArr as $t) {
                 if ($t['name'] == 'pageContents') {
                     //
                     $isPagination = true;
                     $pageSize = $t['avs']['pageNum'];
                 }
             }
         }
         if ($isPagination) {
             $childChannels = $this->getChannelsByParentID($channelID);
             $channelidArr = array($channelID);
             if ($childChannels) {
                 foreach ($childChannels as $c) {
                     array_push($channelidArr, $c->id);
                 }
             }
             $article_db = bpBase::loadModel('article_model');
             $where = to_sqls($channelidArr, '', 'channel_id');
             $totalCount = $article_db->get_var($where, 'COUNT(id)', '', '');
             $totalPage = $totalCount % $pageSize > 0 ? intval($totalCount / $pageSize) + 1 : $totalCount / $pageSize;
             $totalPage = $totalPage < 1 ? 1 : $totalPage;
         } else {
             $totalPage = 1;
         }
     }
     return $totalPage;
 }
示例#10
0
 public function deleteExRelateArticle20130416()
 {
     $taskName = 'deleteExRelateArticle20130416';
     $thisTask = $this->update_log_db->get_one(array('file' => $taskName));
     $this->_executedCheck($taskName, $thisTask);
     //
     $content_db = bpBase::loadModel('content_model');
     $article_db = bpBase::loadModel('article_model');
     $articles = $article_db->select(array('ex' => 1), 'id');
     $articleids = array();
     if ($articles) {
         foreach ($articles as $a) {
             array_push($articleids, $a['id']);
         }
     }
     $content_db->delete(to_sqls($articleids, '', 'contentid'));
     //
     $this->_finishTask($taskName, $thisTask);
 }
示例#11
0
 /**
  * 关键词搜索
  */
 public function init()
 {
     //获取siteid
     $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;
     $SEO = seo($siteid);
     //搜索配置
     $search_setting = getcache('search');
     $setting = $search_setting[$siteid];
     $search_model = getcache('search_model_' . $siteid);
     $type_module = getcache('type_module_' . $siteid);
     if (isset($_POST['q'])) {
         if (trim($_POST['q']) == '') {
             header('Location: ' . APP_PATH . 'index.php?m=search');
             exit;
         }
         $typeid = empty($_POST['typeid']) ? 0 : intval($_POST['typeid']);
         $time = empty($_POST['time']) || !in_array($_POST['time'], array('all', 'day', 'month', 'year', 'week')) ? 'all' : trim($_POST['time']);
         $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
         $pagesize = 10;
         $q = safe_replace(trim($_POST['q']));
         $q = new_html_special_chars(strip_tags($q));
         $q = str_replace('%', '', $q);
         //过滤'%',用户全文搜索
         $search_q = $q;
         //搜索原内容
         $sql_time = $sql_tid = '';
         if ($typeid) {
             $sql_tid = ' AND typeid = ' . $typeid;
         }
         //按时间搜索
         if ($time == 'day') {
             $search_time = SYS_TIME - 86400;
             $sql_time = ' AND adddate > ' . $search_time;
         } elseif ($time == 'week') {
             $search_time = SYS_TIME - 604800;
             $sql_time = ' AND adddate > ' . $search_time;
         } elseif ($time == 'month') {
             $search_time = SYS_TIME - 2592000;
             $sql_time = ' AND adddate > ' . $search_time;
         } elseif ($time == 'year') {
             $search_time = SYS_TIME - 31536000;
             $sql_time = ' AND adddate > ' . $search_time;
         } else {
             $search_time = 0;
             $sql_time = '';
         }
         if ($page == 1 && !$setting['sphinxenable']) {
             //精确搜索
             $commend = $this->db->get_one("`siteid`= '{$siteid}' {$sql_tid} {$sql_time} AND `data` like '%{$q}%'");
         } else {
             $commend = '';
         }
         //如果开启sphinx
         if ($setting['sphinxenable']) {
             $sphinx = pc_base::load_app_class('search_interface', '', 0);
             $sphinx = new search_interface();
             $offset = $pagesize * ($page - 1);
             $res = $sphinx->search($q, array($siteid), array($typeid), array($search_time, SYS_TIME), $offset, $pagesize, '@weight desc');
             $totalnums = $res['total'];
             //如果结果不为空
             if (!empty($res['matches'])) {
                 $result = $res['matches'];
             }
         } else {
             $sql = "`siteid`= '{$siteid}' {$sql_tid} {$sql_time} AND `data` like '%{$q}%'";
             $result = $this->db->listinfo($sql, 'searchid DESC', $page, 10);
             //$result = $this->db->listinfo($sql, 'adddate ASC', $page, 10);
         }
         //如果结果不为空
         if (!empty($result) || !empty($commend['id'])) {
             foreach ($result as $_v) {
                 if ($_v['typeid']) {
                     $sids[$_v['typeid']][] = $_v['id'];
                 }
             }
             if (!empty($commend['id'])) {
                 if ($commend['typeid']) {
                     $sids[$commend['typeid']][] = $commend['id'];
                 }
             }
             $model_type_cache = getcache('type_model_' . $siteid, 'search');
             $model_type_cache = array_flip($model_type_cache);
             $data = array();
             foreach ($sids as $_k => $_val) {
                 $tid = $_k;
                 $ids = array_unique($_val);
                 $where = to_sqls($ids, '', 'id');
                 //获取模型id
                 $modelid = $model_type_cache[$tid];
                 //是否读取其他模块接口
                 if ($modelid) {
                     $this->content_db->set_model($modelid);
                     /**
                      * 如果表名为空,则为黄页模型
                      */
                     if (empty($this->content_db->model_tablename)) {
                         $this->content_db = pc_base::load_model('yp_content_model');
                         $this->content_db->set_model($modelid);
                     }
                     $datas = $this->content_db->select($where, '*', '', 'inputtime DESC');
                 }
                 $data = array_merge($data, $datas);
             }
             $pages = $this->db->pages;
             $totalnums = $this->db->number;
             //如果分词结果为空
             if (!empty($segment_q)) {
                 $replace = explode(' ', $segment_q);
                 foreach ($replace as $replace_arr_v) {
                     $replace_arr[] = '' . $replace_arr_v . '';
                 }
                 foreach ($data as $_k => $_v) {
                     $data[$_k]['title'] = str_replace($replace, $replace_arr, $_v['title']);
                     $data[$_k]['description'] = str_replace($replace, $replace_arr, $_v['description']);
                 }
             } else {
                 foreach ($data as $_k => $_v) {
                     $data[$_k]['title'] = str_replace($q, '' . $q . '', $_v['title']);
                     $data[$_k]['description'] = str_replace($q, '' . $q . '', $_v['description']);
                 }
             }
         }
         $execute_time = execute_time();
         $pages = isset($pages) ? $pages : '';
         $totalnums = isset($totalnums) ? $totalnums : 0;
         $data = isset($data) ? $data : '';
         include template('search', 'list');
     } else {
         include template('search', 'index');
     }
 }
示例#12
0
 function createChannelPageSelect()
 {
     $channel_db = bpBase::loadModel('channel_model');
     $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
     if (isset($_POST['doSubmit'])) {
         //选定栏目
         if ($_GET['type'] == 'channel') {
             $channelIDStr = '';
             if ($_POST['channels']) {
                 $comma = '';
                 foreach ($_POST['channels'] as $c) {
                     //$channelTotalPage=$channel->getChannelTotalPage($c);
                     $channelTotalPage = 1;
                     for ($t = 1; $t < $channelTotalPage + 1; $t++) {
                         $channelIDStr .= $comma . $c . '.' . $t;
                         //,channelid.pageNum
                         $comma = ',';
                     }
                     //清除缓存
                     $content = bpBase::loadAppClass('articleObj', 'article', 1);
                     $content->clearContentsCache($c);
                     $channel->clearCrumbCache($c);
                 }
             }
             file_put_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'channels.txt', $channelIDStr);
             echo '<script>window.location.href=\'?m=template&c=createHtml&a=createChannelPage&siteid=' . $_GET['siteid'] . '&type=channel\';</script>';
         } elseif ($_GET['type'] == 'content') {
             $article_db = bpBase::loadModel('article_model');
             $contentIDStr = '';
             if ($_POST['channels']) {
                 $where = to_sqls($_POST['channels'], '', 'channel_id');
                 $contents = $article_db->get_results('id', '', $where, 'time DESC');
                 $comma = '';
                 if ($contents) {
                     foreach ($contents as $cc) {
                         $contentIDStr .= $comma . $cc->id;
                         $comma = ',';
                     }
                 }
             }
             file_put_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'contents.txt', $contentIDStr);
             echo '<script>window.location.href=\'?m=template&c=createHtml&a=createChannelPage&siteid=' . $_GET['siteid'] . '&type=content\';</script>';
         }
     } else {
         /*
         $channels=$channel_db->select('');
         $channelsByID=array();//用栏目id作为数组id来组织栏目数组
         if ($channels){
         	foreach ($channels as $c){
         		$channelsByID[$c['id']]=$c;
         	}
         }
         $rights=$this->rights($user->uid);//根据用户id获取用户的权限数组
         $accessChannels=$this->accessChannels($rights);
         //*******************向上查找哪些父栏目需要在栏目树中显示********************
         $showChannels=array();//向上查找哪些父栏目需要在栏目树中显示
         foreach ($accessChannels as $channelid){
         	$pid=$channelid;
         	do {
         		$pid=$channelsByID[$channelid]['parentid'];
         		array_push($showChannels,$pid);
         		array_push($showChannels,$channelid);
         		$channelid=$channelsByID[$pid]['id'];
         	}while ($pid!=0&&!in_array($pid,$showChannels));
         }
         */
         /////////////////////////////////////////////////
         $selectOptionStr = $channel->channelCreatePageTree($channel->tree(0, $_GET['siteid']), 0, $accessChannels, $showChannels);
         include $this->showManageTpl('createChannelPageSelect');
     }
 }
示例#13
0
 /**
  * 获取专题下内容数据
  * @param string/intval $ids 多个id用“,”分开
  */
 public function get_search_data($ids)
 {
     $where = to_sqls($ids, '', 'id');
     $data = $this->db->select($where, '`id`, `title`, `thumb`, `description`, `url`, `inputtime`', '', '', '', 'id');
     return $data;
 }
示例#14
0
文件: sms.php 项目: baowzh/renfang
 public function exportmobile()
 {
     $start_time = isset($_POST['start_time']) ? $_POST['start_time'] : '';
     $end_time = isset($_POST['end_time']) ? $_POST['end_time'] : date('Y-m-d', SYS_TIME);
     $where_start_time = strtotime($start_time) ? strtotime($start_time) : 0;
     $where_end_time = strtotime($end_time) + 86400;
     $groupid = isset($_POST['groupid']) && !empty($_POST['groupid']) ? $_POST['groupid'] : '';
     $modelid = isset($_POST['modelid']) && !empty($_POST['modelid']) ? $_POST['modelid'] : 10;
     //开始时间大于结束时间,置换变量
     if ($where_start_time > $where_end_time) {
         $tmp = $where_start_time;
         $where_start_time = $where_end_time;
         $where_end_time = $tmp;
         $tmptime = $start_time;
         $start_time = $end_time;
         $end_time = $tmptime;
         unset($tmp, $tmptime);
     }
     $where = '';
     if ($groupid) {
         $where .= "`groupid` = '{$groupid}' AND ";
     }
     if ($modelid) {
         $where .= "`modelid` = '{$modelid}' AND ";
     }
     $where .= "`regdate` BETWEEN '{$where_start_time}' AND '{$where_end_time}'";
     //根据条件读取会员主表
     $total = $this->member_db->count($where);
     $str = '';
     $perpage = 10;
     for ($i = 0; $i <= floor($total / $perpage); $i++) {
         $start = $i * $perpage;
         $data = $this->member_db->select($where, 'userid', "{$start}, {$perpage}");
         $userid_arr = array();
         foreach ($data as $v) {
             $userid_arr[] = $v['userid'];
         }
         $uids = to_sqls($userid_arr, '', 'userid');
         //读取模型表中手机号码字段
         $this->member_db->set_model($modelid);
         $data = $this->member_db->select($uids);
         foreach ($data as $v) {
             if (!empty($v['mobile'])) {
                 $str .= $v['mobile'] . "\r\n";
             }
         }
         $this->member_db->set_model();
     }
     header("Content-type:application/octet-stream");
     header("Content-Disposition: attachment; filename=mobile.txt");
     echo $str;
 }
示例#15
0
 public function export()
 {
     if (isset($_POST['doSubmit'])) {
         //1 创建保存路径
         $modelPath = ABS_PATH . 'templates' . DIRECTORY_SEPARATOR . 'specialModel';
         if (!file_exists($modelPath) || !is_dir($modelPath)) {
             mkdir($modelPath, 777);
         }
         $saveFolder = $modelPath . DIRECTORY_SEPARATOR . $_POST['enname'];
         if (!file_exists($saveFolder) || !is_dir($saveFolder)) {
             mkdir($saveFolder, 777);
         }
         //2 拷贝专题文件到模型路径
         recurse_copy(ABS_PATH . 'templates' . DIRECTORY_SEPARATOR . 'special' . DIRECTORY_SEPARATOR . $_POST['enname'] . DIRECTORY_SEPARATOR, $saveFolder . DIRECTORY_SEPARATOR);
         //3 保存模型信息:名称、简介等
         $modelInfo = array();
         $modelInfo['name'] = $_POST['name'];
         $modelInfo['enname'] = $_POST['enname'];
         $modelInfo['intro'] = $_POST['intro'];
         file_put_contents($saveFolder . DIRECTORY_SEPARATOR . 'modelInfo.txt', base64_encode(serialize($modelInfo)));
         //4 创建logo
         $logoPath = str_replace(array(MAIN_URL_ROOT . '/', '/'), array(ABS_PATH, DIRECTORY_SEPARATOR), $_POST['thumb']);
         @unlink($saveFolder . DIRECTORY_SEPARATOR . 'logo.jpg');
         @rename($logoPath, $saveFolder . DIRECTORY_SEPARATOR . 'logo.jpg');
         //5 导出专题首页模板信息
         $thisSpecial = $this->special_db->get($_POST['specialid']);
         $tpl_db = bpBase::loadModel('template_model');
         $thisTemplate = $tpl_db->get_one(array('id' => intval($thisSpecial['templateid'])));
         //保存专题首页模板
         $tplFile = ABS_PATH . substr($thisTemplate['path'], 1);
         $thisTemplate['code'] = file_get_contents($tplFile);
         file_put_contents($saveFolder . DIRECTORY_SEPARATOR . 'index.template.info.txt', base64_encode(serialize($thisTemplate)));
         file_put_contents($saveFolder . DIRECTORY_SEPARATOR . 'index.template.txt', $thisTemplate['code']);
         //6 导出专题使用的栏目
         $channel_db = bpBase::loadModel('channel_model');
         $channels = $channel_db->select(array('site' => intval($_POST['specialid'])));
         file_put_contents($saveFolder . DIRECTORY_SEPARATOR . 'channels.data.txt', base64_encode(serialize($channels)));
         //保存栏目信息
         //7 处理栏目及内容用的模板
         if ($channels) {
             //查询出所有用到的栏目和内容templateid
             $templateids = array();
             foreach ($channels as $channel) {
                 array_push($templateids, $channel['channeltemplate']);
                 array_push($templateids, $channel['contenttemplate']);
             }
             $templates = $tpl_db->select(to_sqls($templateids, '', 'id'));
             $templates = arrToArrByKey($templates);
             file_put_contents($saveFolder . DIRECTORY_SEPARATOR . 'templates.data.txt', base64_encode(serialize($templates)));
             foreach ($channels as $channel) {
                 if ($channel['channeltype'] == 1) {
                     //只处理普通栏目的模板
                     //只处理非默认模板
                     $thisChannelTemplate = $templates[$channel['channeltemplate']];
                     $thisContentTemplate = $templates[$channel['contenttemplate']];
                     if (!$thisChannelTemplate['isdefault']) {
                         //栏目模板
                         $tplFile = ABS_PATH . substr($thisChannelTemplate['path'], 1);
                         $code = file_get_contents($tplFile);
                         file_put_contents($saveFolder . DIRECTORY_SEPARATOR . $channel['cindex'] . '.' . $thisChannelTemplate['id'] . '.channel.template.txt', $code);
                     }
                     if (!$thisContentTemplate['isdefault']) {
                         //内容模板
                         $tplFile = ABS_PATH . substr($thisContentTemplate['path'], 1);
                         $code = file_get_contents($tplFile);
                         file_put_contents($saveFolder . DIRECTORY_SEPARATOR . $channel['cindex'] . '.' . $thisContentTemplate['id'] . '.content.template.txt', $code);
                     }
                 }
             }
         }
         showMessage('导出完成', '?m=special&c=m_special&a=specials');
     } else {
         $adus = bpBase::loadAppClass('adus', 'manage');
         $adus->title = '导出专题为模型';
         $adus->formAction = '?m=special&c=m_special&a=export';
         $adus->tip = '导出条件:专题所用的图片、js和css均在“/templates/special/当前专题/”文件夹下';
         /********************输入项*************************/
         //获取专题模板文件夹列表
         $specialPathSub = ABS_PATH . 'templates' . DIRECTORY_SEPARATOR . 'special';
         $files = scandir($specialPathSub);
         $folderArr = array();
         if ($files) {
             foreach ($files as $f) {
                 if ($f != '.' && $f != '..' && is_dir($specialPathSub . DIRECTORY_SEPARATOR . $f)) {
                     array_push($folderArr, array('itemValue' => $f, 'itemText' => $f, 'selected' => false));
                 }
             }
         }
         //
         $inputs = array();
         array_push($inputs, array('name' => '名称', 'type' => 'text', 'validate' => "'required'", 'style' => 'width:180px;', 'field' => 'name', 'value' => ''));
         array_push($inputs, array('name' => '', 'type' => 'hidden', 'validate' => "'required'", 'field' => 'specialid', 'value' => $_GET['specialid']));
         array_push($inputs, array('type' => 'select', 'field' => 'enname', 'name' => '选择文件夹', 'data' => $folderArr, 'complement' => '本专题的css、图片等文件存放文件夹'));
         array_push($inputs, array('name' => '缩略图', 'type' => 'thumb', 'validate' => "'required'", 'style' => 'width:180px;', 'field' => 'thumb', 'value' => '', 'width' => 800, 'height' => 800));
         array_push($inputs, array('name' => '简介', 'type' => 'textarea', 'style' => 'width:80%;font-size:12px;height:60px;', 'field' => 'intro', 'value' => ''));
         $adus->inputs = $inputs;
         $adus->outputPage();
     }
 }
示例#16
0
	/**
	 * 删除用户
	 * @param string {$uid:用户id;$username:用户名;$email:email}
	 * @return array {-1:删除失败;>0:删除成功}
	 */
	public function delete() {
		$this->uid = isset($this->data['uid']) ? $this->data['uid'] : '';
		$this->email = isset($this->data['email']) ? $this->data['email'] : '';

		if($this->uid > 0 || is_array($this->uid)) {
			$where = to_sqls($this->uid, '', 'uid');
			
			//ucenter部份
			if ($this->config['ucuse']) {
				pc_base::load_config('uc_config');
				require_once PHPCMS_PATH.'api/uc_client/client.php';
				$s = $this->db->select($where, 'ucuserid');
				if ($s) {
					$uc_data = array();
					foreach ($s as $k=>$v) {
						$uc_data[$k] = $v['ucuserid'];
					}
					if (!empty($uc_data)) $r = uc_user_delete($uc_data);
					if (!$r) {
						exit('-1');
					}
				} else {
					exit('-1');
				}
				
			}
			
			/*插入消息队列*/
			$noticedata['uids'] = $this->uid;
			messagequeue::add('member_delete', $noticedata);
			
			$this->db->delete($where);
			exit('1');
		} elseif(!empty($this->username)) {
			$this->db->delete(array('username'=>$this->username));
			exit('2');
		} elseif(!empty($this->email)) {
			$this->db->delete(array('email'=>$this->email));
			exit('3');
		} else {
			exit('-1');
		}
	}
示例#17
0
 /**
  * move member
  */
 function move()
 {
     if (isset($_POST['dosubmit'])) {
         $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
         $groupid = isset($_POST['groupid']) && !empty($_POST['groupid']) ? $_POST['groupid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
         $where = to_sqls($uidarr, '', 'userid');
         $this->db->update(array('groupid' => $groupid), $where);
         showmessage(L('member_move') . L('operation_success'), HTTP_REFERER, '', 'move');
     } else {
         $show_header = $show_scroll = true;
         $grouplist = getcache('grouplist');
         foreach ($grouplist as $k => $v) {
             $grouplist[$k] = $v['name'];
         }
         $ids = isset($_GET['ids']) ? explode(',', $_GET['ids']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
         array_pop($ids);
         if (!empty($ids)) {
             $where = to_sqls($ids, '', 'userid');
             $userarr = $this->db->listinfo($where);
         } else {
             showmessage(L('illegal_parameters'), HTTP_REFERER, '', 'move');
         }
         include $this->admin_tpl('member_move');
     }
 }
示例#18
0
 function searchContentSql($channelID = 0, $keywords = '', $page = 0, $count = 0, $starttime = 0, $endtime = 0, $exceptChannel = 0, $uid = 0, $siteid = 1)
 {
     $channelID = intval($channelID);
     $keywords = format_bracket($keywords);
     $starttime = intval($starttime);
     $endtime = intval($endtime);
     $exceptChannel = intval($exceptChannel);
     $keywordsArr = explode(' ', $keywords);
     $normalWords = array('的', '什么');
     $keywordsSql = '';
     if ($keywordsArr) {
         foreach ($keywordsArr as $k) {
             if (strlen($k) && !in_array($k, $normalWords)) {
                 $keywordsSql .= ' OR content LIKE \'%' . $k . '%\' OR title LIKE \'%' . $k . '%\'';
             }
         }
     }
     $keywordsSql = substr($keywordsSql, 4);
     if (strlen($keywordsSql)) {
         $keywordsSql = ' AND (' . $keywordsSql . ')';
     }
     //time
     if (!$starttime && !$endtime) {
         $timeSql = '';
     } elseif ($endtime == 0) {
         $timeSql = ' AND time>' . $starttime . ' AND time<' . SYS_TIME;
     } else {
         $timeSql = ' AND time>' . $starttime . ' AND time<' . $endtime;
     }
     //
     //if (strlen($keywordsSql)){
     $start = 0;
     if ($page > 1) {
         $start = ($page - 1) * $count;
     }
     $limitSql = '';
     if ($count) {
         $limitSql .= ' LIMIT ' . $start . ',' . $count;
     }
     $channelIDSql = '';
     if ($exceptChannel) {
         $exceptChannelSql = ' AND channel_id!=' . $exceptChannel;
     }
     $uid = intval($uid);
     $uidSql = '';
     if ($uid) {
         $uidSql = ' AND uid=' . $uid;
     }
     if ($channelID) {
         $channelObj = bpBase::loadAppClass('channelObj', 'channel');
         $descentChannels = $channelObj->allDescentChannels($channelID);
         $descentsCount = count($descentChannels);
         $channelIDArr = array($channelID);
         if ($descentChannels) {
             foreach ($descentChannels as $c) {
                 array_push($channelIDArr, $c->id);
             }
         }
         $channelIDSql = ' AND ' . to_sqls($channelIDArr, '', 'channel_id');
     } else {
         $channelIDSql = '';
     }
     $article_db = M('article');
     if (!$page && !$count) {
         $sql = 'SELECT COUNT(id) FROM ' . $article_db->table_name . ' WHERE site=' . $siteid . $channelIDSql . $timeSql . $keywordsSql . $exceptChannelSql . $uidSql;
     } else {
         $sql = 'SELECT * FROM ' . $article_db->table_name . ' WHERE site=' . $siteid . $channelIDSql . $timeSql . $keywordsSql . $exceptChannelSql . $uidSql . ' ORDER BY time DESC' . $limitSql;
     }
     return $sql;
 }
示例#19
0
	/**
	 * ignore member
	 */
	function ignore() {
		if(isset($_POST['userid'])) {		
			$uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
			$where = to_sqls($uidarr, '', 'userid');
			$res = $this->db->update(array('status'=>2, 'message'=>$_POST['message']), $where);
			//发送 email通知
			if($res) {
				if($_POST['sendemail']) {
					$memberinfo = $this->db->select($where);
					pc_base::load_sys_func('mail');
					foreach ($memberinfo as $v) {
						sendmail($v['email'], L('reg_ignore'), $_POST['message']);
					}
				}
			}
			showmessage(L('ignore').L('operation_success'), HTTP_REFERER);
		} else {
			showmessage(L('operation_failure'), HTTP_REFERER);
		}
	}
示例#20
0
文件: index.php 项目: shenhua4286/gxw
 public function check_manage_info()
 {
     if (isset($_POST['dosubmit'])) {
         $userid = $_POST['userid'];
         if (!isset($userid)) {
             $userid = $_POST['userids'];
         }
         if (!$userid) {
             showmessage(L('illegal_parameters'), HTTP_REFERER, 1250);
         }
         //echo $userid;
         $where = to_sqls($userid, '', 'userid');
         //更新用户企业名称
         //$nickname = isset($_POST['nickname']) ? trim($_POST['nickname']) : '';
         //$groupid = isset($_POST['groupid']) ? trim($_POST['groupid']) : 10;
         //$nickname = safe_replace($nickname);
         $status = $_POST['status'];
         //echo $nickname;
         $this->db->update(array('status' => $status), $where);
         if (!isset($cookietime)) {
             $get_cookietime = param::get_cookie('cookietime');
         }
         //更新用户状态
         /*if(pc_base::load_config('system', 'phpsso')) {
         			//初始化phpsso
         			$this->_init_phpsso();
         			$res = $this->client->ps_member_edit('', '', '', '', $userid, '',$status);
         			$message_error = array('-1'=>L('user_not_exist'), '-2'=>L('old_password_incorrect'), '-3'=>L('email_already_exist'), '-4'=>L('email_error'), '-5'=>L('param_error'));
         			if ($res < 0) showmessage($message_error[$res]);
         		}*/
         $_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
         $cookietime = $_cookietime ? TIME + $_cookietime : 0;
         param::set_cookie('_status', $status, $cookietime);
         /**发送短消息**/
         $title = '';
         $content = '';
         $member_db = pc_base::load_model('member_model');
         $message_db = pc_base::load_model('message_model');
         switch ($status) {
             case 1:
                 $content = $title = '您的企业资料当前在审核状态';
                 break;
             case -1:
                 $title = '您的企业资料被驳回了,请重新填写资料,进行提交';
                 $content = "驳回意见:" . $_POST['reject_c'];
                 break;
             case 99:
                 $content = $title = '您企业资料已经审核通过了';
                 break;
             default:
                 $content = $title = '您的资料审核状态有了新的变化';
         }
         /**数组审核 发送消息**/
         if (is_array($userid)) {
             foreach ($userid as $k => $u) {
                 $memberinfo = $member_db->get_one(array('userid' => $u), 'userid, username');
                 $message_db->add_message($memberinfo['username'], 'SYSTEM', $title, $content);
             }
         } else {
             $memberinfo = $member_db->get_one(array('userid' => $userid), 'userid, username');
             $message_db->add_message($memberinfo['username'], 'SYSTEM', $title, $content);
         }
         //$url=array('返回列表'=>'index.php?&menu=1&m=member&c=index&a=lists&status=2&search=search&steps=1&t=89&pt=78','查看此信息'=>HTTP_REFERER);
         showmessage("审核成功", HTTP_REFERER);
     } else {
         $memberinfo = $this->memberinfo;
         $memberinfo['userid'] = $_GET['userid'];
         $memberinfo['modelid'] = $_GET['modelid'];
         $memberinfo = $this->db->get_one(array('userid' => $memberinfo['userid']));
         //获取企业模型表单
         require CACHE_MODEL_PATH . 'member_form.class.php';
         $member_form = new member_form($memberinfo['modelid']);
         $this->db->set_model($memberinfo['modelid']);
         $membermodelinfo = $this->db->get_one(array('userid' => $memberinfo['userid']));
         $forminfos = $forminfos_arr = $member_form->get($membermodelinfo);
         //万能字段过滤
         foreach ($forminfos as $field => $info) {
             if ($info['isomnipotent']) {
                 unset($forminfos[$field]);
             } else {
                 if ($info['formtype'] == 'omnipotent') {
                     foreach ($forminfos_arr as $_fm => $_fm_value) {
                         if ($_fm_value['isomnipotent']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                     $forminfos[$field]['form'] = $info['form'];
                 }
             }
         }
         if ($_POST['type'] == 'pro') {
         }
         $formValidator = $member_form->formValidator;
         include template('member', 'check_manage_info');
     }
 }
示例#21
0
 function channel()
 {
     $channelid = $this->channel['id'];
     //meta
     if (!$this->channel['metatitle']) {
         $this->assign('metaTitle', $this->channel['name'] . '_' . $this->site['name']);
     } else {
         $this->assign('metaTitle', $this->channel['metatitle']);
     }
     $this->assign('metaKeywords', $this->channel['metakeyword']);
     $this->assign('metaDescription', $this->channel['metades']);
     //子分类
     $page = intval($_GET['page']);
     $page = $page > 0 ? $page : 1;
     $pageSize = intval($this->channel['pagesize']);
     $channelIDs = array($channelid);
     $subChannels = $this->channel_db->getChannelsByParentID($channelid);
     if ($subChannels) {
         $subChannels = objectsToArrByKey($subChannels);
         $subChannels = $this->convertLinks($subChannels);
         $this->assign('subChannels', $subChannels);
         if ($subChannels) {
             foreach ($subChannels as $sc) {
                 array_push($channelIDs, $sc['id']);
             }
         }
         $contents = $this->article_db->listinfo(to_sqls($channelIDs, '', 'channel_id'), $order = 'taxis DESC', $page, $pageSize);
     } else {
         //
         $contents = $this->article_db->listinfo(array('channel_id' => $channelid), $order = 'taxis DESC', $page, $pageSize);
     }
     //如果只有一条信息就链接到该信息
     if (count($contents) == 1) {
         header('Location:?m=site&c=home&a=content&contentid=' . $contents[0]['id']);
     }
     //
     $contents = $this->convertLinks($contents);
     $this->assign('contents', $contents);
     //
     $total = $this->article_db->number;
     if ($pageSize) {
         if ($total % $pageSize == 0) {
             $totalPage = $total / $pageSize;
         } else {
             $totalPage = intval($total / $pageSize) + 1;
         }
     }
     $totalPage = $totalPage > 0 ? $totalPage : 1;
     $this->assign('totalPage', $totalPage);
     //总页数
     $currentPage = $page;
     $this->assign('currentPage', $currentPage);
     //当前页码
     if ($totalPage == 1 || $currentPage == 1) {
         $this->assign('previousPageLink', 'javascript:void(0)');
         //上页链接
     } else {
         $previousPageNum = $currentPage - 1;
         $this->assign('previousPageLink', $this->channel['link'] . '&page=' . $previousPageNum);
         //上页链接
     }
     if ($totalPage == 1 || $currentPage == $totalPage) {
         $this->assign('nextPageLink', 'javascript:void(0)');
         //下页链接
     } else {
         $nextPageNum = $currentPage + 1;
         $this->assign('nextPageLink', $this->channel['link'] . '&page=' . $nextPageNum);
         //下页链接
     }
     //template
     $template_db = M('template');
     $channelTemplate = $template_db->get_one(array('id' => $this->channel['channeltemplate']));
     $templatePaths = explode('/', $channelTemplate['path']);
     $templateFileName = $templatePaths[count($templatePaths) - 1];
     $this->display($this->smartyDir . $templateFileName, 0);
 }
示例#22
0
 /**
  * 删除会员模型
  */
 function delete()
 {
     $modelidarr = isset($_POST['modelid']) ? $_POST['modelid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
     $newmodelarr = '';
     foreach ($modelidarr as $modelarr) {
         if ($modelarr != 10) {
             $newmodelarr[] = intval($modelarr);
         }
     }
     $where = to_sqls($newmodelarr, '', 'modelid');
     $modelinfo = $this->db->select($where);
     foreach ($modelinfo as $v) {
         $this->db->drop_table($v['tablename']);
     }
     if ($this->db->delete($where)) {
         //删除模型字段
         $this->sitemodel_field_db = pc_base::load_model('sitemodel_field_model');
         $this->sitemodel_field_db->delete($where);
         //修改用户模型组为普通会员
         $this->member_db = pc_base::load_model('members_model');
         $this->member_db->update(array('modelid' => 10), $where);
         //更新模型缓存
         pc_base::load_app_class('member_cache', '', '');
         member_cache::update_cache_model();
         showmessage(L('operation_success'), HTTP_REFERER);
     } else {
         showmessage(L('operation_failure'), HTTP_REFERER);
     }
 }
示例#23
0
 /**
  * 删除会员
  */
 public function delete()
 {
     $uidarr = isset($_POST['uid']) ? $_POST['uid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
     $new_arr = array();
     foreach ($uidarr as $v) {
         $v = intval($v);
         $new_arr[] = $v;
         //删除头像
         $dir = ps_getavatar($v, 1);
         ps_unlink($dir);
     }
     $where = to_sqls($new_arr, '', 'uid');
     //ucenter部份
     if ($this->config['ucuse']) {
         pc_base::load_config('uc_config');
         include PHPCMS_PATH . 'api/uc_client/client.php';
         $s = $this->db->select($where, 'ucuserid');
         if ($s) {
             $uc_data = array();
             foreach ($s as $k => $v) {
                 $uc_data[$k] = $v['ucuserid'];
             }
             if (!empty($uc_data)) {
                 $r = uc_user_delete($uc_data);
             }
             if (!$r) {
                 showmessage(L('operation_failure'), HTTP_REFERER);
             }
         } else {
             showmessage(L('operation_failure'), HTTP_REFERER);
         }
     }
     if ($this->db->delete($where)) {
         /*插入消息队列*/
         $noticedata = array('uids' => $new_arr);
         messagequeue::add('member_delete', $noticedata);
         showmessage(L('operation_success'), HTTP_REFERER);
     } else {
         showmessage(L('operation_failure'), HTTP_REFERER);
     }
 }
示例#24
0
文件: index.php 项目: baowzh/renfang
 public function search()
 {
     $this->db = pc_base::load_model('search_model');
     $q = safe_replace(trim($_POST['title']));
     $typeid = isset($_GET['typeid']) ? intval($_GET['typeid']) : 58;
     $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : 1;
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $q = htmlspecialchars(strip_tags($q));
     $q = str_replace('%', '', $q);
     // 过滤'%',用户全文搜索
     $search_q = $q;
     // 搜索原内容
     $time = empty($_GET['time']) || !in_array($_GET['time'], array('all', 'day', 'month', 'year')) ? 'all' : trim($_GET['time']);
     if ($time == 'day') {
         $search_time = SYS_TIME - 86400;
         $sql_time = ' AND adddate > ' . $search_time;
     } elseif ($time == 'week') {
         $search_time = SYS_TIME - 604800;
         $sql_time = ' AND adddate > ' . $search_time;
     } elseif ($time == 'month') {
         $search_time = SYS_TIME - 2592000;
         $sql_time = ' AND adddate > ' . $search_time;
     } elseif ($time == 'year') {
         $search_time = SYS_TIME - 31536000;
         $sql_time = ' AND adddate > ' . $search_time;
     } else {
         $search_time = 0;
         $sql_time = '';
     }
     if ($page == 1 && !$setting['sphinxenable']) {
         // 精确搜索
         $commend = $this->db->get_one("`typeid` = '{$typeid}' {$sql_time} AND `data` like '%{$q}%'");
     } else {
         $commend = '';
     }
     pc_base::load_sys_class('segment', '', 0);
     $segment = new segment();
     // 分词结果
     $segment_q = $segment->get_keyword($segment->split_result($q));
     // 如果分词结果为空
     if (!empty($segment_q)) {
         $sql = "`siteid`= '{$siteid}' AND `typeid` = '{$typeid}' {$sql_time} AND MATCH (`data`) AGAINST ('{$segment_q}' IN BOOLEAN MODE)";
     } else {
         $sql = "`siteid`= '{$siteid}' AND `typeid` = '{$typeid}' {$sql_time} AND `data` like '%{$q}%'";
     }
     $result = $this->db->listinfo($sql, 'searchid DESC', $page, 7);
     if (!empty($result) || !empty($commend['id'])) {
         //开启sphinx后文章id取法不同
         if ($setting['sphinxenable']) {
             foreach ($result as $_v) {
                 $sids[] = $_v['attrs']['id'];
             }
         } else {
             foreach ($result as $_v) {
                 $sids[] = $_v['id'];
             }
         }
         if (!empty($commend['id'])) {
             $sids[] = $commend['id'];
         }
         $sids = array_unique($sids);
         $where = to_sqls($sids, '', 'id');
         //获取模型id
         $model_type_cache = getcache('type_model_' . $siteid, 'search');
         $model_type_cache = array_flip($model_type_cache);
         $modelid = $model_type_cache[$typeid];
         //是否读取其他模块接口
         if ($modelid) {
             $this->content_db->set_model($modelid);
             /**
              * 如果表名为空,则为黄页模型
              */
             if (empty($this->content_db->model_tablename)) {
                 $this->content_db = pc_base::load_model('yp_content_model');
                 $this->content_db->set_model($modelid);
             }
             if ($setting['sphinxenable']) {
                 $data = $this->content_db->listinfo($where, 'id DESC', 1, $pagesize);
                 $pages = wpa_pages($totalnums, $page, $pagesize);
             } else {
                 $data = $this->content_db->select($where, '*');
                 $pages = $this->db->pages;
                 $totalnums = $this->db->number;
             }
             //如果分词结果为空
             if (!empty($segment_q)) {
                 $replace = explode(' ', $segment_q);
                 foreach ($replace as $replace_arr_v) {
                     $replace_arr[] = '<font color=red>' . $replace_arr_v . '</font>';
                 }
                 foreach ($data as $_k => $_v) {
                     $data[$_k]['title'] = str_replace($replace, $replace_arr, $_v['title']);
                     $data[$_k]['description'] = str_replace($replace, $replace_arr, $_v['description']);
                 }
             } else {
                 foreach ($data as $_k => $_v) {
                     $data[$_k]['title'] = str_replace($q, '<font color=red>' . $q . '</font>', $_v['title']);
                     $data[$_k]['description'] = str_replace($q, '<font color=red>' . $q . '</font>', $_v['description']);
                 }
             }
         } else {
             //读取专辑搜索接口
             $special_api = pc_base::load_app_class('search_api', 'special');
             $data = $special_api->get_search_data($sids);
             $totalnums = count($data);
         }
     }
     $execute_time = execute_time();
     $totalnums = isset($totalnums) ? $totalnums : 0;
     $totalpage = $totalnums / 7;
     $pagesi = wpa_pages($totalpage, $page, 7);
     $data = isset($data) ? $data : '';
     include template('wap', 'list_search');
 }
示例#25
0
文件: phpsso.php 项目: baowzh/renfang
    $userinfo['regdate'] = $userinfo['lastdate'] = SYS_TIME;
    $userinfo['modelid'] = 10;
    $userinfo['groupid'] = 6;
    $userid = $db->insert($userinfo, 1);
    if ($userid) {
        exit('1');
    } else {
        exit('0');
    }
}
/**
 * 删除用户
 */
if ($action == 'member_delete') {
    $uidarr = $arr['uids'];
    $where = to_sqls($uidarr, '', 'phpssouid');
    $status = $db->delete($where);
    if ($status) {
        exit('1');
    } else {
        exit('0');
    }
}
/**
 * 编辑用户
 */
if ($action == 'member_edit') {
    if (!isset($arr['uid'])) {
        exit('0');
    }
    $userinfo = array();
示例#26
0
 /**
  * move member
  */
 function move()
 {
     if (isset($_POST['dosubmit'])) {
         $uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
         $groupid = isset($_POST['groupid']) && !empty($_POST['groupid']) ? $_POST['groupid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
         $where = to_sqls($uidarr, '', 'userid');
         $title = '';
         $content = '';
         switch ($groupid) {
             case 10:
                 $content = $title = '您的企业资料当前在审核状态';
                 break;
             case 11:
                 $title = '您的企业资料被驳回了,请重新填写资料,进行提交';
                 $content = "驳回意见:" . $_POST['reject_c'];
                 break;
             case 12:
                 $content = $title = '您企业资料已经审核通过了';
                 break;
             default:
                 $content = $title = '您的资料有了新的更新';
         }
         $member_db = pc_base::load_model('member_model');
         $message_db = pc_base::load_model('message_model');
         if (isset($uidarr) && !empty($uidarr)) {
             foreach ($uidarr as $id) {
                 $memberinfo = $member_db->get_one(array('userid' => $id), 'userid, username');
                 $message_db->add_message($memberinfo['username'], 'SYSTEM', $title, $content);
             }
         }
         $this->db->update(array('groupid' => $groupid), $where);
         showmessage('操作成功', HTTP_REFERER);
     } else {
         $show_header = $show_scroll = true;
         $grouplist = getcache('grouplist');
         foreach ($grouplist as $k => $v) {
             $grouplist[$k] = $v['name'];
         }
         $ids = isset($_GET['ids']) ? explode(',', $_GET['ids']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
         array_pop($ids);
         if (!empty($ids)) {
             $where = to_sqls($ids, '', 'userid');
             $userarr = $this->db->listinfo($where);
         } else {
             showmessage(L('illegal_parameters'), HTTP_REFERER, '', 'move');
         }
         include $this->admin_tpl('member_move');
     }
 }