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


PHP FileHandler::getRealPath方法代码示例

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


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

示例1: dispInstallIntroduce

 /**
  * @brief Display license messages
  */
 function dispInstallIntroduce()
 {
     $install_config_file = FileHandler::getRealPath('./config/install.config.php');
     if (file_exists($install_config_file)) {
         include $install_config_file;
         if (is_array($install_config)) {
             foreach ($install_config as $k => $v) {
                 $v = $k == 'db_table_prefix' ? $v . '_' : $v;
                 Context::set($k, $v, true);
             }
             unset($GLOBALS['__DB__']);
             Context::set('install_config', true, true);
             $oInstallController = getController('install');
             $output = $oInstallController->procInstall();
             if (!$output->toBool()) {
                 return $output;
             }
             header("location: ./");
             Context::close();
             exit;
         }
     }
     Context::set('l', Context::getLangType());
     $this->setTemplateFile('introduce');
 }
开发者ID:Gunmania,项目名称:xe-core,代码行数:28,代码来源:install.view.php

示例2: dispNcenterliteAdminConfig

 function dispNcenterliteAdminConfig()
 {
     $oModuleModel = getModel('module');
     $oNcenterliteModel = getModel('ncenterlite');
     $oLayoutModel = getModel('layout');
     $config = $oNcenterliteModel->getConfig();
     Context::set('config', $config);
     $layout_list = $oLayoutModel->getLayoutList();
     Context::set('layout_list', $layout_list);
     $mobile_layout_list = $oLayoutModel->getLayoutList(0, 'M');
     Context::set('mlayout_list', $mobile_layout_list);
     $skin_list = $oModuleModel->getSkins($this->module_path);
     Context::set('skin_list', $skin_list);
     $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
     Context::set('mskin_list', $mskin_list);
     if (!$skin_list[$config->skin]) {
         $config->skin = 'default';
     }
     Context::set('colorset_list', $skin_list[$config->skin]->colorset);
     if (!$mskin_list[$config->mskin]) {
         $config->mskin = 'default';
     }
     Context::set('mcolorset_list', $mskin_list[$config->mskin]->colorset);
     $security = new Security();
     $security->encodeHTML('config..');
     $security->encodeHTML('skin_list..title');
     $security->encodeHTML('colorset_list..name', 'colorset_list..title');
     $mid_list = $oModuleModel->getMidList(null, array('module_srl', 'mid', 'browser_title', 'module'));
     Context::set('mid_list', $mid_list);
     // 사용환경정보 전송 확인
     $ncenterlite_module_info = $oModuleModel->getModuleInfoXml('ncenterlite');
     $agreement_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite-', $ncenterlite_module_info->version));
     $agreement_ver_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/ncenterlite/ncenterlite_ver-', $ncenterlite_module_info->version));
     if (file_exists($agreement_file)) {
         $agreement = FileHandler::readFile($agreement_file);
         Context::set('_ncenterlite_env_agreement', $agreement);
         $agreement_ver = FileHandler::readFile($agreement_ver_file);
         if ($agreement == 'Y') {
             $_ncenterlite_iframe_url = 'http://sosifam.com/index.php?mid=ncenterlite_iframe';
             if (!$agreement_ver) {
                 $_host_info = urlencode($_SERVER['HTTP_HOST']) . '-NC' . $ncenterlite_module_info->version . '-PHP' . phpversion() . '-XE' . __XE_VERSION__;
             }
             Context::set('_ncenterlite_iframe_url', $_ncenterlite_iframe_url . '&_host=' . $_host_info);
             Context::set('ncenterlite_module_info', $ncenterlite_module_info);
         }
         FileHandler::writeFile($agreement_ver_file, 'Y');
     } else {
         Context::set('_ncenterlite_env_agreement', 'NULL');
     }
 }
开发者ID:leehankyeol,项目名称:JaWeTip,代码行数:50,代码来源:ncenterlite.admin.view.php

