function favorite_data($vars = null) { $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "10"; $where_sql = "WHERE 1=1 "; isset($vars['userid']) && ($where_sql .= " AND `uid`='" . (int) $vars['userid'] . "' "); $vars['fid'] && ($where_sql .= " AND `fid`='" . (int) $vars['fid'] . "' "); isset($vars['appid']) && ($where_sql .= " AND `appid`='" . (int) $vars['appid'] . "' "); $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1; $by = $vars['by'] == "ASC" ? "ASC" : "DESC"; switch ($vars['orderby']) { default: $order_sql = " ORDER BY `id` {$by}"; } $md5 = md5($where_sql . $order_sql); $offset = 0; if ($vars['page']) { $total = iPHP::total($md5, "SELECT count(*) FROM `#iCMS@__favorite_data` {$where_sql} "); iPHP::assign("fav_data_total", $total); $multi = iCMS::page(array('total' => $total, 'perpage' => $maxperpage, 'unit' => iPHP::lang('iCMS:page:list'), 'nowindex' => $GLOBALS['page'])); $offset = $multi->offset; } if ($vars['cache']) { $cache_name = 'favorite_data/' . $md5 . "/" . (int) $GLOBALS['page']; $resource = iCache::get($cache_name); } if (empty($resource)) { $resource = iDB::all("SELECT * FROM `#iCMS@__favorite_data` {$where_sql} {$order_sql} LIMIT {$offset},{$maxperpage}"); iPHP_SQL_DEBUG && iDB::debug(1); // $resource = array(); // if($rs)foreach ($rs as $key => $value) { // } $vars['cache'] && iCache::set($cache_name, $resource, $cache_time); } return $resource; }
function do_check() { if (empty($this->patch)) { if ($_GET['ajax']) { iPHP::json(array('code' => 0)); } else { iPHP::success("您使用的 iCMS 版本,目前是最新版本<hr />当前版本:iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]", 0, "5"); } } else { switch (iCMS::$config['system']['patch']) { case "1": //自动下载,安装时询问 $this->msg = iPatch::download($this->patch[1]); $json = array('code' => "1", 'url' => __ADMINCP__ . '=patch&do=install', 'msg' => "发现iCMS最新版本<br /><span class='label label-warning'>iCMS " . $this->patch[0] . " [" . $this->patch[1] . "]</span><br />" . $this->patch[3] . "<hr />您当前使用的版本<br /><span class='label label-info'>iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]</span><br /><br />新版本已经下载完成!! 是否现在更新?"); break; case "2": //不自动下载更新,有更新时提示 $json = array('code' => "2", 'url' => __ADMINCP__ . '=patch&do=update', 'msg' => "发现iCMS最新版本<br /><span class='label label-warning'>iCMS " . $this->patch[0] . " [" . $this->patch[1] . "]</span><br />" . $this->patch[3] . "<hr />您当前使用的版本<br /><span class='label label-info'>iCMS " . iCMS_VER . " [" . iCMS_RELEASE . "]</span><br /><br />请马上更新您的iCMS!!!"); break; } if ($_GET['ajax']) { iPHP::json($json, true); } $moreBtn = array(array("text" => "马上更新", "url" => $json['url']), array("text" => "以后在说", "js" => 'return true')); iPHP::dialog('success:#:check:#:' . $json['msg'], 0, 30, $moreBtn); } }
public function value($tag) { $categoryApp = iPHP::app("category"); if ($tag['cid']) { $category = $categoryApp->category($tag['cid'], false); $tag['category'] = $categoryApp->get_lite($category); } if ($tag['tcid']) { $tag_category = $categoryApp->category($tag['tcid'], false); $tag['tag_category'] = $categoryApp->get_lite($tag_category); } $tag['iurl'] = iURL::get('tag', array($tag, $category, $tag_category)); $tag['url'] or $tag['url'] = $tag['iurl']->href; $tag['link'] = '<a href="' . $tag['url'] . '" class="tag" target="_blank">' . $tag['name'] . '</a>'; if ($category['mode'] && stripos($tag['url'], '.php?') === false) { iCMS::set_html_url($tag['iurl']); } $tag['metadata'] && ($tag['meta'] = json_decode($tag['metadata'])); $tag['related'] && ($tag['relArray'] = explode(',', $tag['related'])); $tag['appid'] = iCMS_APP_TAG; $tag['pic'] = get_pic($tag['pic']); $tag['bpic'] = get_pic($tag['bpic']); $tag['mpic'] = get_pic($tag['mpic']); $tag['spic'] = get_pic($tag['spic']); return $tag; }
/** * @package iCMS * @copyright 2007-2010, iDreamSoft * @license http://www.idreamsoft.com iDreamSoft * @author coolmoo <*****@*****.**> * @$Id: iCMS.push.php 148 2013-03-14 16:15:12Z coolmoo $ */ function iCMS_lang($vars) { if (empty($vars['key'])) { return; } echo iPHP::lang($vars['key']); }
public function cleancookie() { iPHP::set_cookie('WB_ACCESS_TOKEN', '', -31536000); iPHP::set_cookie('WB_REFRESH_TOKEN', '', -31536000); iPHP::set_cookie('WB_OPENID', '', -31536000); iPHP::set_cookie('WB_STATE', '', -31536000); }
function public_qrcode($vars = null) { $data = $vars['data']; $query = array('app' => 'public', 'do' => 'qrcode', 'url' => $data); isset($vars['cache']) && ($query['cache'] = true); $url = iPHP::router('/api', iCMS_REWRITE); echo buildurl($url, $query); }
/** * @package iCMS * @copyright 2007-2010, iDreamSoft * @license http://www.idreamsoft.com iDreamSoft * @author coolmoo <*****@*****.**> * @$Id: push.tpl.php 1392 2013-05-20 12:28:08Z coolmoo $ */ function push_list($vars) { $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "100"; $cache_time = isset($vars['time']) ? (int) $vars['time'] : "-1"; $where_sql = "WHERE `status`='1'"; isset($vars['userid']) && ($where_sql .= " AND `userid`='{$vars['userid']}'"); if (isset($vars['cid!'])) { $ncids = explode(',', $vars['cid!']); $vars['sub'] && ($ncids += iCMS::get_category_ids($ncids, true)); $where_sql .= iPHP::where($ncids, 'cid', 'not'); } if (isset($vars['cid'])) { $cid = explode(',', $vars['cid']); $vars['sub'] && ($cid += iCMS::get_category_ids($cid, true)); $where_sql .= iPHP::where($cid, 'cid'); } isset($vars['pid']) && ($where_sql .= " AND `type` ='{$vars['pid']}'"); isset($vars['pic']) && ($where_sql .= " AND `haspic`='1'"); isset($vars['nopic']) && ($where_sql .= " AND `haspic`='0'"); isset($vars['startdate']) && ($where_sql .= " AND `addtime`>='" . strtotime($vars['startdate']) . "'"); isset($vars['enddate']) && ($where_sql .= " AND `addtime`<='" . strtotime($vars['enddate']) . "'"); $by = $vars['by'] == "ASC" ? "ASC" : "DESC"; switch ($vars['orderby']) { case "id": $order_sql = " ORDER BY `id` {$by}"; break; case "addtime": $order_sql = " ORDER BY `addtime` {$by}"; break; case "disorder": $order_sql = " ORDER BY `ordernum` {$by}"; break; default: $order_sql = " ORDER BY `id` DESC"; } if ($vars['cache']) { $cache_name = iPHP_DEVICE . '/push/' . md5($where_sql); $resource = iCache::get($cache_name); } if (empty($resource)) { $resource = iDB::all("SELECT * FROM `#iCMS@__push` {$where_sql} {$order_sql} LIMIT {$maxperpage}"); iPHP_SQL_DEBUG && iDB::debug(1); if ($resource) { foreach ($resource as $key => $value) { $value['pic'] && ($value['pic'] = iFS::fp($value['pic'], '+http')); $value['pic2'] && ($value['pic2'] = iFS::fp($value['pic2'], '+http')); $value['pic2'] && ($value['pic2'] = iFS::fp($value['pic2'], '+http')); $value['metadata'] && ($value['metadata'] = unserialize($value['metadata'])); $resource[$key] = $value; } } $vars['cache'] && iCache::set($cache_name, $resource, $cache_time); } return $resource; }
function do_save() { $disable = explode("\n", iS::escapeStr($_POST['disable'])); $filter = explode("\n", iS::escapeStr($_POST['filter'])); foreach ($filter as $k => $val) { $filterArray[$k] = explode("=", $val); } $this->setting->set($filterArray, 'word.filter', 0, true); $this->setting->set($disable, 'word.disable', 0, true); iPHP::success('更新完成'); }
public static function run($pre = null) { extension_loaded('gd') && function_exists('gd_info') or self::$noGD = true; self::$code or self::$code = self::__mkcode(); self::$noGD && (self::$code = 'iCMS'); $name = 'seccode'; $pre && ($name = $pre . '_seccode'); //设定cookie iPHP::set_cookie($name, authcode(self::$code, 'ENCODE')); self::__image(); }
function do_iCMS() { $res = iPHP::folder('template', array('htm', 'css', 'js', 'png', 'jpg', 'gif')); $dirRs = $res['DirArray']; $fileRs = $res['FileArray']; $pwd = $res['pwd']; $parent = $res['parent']; $URI = $res['URI']; $navbar = true; $file_edit = true; include iACP::view("files.explorer"); }
public static function yun($vendor = null) { if ($vendor === null) { return false; } $conf = self::$config['sdk'][$vendor]; if ($conf['AccessKey'] && $conf['SecretKey']) { iPHP::import(iPHP_LIB . '/' . $vendor . '.php'); return new $vendor($conf['AccessKey'], $conf['SecretKey'], $conf['AppId']); } else { return false; } }
function do_save() { $filter = explode("\n", $_POST['filter']); $disable = explode("\n", $_POST['disable']); $disable = array_unique($disable); foreach ($filter as $k => $val) { $filterArray[$k] = explode("=", $val); } $this->setting->set($filterArray, 'word.filter', 0, true); $this->setting->set($disable, 'word.disable', 0, true); $this->cache(); iPHP::success('更新完成'); }
/** * @package iCMS * @copyright 2007-2010, iDreamSoft * @license http://www.idreamsoft.com iDreamSoft * @author coolmoo <*****@*****.**> * @$Id: iCMS.push.php 148 2013-03-14 16:15:12Z coolmoo $ */ function iCMS_router($vars) { if (empty($vars['url'])) { echo 'javascript:;'; return; } $router = $vars['url']; unset($vars['url'], $vars['app']); $url = iPHP::router($router, iCMS_REWRITE); $vars['query'] && ($url = buildurl($url, $vars['query'])); if ($url && stripos($url, 'http://') === false && $vars['host']) { $url = rtrim(iCMS_URL, '/') . '/' . ltrim($url, '/'); } echo $url ? $url : 'javascript:;'; }
public function index($a = null) { $index_name = $a[1] ? $a[1] : iCMS::$config['template']['index_name']; $index_tpl = $a[0] ? $a[0] : iCMS::$config['template']['index']; $index_name or $index_name = 'index'; $iurl = iURL::get('index', array('urlRule' => $index_name . iCMS::$config['router']['html_ext'])); if (iCMS::$config['template']['index_mode'] && iPHP_DEVICE == "desktop") { iCMS::gotohtml($iurl->path, $iurl->href); } if (iPHP::$iTPL_MODE == "html" || iCMS::$config['template']['index_rewrite']) { iCMS::set_html_url($iurl); } $html = iPHP::view($index_tpl); if (iPHP::$iTPL_MODE == "html") { return array($html, $iurl); } }
function do_batch() { $idArray = (array) $_POST['id']; $idArray or iPHP::alert("请选择要操作的关键词"); $ids = implode(',', $idArray); $batch = $_POST['batch']; switch ($batch) { case 'dels': iPHP::$break = false; foreach ($idArray as $id) { $this->do_del($id, false); } iPHP::$break = true; iPHP::success('关键词全部删除完成!', 'js:1'); break; } }
function search_url($vars) { $q = rawurlencode($vars['query']); if (empty($q)) { return; } $query['app'] = 'search'; if (isset($vars['_app'])) { $query['app'] = $vars['_app']; $query['do'] = 'search'; } $query['q'] = $q; $url = iPHP::router('/api', iPHP_ROUTER_REWRITE); $url = buildurl($url, $query); if ($vars['ret']) { return $url; } echo $url; }
public function search($tpl = false) { $q = htmlspecialchars(rawurldecode($_GET['q'])); $encode = mb_detect_encoding($q, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5")); if (strtoupper($encode) != 'UTF-8') { if (function_exists('iconv')) { $q = iconv($encode, 'UTF-8//IGNORE', $q); } elseif (function_exists('mb_convert_encoding')) { $q = mb_convert_encoding($q, 'UTF-8//IGNORE', $encode); } } $q = iS::escapeStr($q); //empty($q) && iPHP::throw404('应用程序运行出错.亲!搜点什么吧!!', 60001); $fwd = iCMS::filter($q); $fwd && iPHP::throw404('非法搜索词!', 60002); $search['title'] = stripslashes($q); $search['keyword'] = $q; $tpl === false && ($tpl = '{iTPL}/search.htm'); $q && $this->slog($q); iPHP::assign("search", $search); return iPHP::view($tpl, 'search'); }
/** * @package iCMS * @copyright 2007-2010, iDreamSoft * @license http://www.idreamsoft.com iDreamSoft * @author coolmoo <*****@*****.**> * @$Id: push.tpl.php 1392 2013-05-20 12:28:08Z coolmoo $ */ function marker_html($vars) { $where_sql = "WHERE `status`='1'"; $vars['key'] or iPHP::warning('iCMS:marker:html 标签出错! 缺少"key"属性或"key"值为空.'); if (isset($vars['cid']) && $vars['cid'] != '') { $where_sql .= " AND `cid`='{$vars['cid']}'"; } if (isset($vars['pid']) && $vars['pid'] != '') { $where_sql .= " AND `pid`='{$vars['pid']}'"; } if (isset($vars['key']) && $vars['key'] != '') { $where_sql .= " AND `key`='{$vars['key']}'"; } if (isset($vars['id']) && $vars['id'] != '') { $where_sql .= " AND `id`='{$vars['id']}'"; } $marker = iDB::row("SELECT * FROM `#iCMS@__marker` {$where_sql}", ARRAY_A); iPHP_SQL_DEBUG && iDB::debug(1); if ($marker) { echo $marker['data']; } }
public static function pagenav($total, $displaypg = 20, $unit = "条记录", $url = '', $target = '') { $displaypg = intval($displaypg); $page = $GLOBALS["page"] ? intval($GLOBALS["page"]) : 1; $lastpg = ceil($total / $displaypg); //最后页,也是总页数 $page = min($lastpg, $page); $prepg = $page - 1 < 0 ? "0" : $page - 1; //上一页 $nextpg = $page == $lastpg ? 0 : $page + 1; //下一页 $url = buildurl($url, array('total_num' => $total, 'page' => '')); self::$offset = ($page - 1) * $displaypg; self::$offset < 0 && (self::$offset = 0); self::$pagenav = "<ul><li><a href='{$url}1' target='_self'>首页</a></li>"; self::$pagenav .= $prepg ? "<li><a href='{$url}{$prepg}' target='_self'>上一页</a></li>" : '<li class="disabled"><a href="javascript:;">上一页</a></li>'; $flag = 0; for ($i = $page - 2; $i <= $page - 1; $i++) { if ($i < 1) { continue; } self::$pagenav .= "<li><a href='{$url}{$i}' target='_self'>{$i}</a></li>"; } self::$pagenav .= '<li class="active"><a href="javascript:;">' . $page . '</a></li>'; for ($i = $page + 1; $i <= $lastpg; $i++) { self::$pagenav .= "<li><a href='{$url}{$i}' target='_self'>{$i}</a></li>"; $flag++; if ($flag == 4) { break; } } self::$pagenav .= $nextpg ? "<li><a href='{$url}{$nextpg}' target='_self'>下一页</a></li>" : '<li class="disabled"><a href="javascript:;">下一页</a></li>'; self::$pagenav .= "<li><a href='{$url}{$lastpg}' target='_self'>末页</a></li>"; self::$pagenav .= "<li> <span class=\"muted\">共{$total}{$unit},{$displaypg}{$unit}/页 共{$lastpg}页</span></li>"; for ($i = 1; $i <= $lastpg; $i = $i + 5) { $s = $i == $page ? ' selected="selected"' : ''; $select .= "<option value=\"{$i}\"{$s}>{$i}</option>"; } if ($lastpg > 200) { self::$pagenav .= "<li> <span class=\"muted\">跳到 <input type=\"text\" id=\"pageselect\" style=\"width:24px;height:12px;margin-bottom: 0px;line-height: 12px;\" /> 页 <input class=\"btn btn-small\" type=\"button\" onClick=\"window.location='{$url}'+\$('#pageselect').val();\" value=\"跳转\" style=\"height: 22px;line-height: 18px;\"/></span></li>"; } else { self::$pagenav .= "<li> <span class=\"muted\">跳到 <select id=\"pageselect\" style=\"width:48px;height:20px;margin-bottom: 3px;line-height: 16px;padding: 0px\" onchange=\"window.location='{$url}'+this.value\">{$select}</select> 页</span></li>"; } self::$pagenav .= '</ul>'; //(int)$lastpg<2 &&UCP::$pagenav=''; }
function logout() { iPHP::set_cookie(self::$AUTH, '', -31536000); }
header('Content-Type: text/html; charset=' . iPHP_CHARSET); header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); if (function_exists('memory_get_usage') && (int) @ini_get('memory_limit') < abs(intval(iPHP_MEMORY_LIMIT))) { @ini_set('memory_limit', iPHP_MEMORY_LIMIT); } @ini_set('date.timezone', iPHP_TIME_ZONE); //设置时区 function_exists('date_default_timezone_set') && date_default_timezone_set(iPHP_TIME_ZONE); require iPHP_PATH . '/iPHP.compat.php'; require iPHP_PATH . '/iPHP.class.php'; set_error_handler('iPHP_ERROR_HANDLER'); iPHP::timer_start(); //waf iPHP::LoadClass("Waf"); waf::filter(); //security iPHP::LoadClass("Security", 'S'); iS::filter(); iS::GP('page', 'GP', 2); define('__SELF__', $_SERVER['PHP_SELF']); define('__REF__', $_SERVER['HTTP_REFERER']); $iDB_CLASS = 'Mysql'; iPHP_DB_TYPE == 'mysql' && version_compare(PHP_VERSION, '5.5', '>=') && ($iDB_CLASS = 'Mysqli'); iPHP_DB_TYPE == 'pgsql' && ($iDB_CLASS = 'Pgsql'); iPHP_DB_TYPE == 'sqlite' && ($iDB_CLASS = 'SQLite'); iPHP::loadClass($iDB_CLASS, 'DB'); //加载数据库操作类 iPHP::loadClass("FileSystem", 'FS'); //加载文件操作类 iPHP::loadClass('Cache'); //加载缓存操作类
private static function icmsChar($name) { iPHP::set_cookie($name, authcode('iCMS', 'ENCODE')); header('Content-type:image/gif' . PHP_EOL); exit(base64_decode(' R0lGODlhUAAeALMAAAAAAI+Pj09PTzMzM8zMzK+vr39/fw8PD2ZmZj8/Px8fH9/f35mZmb+/v2ZmZv ///yH5BAEHAA8ALAAAAABQAB4AAAT/8MlJq7046827/2AojmS5IYi2MEYiGMyiBYa4GEFWtElvEJoE oHBpCADIAxIpAF6QjBACeQkok4qlgnhZHA4yyhQgKIQXhSOgZkEqQF5qZXpANCiNcaoKiE6mA04WBA MAexRLdx4BSxWMA2EWC4WHGgYAkCqFfhOGAAkfCgeFFaKRXYWKGQsACqcYXmCIBkeCGgxrQhQEhhy8 b46CU6obuGwSaw29HEILuhPKXCcHbWxeAyAKlWsPzRvKKc8SyjkcC68P3A8FAOUk3MYnADLiD7HoHu qX+B/qpqtkJNR7wOiANBDqElAzoQ6XOwvDBAKwwAhTAH4YEoJiaO0AMEmj/yYMlLBgTKsXxDKyObCx hLoHlzhRiClyIiwGCLIsKZNBo4l0x1hhs6DgYzebHBoYKITJVic2CYa6PPYgIgWHFEZuKAmlmoQpP1 /a+1RhgKyaIwh8eaWO3UEOuASJPRpJGdWjVzFWiDeL5DIPUyLNBTfhyCtx5PrdfRnYg9C+ZeeNrSSR Qsh8i4OS7XBE5twH8RpXqHfpLQa7FcQyonxhSktkdyWYYnmh3gJRTi/USn0XUMoJC45kguwIE4DfeH d9eViBqwCvjpRoK9CgegA1CdB9ticdw0gCWaZXr04LSXbozQ3oXIJkgEzic/p4X5h+PXtM7ycQ0Etg hwEDDfCn1xAq/PkHQ4A/Jajgggw26EEEADs=')); }
function do_batch() { $idArray = (array) $_POST['id']; $idArray or iPHP::alert("请选择要操作的标签"); $ids = implode(',', $idArray); $batch = $_POST['batch']; switch ($batch) { case 'dels': iPHP::$break = false; foreach ($idArray as $id) { $this->do_del($id, false); } iPHP::$break = true; iPHP::success('标签全部删除完成!', 'js:1'); break; case 'move': $_POST['cid'] or iPHP::alert("请选择目标栏目!"); iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('category', $this->appid); $cid = (int) $_POST['cid']; foreach ($idArray as $id) { $_cid = iDB::value("SELECT `cid` FROM `#iCMS@__tags` where `id` ='{$id}'"); iDB::update("tags", compact('cid'), compact('id')); if ($_cid != $cid) { map::diff($cid, $_cid, $id); $this->categoryApp->update_count_one($_cid, '-'); $this->categoryApp->update_count_one($cid); } } iPHP::success('成功移动到目标栏目!', 'js:1'); break; case 'mvtcid': $_POST['tcid'] or iPHP::alert("请选择目标分类!"); iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('category', $this->appid); $tcid = (int) $_POST['tcid']; foreach ($idArray as $id) { $_tcid = iDB::value("SELECT `tcid` FROM `#iCMS@__tags` where `id` ='{$id}'"); iDB::update("tags", compact('tcid'), compact('id')); if ($_tcid != $tcid) { map::diff($tcid, $_tcid, $id); $this->categoryApp->update_count_one($_tcid, '-'); $this->categoryApp->update_count_one($tcid); } } iPHP::success('成功移动到目标分类!', 'js:1'); break; case 'prop': iPHP::import(iPHP_APP_CORE . '/iMAP.class.php'); map::init('prop', $this->appid); $pid = implode(',', (array) $_POST['pid']); foreach ((array) $_POST['id'] as $id) { $_pid = iDB::value("SELECT pid FROM `#iCMS@__tags` WHERE `id`='{$id}'"); iDB::update("tags", compact('pid'), compact('id')); map::diff($pid, $_pid, $id); } iPHP::success('属性设置完成!', 'js:1'); break; case 'weight': $weight = _int($_POST['mweight']); $sql = "`weight` = '{$weight}'"; break; case 'tpl': $tpl = iS::escapeStr($_POST['mtpl']); $sql = "`tpl` = '{$tpl}'"; break; case 'keyword': if ($_POST['pattern'] == 'replace') { $sql = "`keywords` = '" . iS::escapeStr($_POST['mkeyword']) . "'"; } elseif ($_POST['pattern'] == 'addto') { foreach ($idArray as $id) { $keywords = iDB::value("SELECT keywords FROM `#iCMS@__tags` WHERE `id`='{$id}'"); $sql = "`keywords` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mkeyword']) : iS::escapeStr($_POST['mkeyword'])) . "'"; iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'"); } iPHP::success('关键字更改完成!', 'js:1'); } break; case 'tag': if ($_POST['pattern'] == 'replace') { $sql = "`related` = '" . iS::escapeStr($_POST['mtag']) . "'"; } elseif ($_POST['pattern'] == 'addto') { foreach ($idArray as $id) { $keywords = iDB::value("SELECT related FROM `#iCMS@__tags` WHERE `id`='{$id}'"); $sql = "`related` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mtag']) : iS::escapeStr($_POST['mtag'])) . "'"; iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'"); } iPHP::success('相关标签更改完成!', 'js:1'); } break; default: if (strpos($batch, ':')) { $data = iACP::fields($batch); foreach ($idArray as $id) { $data && iDB::update("tags", $data, array('id' => $id)); } iPHP::success('操作成功!', 'js:1'); } else { iPHP::alert('请选择要操作项!', 'js:1'); } } $sql && iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id` IN ({$ids})"); iPHP::success('操作成功!', 'js:1'); }
function Article($id) { $app = iCMS::run('article', 'article', 'object'); $htm = $app->article($id); $htm or iPHP::alert("文章所属栏目URL规则设置问题! 此栏目下的文章不能生成静态,请修改栏目的访问模式和URL规则"); $total = $htm[1]['page']['total']; $title = $htm[1]['title']; iFS::check_ext($htm[1]['iurl']->path) or iPHP::alert("文件类型不合法,禁止生成!<hr />请更改栏目->URL规则设置->内容规则"); iFS::mkdir($htm[1]['iurl']->dir); iFS::write($htm[1]['iurl']->path, $htm[0]); if ($total >= 2) { for ($ap = 2; $ap <= $total; $ap++) { $htm = $app->article($id, $ap); $fpath = iPHP::p2num($htm[1]['iurl']->pagepath, $ap); iFS::write($fpath, $htm[0]); } } unset($app, $htm); return $title; }
function __article_array($vars, $variable) { $resource = array(); if ($variable) { $articleApp = iPHP::app("article"); $vars['category_lite'] = true; foreach ($variable as $key => $value) { $value = $articleApp->value($value, false, $vars); if ($value === false) { continue; } if ($vars['page']) { $value['page'] = $GLOBALS['page'] ? $GLOBALS['page'] : 1; $value['total'] = $total; } if ($vars['archive'] == "date") { $_date = archive_date($value['postime']); //var_dump($_date); //$_date = get_date($value['postime'],'Ymd'); unset($resource[$key]); $resource[$_date][$key] = $value; } else { $resource[$key] = $value; } } } return $resource; }
function do_del($uid = null, $dialog = true) { $uid === null && ($uid = $this->uid); $uid or iPHP::alert('请选择要删除的用户'); $uid == "1" && iPHP::alert('不能删除超级管理员'); iDB::query("DELETE FROM `#iCMS@__members` WHERE `uid` = '{$uid}'"); $dialog && iPHP::success('用户删除完成', 'js:parent.$("#tr' . $uid . '").remove();'); }
function check_dir($dir, $appid, $url, $cid = 0) { $sql = "SELECT `dir` FROM `#iCMS@__category` where `dir` ='{$dir}' AND `appid`='{$appid}'"; $cid && ($sql .= " AND `cid` !='{$cid}'"); iDB::value($sql) && empty($url) && iPHP::alert('该' . $this->category_name . '静态目录已经存在!<br />请重新填写(URL规则设置->静态目录)'); }
public function cleancookie() { iPHP::set_cookie('QQ_ACCESS_TOKEN', '', -31536000); iPHP::set_cookie('QQ_OPENID', '', -31536000); iPHP::set_cookie('QQ_STATE', '', -31536000); }
function do_saveproject() { $id = (int) $_POST['id']; $name = iS::escapeStr($_POST['name']); $urls = iS::escapeStr($_POST['urls']); $list_url = $_POST['list_url']; $cid = iS::escapeStr($_POST['cid']); $rid = iS::escapeStr($_POST['rid']); $poid = iS::escapeStr($_POST['poid']); $poid = iS::escapeStr($_POST['poid']); $checker = iS::escapeStr($_POST['checker']); $self = isset($_POST['self']) ? '1' : '0'; $sleep = (int) $_POST['sleep']; $auto = iS::escapeStr($_POST['auto']); $psleep = (int) $_POST['psleep']; $lastupdate = $_POST['lastupdate'] ? iPHP::str2time($_POST['lastupdate']) : ''; empty($name) && iPHP::alert('名称不能为空!'); empty($cid) && iPHP::alert('请选择绑定的栏目'); empty($rid) && iPHP::alert('请选择采集规则'); //empty($poid) && iPHP::alert('请选择发布规则'); $fields = array('name', 'urls', 'list_url', 'cid', 'rid', 'poid', 'checker', 'self', 'sleep', 'auto', 'lastupdate', 'psleep'); $data = compact($fields); if ($id) { iDB::update('spider_project', $data, array('id' => $id)); } else { iDB::insert('spider_project', $data); } iPHP::success('完成', 'url:' . APP_URI . '&do=project'); }
public static function head($navbar = true) { $body_class = ''; if (iCMS::$config['other']['sidebar_enable']) { iCMS::$config['other']['sidebar'] or $body_class = 'sidebar-mini'; $body_class = iPHP::get_cookie('ACP_sidebar_mini') ? 'sidebar-mini' : ''; } else { $body_class = 'sidebar-display'; } $navbar === false && ($body_class = 'iframe '); include self::view("admincp.header"); $navbar === true && (include self::view("admincp.navbar")); }