Exemple #1
0
 public function getSystemInfo()
 {
     $answer = '';
     if (function_exists('curl_init')) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, 'http://service.impresspages.org');
         curl_setopt($ch, CURLOPT_POST, 1);
         $postFields = 'module_name=communication&module_group=service&action=getInfo&version=1&afterLogin='******'&systemVersion=' . \DbSystem::getSystemVariable('version');
         $groups = \Modules\developer\modules\Db::getGroups();
         foreach ($groups as $groupKey => $group) {
             $modules = \Modules\developer\modules\Db::getModules($group['id']);
             foreach ($modules as $moduleKey => $module) {
                 $postFields .= '&modules[' . $group['name'] . '][' . $module['name'] . ']=' . $module['version'];
             }
         }
         curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
         curl_setopt($ch, CURLOPT_REFERER, BASE_URL);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 1);
         $answer = curl_exec($ch);
         if (json_decode($answer) === null) {
             //json decode error
             return '';
         }
     }
     return $answer;
 }
 private function _checkCompatability($moduleGroup, $moduleName, $version)
 {
     $answer = '';
     if (function_exists('curl_init')) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, 'http://service.impresspages.org');
         curl_setopt($ch, CURLOPT_POST, 1);
         $postFields = 'module_name=communication&module_group=service&action=checkCompatability&newModuleGroup=' . $moduleGroup . '&newModuleName=' . $moduleName . '&newModuleVersion=' . $version . '&version=1';
         $postFields .= '&systemVersion=' . \DbSystem::getSystemVariable('version');
         $groups = \Modules\developer\modules\Db::getGroups();
         foreach ($groups as $groupKey => $group) {
             $modules = \Modules\developer\modules\Db::getModules($group['id']);
             foreach ($modules as $moduleKey => $module) {
                 $postFields .= '&modules[' . $group['name'] . '][' . $module['name'] . ']=' . $module['version'];
             }
         }
         curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
         curl_setopt($ch, CURLOPT_REFERER, BASE_URL);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, 1);
         $json = curl_exec($ch);
         if (json_decode($json) !== null) {
             //json decode succeded
             $array = json_decode($json, true);
             if ($array['status'] != 'success') {
                 $answer = $array['errorMessage'];
             }
         }
     }
     return $answer;
 }