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 static function success($msg, $js = null, $s = 3) { self::$dialog = array('lock' => true, 'width' => 360, 'height' => 120); self::dialog('success:#:check:#:' . $msg, $js, $s); }
function do_createArticle($aid = null) { $category = $this->PG['cid']; $startime = $this->PG['startime']; $endtime = $this->PG['endtime']; $startid = $this->PG['startid']; $endid = $this->PG['endid']; $perpage = (int) $this->PG['perpage']; $offset = (int) $this->PG['offset']; $orderby = $this->PG['orderby']; $whereSQL = "WHERE `status` ='1'"; $aid === null && ($aid = $this->PG['aid']); if ($aid) { $title = self::Article($aid); iPHP::success($title . '<hr />生成静态完成!'); } $category[0] == 'all' && ($category = $this->get_category(iCMS_APP_ARTICLE)); if ($category) { $cids = implode(',', (array) $category); $whereSQL .= " AND `cid` IN({$cids})"; } $startime && ($whereSQL .= " AND `pubdate`>=UNIX_TIMESTAMP('{$startime} 00:00:00')"); $endtime && ($whereSQL .= " AND `pubdate`<=UNIX_TIMESTAMP('{$endtime} 23:59:59')"); $startid && ($whereSQL .= " AND `id`>='{$startid}'"); $endid && ($whereSQL .= " AND `id`<='{$endid}'"); $perpage or $perpage = $this->CP; $orderby or $orderby = "id DESC"; $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__article` {$whereSQL}", "G"); $looptimes = ceil($total / $perpage); $offset = $this->page * $perpage; $rs = iDB::all("SELECT `id` FROM `#iCMS@__article` {$whereSQL} order by {$orderby} LIMIT {$offset},{$perpage}"); $_count = count($rs); $msg = "共<span class='label label-info'>{$total}</span>篇文章,将分成<span class='label label-info'>{$looptimes}</span>次完成<hr />开始执行第<span class='label label-info'>" . ($this->page + 1) . "</span>次生成,共<span class='label label-info'>{$_count}</span>篇<hr />"; for ($i = 0; $i < $_count; $i++) { self::Article($rs[$i]['id']); $msg .= '<span class="label label-success">' . $rs[$i]['id'] . ' <i class="fa fa-check"></i></span> '; } $GLOBALS['page']++; $use_time = iPHP::timer_stop(); $msg .= "<hr />用时<span class='label label-info'>{$use_time}</span>秒"; $query["total_num"] = $total; $query["alltime"] = $this->alltime + $use_time; $loopurl = $this->loopurl($looptimes, $query); if ($loopurl) { $moreBtn = array(array("id" => "btn_stop", "text" => "停止", "url" => APP_URI . "&do=article"), array("id" => "btn_next", "text" => "继续", "src" => $loopurl, "next" => true)); $dtime = 1; $all_time = $looptimes * $use_time + $looptimes + 1; $msg .= "<hr />预计全部生成还需要<span class='label label-info'>{$all_time}</span>秒"; } else { $moreBtn = array(array("id" => "btn_next", "text" => "完成", "url" => APP_URI . "&do=article")); $dtime = 5; $msg .= "<hr />已全部生成完成<hr />总共用时<span class='label label-info'>" . $query["alltime"] . "</span>秒"; } $updateMsg = $this->page ? true : false; iPHP::dialog($msg, $loopurl ? "src:" . $loopurl : '', $dtime, $moreBtn, $updateMsg); }
function do_mpublish($pubArray = array()) { iPHP::$break = false; if ($_POST['pub']) { foreach ((array) $_POST['pub'] as $i => $a) { list($cid, $pid, $rid, $url, $title) = explode('|', $a); $pubArray[] = array('sid' => 0, 'url' => $url, 'title' => $title, 'cid' => $cid, 'rid' => $rid, 'pid' => $pid); } } if (empty($pubArray)) { iPHP::$break = true; iPHP::alert('暂无最新内容', 0, 30); } $_count = count($pubArray); ob_start(); ob_end_flush(); ob_implicit_flush(1); foreach ((array) $pubArray as $i => $a) { spider::$sid = $a['sid']; spider::$cid = $a['cid']; spider::$pid = $a['pid']; spider::$rid = $a['rid']; spider::$url = $a['url']; spider::$title = $a['title']; $rs = $this->multipublish(); $updateMsg = $i ? true : false; $timeout = $i++ == $_count ? '3' : false; iPHP::dialog($rs['msg'], 'js:' . $rs['js'], $timeout, 0, $updateMsg); ob_flush(); flush(); } iDB::update('spider_project', array('lastupdate' => time()), array('id' => $this->pid)); iPHP::dialog('success:#:check:#:采集完成!', 0, 3, 0, true); }
function do_del() { $msg = $this->delArticle($this->id); $msg .= $this->del_msg('文章删除完成!'); $msg .= $this->del_msg('10秒后返回文章列表!'); iPHP::$dialog['lock'] = true; iPHP::dialog($msg, 'js:1'); }
function do_renew() { iPHP::alert('请使用 iCMS Tools 恢复'); $this->bakdir or iPHP::alert('请选择要恢复的备份卷'); $backupdir = iPHP_APP_CACHE . '/backup/' . $this->bakdir; $step = (int) $_GET['step']; $count = (int) $_GET['count']; if ($count == 0) { $fileArray = glob($backupdir . '/iCMS_*.sql'); $count = count($fileArray); } $step or $step = 1; $this->bakindata($step); $i = $step; $step++; if ($count > 1 && $step <= $count) { $loopurl = APP_FURI . "&do=renew&step={$step}&count={$count}&dir={$this->bakdir}"; $moreBtn = array(array("id" => "btn_stop", "text" => "停止", "url" => APP_URI . "&do=recover"), array("id" => "btn_next", "text" => "继续", "src" => $loopurl, "next" => true)); $dtime = 1; $msg = "正在导入第<span class='label label-success'>{$i}</span>卷备份文件,<hr />程序将自动导入余下备份文件..."; } else { $msg = "success:#:check:#:导入成功!"; $moreBtn = array(array("id" => "btn_next", "text" => "完成", "url" => APP_URI . "&do=recover")); $dtime = 5; } $updateMsg = $i == 1 ? false : true; iPHP::dialog($msg, $loopurl ? "src:" . $loopurl : 'js:1', $dtime, $moreBtn, $updateMsg); }
function do_delfile() { iACP::MP('FILE.DELETE', 'alert'); $_GET['path'] or iPHP::alert("请选择要删除的文件"); strpos($_GET['path'], '..') !== false && iPHP::alert("文件路径中带有.."); $hash = md5($_GET['path']); $FileRootPath = iFS::fp($_GET['path'], '+iPATH'); if (iFS::del($FileRootPath)) { $msg = 'success:#:check:#:文件删除完成!'; $_GET['ajax'] && iPHP::json(array('code' => 1, 'msg' => $msg)); } else { $msg = 'warning:#:warning:#:找不到相关文件,文件删除失败!'; $_GET['ajax'] && iPHP::json(array('code' => 0, 'msg' => $msg)); } iPHP::dialog($msg, 'js:parent.$("#' . $hash . '").remove();'); }
function do_del() { $id = (int) $_GET['id']; if (empty(iACP::$menu->root_array[$id])) { iDB::query("DELETE FROM `#iCMS@__menu` WHERE `id` = '{$id}'"); iACP::$menu->cache(); $msg = '删除成功!'; } else { $msg = '请先删除本菜单下的子菜单!'; } iPHP::dialog($msg, 'js:parent.$("#' . $id . '").remove();'); }