本文整理汇总了PHP中FileHandler::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::exists方法的具体用法?PHP FileHandler::exists怎么用?PHP FileHandler::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check
public function check($file)
{
// TODO: 기능개선후 enable
return TRUE;
// disable
if (!$file || !FileHandler::exists($file)) {
return TRUE;
}
return self::_check($file);
}
示例2: proc
/**
* excute the member method specified by $act variable
* @return boolean true : success false : fail
* */
function proc()
{
// pass if stop_proc is true
if ($this->stop_proc) {
debugPrint($this->message, 'ERROR');
return FALSE;
}
// trigger call
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this);
if (!$triggerOutput->toBool()) {
$this->setError($triggerOutput->getError());
$this->setMessage($triggerOutput->getMessage());
return FALSE;
}
// execute an addon(call called_position as before_module_proc)
$called_position = 'before_module_proc';
$oAddonController = getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if (FileHandler::exists($addon_file)) {
include $addon_file;
}
if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) {
// Check permissions
if ($this->module_srl && !$this->grant->access) {
$this->stop("msg_not_permitted_act");
return FALSE;
}
// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
$is_default_skin = !Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N' || Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N';
$usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET'));
if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) {
$dir = Mobile::isFromMobilePhone() ? 'm.skins' : 'skins';
$valueName = Mobile::isFromMobilePhone() ? 'mskin' : 'skin';
$oModuleModel = getModel('module');
$skinType = Mobile::isFromMobilePhone() ? 'M' : 'P';
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType);
if ($this->module == 'page') {
$this->module_info->{$valueName} = $skinName;
} else {
$isTemplatPath = strpos($this->getTemplatePath(), '/tpl/') !== FALSE;
if (!$isTemplatPath) {
$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName));
}
}
}
$oModuleModel = getModel('module');
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
Context::set('module_info', $this->module_info);
// Run
$output = $this->{$this->act}();
} else {
return FALSE;
}
// trigger call
$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
if (!$triggerOutput->toBool()) {
$this->setError($triggerOutput->getError());
$this->setMessage($triggerOutput->getMessage());
return FALSE;
}
// execute an addon(call called_position as after_module_proc)
$called_position = 'after_module_proc';
$oAddonController = getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if (FileHandler::exists($addon_file)) {
include $addon_file;
}
if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) {
$this->setError($output->getError());
$this->setMessage($output->getMessage());
if (!$output->toBool()) {
return FALSE;
}
}
// execute api methos of the module if view action is and result is XMLRPC or JSON
if ($this->module_info->module_type == 'view') {
if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
$oAPI = getAPI($this->module_info->module, 'api');
if (method_exists($oAPI, $this->act)) {
$oAPI->{$this->act}($this);
}
}
}
return TRUE;
}
示例3: 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');
}
示例4: procImporterAdminImport
/**
* Migrate data after completing xml file extraction
* @return void
*/
function procImporterAdminImport()
{
// Variable setting
$type = Context::get('type');
$total = Context::get('total');
$cur = Context::get('cur');
$key = Context::get('key');
$user_id = Context::get('user_id');
$target_module = Context::get('target_module');
$guestbook_target_module = Context::get('guestbook_target_module');
$this->unit_count = Context::get('unit_count');
// Check if an index file exists
$index_file = './files/cache/importer/' . $key . '/index';
if (!file_exists($index_file)) {
return new Object(-1, 'msg_invalid_xml_file');
}
switch ($type) {
case 'ttxml':
if (!$target_module) {
return new Object(-1, 'msg_invalid_request');
}
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module');
$target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList);
$ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php');
if ($ttimporter) {
require_once $ttimporter;
}
$oTT = new ttimport();
$cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module);
break;
case 'message':
$cur = $this->importMessage($key, $cur, $index_file);
break;
case 'member':
$cur = $this->importMember($key, $cur, $index_file);
break;
case 'module':
// Check if the target module exists
if (!$target_module) {
return new Object(-1, 'msg_invalid_request');
}
$cur = $this->importModule($key, $cur, $index_file, $target_module);
break;
}
// Notify that all data completely extracted
$this->add('type', $type);
$this->add('total', $total);
$this->add('cur', $cur);
$this->add('key', $key);
$this->add('target_module', $target_module);
// When completing, success message appears and remove the cache files
if ($total <= $cur) {
$this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total));
FileHandler::removeDir('./files/cache/importer/' . $key);
} else {
$this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur));
}
}
示例5:
px;"></div>
<?php
if ($__Context->allow_fileupload) {
?>
<?php
$__tpl = TemplateHandler::getInstance();
echo $__tpl->compile('modules/editor/skins/ckeditor', 'file_upload.html');
}
?>
<script>
(function($){
"use strict";
// editor
$(function(){
<?php
if (!FileHandler::exists('common/js/plugins/ckeditor/ckeditor/config.js')) {
?>
CKEDITOR.config.customConfig = '';<?php
}
?>
var settings = {
ckeconfig: {
height: '<?php
echo $__Context->editor_height;
?>
',
skin: '<?php
echo $__Context->colorset;
?>
',
contentsCss: '<?php
示例6: procProfilerAdminDeleteLogFile
function procProfilerAdminDeleteLogFile()
{
$slowlog_files = array(_XE_PATH_ . 'files/_slowlog_addon.php', _XE_PATH_ . 'files/_slowlog_trigger.php', _XE_PATH_ . 'files/_slowlog_widget.php', _XE_PATH_ . 'files/_slowlog_query.php');
foreach ($slowlog_files as $file) {
$slowlog_file = FileHandler::exists($file);
if ($slowlog_file === false) {
continue;
}
FileHandler::removeFile($file);
}
$this->setMessage('msg_profiler_slowlog_file_arranged');
$this->setRedirectUrl(Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispProfilerAdminConfig'));
}
示例7: _getMyNotifyList
function _getMyNotifyList($member_srl = null, $page = 1, $readed = 'N')
{
if (!$member_srl) {
$logged_info = Context::get('logged_info');
if (!$logged_info) {
return array();
}
$member_srl = $logged_info->member_srl;
}
$flag_path = \RX_BASEDIR . 'files/cache/ncenterlite/new_notify/' . getNumberingPath($member_srl) . $member_srl . '.php';
if (FileHandler::exists($flag_path) && $page <= 1) {
$output = (require_once $flag_path);
if (is_object($output)) {
$output->flag_exists = true;
return $output;
}
}
$args = new stdClass();
$args->member_srl = $member_srl;
$args->page = $page ? $page : 1;
if ($readed) {
$args->readed = $readed;
}
$output = executeQueryArray('ncenterlite.getNotifyList', $args);
$output->flag_exists = false;
if (!$output->data) {
$output->data = array();
}
return $output;
}
示例8: init
/**
* Initialization, it sets DB information, request arguments and so on.
*
* @see This function should be called only once
* @return void
*/
public function init()
{
// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
// If content is not XML or JSON, unset
if (!preg_match('/^[\\<\\{\\[]/', $GLOBALS['HTTP_RAW_POST_DATA'])) {
unset($GLOBALS['HTTP_RAW_POST_DATA']);
}
}
// set context variables in $GLOBALS (backward compatibility)
$GLOBALS['__Context__'] = $this;
$GLOBALS['lang'] =& $this->lang;
$this->_COOKIE = $_COOKIE;
// 20140429 editor/image_link
$this->_checkGlobalVars();
$this->setRequestMethod('');
$this->_setXmlRpcArgument();
$this->_setJSONRequestArgument();
$this->_setRequestArgument();
$this->_setUploadedArgument();
$this->loadDBInfo();
if ($this->db_info->use_sitelock == 'Y') {
if (is_array($this->db_info->sitelock_whitelist)) {
$whitelist = $this->db_info->sitelock_whitelist;
}
if (!IpFilter::filter($whitelist)) {
$title = $this->db_info->sitelock_title ? $this->db_info->sitelock_title : 'Maintenance in progress...';
$message = $this->db_info->sitelock_message;
define('_XE_SITELOCK_', TRUE);
define('_XE_SITELOCK_TITLE_', $title);
define('_XE_SITELOCK_MESSAGE_', $message);
header("HTTP/1.1 403 Forbidden");
if (FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) {
include _XE_PATH_ . 'common/tpl/sitelock.user.html';
} else {
include _XE_PATH_ . 'common/tpl/sitelock.html';
}
exit;
}
}
// If XE is installed, get virtual site information
if (self::isInstalled()) {
$oModuleModel = getModel('module');
$site_module_info = $oModuleModel->getDefaultMid();
if (!isset($site_module_info)) {
$site_module_info = new stdClass();
}
// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) {
$site_module_info->domain = $this->db_info->default_url;
}
self::set('site_module_info', $site_module_info);
if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) {
self::set('vid', $site_module_info->domain, TRUE);
}
if (!isset($this->db_info)) {
$this->db_info = new stdClass();
}
$this->db_info->lang_type = $site_module_info->default_language;
if (!$this->db_info->lang_type) {
$this->db_info->lang_type = 'ko';
}
if (!$this->db_info->use_db_session) {
$this->db_info->use_db_session = 'N';
}
}
// Load Language File
$lang_supported = self::loadLangSelected();
// Retrieve language type set in user's cookie
if ($this->lang_type = self::get('l')) {
if ($_COOKIE['lang_type'] != $this->lang_type) {
setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
}
} elseif ($_COOKIE['lang_type']) {
$this->lang_type = $_COOKIE['lang_type'];
}
// If it's not exists, follow default language type set in db_info
if (!$this->lang_type) {
$this->lang_type = $this->db_info->lang_type;
}
// if still lang_type has not been set or has not-supported type , set as Korean.
if (!$this->lang_type) {
$this->lang_type = 'ko';
}
if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) {
$this->lang_type = 'ko';
}
self::set('lang_supported', $lang_supported);
self::setLangType($this->lang_type);
// Load languages
$this->lang = Rhymix\Framework\Lang::getInstance($this->lang_type);
$this->lang->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
$this->lang->loadDirectory(RX_BASEDIR . 'modules/module/lang', 'module');
//.........这里部分代码省略.........
示例9: get
/**
* Fetch a stored variable from the cache
*
* @param string $key The $key used to store the value.
* @param int $modified_time Not used
* @return false|mixed Return false on failure. Return the string associated with the $key on success.
*/
function get($key, $modified_time = 0)
{
if (!($cache_file = FileHandler::exists($this->getCacheFileName($key)))) {
return false;
}
if ($modified_time > 0 && filemtime($cache_file) < $modified_timed) {
FileHandler::removeFile($cache_file);
return false;
}
$content = (include $cache_file);
return unserialize(stripslashes($content));
}
示例10: init
/**
* Initialization, it sets DB information, request arguments and so on.
*
* @see This function should be called only once
* @return void
*/
function init()
{
if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) {
if (simplexml_load_string(file_get_contents("php://input")) !== false) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
}
if (strpos($_SERVER['CONTENT_TYPE'], 'json') || strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json')) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
}
}
// set context variables in $GLOBALS (to use in display handler)
$this->context =& $GLOBALS['__Context__'];
$this->context->lang =& $GLOBALS['lang'];
$this->context->_COOKIE = $_COOKIE;
// 20140429 editor/image_link
$this->_checkGlobalVars();
$this->setRequestMethod('');
$this->_setXmlRpcArgument();
$this->_setJSONRequestArgument();
$this->_setRequestArgument();
$this->_setUploadedArgument();
$this->loadDBInfo();
if ($this->db_info->use_sitelock == 'Y') {
if (is_array($this->db_info->sitelock_whitelist)) {
$whitelist = $this->db_info->sitelock_whitelist;
}
if (!IpFilter::filter($whitelist)) {
$title = $this->db_info->sitelock_title ? $this->db_info->sitelock_title : 'Maintenance in progress...';
$message = $this->db_info->sitelock_message;
define('_XE_SITELOCK_', TRUE);
define('_XE_SITELOCK_TITLE_', $title);
define('_XE_SITELOCK_MESSAGE_', $message);
header("HTTP/1.1 403 Forbidden");
if (FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) {
include _XE_PATH_ . 'common/tpl/sitelock.user.html';
} else {
include _XE_PATH_ . 'common/tpl/sitelock.html';
}
exit;
}
}
// If XE is installed, get virtual site information
if (self::isInstalled()) {
$oModuleModel = getModel('module');
$site_module_info = $oModuleModel->getDefaultMid();
if (!isset($site_module_info)) {
$site_module_info = new stdClass();
}
// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) {
$site_module_info->domain = $this->db_info->default_url;
}
$this->set('site_module_info', $site_module_info);
if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) {
$this->set('vid', $site_module_info->domain, TRUE);
}
if (!isset($this->db_info)) {
$this->db_info = new stdClass();
}
$this->db_info->lang_type = $site_module_info->default_language;
if (!$this->db_info->lang_type) {
$this->db_info->lang_type = 'en';
}
if (!$this->db_info->use_db_session) {
$this->db_info->use_db_session = 'N';
}
}
// Load Language File
$lang_supported = $this->loadLangSelected();
// Retrieve language type set in user's cookie
if ($this->lang_type = $this->get('l')) {
if ($_COOKIE['lang_type'] != $this->lang_type) {
setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
}
} elseif ($_COOKIE['lang_type']) {
$this->lang_type = $_COOKIE['lang_type'];
}
// If it's not exists, follow default language type set in db_info
if (!$this->lang_type) {
$this->lang_type = $this->db_info->lang_type;
}
// if still lang_type has not been set or has not-supported type , set as English.
if (!$this->lang_type) {
$this->lang_type = 'en';
}
if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) {
$this->lang_type = 'en';
}
$this->set('lang_supported', $lang_supported);
$this->setLangType($this->lang_type);
// load module module's language file according to language setting
$this->loadLang(_XE_PATH_ . 'modules/module/lang');
// set session handler
if (self::isInstalled() && $this->db_info->use_db_session == 'Y') {
//.........这里部分代码省略.........
示例11: getSiteDefaultLayout
public function getSiteDefaultLayout($viewType = 'P', $siteSrl = 0)
{
$target = $viewType == 'M' ? 'mlayout_srl' : 'layout_srl';
$designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $siteSrl);
if (FileHandler::exists($designInfoFile)) {
include $designInfoFile;
}
if (!$designInfo || !$designInfo->{$target}) {
return 0;
}
$oModel = getModel('layout');
$layout_info = $oModel->getLayout($designInfo->{$target});
if (!$layout_info) {
return 0;
}
return $designInfo->{$target};
}
示例12: enforceSiteLock
/**
* Enforce site lock.
*/
private static function enforceSiteLock()
{
// Allow if the current user is logged in as administrator, or trying to log in.
$logged_info = self::get('logged_info');
if ($logged_info && $logged_info->is_admin === 'Y') {
return;
} elseif (in_array(self::get('act'), array('procMemberLogin', 'dispMemberLogout'))) {
return;
}
// Allow if the current user is in the list of allowed IPs.
if (Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, config('lock.allow'))) {
return;
}
// Set headers and constants for backward compatibility.
header('HTTP/1.1 503 Service Unavailable');
define('_XE_SITELOCK_', TRUE);
define('_XE_SITELOCK_TITLE_', config('lock.title') ?: self::getLang('admin.sitelock_in_use'));
define('_XE_SITELOCK_MESSAGE_', config('lock.message'));
unset($_SESSION['XE_VALIDATOR_RETURN_URL']);
// Load the sitelock template.
if (FileHandler::exists(RX_BASEDIR . 'common/tpl/sitelock.user.html')) {
include RX_BASEDIR . 'common/tpl/sitelock.user.html';
} else {
self::displayErrorPage(_XE_SITELOCK_TITLE_, _XE_SITELOCK_MESSAGE_, 503);
}
exit;
}
示例13: moduleUpdate
/**
* Execute update
*
* @return Object
*/
function moduleUpdate()
{
$oDB = DB::getInstance();
$oModuleModel = getModel('module');
$oModuleController = getController('module');
if (!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_installed_packages.xml') && $oDB->isTableExists("autoinstall_installed_packages")) {
$oDB->dropTable("autoinstall_installed_packages");
}
if (!FileHandler::exists('./modules/autoinstall/schemas/autoinstall_remote_categories.xml') && $oDB->isTableExists("autoinstall_remote_categories")) {
$oDB->dropTable("autoinstall_remote_categories");
}
// 2011.08.08 add column 'list_order' in 'ai_remote_categories
if (!$oDB->isColumnExists('ai_remote_categories', 'list_order')) {
$oDB->addColumn('ai_remote_categories', 'list_order', 'number', 11, NULL, TRUE);
$oDB->addIndex('ai_remote_categories', 'idx_list_order', array('list_order'));
}
// 2011. 08. 08 set _XE_DOWNLOAD_SERVER_ at module config
$config = $oModuleModel->getModuleConfig('autoinstall');
if (!isset($config->downloadServer)) {
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
$oModuleController->insertModuleConfig('autoinstall', $config);
}
// 2012.11.12 add column 'have_instance' in autoinstall_packages
if (!$oDB->isColumnExists('autoinstall_packages', 'have_instance')) {
$oDB->addColumn('autoinstall_packages', 'have_instance', 'char', '1', 'N', TRUE);
}
return new Object(0, 'success_updated');
}
示例14: 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();
}
}
示例15: getThemeInfo
/**
* Return theme info
* @param string $theme_name
* @param array $layout_list
* @return object
*/
function getThemeInfo($theme_name, $layout_list = NULL)
{
if ($GLOBALS['__ThemeInfo__'][$theme_name]) {
return $GLOBALS['__ThemeInfo__'][$theme_name];
}
$info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml';
if (!file_exists($info_file)) {
return;
}
$oXmlParser = new XmlParser();
$_xml_obj = $oXmlParser->loadXmlFile($info_file);
if (!$_xml_obj->theme) {
return;
}
$xml_obj = $_xml_obj->theme;
// 스킨이름
$theme_info = new stdClass();
$theme_info->name = $theme_name;
$theme_info->title = $xml_obj->title->body;
$thumbnail = './themes/' . $theme_name . '/thumbnail.png';
$theme_info->thumbnail = FileHandler::exists($thumbnail) ? $thumbnail : NULL;
$theme_info->version = $xml_obj->version->body;
$date_obj = new stdClass();
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$theme_info->description = $xml_obj->description->body;
$theme_info->path = './themes/' . $theme_name . '/';
if (!is_array($xml_obj->publisher)) {
$publisher_list = array();
$publisher_list[] = $xml_obj->publisher;
} else {
$publisher_list = $xml_obj->publisher;
}
$theme_info->publisher = array();
foreach ($publisher_list as $publisher) {
$publisher_obj = new stdClass();
$publisher_obj->name = $publisher->name->body;
$publisher_obj->email_address = $publisher->attrs->email_address;
$publisher_obj->homepage = $publisher->attrs->link;
$theme_info->publisher[] = $publisher_obj;
}
$layout = $xml_obj->layout;
$layout_path = $layout->directory->attrs->path;
$layout_parse = explode('/', $layout_path);
$layout_info = new stdClass();
switch ($layout_parse[1]) {
case 'themes':
$layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1];
break;
case 'layouts':
$layout_info->name = $layout_parse[count($layout_parse) - 1];
break;
}
$layout_info->title = $layout_parse[count($layout_parse) - 1];
$layout_info->path = $layout_path;
$site_info = Context::get('site_module_info');
// check layout instance
$is_new_layout = TRUE;
$oLayoutModel = getModel('layout');
$layout_info_list = array();
$layout_list = $oLayoutModel->getLayoutList($site_info->site_srl);
if ($layout_list) {
foreach ($layout_list as $val) {
if ($val->layout == $layout_info->name) {
$is_new_layout = FALSE;
$layout_info->layout_srl = $val->layout_srl;
break;
}
}
}
if ($is_new_layout) {
$site_module_info = Context::get('site_module_info');
$args = new stdClass();
$args->site_srl = (int) $site_module_info->site_srl;
$args->layout_srl = getNextSequence();
$args->layout = $layout_info->name;
$args->title = $layout_info->title;
$args->layout_type = "P";
// Insert into the DB
$oLayoutAdminController = getAdminController('layout');
$output = $oLayoutAdminController->insertLayout($args);
$layout_info->layout_srl = $args->layout_srl;
}
$theme_info->layout_info = $layout_info;
$skin_infos = $xml_obj->skininfos;
if (is_array($skin_infos->skininfo)) {
$skin_list = $skin_infos->skininfo;
} else {
$skin_list = array($skin_infos->skininfo);
}
$oModuleModel = getModel('module');
$skins = array();
foreach ($skin_list as $val) {
$skin_info = new stdClass();
//.........这里部分代码省略.........