Ejemplo n.º 1
0
            rmdirs(IA_ROOT . '/app/themes/' . $id, true);
            header('Location: ' . url('cloud/process', array('t' => $id, 'is_upgrade' => 1)));
            exit;
        } else {
            $packet = cloud_t_build($id);
            $manifest = ext_template_manifest_parse($packet['manifest']);
        }
    }
    if (empty($manifest)) {
        if ($batch == 1) {
            cache_write('upgrade:template', iserializer($wait_upgrade));
            message($theme['title'] . ' 模块安装配置文件不存在或是格式不正确。系统将进入下一个模板的更新。<br>请勿关闭浏览器', url('extension/theme/upgrade', array('batch' => 1)), 'success');
        }
        message('模块安装配置文件不存在或是格式不正确!', '', 'error');
    }
    if (ver_compare($theme['version'], $packet['version']) != -1) {
        if ($batch == 1) {
            cache_write('upgrade:template', iserializer($wait_upgrade));
            message($theme['title'] . ' 模板版本不低于要更新的版本。系统将进入下一个模板的更新。<br>请勿关闭浏览器', url('extension/theme/upgrade', array('batch' => 1)), 'success');
        }
        message('已安装的模板版本不低于要更新的版本, 操作无效.');
    }
    pdo_update('site_templates', array('version' => $packet['version']), array('id' => $theme['id']));
    if ($batch == 1) {
        cache_write('upgrade:template', iserializer($wait_upgrade));
        message($theme['title'] . ' 模板更新成功。系统将进入下一个模板的更新。<br>请勿关闭浏览器', url('extension/theme/upgrade', array('batch' => 1)), 'success');
    }
    message('模板更新成功!', url('extension/theme'), 'success');
}
if ($do == 'web') {
    $_W['page']['title'] = '管理后台风格 - 风格主题 - 扩展';
Ejemplo n.º 2
0
             header('location: ' . url('cloud/redirect/buyversion', array('m' => $id, 'version' => $module['version'], 'is_upgrade' => 1)));
             exit;
         } else {
             header('location: ' . url('cloud/process', array('m' => $id, 'is_upgrade' => 1)));
             exit;
         }
     } else {
         $packet = cloud_m_build($id);
         $manifest = ext_module_manifest_parse($packet['manifest']);
     }
 }
 if (empty($manifest)) {
     message('模块安装配置文件不存在或是格式不正确!', '', 'error');
 }
 manifest_check($id, $manifest);
 if (ver_compare($module['version'], $manifest['application']['version']) != -1) {
     message('已安装的模块版本不低于要更新的版本, 操作无效.');
 }
 if (!file_exists($modulepath . 'processor.php') && !file_exists($modulepath . 'module.php') && !file_exists($modulepath . 'receiver.php') && !file_exists($modulepath . 'site.php')) {
     message('模块处理文件 site.php, processor.php, module.php, receiver.php 一个都不存在 !', '', 'error');
 }
 $module = ext_module_convert($manifest);
 unset($module['name']);
 unset($module['id']);
 $bindings = array_elements(array_keys($points), $module, false);
 foreach ($points as $p => $row) {
     unset($module[$p]);
     if (is_array($bindings[$p]) && !empty($bindings[$p])) {
         foreach ($bindings[$p] as $entry) {
             $entry['module'] = $manifest['application']['identifie'];
             $entry['entry'] = $p;
Ejemplo n.º 3
0
function ext_module_checkupdate($modulename)
{
    $manifest = ext_module_manifest($modulename);
    if (!empty($manifest) && is_array($manifest)) {
        $version = $manifest['application']['version'];
        load()->model('module');
        $module = module_fetch($modulename);
        if (ver_compare($version, $module['version']) == '1') {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
function ihttp_request($url, $post = '', $extra = array(), $timeout = 60)
{
    $urlset = parse_url($url);
    if (empty($urlset['path'])) {
        $urlset['path'] = '/';
    }
    if (!empty($urlset['query'])) {
        $urlset['query'] = "?{$urlset['query']}";
    }
    if (empty($urlset['port'])) {
        $urlset['port'] = $urlset['scheme'] == 'https' ? '443' : '80';
    }
    if (strexists($url, 'https://') && !extension_loaded('openssl')) {
        if (!extension_loaded("openssl")) {
            message('请开启您PHP环境的openssl');
        }
    }
    if (function_exists('curl_init') && function_exists('curl_exec')) {
        $ch = curl_init();
        if (ver_compare(phpversion(), '5.6') >= 0) {
            curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
        }
        if (!empty($extra['ip'])) {
            $extra['Host'] = $urlset['host'];
            $urlset['host'] = $extra['ip'];
            unset($extra['ip']);
        }
        curl_setopt($ch, CURLOPT_URL, $urlset['scheme'] . '://' . $urlset['host'] . ($urlset['port'] == '80' ? '' : ':' . $urlset['port']) . $urlset['path'] . $urlset['query']);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        if ($post) {
            if (is_array($post)) {
                $filepost = false;
                foreach ($post as $name => $value) {
                    if (substr($value, 0, 1) == '@' || class_exists('CURLFile') && $value instanceof CURLFile) {
                        $filepost = true;
                        break;
                    }
                }
                if (!$filepost) {
                    $post = http_build_query($post);
                }
            }
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }
        if (!empty($GLOBALS['_W']['config']['setting']['proxy'])) {
            $urls = parse_url($GLOBALS['_W']['config']['setting']['proxy']['host']);
            curl_setopt($ch, CURLOPT_PROXY, "{$urls['host']}:{$urls['port']}");
            $proxytype = 'CURLPROXY_' . strtoupper($urls['scheme']);
            if (!empty($urls['scheme']) && defined($proxytype)) {
                curl_setopt($ch, CURLOPT_PROXYTYPE, constant($proxytype));
            } else {
                curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
                curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
            }
            if (!empty($GLOBALS['_W']['config']['setting']['proxy']['auth'])) {
                curl_setopt($ch, CURLOPT_PROXYUSERPWD, $GLOBALS['_W']['config']['setting']['proxy']['auth']);
            }
        }
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSLVERSION, 1);
        if (defined('CURL_SSLVERSION_TLSv1')) {
            curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
        }
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1');
        if (!empty($extra) && is_array($extra)) {
            $headers = array();
            foreach ($extra as $opt => $value) {
                if (strexists($opt, 'CURLOPT_')) {
                    curl_setopt($ch, constant($opt), $value);
                } elseif (is_numeric($opt)) {
                    curl_setopt($ch, $opt, $value);
                } else {
                    $headers[] = "{$opt}: {$value}";
                }
            }
            if (!empty($headers)) {
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            }
        }
        $data = curl_exec($ch);
        $status = curl_getinfo($ch);
        $errno = curl_errno($ch);
        $error = curl_error($ch);
        curl_close($ch);
        if ($errno || empty($data)) {
            return error(1, $error);
        } else {
            return ihttp_response_parse($data);
        }
    }
    $method = empty($post) ? 'GET' : 'POST';
    $fdata = "{$method} {$urlset['path']}{$urlset['query']} HTTP/1.1\r\n";
    $fdata .= "Host: {$urlset['host']}\r\n";
    if (function_exists('gzdecode')) {
        $fdata .= "Accept-Encoding: gzip, deflate\r\n";
    }
    $fdata .= "Connection: close\r\n";
    if (!empty($extra) && is_array($extra)) {
        foreach ($extra as $opt => $value) {
            if (!strexists($opt, 'CURLOPT_')) {
                $fdata .= "{$opt}: {$value}\r\n";
            }
        }
    }
    $body = '';
    if ($post) {
        if (is_array($post)) {
            $body = http_build_query($post);
        } else {
            $body = urlencode($post);
        }
        $fdata .= 'Content-Length: ' . strlen($body) . "\r\n\r\n{$body}";
    } else {
        $fdata .= "\r\n";
    }
    if ($urlset['scheme'] == 'https') {
        $fp = fsockopen('ssl://' . $urlset['host'], $urlset['port'], $errno, $error);
    } else {
        $fp = fsockopen($urlset['host'], $urlset['port'], $errno, $error);
    }
    stream_set_blocking($fp, true);
    stream_set_timeout($fp, $timeout);
    if (!$fp) {
        return error(1, $error);
    } else {
        fwrite($fp, $fdata);
        $content = '';
        while (!feof($fp)) {
            $content .= fgets($fp, 512);
        }
        fclose($fp);
        return ihttp_response_parse($content, true);
    }
}
Ejemplo n.º 5
0
}
if ($do == 'list') {
    $_W['page']['title'] = '功能模块展示';
    load()->model('module');
    load()->model('extension');
    load()->model('cloud');
    load()->model('cache');
    load()->func('file');
    $modtypes = module_types();
    $modules = pdo_fetchall("SELECT * FROM " . tablename('modules') . ' ORDER BY `issystem` DESC, `mid` ASC', array(), 'mid');
    if (!empty($modules)) {
        foreach ($modules as $mid => $module) {
            $manifest = ext_module_manifest($module['name']);
            $modules[$mid]['official'] = empty($module['issystem']) && (strexists($module['author'], 'WeiZan Team') || strexists($module['author'], '微赞团队'));
            $modules[$mid]['description'] = strip_tags($module['description']);
            if (is_array($manifest) && ver_compare($module['version'], $manifest['application']['version']) == '-1') {
                $modules[$mid]['upgrade'] = true;
            }
            if (in_array($module['name'], $sysmodules)) {
                $modules[$mid]['imgsrc'] = '../framework/builtin/' . $module['name'] . '/icon-custom.jpg';
                if (!file_exists($modules[$mid]['imgsrc'])) {
                    $modules[$mid]['imgsrc'] = '../framework/builtin/' . $module['name'] . '/icon.jpg';
                }
            } else {
                $modules[$mid]['imgsrc'] = '../addons//' . $module['name'] . '/icon-custom.jpg';
                if (!file_exists($modules[$mid]['imgsrc'])) {
                    $modules[$mid]['imgsrc'] = '../addons/' . $module['name'] . '/icon.jpg';
                }
            }
        }
    }