Пример #1
0
if ($action == 'insplu') {
    $source = isset($_GET['source']) ? trim($_GET['source']) : '';
    $source_type = 'plu';
    $source_typename = '插件';
    $source_typeurl = '<a href="plugin.php">查看插件</a>';
    include View::getView('header');
    require_once View::getView('store_install');
    include View::getView('footer');
}
if ($action == 'addon') {
    $source = isset($_GET['source']) ? trim($_GET['source']) : '';
    $source_type = isset($_GET['type']) ? trim($_GET['type']) : '';
    if (empty($source)) {
        exit('error');
    }
    $temp_file = emFecthFile(OFFICIAL_SERVICE_HOST . $source);
    if (!$temp_file) {
        exit('error_down');
    }
    $unzip_path = $source_type == 'tpl' ? '../content/templates/' : '../content/plugins/';
    $ret = emUnZip($temp_file, $unzip_path, $source_type);
    @unlink($temp_file);
    switch ($ret) {
        case 0:
            exit('succ');
            break;
        case 1:
        case 2:
            exit('error_dir');
            break;
        case 3:
Пример #2
0
 switch ($ret) {
     case 1:
     case 2:
         exit('error_dir');
         break;
     case 3:
         exit('error_zip');
         break;
 }
 //update db
 if (!$upsql) {
     exit('succ');
 }
 $DB = Database::getInstance();
 $setchar = $DB->getMysqlVersion() > '4.1' ? "ALTER DATABASE `" . DB_NAME . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" : '';
 $temp_file = emFecthFile(OFFICIAL_SERVICE_HOST . $upsql);
 if (!$temp_file) {
     exit('error_down');
 }
 $sql = file($temp_file);
 @unlink($temp_file);
 array_unshift($sql, $setchar);
 $query = '';
 foreach ($sql as $value) {
     if (!$value || $value[0] == '#') {
         continue;
     }
     $value = str_replace("{db_prefix}", DB_PREFIX, trim($value));
     if (preg_match("/\\;\$/i", $value)) {
         $query .= $value;
         $DB->query($query);