当前位置: 首页>>代码示例>>PHP>>正文


PHP IPSSetUp::fetchXmlAppWriteableFiles方法代码示例

本文整理汇总了PHP中IPSSetUp::fetchXmlAppWriteableFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSSetUp::fetchXmlAppWriteableFiles方法的具体用法?PHP IPSSetUp::fetchXmlAppWriteableFiles怎么用?PHP IPSSetUp::fetchXmlAppWriteableFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPSSetUp的用法示例。


在下文中一共展示了IPSSetUp::fetchXmlAppWriteableFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: start

 /**
  * Begin installation
  *
  * @return	@e void
  */
 public function start()
 {
     /* INIT */
     $app_directory = IPSText::alphanumericalClean($this->request['app_directory']);
     $type = 'upgrade';
     $data = array();
     $ok = 1;
     $errors = array();
     $localfiles = array(DOC_IPS_ROOT_PATH . 'cache/skin_cache');
     $info = array();
     /* Init Data */
     $data = IPSSetUp::fetchXmlAppInformation($app_directory, $this->settings['gb_char_set']);
     $_numbers = IPSSetUp::fetchAppVersionNumbers($app_directory);
     $_files = IPSSetUp::fetchXmlAppWriteableFiles($app_directory);
     /* Grab Data */
     $data['app_directory'] = $app_directory;
     $data['current_version'] = $_numbers['current'][0] ? $_numbers['current'][0] : $this->lang->words['cur_version_none'];
     $data['latest_version'] = $_numbers['latest'][1];
     $data['next_version'] = $_numbers['next'][0];
     /* Install, or upgrade? */
     if (!$_numbers['current'][0]) {
         $type = 'install';
     } else {
         @header("Location: {$this->settings['board_url']}/" . CP_DIRECTORY . "/upgrade/");
         exit;
     }
     /* Version Check */
     if ($data['current_version'] > 0 and $data['current_version'] == $data['latest_version']) {
         $this->registry->output->global_message = $this->lang->words['error__up_to_date'];
         $this->registry->output->silentRedirectWithMessage($this->settings['base_url']);
         return;
     }
     /* Check local files */
     foreach ($localfiles as $_path) {
         if (!file_exists($_path)) {
             if ($data['dir']) {
                 if (!@mkdir($_path, IPS_FOLDER_PERMISSION, TRUE)) {
                     $info['notexist'][] = $_path;
                 }
             } else {
                 $info['notexist'][] = $_path;
             }
         } else {
             if (!is_writeable($_path)) {
                 if (!@chmod($_path, is_dir($_path) ? IPS_FOLDER_PERMISSION : IPS_FILE_PERMISSION)) {
                     $info['notwrite'][] = $_path;
                 }
             }
         }
     }
     /* Check files... */
     if (is_array($_files) and count($_files)) {
         $info = array_merge($info, $_files);
     }
     if (count($info['notexist'])) {
         foreach ($info['notexist'] as $path) {
             $errors[] = sprintf($this->lang->words['error__file_missing'], $path);
         }
     }
     if (count($info['notwrite'])) {
         foreach ($info['notwrite'] as $path) {
             $errors[] = sprintf($this->lang->words['error__file_chmod'], $path);
         }
     }
     /**
      * Custom errors
      */
     if (count($info['other'])) {
         foreach ($info['other'] as $error) {
             $errors[] = $error;
         }
     }
     /* Check for xml files */
     $required_xml = array("information");
     foreach ($required_xml as $r) {
         if (!is_file($this->app_full_path . "xml/{$r}.xml")) {
             $errors[] = sprintf($this->lang->words['error__file_needed'], $this->app_full_path . "xml/{$r}.xml");
         }
     }
     /* Show splash */
     $this->registry->output->html .= $this->html->setup_splash_screen($data, $errors, $type);
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:87,代码来源:setup.php

示例2: doExecute

 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Check input? */
     if ($this->request['do'] == 'check') {
         /* Check Directory */
         if (!is_array($_POST['apps']) or !count($_POST['apps'])) {
             $this->registry->output->addError('You must select to install at least one application');
         } else {
             /* Save Form Data */
             IPSSetUp::setSavedData('install_apps', implode(',', array_keys($_POST['apps'])));
             /* Check writeable files */
             foreach (array_keys($_POST['apps']) as $appDir) {
                 $info = IPSSetUp::fetchXmlAppWriteableFiles($appDir);
                 if (count($info['notexist'])) {
                     foreach ($info['notexist'] as $path) {
                         $this->registry->output->addWarning('File or directory does not exist: "' . $path . '", please create it via FTP');
                     }
                 }
                 if (count($info['notwrite'])) {
                     foreach ($info['notwrite'] as $path) {
                         $this->registry->output->addWarning('File or directory is not writeable: "' . $path . '", please CHMOD via FTP');
                     }
                 }
                 /**
                  * Custom errors
                  */
                 if (count($info['other'])) {
                     foreach ($info['other'] as $error) {
                         $this->registry->output->addWarning($error);
                     }
                 }
             }
             /* Do we have errors? */
             if (!count($this->registry->output->fetchWarnings())) {
                 /* Next Action */
                 $this->registry->autoLoadNextAction('address');
             }
         }
     }
     /* Generate apps... */
     $apps = array('core' => array(), 'ips' => array(), 'other' => array());
     foreach (array('applications', 'applications_addon/ips', 'applications_addon/other') as $_pBit) {
         $path = IPS_ROOT_PATH . $_pBit;
         $handle = opendir($path);
         while (($file = readdir($handle)) !== FALSE) {
             if (!preg_match("#^\\.#", $file)) {
                 if (is_dir($path . '/' . $file)) {
                     //-----------------------------------------
                     // Get it!
                     //-----------------------------------------
                     if (!is_file(IPS_ROOT_PATH . $_pBit . '/' . $file . '/xml/information.xml')) {
                         continue;
                     }
                     $data = IPSSetUp::fetchXmlAppInformation($file, $this->settings['gb_char_set']);
                     switch ($_pBit) {
                         case 'applications':
                             $apps['core'][$file] = $data;
                             break;
                         case 'applications_addon/ips':
                             $apps['ips'][$file] = $data;
                             break;
                         case 'applications_addon/other':
                             $apps['other'][$file] = $data;
                             break;
                     }
                 }
             }
         }
         closedir($handle);
     }
     /* We don't want IP.SEO to be installed on future versions. Bad things happen. */
     unset($apps['ips']['ipseo']);
     unset($apps['other']['ipseo']);
     /* Reorder the array so that core is first */
     $new_array = array();
     $new_array['core'] = $apps['core']['core'];
     foreach ($apps['core'] as $app => $data) {
         if ($app == 'core') {
             continue;
         }
         $new_array[$app] = $data;
     }
     $apps['core'] = $new_array;
     /* Page Output */
     $this->registry->output->setTitle("Applications");
     $this->registry->output->setNextAction('apps&do=check');
     $this->registry->output->addContent($this->registry->output->template()->page_apps($apps));
     $this->registry->output->sendOutput();
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:96,代码来源:apps.php


注:本文中的IPSSetUp::fetchXmlAppWriteableFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。