示例3: procImporterAdminCheckXmlFile

 /**
  * Check whether the passing filename exists or not. Detect the file type, too.
  * @return void
  */
 function procImporterAdminCheckXmlFile()
 {
     global $lang;
     $filename = Context::get('filename');
     $isExists = 'false';
     if (strncasecmp('http://', $filename, 7) === 0) {
         if (ini_get('allow_url_fopen')) {
             $fp = @fopen($filename, "r");
             if ($fp) {
                 $str = fgets($fp, 100);
                 if (strlen($str) > 0) {
                     $isExists = 'true';
                     $type = 'XML';
                     if (stristr($str, 'tattertools')) {
                         $type = 'TTXML';
                     }
                     $this->add('type', $type);
                 }
                 fclose($fp);
                 $resultMessage = $lang->found_xml_file;
             } else {
                 $resultMessage = $lang->cannot_url_file;
             }
         } else {
             $resultMessage = $lang->cannot_allow_fopen_in_phpini;
         }
         $this->add('exists', $isExists);
     } else {
         $realPath = FileHandler::getRealPath($filename);
         if (file_exists($realPath) && is_file($realPath)) {
             $isExists = 'true';
         }
         $this->add('exists', $isExists);
         if ($isExists == 'true') {
             $type = 'XML';
             $fp = fopen($realPath, "r");
             $str = fgets($fp, 100);
             if (stristr($str, 'tattertools')) {
                 $type = 'TTXML';
             }
             fclose($fp);
             $this->add('type', $type);
             $resultMessage = $lang->found_xml_file;
         } else {
             $resultMessage = $lang->not_found_xml_file;
         }
     }
     $this->add('result_message', $resultMessage);
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:53,代码来源:importer.admin.controller.php

示例4: dispInstallIntroduce

 /**
  * @brief Display license messages
  */
 function dispInstallIntroduce()
 {
     $install_config_file = FileHandler::getRealPath('./config/install.config.php');
     if (file_exists($install_config_file)) {
         /**
         * If './config/install.config.php' file created  and write array shown in the example below, XE installed using config file.
         * ex )
          $install_config = array(
          'db_type' =>'mysqli_innodb',
          'db_port' =>'3306',
          'db_hostname' =>'localhost',
          'db_userid' =>'root',
          'db_password' =>'root',
          'db_database' =>'rx_database',
          'db_table_prefix' =>'rx',
          'user_rewrite' =>'N',
          'time_zone' =>'0000',
          'email_address' =>'admin@admin.net',
          'password' =>'pass',
          'password2' =>'pass',
          'nick_name' =>'admin',
          'user_id' =>'admin',
          'lang_type' =>'ko',	// en, jp, ...
          );
         */
         include $install_config_file;
         if (is_array($install_config)) {
             foreach ($install_config as $k => $v) {
                 $v = $k == 'db_table_prefix' ? $v . '_' : $v;
                 Context::set($k, $v, true);
             }
             unset($GLOBALS['__DB__']);
             Context::set('install_config', true, true);
             $oInstallController = getController('install');
             $output = $oInstallController->procInstall();
             if (!$output->toBool()) {
                 return $output;
             }
             header("location: ./");
             Context::close();
             exit;
         }
     }
     Context::set('l', Context::getLangType());
     return $this->dispInstallLicenseAgreement();
     //$this->setTemplateFile('introduce');
 }
开发者ID:conory,项目名称:rhymix,代码行数:50,代码来源:install.view.php

示例5: checkAdminMenu

 public function checkAdminMenu()
 {
     // for admin menu
     if (Context::isInstalled()) {
         $oMenuAdminModel = getAdminModel('menu');
         $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName);
         if (!$output->menu_srl) {
             $this->createXeAdminMenu();
             $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName);
         } else {
             if (!is_readable(FileHandler::getRealPath($output->php_file))) {
                 $oMenuAdminController = getAdminController('menu');
                 $oMenuAdminController->makeXmlFile($output->menu_srl);
             }
             Context::set('admin_menu_srl', $output->menu_srl);
         }
         $this->_oldAdminmenuDelete();
         $returnObj = new stdClass();
         $returnObj->menu_srl = $output->menu_srl;
         $returnObj->php_file = FileHandler::getRealPath($output->php_file);
         return $returnObj;
     }
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:23,代码来源:admin.class.php

