$ret = ext_module_manifest_compat($id);
         if (!empty($ret) && !empty($ret['convert'])) {
             $manifest = $ret['convert'];
             $version_error = true;
         }
     }
     if (is_array($manifest) && version_compare($module['version'], $manifest['application']['version']) == -1) {
         $module['upgrade'] = 1;
     }
     $isinstall = true;
     $from = 'installed';
 } else {
     require model('cloud');
     $define = cloud_m_info($id);
     if (!empty($define)) {
         $manifest = ext_module_manifest_parse($define);
         $from = 'cloud';
     }
     if (empty($manifest)) {
         $manifest = ext_module_manifest($id);
         if (!is_array($manifest) || empty($manifest)) {
             $ret = ext_module_manifest_compat($id);
             if (!empty($ret) && !empty($ret['convert'])) {
                 $manifest = $ret['convert'];
                 $version_error = true;
             }
         }
         $from = 'local';
     }
     if (is_array($manifest) && !empty($manifest)) {
         $module = ext_module_convert($manifest);
Esempio n. 2
0
function ext_module_manifest($modulename)
{
    $filename = IA_ROOT . '/addons/' . $modulename . '/manifest.xml';
    if (!file_exists($filename)) {
        return array();
    }
    $xml = file_get_contents($filename);
    return ext_module_manifest_parse($xml);
}
Esempio n. 3
0
 $info = cloud_m_upgradeinfo($id);
 if ($type == 'getinfo') {
     message($info, '', 'ajax');
 }
 if (!is_error($info)) {
     if (empty($_GPC['flag'])) {
         if (!empty($info['version']['upgradeprice'])) {
             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']);
function ext_module_manifest($modulename, $withRemote = false)
{
    if (!preg_match('/^[a-z\\d_]+$/', $modulename)) {
        return array();
    }
    if ($withRemote) {
        $manifest = cloud_m_manifest($modulename);
        if (!empty($manifest)) {
            return ext_module_manifest_parse($manifest);
        }
    }
    $filename = IA_ROOT . '/source/modules/' . $modulename . '/manifest.xml';
    if (!file_exists($filename)) {
        return array();
    }
    $xml = file_get_contents($filename);
    return ext_module_manifest_parse($xml);
}