Esempio n. 1
0
 function do_install($action = false)
 {
     $task = HOME_DIR . '/tmp/' . $_GET['download'];
     $temp_mess = file_get_contents($task . '/task.php');
     $down_data = unserialize($temp_mess);
     $url = $down_data['download_list'][0];
     $filename = substr($url, strrpos($url, "/") + 1);
     $file_path = $task . '/' . $filename;
     if ($action == 'template') {
         $tar = $this->system->loadModel('utility/tar');
         $d_install = $this->system->loadModel('service/data_install');
         if ($tar->openTAR($file_path)) {
             foreach ($tar->files as $id => $file) {
                 $fpath = $task . '/install.sql';
                 if (substr($file['name'], -4) == '.sql') {
                     $content = $tar->getContents($file);
                     if (!$d_install->do_install($content)) {
                         echo $this->_fetch_compile_include('service/download_complete_handle.html', array('info' => '体验数据安装失败' . $d_install->error));
                         exit;
                     }
                 }
             }
             $tar->closeTAR();
         }
         include CORE_DIR . '/admin/controller/service/ctl.download.php';
         $download = new ctl_download();
         $_POST = array('download_list' => array($down_data['template']), 'succ_url' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?ctl=service/demo_data&act=do_install');
         $download->start();
         exit;
     }
     if ($url) {
         if (file_exists($file_path)) {
             $file['tmp_name'] = $file_path;
             $file['name'] = time();
             $file['error'] = '0';
             $file['size'] = filesize($file_path);
             $template =& $this->system->loadModel("system/template");
             $template->upload($file, $msg);
             @unlink(MEDIA_DIR . '/brand_list.data');
             $this->clear_cache();
             $this->system->cache->clear();
         } else {
             $msg = "找不到安装文件。安装失败";
         }
     }
     echo $this->_fetch_compile_include('service/download_complete_handle.html', array('info' => '体验数据安装成功'));
     exit;
 }
Esempio n. 2
0
 function install_online($ident, $url, $is_update = false)
 {
     if (!$url) {
         $url = 'http://sds.ecos.shopex.cn/payments/apps/' . $ident . '.tar';
     }
     include CORE_DIR . '/admin/controller/service/ctl.download.php';
     $download = new ctl_download();
     $_POST = array('download_list' => array($url), 'succ_url' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?ctl=trading/payment&act=do_install_online');
     $download->set = 'true';
     $download->start();
     if ($is_update) {
         $ident = date("Ymd") . substr(md5(time() . rand(0, 9999)), 0, 5);
         $download->run($download->ident, 0);
         $_GET['download'] = $download->ident;
         $this->do_install_online();
     }
 }
Esempio n. 3
0
 function install_online()
 {
     if (isset($_GET['url'])) {
         include CORE_DIR . '/admin/controller/service/ctl.download.php';
         $download = new ctl_download();
         $_POST = array('download_list' => array($_GET['url']), 'succ_url' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?ctl=system/appmgr&act=do_install_online');
         $download->start();
     }
     exit;
 }
Esempio n. 4
0
 function install_online()
 {
     //echo time();
     //exit();
     if (isset($_POST['url']) && isset($_POST['tpl_name']) && isset($_POST['fullsize'])) {
         include CORE_DIR . '/admin/controller/service/ctl.download.php';
         $download = new ctl_download();
         $_POST = array('download_list' => array($_POST['url']), 'succ_url' => 'http://' . HTTP_HOST . dirname(PHP_SELF) . '/index.php?ctl=system/template&act=install');
         $download->start();
     }
     exit;
 }