示例6: getAdminFTPPath

 /**
  * Find XE installed path on ftp
  */
 function getAdminFTPPath()
 {
     Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
     @set_time_limit(5);
     $ftp_info = Context::getRequestVars();
     if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
         return new Object(1, 'msg_ftp_invalid_auth_info');
     }
     if (!$ftp_info->ftp_host) {
         $ftp_info->ftp_host = '127.0.0.1';
     }
     if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) {
         $ftp_info->ftp_port = '21';
     }
     if ($ftp_info->sftp == 'Y') {
         if (!function_exists('ssh2_sftp')) {
             return new Object(-1, 'disable_sftp_support');
         }
         return $this->getSFTPPath();
     }
     if ($ftp_info->ftp_pasv == 'N') {
         if (function_exists('ftp_connect')) {
             return $this->getFTPPath();
         }
         $ftp_info->ftp_pasv = "Y";
     }
     $oFTP = new ftp();
     if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
         return new Object(1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
     }
     if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
         return new Object(1, 'msg_ftp_invalid_auth_info');
     }
     // create temp file
     $pin = $_SERVER['REQUEST_TIME'];
     FileHandler::writeFile('./files/cache/ftp_check', $pin);
     // create path candidate
     $xe_path = _XE_PATH_;
     $path_info = array_reverse(explode('/', _XE_PATH_));
     array_pop($path_info);
     // remove last '/'
     $path_candidate = array();
     $temp = '';
     foreach ($path_info as $path) {
         $temp = '/' . $path . $temp;
         $path_candidate[] = $temp;
     }
     // try
     foreach ($path_candidate as $path) {
         // upload check file
         if (!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) {
             continue;
         }
         // get check file
         $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
         // delete temp check file
         $oFTP->ftp_delete($path . 'ftp_check.html');
         // found
         if ($result == $pin) {
             $found_path = $path;
             break;
         }
     }
     FileHandler::removeFile('./files/cache/ftp_check', $pin);
     if ($found_path) {
         $this->add('found_path', $found_path);
     }
 }
开发者ID:conory,项目名称:rhymix,代码行数:71,代码来源:admin.admin.model.php

