コード例 #1
0
ファイル: admin.php プロジェクト: yunsite/easysns
 function getplugs()
 {
     $this->check_admin();
     $id = intval(v('id'));
     $aid = z(v('aid'));
     if ($id < 1) {
         info_page('错误的Id');
     }
     $folder = z(v('folder'));
     if ($folder == '') {
         info_page('请填写安装目录');
     }
     $update = false;
     $path = 'application/app/' . $folder . '/';
     if (file_exists(ROOT . $path . 'controller/config.php')) {
         include ROOT . $path . 'controller/config.php';
         if ($app_config['id'] != $aid) {
             info_page('此目录已安装其他应用');
         } else {
             $update = true;
         }
     }
     $this->load->library('service');
     $this->service->add('id', $id);
     $this->service->add('aid', $aid);
     $result = $this->service->result('getPlug');
     if ($result == false) {
         info_page('网络错误');
     } elseif (!isset($result['flag']) || $result['flag'] != 'ok') {
         info_page('数据传输错误');
     } else {
         if ($result['error']) {
             info_page($result['notice']);
         } else {
             @MakeDir($path);
             $file = $path . 'install.zip';
             file_put_contents(ROOT . $file, $result['zip']);
             $this->load->library('pclzip', $file);
             if ($this->pclzip->extract(PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_PATH, $path) == 0) {
                 info_page("Error : " . $this->pclzip->errorInfo(true));
             }
             @unlink($file);
             $all_files = app_files('application/app/' . $folder);
             if ($all_files) {
                 foreach ($all_files as $file) {
                     @touch(ROOT . $file);
                 }
             }
             if ($update) {
                 info_page('应用内容已更新', '/admin/applist', '管理应用');
             } else {
                 info_page('应用已下载', '/admin/applist', '管理应用');
             }
         }
     }
 }
コード例 #2
0
ファイル: lazy_helper.php プロジェクト: yunsite/easysns
function app_files($path)
{
    $list = array();
    $all = glob($path . '/*');
    if ($all) {
        foreach ($all as $item) {
            if (is_dir($item)) {
                $list = array_merge($list, app_files($item));
            } else {
                $list[] = $item;
            }
        }
    }
    return $list;
}
コード例 #3
0
ファイル: design.php プロジェクト: yunsite/easysns
 function unzip($id = NULL)
 {
     check_admin();
     $id = intval($id);
     if (!$id) {
         info_page('错误的组件Id');
     }
     $finfo = $this->form->get_form_info_by_id($id);
     if (!$finfo) {
         info_page('错误的组件Id');
     }
     $data['folder'] = $finfo['name'];
     $path = 'application/app/' . $finfo['name'] . '/';
     $file = $path . 'install.zip';
     if (!file_exists(ROOT . $file)) {
         info_page('错误 文件' . $file . '不存在');
     }
     $this->load->library('pclzip', $file);
     if ($this->pclzip->extract(PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_PATH, $path) == 0) {
         info_page("Error : " . $this->pclzip->errorInfo(true));
     }
     @unlink($file);
     if (!file_exists(ROOT . 'static/icon/' . $finfo['name'] . '.gif')) {
         @copy(ROOT . 'static/images/app.default.png', ROOT . 'static/icon/' . $finfo['name'] . '.gif');
     }
     $all_files = app_files('application/app/' . $finfo['name']);
     if ($all_files) {
         foreach ($all_files as $file) {
             @touch(ROOT . $file);
         }
     }
     @(include_once $path . 'controller/operate.php');
     $updatesql = isset($update['sql']) && $update['sql'] ? 1 : 0;
     $data['installed'] = check_app_install($id);
     if ($data['installed'] && $updatesql) {
         $data['update'] = true;
     } else {
         $data['update'] = false;
     }
     $data['id'] = $id;
     $this->view('unzip', $data);
 }