36 if(!$ftp_info->ftp_root_path)
42 $this->ftp_set = TRUE;
48 Context::set(
'iCount', $oModel->getInstalledPackageCount());
92 $ret =
new stdClass();
93 foreach($targets as $target)
95 $ret->{$target} = $item->{$target}->body;
172 if(!is_array($items))
174 $items = array($items);
177 $item_list = array();
178 $targets = array(
'category_srl',
'package_srl',
'item_screenshot_url',
'package_voted',
'package_voter',
'package_description',
'package_downloaded',
'item_regdate',
'title',
'item_version',
'package_star',
'depfrom');
179 $targetpackages = array();
181 foreach($items as $item)
183 $targetpackages[$item->package_srl->body] = 0;
190 $packages = $oModel->getInstalledPackages(array_keys($targetpackages));
195 foreach($items as $item)
197 $v = $this->rearrange($item, $targets);
199 $v->category = $this->categories[$v->category_srl]->title;
202 if($packages[$v->package_srl])
204 $v->current_version = $packages[$v->package_srl]->current_version;
205 $v->need_update = $packages[$v->package_srl]->need_update;
206 $v->type = $oModel->getTypeFromPath($packages[$v->package_srl]->path);
208 if($this->ftp_set && $v->depfrom)
210 $depfrom = explode(
",", $v->depfrom);
211 foreach($depfrom as $package_srl)
213 $depto[$package_srl][] = $v->package_srl;
217 if($v->type ==
"core")
219 $v->avail_remove = FALSE;
221 else if($v->type ==
"module")
223 $v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path);
227 $v->avail_remove = TRUE;
230 $item_list[$v->package_srl] = $v;
233 if(count($depto) > 0)
235 $installed = $oModel->getInstalledPackages(implode(
",", array_keys($depto)));
236 foreach($installed as $key => $val)
239 $type = $oModel->getTypeFromPath($path);
241 if(!$type || $type ==
"core")
246 $config_file = $oModel->getConfigFilePath($type);
259 if($type ==
"drcomponent")
263 if($type ==
"style" || $type ==
"m.skin")
267 if($type ==
"m.layout")
271 $title = $xmlDoc->{$type}->title->body;
272 $installed[$key]->title = $title;
277 $oSecurity->encodeHTML(
'installed..');
279 foreach($installed as $key => $val)
281 foreach($depto[$key] as $package_srl)
283 $item_list[$package_srl]->avail_remove =
false;
284 $item_list[$package_srl]->deps[] = $key;
307 $output = $oModel->getInstalledPackageList($page);
310 $params[
"act"] =
"getResourceapiPackages";
311 $params[
"package_srls"] = implode(
",", array_keys($package_list));
315 $xmlDoc = $xml_lUpdate->parse($buff);
316 if($xmlDoc && $xmlDoc->response->packagelist->item)
318 $item_list = $this->rearranges($xmlDoc->response->packagelist->item, $package_list);
320 foreach($package_list as $package_srl => $package)
322 if($item_list[$package_srl])
324 $res[] = $item_list[$package_srl];
330 if(count($package_list) != count($res))
332 $localPackageSrls = array_keys($package_list);
333 $remotePackageSrls = array_keys($item_list);
334 $targetPackageSrls = array_diff($localPackageSrls, $remotePackageSrls);
335 $countDiff = count($targetPackageSrls);
336 $output->page_navigation->total_count -= $countDiff;
341 $this->setTemplateFile(
'index');
344 $security->encodeHTML(
'item_list..');
357 return $this->dispAutoinstallAdminIndex();
361 $package = $oAdminModel->getInstallInfo($package_srl);
366 if(!$_SESSION[
'ftp_password'])
371 $output = $oAdminModel->checkUseDirectModuleInstall($package);
378 $this->setTemplateFile(
'install');
381 $security->encodeHTML(
'package.',
'package.depends..');
394 if(!$ftp_info->ftp_root_path)
399 $this->setTemplateFile(
'index');
402 $params[
"act"] =
"getResourceapiLastupdate";
406 $lUpdateDoc = $xml_lUpdate->parse($buff);
407 $updateDate = $lUpdateDoc->response->updatedate->body;
411 return $this->stop(
'msg_connection_fail');
415 $item = $oModel->getLatestPackage();
416 if(!$item || $item->updatedate < $updateDate || count($this->categories) < 1)
419 $oController->_updateinfo();
421 if(!$_SESSION[
'__XE_EASYINSTALL_REDIRECT__'])
423 header(
'location: ' .
getNotEncodedUrl(
'',
'module',
'admin',
'act',
'dispAutoinstallAdminIndex'));
424 $_SESSION[
'__XE_EASYINSTALL_REDIRECT__'] = TRUE;
428 unset($_SESSION[
'__XE_EASYINSTALL_REDIRECT__']);
438 if(!in_array($order_type, array(
'asc',
'desc')))
440 $order_type =
'desc';
445 if(!in_array($order_target, array(
'newest',
'download',
'popular')))
447 $order_target =
'newest';
457 $params[
"category_srl"] = $childrenList;
459 else if($category_srl)
461 $params[
"category_srl"] = $category_srl;
464 $params[
"act"] =
"getResourceapiPackagelist";
465 $params[
"order_target"] = $order_target;
466 $params[
"order_type"] = $order_type;
467 $params[
"page"] = $page;
470 $params[
"search_keyword"] = $search_keyword;
473 if($xmlDoc && $xmlDoc->response->packagelist->item)
475 $item_list = $this->rearranges($xmlDoc->response->packagelist->item);
477 $array = array(
'total_count',
'total_page',
'cur_page',
'page_count',
'first_page',
'last_page');
478 $page_nav = $this->rearrange($xmlDoc->response->page_navigation, $array);
479 $page_navigation =
new PageHandler($page_nav->total_count, $page_nav->total_page, $page_nav->cur_page, 5);
484 $security->encodeHTML(
'package.',
'package.depends..',
'item_list..');
485 $security->encodeHTML(
'search_target',
'search_keyword',
'order_target',
'order_type');
496 $this->categories = $oModel->getCategoryList();
510 return $this->dispAutoinstallAdminIndex();
515 $installedPackage = $oModel->getInstalledPackage($package_srl);
516 if(!$installedPackage)
518 return $this->dispAutoinstallAdminInstalledPackages();
521 if(!$_SESSION[
'ftp_password'])
526 $installedPackage = $oModel->getPackage($package_srl);
527 $path = $installedPackage->path;
528 $type = $oModel->getTypeFromPath($path);
530 if(!$type || $type ==
"core")
532 return $this->stop(
"msg_invalid_request");
535 $config_file = $oModel->getConfigFilePath($type);
538 return $this->stop(
"msg_invalid_request");
541 $output = $oAdminModel->checkUseDirectModuleInstall($installedPackage);
548 $params[
"act"] =
"getResourceapiPackages";
549 $params[
"package_srls"] = $package_srl;
553 $xmlDoc = $xml_lUpdate->parse($buff);
554 if($xmlDoc && $xmlDoc->response->packagelist->item)
556 $item_list = $this->rearranges($xmlDoc->response->packagelist->item);
557 $installedPackage->title = $item_list[$package_srl]->title;
558 $installedPackage->type = $item_list[$package_srl]->category;
559 $installedPackage->avail_remove = $item_list[$package_srl]->avail_remove;
560 $installedPackage->deps = $item_list[$package_srl]->deps;
562 $this->setTemplateFile(
'uninstall');
566 $security->encodeHTML(
'package.');
568 $this->setTemplateFile(
'uninstall');
572 return $this->stop(
'msg_connection_fail');
dispAutoinstallAdminUninstall()
$template_path
a path of directory where template files reside
set($key, $val, $set_to_get_vars=0)
rearrange(&$item, &$targets)
getRemoteResource($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
dispAutoinstallAdminInstalledPackages()
const _XE_DOWNLOAD_SERVER_
getAdminModel($module_name)
dispAutoinstallAdminInstall()
rearranges($items, $packages=null)
getAdminController($module_name)
addJsFilter($path, $filename)
dispAutoinstallAdminIndex()