示例7: dispAttendanceAdminList

 function dispAttendanceAdminList()
 {
     /*attendance model 객체 생성*/
     $oAttendanceModel = getModel('attendance');
     Context::set('Model', $oAttendanceModel);
     $selected_date = Context::get('selected_date');
     //선택한 날짜 받아오기
     $type = Context::get('type');
     /*attendance admin model 객체 생성*/
     $oAttendanceAdminModel = getAdminModel('attendance');
     Context::set('oAttendanceAdminModel', $oAttendanceAdminModel);
     if ($type != 'config' && $type != 'time') {
         $user_data = $oAttendanceAdminModel->getAttendanceMemberList(20, $type);
         Context::set('user_data', $user_data);
     }
     // 멤버모델 객체 생성
     $oMemberModel = getModel('member');
     $group_list = $oMemberModel->getGroups();
     Context::set('group_list', $group_list);
     /*날짜 관련*/
     if (!$selected_date) {
         $selected_date = zDate(date('YmdHis'), "Ymd");
     }
     $year = substr($selected_date, 0, 4);
     $month = substr($selected_date, 4, 2);
     $day = substr($selected_date, 6, 2);
     $end_day = date('t', mktime(0, 0, 0, $month, 1, $year));
     $oMemberModel = getModel('member');
     Context::set('end_day', $end_day);
     Context::set('year', $year);
     Context::set('selected', $selected_date);
     Context::set('month', $month);
     Context::set('day', $day);
     Context::set('ipaddress', $_SERVER['REMOTE_ADDR']);
     Context::set('oMemberModel', $oMemberModel);
     //module의 설정값 가져오기
     $oModuleModel = getModel('module');
     $config = $oModuleModel->getModuleConfig('attendance');
     $oModuleAdminModel = getAdminModel('module');
     Context::set('config', $config);
     $start_time = new stdClass();
     $start_time->hour = substr($config->start_time, 0, 2);
     $start_time->min = substr($config->start_time, 2, 2);
     $end_time = new stdClass();
     $end_time->hour = substr($config->end_time, 0, 2);
     $end_time->min = substr($config->end_time, 2, 2);
     Context::set('start_time', $start_time);
     Context::set('end_time', $end_time);
     // 스킨 목록을 구해옴
     $oModuleModel = getModel('module');
     $module_info = $oModuleModel->getModuleInfoByMid('attendance');
     $skin_list = $oModuleModel->getSkins($this->module_path);
     Context::set('skin_list', $skin_list);
     $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
     Context::set('mskin_list', $mskin_list);
     // 레이아웃 목록을 구해옴
     $oLayoutModel = getModel('layout');
     $layout_list = $oLayoutModel->getLayoutList();
     Context::set('layout_list', $layout_list);
     $mobile_layout_list = $oLayoutModel->getLayoutList(0, "M");
     Context::set('mlayout_list', $mobile_layout_list);
     // 모듈 카테고리 목록을 구함
     $module_category = $oModuleModel->getModuleCategories();
     Context::set('module_category', $module_category);
     // 공통 모듈 권한 설정 페이지 호출
     $skin_content = $oModuleAdminModel->getModuleSkinHTML($module_info->module_srl);
     Context::set('skin_content', $skin_content);
     Context::set('module_info', $module_info);
     Context::set('module_srl', $module_info->module_srl);
     // 사용환경정보 전송 확인
     $attendance_module_info = $oModuleModel->getModuleInfoXml('attendance');
     $agreement_file = FileHandler::getRealPath(sprintf('%s%s.txt', './files/cache/attendance/attendance-', $attendance_module_info->version));
     if (file_exists($agreement_file)) {
         $agreement = FileHandler::readFile($agreement_file);
         Context::set('_attendance_env_agreement', $agreement);
         if ($agreement == 'Y') {
             $_attendance_iframe_url = 'http://sosifam.com/index.php?mid=attendance_iframe';
             $_host_info = urlencode($_SERVER['HTTP_HOST']) . '-NC' . $attendance_module_info->version . '-PHP' . phpversion() . '-XE' . __XE_VERSION__;
             Context::set('_attendance_iframe_url', $_attendance_iframe_url . '&_host=' . $_host_info);
             Context::set('attendance_module_info', $attendance_module_info);
         }
     } else {
         Context::set('_attendance_env_agreement', 'NULL');
     }
     /*템플릿 설정*/
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile('index');
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:88,代码来源:attendance.admin.view.php

示例8: executeFile

 /**
  * @brief Create a cache file in order to include if it is an internal file
  */
 function executeFile($target_file, $caching_interval, $cache_file)
 {
     // Cancel if the file doesn't exist
     if (!file_exists(FileHandler::getRealPath($target_file))) {
         return;
     }
     // Get a path and filename
     $tmp_path = explode('/', $cache_file);
     $filename = $tmp_path[count($tmp_path) - 1];
     $filepath = preg_replace('/' . $filename . "\$/i", "", $cache_file);
     $cache_file = FileHandler::getRealPath($cache_file);
     // Verify cache
     if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file)) {
         if (file_exists($cache_file)) {
             FileHandler::removeFile($cache_file);
         }
         // Read a target file and get content
         ob_start();
         include FileHandler::getRealPath($target_file);
         $content = ob_get_clean();
         // Replace relative path to the absolute path
         $this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/';
         $content = preg_replace_callback('/(target=|src=|href=|url\\()("|\')?([^"\'\\)]+)("|\'\\))?/is', array($this, '_replacePath'), $content);
         $content = preg_replace_callback('/(<!--%import\\()(\\")([^"]+)(\\")/is', array($this, '_replacePath'), $content);
         FileHandler::writeFile($cache_file, $content);
         // Include and then Return the result
         if (!file_exists($cache_file)) {
             return;
         }
         // Attempt to compile
         $oTemplate =& TemplateHandler::getInstance();
         $script = $oTemplate->compileDirect($filepath, $filename);
         FileHandler::writeFile($cache_file, $script);
     }
     $__Context =& $GLOBALS['__Context__'];
     $__Context->tpl_path = $filepath;
     ob_start();
     include $cache_file;
     $content = ob_get_clean();
     return $content;
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:44,代码来源:page.view.php

