Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 public static function LoginPage()
 {
     self::$AJAX && iPHP::json(array('code' => 0));
     iPHP::set_cookie(self::$AUTH, '', -31536000);
     include self::$LOGIN_TPL . '/template/admincp.login.php';
     exit;
 }
Beispiel #3
0
 public function API_list()
 {
     iPHP::app('user.class', 'static');
     user::get_cookie() or iPHP::code(0, 'iCMS:!login', 0, 'json');
     iPHP::app('favorite.func');
     $array = favorite_list(array('userid' => user::$userid));
     iPHP::json($array);
 }
Beispiel #4
0
 public function API_json()
 {
     $vars = array('appid' => iCMS_APP_ARTICLE, 'id' => (int) $_GET['id'], 'iid' => (int) $_GET['iid'], 'date_format' => 'Y-m-d H:i');
     $_GET['by'] && ($vars['by'] = iS::escapeStr($_GET['by']));
     $_GET['date_format'] && ($vars['date_format'] = iS::escapeStr($_GET['date_format']));
     $vars['page'] = true;
     iPHP::app('comment.func', 'static');
     $array = comment_list($vars);
     iPHP::json($array);
     //iPHP::assign('vars',$vars);
     //iPHP::view('iCMS://comment/api.json.htm');
 }
Beispiel #5
0
 function LoginPage()
 {
     self::$ajax && iPHP::json(array('code' => 0));
     iPHP::set_cookie(self::$AUTH, '', -31536000);
     include self::$LOGIN_TPL . '/template/login.php';
     exit;
 }
Beispiel #6
0
 public function API_data($uid = 0)
 {
     $user = user::status();
     if ($user) {
         $array = array('code' => 1, 'uid' => $user->uid, 'url' => $user->url, 'avatar' => $user->avatar, 'nickname' => $user->nickname);
         iPHP::json($array);
     } else {
         user::logout();
         iPHP::code(0, 0, $this->forward, 'json');
     }
 }
Beispiel #7
0
 function do_uploadscrawl()
 {
     if ($_GET["action"] == "tmpImg") {
         // 背景上传
         iFS::$callback = false;
         $F = iFS::upload('upfile', 'scrawl/tmp');
         $F === false && exit;
         $F['path'] && ($url = iFS::fp($F['path'], '+http'));
         echo "<script>parent.ue_callback('" . $url . "','SUCCESS')</script>";
     } else {
         iFS::$callback = true;
         $F = iFS::base64ToFile($_POST['upfile'], 'scrawl/' . get_date(0, 'Y/md'));
         $F === false && exit(iFS::$ERROR);
         $F['path'] && ($url = iFS::fp($F['path'], '+http'));
         $tmp = iFS::get_dir() . "scrawl/tmp/";
         iFS::rmdir($tmp);
         iPHP::json(array("url" => $url, "state" => 'SUCCESS'));
     }
 }
Beispiel #8
0
 function do_getmeta()
 {
     $cid = $_GET['cid'];
     $cid && ($contentprop = unserialize($this->category[$cid]['contentprop']));
     iPHP::json($contentprop);
 }
Beispiel #9
0
 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();');
 }