示例9: getMicroTime

 /**
  * It creates a module instance
  * @param string $module module name
  * @param string $type instance type, (e.g., view, controller, model)
  * @param string $kind admin or svc
  * @return ModuleObject module instance (if failed it returns null)
  * @remarks if there exists a module instance created before, returns it.
  **/
 function &getModuleInstance($module, $type = 'view', $kind = '')
 {
     if (__DEBUG__ == 3) {
         $start_time = getMicroTime();
     }
     $kind = strtolower($kind);
     $type = strtolower($type);
     $kinds = array('svc' => 1, 'admin' => 1);
     if (!isset($kinds[$kind])) {
         $kind = 'svc';
     }
     $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
     if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) {
         $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
     }
     // if there is no instance of the module in global variable, create a new one
     if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) {
         $parent_module = $module;
         $class_path = ModuleHandler::getModulePath($module);
         if (!is_dir(FileHandler::getRealPath($class_path))) {
             return NULL;
         }
         // Get base class name and load the file contains it
         if (!class_exists($module)) {
             $high_class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module);
             if (!file_exists($high_class_file)) {
                 return NULL;
             }
             require_once $high_class_file;
         }
         // Get the object's name
         $types = explode(' ', 'view controller model api wap mobile class');
         if (!in_array($type, $types)) {
             $type = $types[0];
         }
         if ($type == 'class') {
             $instance_name = '%s';
             $class_file = '%s%s.%s.php';
         } elseif ($kind == 'admin' && array_search($type, $types) < 3) {
             $instance_name = '%sAdmin%s';
             $class_file = '%s%s.admin.%s.php';
         } else {
             $instance_name = '%s%s';
             $class_file = '%s%s.%s.php';
         }
         $instance_name = sprintf($instance_name, $module, ucfirst($type));
         $class_file = sprintf($class_file, $class_path, $module, $type);
         $class_file = FileHandler::getRealPath($class_file);
         // Get the name of the class file
         if (!is_readable($class_file)) {
             return NULL;
         }
         // Create an instance with eval function
         require_once $class_file;
         if (!class_exists($instance_name)) {
             return NULL;
         }
         $tmp_fn = create_function('', "return new {$instance_name}();");
         $oModule = $tmp_fn();
         if (!is_object($oModule)) {
             return NULL;
         }
         // Load language files for the class
         Context::loadLang($class_path . 'lang');
         if ($extend_module) {
             Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
         }
         // Set variables to the instance
         $oModule->setModule($module);
         $oModule->setModulePath($class_path);
         // If the module has a constructor, run it.
         if (!isset($GLOBALS['_called_constructor'][$instance_name])) {
             $GLOBALS['_called_constructor'][$instance_name] = true;
             if (@method_exists($oModule, $instance_name)) {
                 $oModule->{$instance_name}();
             }
         }
         // Store the created instance into GLOBALS variable
         $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
     }
     if (__DEBUG__ == 3) {
         $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
     }
     // return the instance
     return $GLOBALS['_loaded_module'][$module][$type][$kind];
 }
开发者ID:relip,项目名称:xe-core,代码行数:94,代码来源:ModuleHandler.class.php

示例10: _getModuleFilePath

 function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName)
 {
     $classPath = ModuleHandler::getModulePath($module);
     $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
     $highClassFile = FileHandler::getRealPath($highClassFile);
     $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
     if (!in_array($type, $types)) {
         $type = $types[0];
     }
     if ($type == 'class') {
         $instanceName = '%s';
         $classFile = '%s%s.%s.php';
     } elseif ($kind == 'admin' && array_search($type, $types) < 3) {
         $instanceName = '%sAdmin%s';
         $classFile = '%s%s.admin.%s.php';
     } else {
         $instanceName = '%s%s';
         $classFile = '%s%s.%s.php';
     }
     $instanceName = sprintf($instanceName, $module, ucfirst($type));
     $classFile = FileHandler::getRealPath(sprintf($classFile, $classPath, $module, $type));
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:22,代码来源:ModuleHandler.class.php

示例11: makeCategoryFile

 /**
  * Save the category in a cache file
  * @param int $module_srl
  * @return string
  */
 function makeCategoryFile($module_srl)
 {
     // Return if there is no information you need for creating a cache file
     if (!$module_srl) {
         return false;
     }
     // Get module information (to obtain mid)
     $oModuleModel = getModel('module');
     $columnList = array('module_srl', 'mid', 'site_srl');
     $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
     $mid = $module_info->mid;
     if (!is_dir('./files/cache/document_category')) {
         FileHandler::makeDir('./files/cache/document_category');
     }
     // Cache file's name
     $xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl);
     $php_file = sprintf("./files/cache/document_category/%s.php", $module_srl);
     // Get a category list
     $args = new stdClass();
     $args->module_srl = $module_srl;
     $args->sort_index = 'list_order';
     $output = executeQueryArray('document.getCategoryList', $args);
     $category_list = $output->data;
     if (!is_array($category_list)) {
         $category_list = array($category_list);
     }
     $category_count = count($category_list);
     for ($i = 0; $i < $category_count; $i++) {
         $category_srl = $category_list[$i]->category_srl;
         if (!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) {
             $category_list[$i]->group_srls = '';
         }
         $list[$category_srl] = $category_list[$i];
     }
     // Create the xml file without node data if no data is obtained
     if (!$list) {
         $xml_buff = "<root />";
         FileHandler::writeFile($xml_file, $xml_buff);
         FileHandler::writeFile($php_file, '<?php if(!defined("__XE__")) exit(); ?>');
         return $xml_file;
     }
     // Change to an array if only a single data is obtained
     if (!is_array($list)) {
         $list = array($list);
     }
     // Create a tree for loop
     foreach ($list as $category_srl => $node) {
         $node->mid = $mid;
         $parent_srl = (int) $node->parent_srl;
         $tree[$parent_srl][$category_srl] = $node;
     }
     // A common header to set permissions and groups of the cache file
     $header_script = '$lang_type = Context::getLangType(); ' . '$is_logged = Context::get(\'is_logged\'); ' . '$logged_info = Context::get(\'logged_info\'); ' . 'if($is_logged) {' . 'if($logged_info->is_admin=="Y") $is_admin = true; ' . 'else $is_admin = false; ' . '$group_srls = array_keys($logged_info->group_list); ' . '} else { ' . '$is_admin = false; ' . '$group_srsl = array(); ' . '} ' . "\n";
     // Create the xml cache file (a separate session is needed for xml cache)
     $xml_header_buff = '';
     $xml_body_buff = $this->getXmlTree($tree[0], $tree, $module_info->site_srl, $xml_header_buff);
     $xml_buff = sprintf('<?php ' . 'define(\'__XE__\', true); ' . 'require_once(\'' . FileHandler::getRealPath('./config/config.inc.php') . '\'); ' . '$oContext = &Context::getInstance(); ' . '$oContext->init(); ' . 'header("Content-Type: text/xml; charset=UTF-8"); ' . 'header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); ' . 'header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); ' . 'header("Cache-Control: no-store, no-cache, must-revalidate"); ' . 'header("Cache-Control: post-check=0, pre-check=0", false); ' . 'header("Pragma: no-cache"); ' . '%s' . '%s ' . '$oContext->close();' . '?>' . '<root>%s</root>', $header_script, $xml_header_buff, $xml_body_buff);
     // Create php cache file
     $php_header_buff = '$_titles = array();';
     $php_header_buff .= '$_descriptions = array();';
     $php_output = $this->getPhpCacheCode($tree[0], $tree, $module_info->site_srl, $php_header_buff);
     $php_buff = sprintf('<?php ' . 'if(!defined("__XE__")) exit(); ' . '%s' . '%s' . '$menu = new stdClass;' . '$menu->list = array(%s); ', $header_script, $php_header_buff, $php_output['buff']);
     // Save File
     FileHandler::writeFile($xml_file, $xml_buff);
     FileHandler::writeFile($php_file, $php_buff);
     return $xml_file;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:72,代码来源:document.controller.php

示例12: getFileInfo

 /**
  * Get file information
  *
  * @param string $fileName The file name
  * @param string $targetIe Target IE of file
  * @param string $media Media of file
  * @param bool $forceMinify Whether this file should be minified
  * @return stdClass The file information
  */
 private function getFileInfo($fileName, $targetIe = '', $media = 'all', $forceMinify = false)
 {
     static $existsInfo = array();
     if (self::$minify === null) {
         self::$minify = Context::getDBInfo()->minify_scripts ?: 'common';
     }
     if (isset($existsInfo[$existsKey])) {
         return $existsInfo[$existsKey];
     }
     $pathInfo = pathinfo($fileName);
     $file = new stdClass();
     $file->fileName = $pathInfo['basename'];
     $file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
     $file->fileRealPath = FileHandler::getRealPath($pathInfo['dirname']);
     $file->fileExtension = strtolower($pathInfo['extension']);
     if (preg_match('/^(.+)\\.min$/', $pathInfo['filename'], $matches)) {
         $file->fileNameNoExt = $matches[1];
         $file->isMinified = true;
     } else {
         $file->fileNameNoExt = $pathInfo['filename'];
         $file->isMinified = false;
     }
     $file->isExternalURL = preg_match('@^(https?:)?//@i', $file->filePath) ? true : false;
     $file->isCachedScript = !$file->isExternalURL && strpos($file->filePath, 'files/cache/') !== false;
     $file->keyName = $file->fileNameNoExt . '.' . $file->fileExtension;
     $file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);
     $originalFilePath = $file->fileRealPath . '/' . $pathInfo['basename'];
     // Fix incorrectly minified URL
     if ($file->isMinified && !$file->isExternalURL && (!file_exists($originalFilePath) || is_link($originalFilePath) || filesize($originalFilePath) < 32 && trim(file_get_contents($originalFilePath)) === $file->keyName)) {
         if (file_exists($file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension)) {
             $file->fileName = $file->fileNameNoExt . '.' . $file->fileExtension;
             $file->isMinified = false;
             $originalFilePath = $file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension;
         }
     }
     // Decide whether to minify this file
     if (self::$minify === 'all') {
         $minify_enabled = true;
     } elseif (self::$minify === 'none') {
         $minify_enabled = false;
     } else {
         $minify_enabled = $forceMinify;
     }
     // Minify file
     if ($minify_enabled && !$file->isMinified && !$file->isExternalURL && !$file->isCachedScript && strpos($file->filePath, 'common/js/plugins') === false) {
         if (($file->fileExtension === 'css' || $file->fileExtension === 'js') && file_exists($originalFilePath)) {
             $minifiedFileName = $file->fileNameNoExt . '.min.' . $file->fileExtension;
             $minifiedFileHash = ltrim(str_replace(array('/', '\\'), '.', $pathInfo['dirname']), '.');
             $minifiedFilePath = _XE_PATH_ . 'files/cache/minify/' . $minifiedFileHash . '.' . $minifiedFileName;
             if (!file_exists($minifiedFilePath) || filemtime($minifiedFilePath) < filemtime($originalFilePath)) {
                 if ($file->fileExtension === 'css') {
                     $minifier = new MatthiasMullie\Minify\CSS($originalFilePath);
                     $content = $minifier->execute($minifiedFilePath);
                 } else {
                     $minifier = new MatthiasMullie\Minify\JS($originalFilePath);
                     $content = $minifier->execute($minifiedFilePath);
                 }
                 FileHandler::writeFile($minifiedFilePath, $content);
             }
             $file->fileName = $minifiedFileHash . '.' . $minifiedFileName;
             $file->filePath = $this->_getAbsFileUrl('./files/cache/minify');
             $file->fileRealPath = _XE_PATH_ . 'files/cache/minify';
             $file->keyName = $minifiedFileHash . '.' . $file->fileNameNoExt . '.' . $file->fileExtension;
             $file->cdnPath = $this->_normalizeFilePath('./files/cache/minify');
             $file->isMinified = true;
         }
     }
     // Process targetIe and media attributes
     $file->targetIe = $targetIe;
     if ($file->fileExtension == 'css') {
         $file->media = $media;
         if (!$file->media) {
             $file->media = 'all';
         }
         $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media;
     } else {
         if ($file->fileExtension == 'js') {
             $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe;
         }
     }
     return $file;
 }
开发者ID:conory,项目名称:rhymix,代码行数:91,代码来源:FrontEndFileHandler.class.php

示例13: procInstall

 /**
  * @brief Install with received information
  */
 function procInstall()
 {
     // Check if it is already installed
     if (Context::isInstalled()) {
         return new Object(-1, 'msg_already_installed');
     }
     // Assign a temporary administrator when installing
     $logged_info = new stdClass();
     $logged_info->is_admin = 'Y';
     Context::set('logged_info', $logged_info);
     // check install config
     if (Context::get('install_config')) {
         $db_info = $this->_makeDbInfoByInstallConfig();
     } else {
         if (FileHandler::exists($this->db_tmp_config_file)) {
             include $this->db_tmp_config_file;
         }
         if (FileHandler::exists($this->etc_tmp_config_file)) {
             include $this->etc_tmp_config_file;
         }
     }
     // Set DB type and information
     Context::setDBInfo($db_info);
     // Create DB Instance
     $oDB =& DB::getInstance();
     // Check if available to connect to the DB
     if (!$oDB->isConnected()) {
         return $oDB->getError();
     }
     // Install all the modules
     try {
         $oDB->begin();
         $this->installDownloadedModule();
         $oDB->commit();
     } catch (Exception $e) {
         $oDB->rollback();
         return new Object(-1, $e->getMessage());
     }
     // Create a config file
     if (!$this->makeConfigFile()) {
         return new Object(-1, 'msg_install_failed');
     }
     // load script
     $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\\.php)$/');
     if (count($scripts) > 0) {
         sort($scripts);
         foreach ($scripts as $script) {
             $script_path = FileHandler::getRealPath('./modules/install/script/');
             $output = (include $script_path . $script);
         }
     }
     // save selected lang info
     $oInstallAdminController = getAdminController('install');
     $oInstallAdminController->saveLangSelected(array(Context::getLangType()));
     // Display a message that installation is completed
     $this->setMessage('msg_install_completed');
     unset($_SESSION['use_rewrite']);
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
         header('location:' . $returnUrl);
         return new Object();
     }
 }
开发者ID:rubythonode,项目名称:xe-core,代码行数:66,代码来源:install.controller.php

示例14: _copyDir

 /**
  * Copy directory
  *
  * @param array $file_list File list to copy
  * @return Object
  */
 function _copyDir(&$file_list)
 {
     $output = $this->_connect();
     if (!$output->toBool()) {
         return $output;
     }
     $target_dir = $this->target_path;
     if (is_array($file_list)) {
         foreach ($file_list as $k => $file) {
             $org_file = $file;
             if ($this->package->path == ".") {
                 $file = substr($file, 3);
             }
             $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
             $path_list = explode('/', dirname($this->target_path . "/" . $file));
             $real_path = "./";
             for ($i = 0; $i < count($path_list); $i++) {
                 if ($path_list == "") {
                     continue;
                 }
                 $real_path .= $path_list[$i] . "/";
                 if (!file_exists(FileHandler::getRealPath($real_path))) {
                     FileHandler::makeDir($real_path);
                 }
             }
             FileHandler::copyFile(FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
         }
     }
     $this->_close();
     return new Object();
 }
开发者ID:conory,项目名称:rhymix,代码行数:37,代码来源:autoinstall.lib.php

示例15: dispLayoutPreview

 /**
  * Preview a layout
  * @return void|Object (void : success, Object : fail)
  */
 function dispLayoutPreview()
 {
     // admin check
     // this act is admin view but in normal view because do not load admin css/js files
     $logged_info = Context::get('logged_info');
     if ($logged_info->is_admin != 'Y') {
         return $this->stop('msg_invalid_request');
     }
     $layout_srl = Context::get('layout_srl');
     $code = Context::get('code');
     $code_css = Context::get('code_css');
     if (!$layout_srl || !$code) {
         return new Object(-1, 'msg_invalid_request');
     }
     // Get the layout information
     $oLayoutModel = getModel('layout');
     $layout_info = $oLayoutModel->getLayout($layout_srl);
     if (!$layout_info) {
         return new Object(-1, 'msg_invalid_request');
     }
     // Separately handle the layout if its type is faceoff
     if ($layout_info && $layout_info->type == 'faceoff') {
         $oLayoutModel->doActivateFaceOff($layout_info);
     }
     // Apply CSS directly
     Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">" . $code_css . "</style>");
     // Set names and values of extra_vars to $layout_info
     if ($layout_info->extra_var_count) {
         foreach ($layout_info->extra_var as $var_id => $val) {
             $layout_info->{$var_id} = $val->value;
         }
     }
     // menu in layout information becomes an argument for Context:: set
     if ($layout_info->menu_count) {
         foreach ($layout_info->menu as $menu_id => $menu) {
             $menu->php_file = FileHandler::getRealPath($menu->php_file);
             if (FileHandler::exists($menu->php_file)) {
                 include $menu->php_file;
             }
             Context::set($menu_id, $menu);
         }
     }
     Context::set('layout_info', $layout_info);
     Context::set('content', Context::getLang('layout_preview_content'));
     // Temporary save the codes
     $edited_layout_file = _XE_PATH_ . 'files/cache/layout/tmp.tpl';
     FileHandler::writeFile($edited_layout_file, $code);
     // Compile
     $oTemplate =& TemplateHandler::getInstance();
     $layout_path = $layout_info->path;
     $layout_file = 'layout';
     $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
     Context::set('layout', 'none');
     // Convert widgets and others
     $oContext =& Context::getInstance();
     Context::set('layout_tpl', $layout_tpl);
     // Delete Temporary Files
     FileHandler::removeFile($edited_layout_file);
     $this->setTemplateFile('layout_preview');
 }
开发者ID:rubythonode,项目名称:xe-core,代码行数:64,代码来源:layout.view.php


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