本文整理汇总了PHP中classXML::load方法的典型用法代码示例。如果您正苦于以下问题:PHP classXML::load方法的具体用法?PHP classXML::load怎么用?PHP classXML::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类classXML
的用法示例。
在下文中一共展示了classXML::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _restoreXmlSkin
/**
* Execute selected method
*
* @param object Registry object
* @return @e void
*/
public function _restoreXmlSkin()
{
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPSSetUp::charSet);
/* Skin Set Data */
$xml->load(IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml');
foreach ($xml->fetchElements('set') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['set_key'] == 'xmlskin') {
$data['set_order'] = intval($data['set_order']);
unset($data['set_id']);
$this->DB->delete('skin_collections', "set_key='xmlskin'");
$this->DB->insert('skin_collections', $data);
}
}
$this->registry->output->addMessage("XML стиль восстановлен");
$this->request['workact'] = '';
}
示例2: rebuildMobileSkinUserAgentsFromSetDataXml
/**
* Rebuilds the mobile user agents from the skin set data
*/
public function rebuildMobileSkinUserAgentsFromSetDataXml()
{
/* Init */
$mobileSkinSet = $this->fetchSkinData($this->fetchSetIdByKey('mobile', true), true);
$xmlData = array();
/* Grab xml */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML('UTF-8');
/* Skin Set Data */
$xml->load(IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml');
foreach ($xml->fetchElements('set') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['set_key'] == 'mobile') {
$xmlData = $data;
break;
}
}
/* Update */
if ($xmlData['set_key'] && IPSLib::isSerialized($xmlData['set_locked_uagent']) && IPSLib::isSerialized($mobileSkinSet['set_locked_uagent'])) {
$new = unserialize($xmlData['set_locked_uagent']);
$old = unserialize($mobileSkinSet['set_locked_uagent']);
/* Merge them */
foreach ($new['groups'] as $group) {
if (!in_array($group, $old['groups'])) {
$old['groups'][] = $group;
}
}
foreach ($new['uagents'] as $agent => $version) {
if (!in_array($agent, $new['uagents'])) {
$old['uagents'][$agent] = $version;
}
}
}
if (is_array($old) && count($old)) {
$this->DB->update('skin_collections', array('set_locked_uagent' => serialize($old)), "set_key='mobile'");
}
}
示例3: installAppHooks
/**
* Function mostly used in installer/upgrader
* Inserts new hooks
*
* @param string Application to install hooks for
*/
public function installAppHooks($app)
{
static $hooks = array();
$msgs = array('inserted' => 0, 'updated' => 0, 'skipped' => 0);
$xmlData = array();
$path = IPSLib::getAppDir($app) . '/xml';
if (is_file($path . '/hooks.xml') and is_dir($path . '/hooks')) {
if (!count($hooks)) {
/* Fetch current hooks */
$this->DB->build(array('select' => '*', 'from' => 'core_hooks'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
if ($row['hook_key']) {
$hooks[$row['hook_key']] = $row;
}
}
}
/* Alright. We're in. Read the XML file */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
/* Grab wrapper file */
$xml->load($path . '/hooks.xml');
foreach ($xml->fetchElements('hook') as $data) {
$xmlData[] = $xml->fetchElementsFromRecord($data);
}
/* Examine XML */
if (is_array($xmlData) and count($xmlData)) {
foreach ($xmlData as $x) {
if (is_file($path . '/hooks/' . $x['file'])) {
$xml->load($path . '/hooks/' . $x['file']);
foreach ($xml->fetchElements('config') as $data) {
$config = $xml->fetchElementsFromRecord($data);
}
if (!isset($hooks[$config['hook_key']])) {
/* Add it */
$msgs['inserted']++;
$this->installHook(file_get_contents($path . '/hooks/' . $x['file']), FALSE, FALSE, $x['enabled']);
} else {
$this->installHook(file_get_contents($path . '/hooks/' . $x['file']), FALSE, FALSE, $x['enabled']);
$msgs['updated']++;
}
}
}
}
}
return $msgs;
}
示例4: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* INIT */
$filesOK = NULL;
$extensions = get_loaded_extensions();
$extensionsOK = TRUE;
$extensionData = array();
/* Test Extensions */
$INSTALLDATA = array();
include IPS_ROOT_PATH . 'setup/xml/requiredextensions.php';
/*noLibHook*/
if (is_array($INSTALLDATA) && count($INSTALLDATA)) {
foreach ($INSTALLDATA as $data) {
if (!in_array($data['testfor'], $extensions)) {
//-----------------------------------------
// Added 'nohault' key which will show a
// warning but not prohibit installation
//-----------------------------------------
if ($data['nohault']) {
$data['_ok'] = 1;
// Anything but true or false
$extensionsOK = 1;
// Anything but true or false
} else {
$extensionsOK = FALSE;
}
} else {
$data['_ok'] = TRUE;
}
$extensionData[] = $data;
}
}
/* Check for conf_global.dist.php */
if (is_file(DOC_IPS_ROOT_PATH . 'conf_global.dist.php') and !is_file(DOC_IPS_ROOT_PATH . 'conf_global.php')) {
if (!@rename(DOC_IPS_ROOT_PATH . 'conf_global.dist.php', DOC_IPS_ROOT_PATH . 'conf_global.php')) {
$filesOK = FALSE;
$this->registry->output->addError("<strong>You MUST rename the file 'conf_global.<b style='color:red'>dist.php</b>' TO 'conf_global.<b style='color:red'>php</b>' before continuing.</strong>\r\r\n\t\t\t\t\t\t\t \t\t\t\t\t\t This file can be found in the 'root' directory on your IP.Board install.");
}
}
/* All extensions loaded OK? */
if ($extensionsOK == TRUE and $filesOK === NULL) {
$filesOK = FALSE;
/* Fetch core writeable files */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPSSetUp::charSet);
try {
$xml->load(IPS_ROOT_PATH . 'setup/xml/writeablefiles.xml');
foreach ($xml->fetchElements('file') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['path']) {
$_path = DOC_IPS_ROOT_PATH . $data['path'];
if (!file_exists($_path)) {
if ($data['dir']) {
if (!@mkdir($_path, IPS_FOLDER_PERMISSION, TRUE)) {
$this->registry->output->addError('Directory does not exist: "' . $data['path'] . '", please create it via FTP');
}
} else {
$this->registry->output->addError('File does not exist: "' . $data['path'] . '", please create it via FTP');
}
}
if (!is_writeable($_path)) {
if (!@chmod($_path, is_dir($_path) ? IPS_FOLDER_PERMISSION : IPS_FILE_PERMISSION)) {
if (is_dir($_path)) {
$this->registry->output->addError('Can not write to directory: "' . $data['path'] . '", please CHMOD to 777');
} else {
$this->registry->output->addError('Can not write to file: "' . $data['path'] . '", please CHMOD to 777');
}
}
}
}
}
if (!count($this->registry->output->fetchErrors())) {
$filesOK = TRUE;
}
} catch (Exception $error) {
$filesOK = FALSE;
$this->registry->output->addError("Cannot locate: " . IPS_ROOT_PATH . 'setup/xml/writeablefiles.xml');
}
}
/* Hide buttons? */
if ($filesOK !== TRUE or $extensionsOK != TRUE) {
$this->registry->output->setNextAction('');
$this->registry->output->setHideButton(TRUE);
}
/* Simply return the requirements page */
$this->registry->output->setTitle("Requirements");
$this->registry->output->addContent($this->registry->output->template()->page_requirements($filesOK, $extensionsOK, $extensionData));
$this->registry->output->sendOutput();
}
示例5: install_templates
/**
* Install templates
*
* @return void
*/
public function install_templates()
{
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_templates'), 'core');
//-----------------------------------------
// INIT
//-----------------------------------------
$previous = $_REQUEST['previous'];
if (is_file(IPS_ROOT_PATH . 'setup/sql/' . strtolower($this->registry->dbFunctions()->getDriverType()) . '_install.php')) {
require_once IPS_ROOT_PATH . 'setup/sql/' . strtolower($this->registry->dbFunctions()->getDriverType()) . '_install.php';
/*noLibHook*/
$extra_install = new install_extra($this->registry);
}
//-----------------------------------------
// Fetch next 'un
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']);
/* Got any skin sets? */
$count = $this->DB->buildAndFetch(array('select' => 'count(*) as count', 'from' => 'skin_collections'));
if (!$count['count']) {
//-----------------------------------------
// Next...
//-----------------------------------------
$output[] = "Добавление шаблонов";
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPSSetUp::charSet);
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('skinset');
}
/* Skin Set Data */
$xml->load(IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml');
foreach ($xml->fetchElements('set') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
$this->DB->insert('skin_collections', $data);
}
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('skinset');
}
}
/* Load skin classes */
require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php';
/*noLibHook*/
$skinFunctions = new skinImportExport($this->registry);
/* Grab skin data */
$this->DB->build(array('select' => '*', 'from' => 'skin_collections'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
/* Bit of jiggery pokery... */
if ($row['set_key'] == 'default') {
$row['set_key'] = 'root';
$row['set_id'] = 0;
}
$skinSets[$row['set_key']] = $row;
}
//-----------------------------------------
// InstallTemplates
//-----------------------------------------
if ($next['key']) {
foreach ($skinSets as $skinKey => $skinData) {
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
$output[] = $next['title'] . ": Обновление шаблонов {$skinData['set_name']}";
if (is_file($_PATH . $next['key'] . '_' . $skinKey . '_templates.xml')) {
//-----------------------------------------
// Install
//-----------------------------------------
$return = $skinFunctions->importTemplateAppXML($next['key'], $skinKey, $skinData['set_id'], TRUE);
$output[] = $next['title'] . ": " . intval($return['insertCount']) . " шаблонов добавлено";
}
if (is_file($_PATH . $next['key'] . '_' . $skinKey . '_css.xml')) {
//-----------------------------------------
// Install
//-----------------------------------------
$return = $skinFunctions->importCSSAppXML($next['key'], $skinKey, $skinData['set_id']);
$output[] = $next['title'] . ": " . intval($return['insertCount']) . " {$skinData['set_name']} CSS файлов добавлено";
}
}
//-----------------------------------------
// Done.. so get some more!
//-----------------------------------------
$this->_finishStep($output, "Обновление: Шаблоны", 'upgrade&do=templates&previous=' . $next['key']);
} else {
//-----------------------------------------
// Recache templates
//-----------------------------------------
$output[] = "Кеширование шаблонов";
//.........这里部分代码省略.........
示例6: __construct
/**
* Construct
*
* @access public
* @param object ipsRegistry reference
* @param bool Whether to init
* @return @e void
*/
public function __construct(ipsRegistry $registry, $init = FALSE)
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
if ($init === TRUE) {
/* Load 'template' */
require_once IPS_ROOT_PATH . 'setup/templates/skin_setup.php';
/*noLibHook*/
$this->template = new skin_setup($registry);
/* Images URL */
$this->imageUrl = '../setup/' . PUBLIC_DIRECTORY . '/images';
/* Fetch sequence data */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPSSetUp::charSet);
$file = IPS_IS_UPGRADER ? IPS_ROOT_PATH . 'setup/xml/upgrade_sequence.xml' : IPS_ROOT_PATH . 'setup/xml/sequence.xml';
try {
$xml->load($file);
foreach ($xml->fetchElements('action') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
$_tmp[$data['position']] = $data;
ksort($_tmp);
foreach ($_tmp as $pos => $data) {
$this->sequenceData[$data['file']] = $data['menu'];
}
}
} catch (Exception $error) {
$this->addError("Could not locate: " . $file);
}
/* Set up URLs */
$this->settings['base_url'] = $this->settings['base_url'] ? $this->settings['base_url'] : IPSSetUp::getSavedData('install_url');
$this->settings['public_dir'] = $this->settings['base_url'] . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['img_url_no_dir'] = $this->settings['base_url'] . '/' . PUBLIC_DIRECTORY . '/style_images/';
/* Set Current Page */
$this->currentPage = $this->request['section'] ? $this->request['section'] : 'index';
if (!$this->sequenceData[$this->currentPage]) {
$this->currentPage = 'index';
}
/* Set default next action */
$_hit = 0;
foreach ($this->sequenceData as $file => $text) {
if ($_hit) {
$this->nextAction = $file;
break;
}
if ($file == $this->currentPage) {
$_hit = 1;
}
}
/* Build all skins array */
if (IPS_IS_UPGRADER) {
/* For < 3.0.0 upgrades, they won't have this table, so check for it */
if ($this->DB->checkForTable('skin_collections')) {
$this->DB->build(array('select' => '*', 'from' => 'skin_collections', 'order' => 'set_id ASC'));
$this->DB->execute();
while ($_skinSets = $this->DB->fetch()) {
$id = $_skinSets['set_id'];
$this->allSkins[$id] = $_skinSets;
$this->allSkins[$id]['_parentTree'] = unserialize($_skinSets['set_parent_array']);
$this->allSkins[$id]['_childTree'] = unserialize($_skinSets['set_child_array']);
$this->allSkins[$id]['_userAgents'] = unserialize($_skinSets['set_locked_uagent']);
$this->allSkins[$id]['_cssGroupsArray'] = unserialize($_skinSets['set_css_groups']);
$this->allSkins[$id]['_youCanUse'] = TRUE;
$this->allSkins[$id]['_gatewayExclude'] = FALSE;
/* Array groups */
if (is_array($this->allSkins[$id]['_cssGroupsArray'])) {
ksort($this->allSkins[$id]['_cssGroupsArray'], SORT_NUMERIC);
} else {
$this->allSkins[$id]['_cssGroupsArray'] = array();
}
}
}
}
}
}
示例7: install_other
/**
* Install Other stuff
*
* @return void
*/
public function install_other()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$previous = $_REQUEST['previous'];
//-----------------------------------------
// HOOKS: Fetch next 'un
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, 'hooks.xml');
/* Set up DB driver */
$extra_install = $this->_setUpDBDriver(FALSE);
//-----------------------------------------
// Insert tasks
//-----------------------------------------
if ($next['key']) {
$output[] = $next['title'] . ": Inserting hooks...";
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
if (file_exists($_PATH . 'hooks.xml')) {
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('hooks');
}
//-----------------------------------------
// Continue
//-----------------------------------------
require_once IPS_ROOT_PATH . 'applications/core/modules_admin/applications/hooks.php';
$hooks = new admin_core_applications_hooks();
$hooks->makeRegistryShortcuts($this->registry);
$result = $hooks->installAppHooks($next['key']);
$output[] = "Hooks " . $next['title'] . ": " . $result['inserted'] . " inserted";
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('hooks');
}
}
//-----------------------------------------
// Done.. so get some more!
//-----------------------------------------
$this->_finishStep($output, "Install: Hook", 'install&do=other&previous=' . $next['key']);
} else {
require_once IPS_KERNEL_PATH . 'classXML.php';
//-----------------------------------------
// ****** LOG IN MODULES
//-----------------------------------------
$output[] = "Inserting log in modules information...";
$xml = new classXML(IPSSetUp::charSet);
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('login');
}
//-----------------------------------------
// Continue
//-----------------------------------------
$xml->load(IPS_ROOT_PATH . 'setup/xml/loginauth.xml');
foreach ($xml->fetchElements('login_methods') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
unset($data['login_id']);
$this->DB->insert('login_methods', $data);
}
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('login');
}
//-----------------------------------------
// ****** USER AGENTS
//-----------------------------------------
$output[] = "Inserting default user agents...";
$xml = new classXML(IPSSetUp::charSet);
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('useragents');
}
require_once IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php';
$userAgentFunctions = new userAgentFunctions($this->registry);
$userAgentFunctions->rebuildMasterUserAgents();
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('useragents');
}
//-----------------------------------------
// ****** GROUPS
//-----------------------------------------
$output[] = "Inserting groups information...";
$xml = new classXML(IPSSetUp::charSet);
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('groups');
}
$xml->load(IPS_ROOT_PATH . 'setup/xml/groups.xml');
//.........这里部分代码省略.........
示例8: fetchXmlAppModules
/**
* Fetch Apps XML Modules File
*
* @access public
* @param string Application Directory
* @param string Charset (post install)
* @return array ..of data
*/
public static function fetchXmlAppModules($app, $charset = '')
{
//-----------------------------------------
// No modules?
//-----------------------------------------
if (!is_file(IPSLib::getAppDir($app) . '/xml/' . $app . '_modules.xml')) {
return array();
}
/* INIT */
$modules = array();
try {
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML($charset ? $charset : IPSSetUp::charSet);
$xml->load(IPSLib::getAppDir($app) . '/xml/' . $app . '_modules.xml');
/* Fetch info */
foreach ($xml->fetchElements('module') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['sys_module_id']) {
unset($data['sys_module_id']);
}
/* Remove fields removed from 3.1.3+ to avoid driver errors */
unset($data['sys_module_parent']);
unset($data['sys_module_tables']);
unset($data['sys_module_hooks']);
$modules[$data['sys_module_key'] . intval($data['sys_module_admin'])] = $data;
}
return $modules;
} catch (Exception $error) {
return FALSE;
}
}
示例9: install_other
/**
* Install Other stuff
*
* @return void
*/
public function install_other()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$previous = $_REQUEST['previous'];
//-----------------------------------------
// HOOKS: Fetch next 'un
//-----------------------------------------
$next = IPSSetUp::fetchNextApplication($previous, 'hooks.xml', $this->settings['gb_char_set']);
/* Set up DB driver */
$extra_install = $this->_setUpDBDriver(FALSE);
//-----------------------------------------
// Insert tasks
//-----------------------------------------
if ($next['key']) {
$output[] = $next['title'] . ": Добавление модификаций";
$_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
if (is_file($_PATH . 'hooks.xml')) {
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('hooks');
}
//-----------------------------------------
// Continue
//-----------------------------------------
require_once IPS_ROOT_PATH . 'applications/core/modules_admin/applications/hooks.php';
/*noLibHook*/
$hooks = new admin_core_applications_hooks();
$hooks->makeRegistryShortcuts($this->registry);
$result = $hooks->installAppHooks($next['key']);
$output[] = "Модификации " . $next['title'] . ": " . $result['inserted'] . " добавлено";
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('hooks');
}
}
//-----------------------------------------
// Done.. so get some more!
//-----------------------------------------
$this->_finishStep($output, "Установка: Модификации", 'install&do=other&previous=' . $next['key']);
} else {
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
//-----------------------------------------
// ****** LOG IN MODULES
//-----------------------------------------
$output[] = "Добавление модулей авторизации";
$xml = new classXML(IPSSetUp::charSet);
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('login');
}
//-----------------------------------------
// Continue
//-----------------------------------------
$xml->load(IPS_ROOT_PATH . 'setup/xml/loginauth.xml');
foreach ($xml->fetchElements('login_methods') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
unset($data['login_id']);
unset($data['login_date']);
$this->DB->insert('login_methods', $data);
}
//-----------------------------------------
// Adjust the table?
//-----------------------------------------
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('login');
}
//-----------------------------------------
// ****** USER AGENTS
//-----------------------------------------
$output[] = "Добавление user-agent`ов по-умолчанию";
$xml = new classXML(IPSSetUp::charSet);
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
$q = $extra_install->before_inserts_run('useragents');
}
require_once IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php';
/*noLibHook*/
$userAgentFunctions = new userAgentFunctions($this->registry);
$userAgentFunctions->rebuildMasterUserAgents();
if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
$q = $extra_install->after_inserts_run('useragents');
}
//-----------------------------------------
// ****** ATTACHMENTS
//-----------------------------------------
$output[] = "Добавление типов прикрепляемых файлов";
if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
//.........这里部分代码省略.........
示例10: applicationRemove
/**
* Remove an application
*
* @return @e void [Outputs to screen]
*/
public function applicationRemove()
{
//--------------------------------------------
// INIT
//--------------------------------------------
$app_id = intval($this->request['app_id']);
//-----------------------------------------
// Got an application?
//-----------------------------------------
$application = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_applications', 'where' => 'app_id=' . $app_id));
if (!$application['app_id']) {
$this->registry->output->global_message = $this->lang->words['a_noid'];
$this->applicationsOverview();
return;
}
//-----------------------------------------
// Protected?
//-----------------------------------------
if (!IN_DEV and $application['app_protected']) {
$this->registry->output->global_message = $this->lang->words['a_protectapp'];
$this->applicationsOverview();
return;
}
//-----------------------------------------
// Remove Settings
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'core_sys_settings_titles', 'where' => "conf_title_app='{$application['app_directory']}'"));
$this->DB->execute();
$conf_title_id = array();
while ($r = $this->DB->fetch()) {
$conf_title_id[] = $r['conf_title_id'];
}
if (count($conf_title_id)) {
$this->DB->delete('core_sys_conf_settings', 'conf_group IN(' . implode(',', $conf_title_id) . ')');
}
$this->DB->delete('core_sys_settings_titles', "conf_title_app='{$application['app_directory']}'");
$settingsFile = IPSLib::getAppDir($application['app_directory']) . '/xml/' . $application['app_directory'] . '_settings.xml';
if (is_file($settingsFile)) {
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->load($settingsFile);
$keys = array();
foreach ($xml->fetchElements('setting') as $setting) {
$entry = $xml->fetchElementsFromRecord($setting);
if ($entry['conf_is_title']) {
continue;
}
$keys[] = "'{$entry['conf_key']}'";
}
if (!empty($keys)) {
$this->DB->delete('core_sys_conf_settings', 'conf_key IN(' . implode(',', $keys) . ')');
}
}
//-----------------------------------------
// Remove Application Caches
//-----------------------------------------
$_file = IPSLib::getAppDir($application['app_directory']) . '/extensions/coreVariables.php';
if (is_file($_file)) {
$CACHE = array();
require $_file;
/*noLibHook*/
if (is_array($CACHE) and count($CACHE)) {
foreach ($CACHE as $key => $data) {
$this->DB->delete('cache_store', "cs_key='{$key}'");
}
}
}
//-----------------------------------------
// Remove tables
//-----------------------------------------
$_file = IPSLib::getAppDir($application['app_directory']) . '/setup/versions/install/sql/' . $application['app_directory'] . '_' . ipsRegistry::dbFunctions()->getDriverType() . '_tables.php';
if (is_file($_file)) {
$TABLE = array();
require $_file;
/*noLibHook*/
foreach ($TABLE as $q) {
//-----------------------------------------
// Capture create tables first
//-----------------------------------------
preg_match("/CREATE TABLE (\\S+)(\\s)?\\(/", $q, $match);
if ($match[1]) {
$_table = preg_replace('#^' . ipsRegistry::dbFunctions()->getPrefix() . "(\\S+)#", "\\1", $match[1]);
$this->DB->dropTable($_table);
} else {
//-----------------------------------------
// Then capture alter tables
//-----------------------------------------
preg_match("/ALTER TABLE (\\S+)\\sADD\\s(\\S+)\\s/i", $q, $match);
if ($match[1] and $match[2]) {
$_table = preg_replace('#^' . ipsRegistry::dbFunctions()->getPrefix() . "(\\S+)#", "\\1", $match[1]);
$_field = $match[2];
/* check for field */
if ($this->DB->checkForField($_field, $_table)) {
$this->DB->dropField($_table, $_field);
//.........这里部分代码省略.........
示例11: importTemplateAppXML
/**
* Import a single app
*
* @access public
* @param string App
* @param string Skin key to import
* @param int Set ID
* @param boolean Set the edited / added flags to 0 (from install, upgrade)
* @return mixed bool, or array of info
*/
public function importTemplateAppXML($app, $skinKey, $setID = 0, $ignoreAddedEditedFlag = false)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$templateGroups = array();
$templates = array();
$fileXML = IPSLib::getAppDir($app) . '/xml/' . $app . '_' . $skinKey . '_templates.xml';
$infoXML = IPSLib::getAppDir($app) . '/xml/information.xml';
$return = array('updateCount' => 0, 'insertCount' => 0, 'updateBits' => array(), 'insertBits' => array());
if (!file_exists($fileXML)) {
return $return;
}
if (!$setID and $skinKey != 'root') {
/* Figure out correct set ID based on key */
$skinSetData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => "set_key='" . $skinKey . "'"));
$setID = $skinSetData['set_id'];
}
/* Set ignore flag correctly */
if (!empty($skinKey) and in_array($skinKey, array('root', 'lofi', 'xmlskin'))) {
$ignoreAddedEditedFlag = true;
}
//-----------------------------------------
// XML
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
$xml = new classXML(IPS_DOC_CHAR_SET);
//-----------------------------------------
// Get information file
//-----------------------------------------
$xml->load($infoXML);
foreach ($xml->fetchElements('template') as $template) {
$name = $xml->fetchItem($template);
$match = $xml->fetchAttribute($template, 'match');
if ($name) {
$templateGroups[$name] = $match;
}
}
if (!is_array($templateGroups) or !count($templateGroups)) {
$this->_addMessage("Nothing to export for " . $app);
return FALSE;
}
//-----------------------------------------
// Fetch templates
//-----------------------------------------
$_templates = $this->fetchTemplates($setID, 'allNoContent');
$_MASTER = $this->fetchTemplates(0, 'allNoContent');
//-----------------------------------------
// Loop through...
//-----------------------------------------
foreach ($_templates as $group => $data) {
$_okToGo = FALSE;
foreach ($templateGroups as $name => $match) {
if ($match == 'contains') {
if (stristr($group, $name)) {
$_okToGo = TRUE;
break;
}
} else {
if ($group == $name) {
$_okToGo = TRUE;
}
}
}
if ($_okToGo === TRUE) {
foreach ($data as $name => $templateData) {
$templates[$group][$name] = $templateData;
}
}
}
//-----------------------------------------
// Wipe the master skins
//-----------------------------------------
if ($setID == 0) {
$this->DB->delete('skin_templates', "template_set_id=0 AND template_group IN ('" . implode("','", array_keys($templates)) . "') AND template_user_added=0 AND template_added_to=0");
/* Now wipe the array so we enforce creation */
unset($templates);
}
//-----------------------------------------
// Now grab the actual XML files
//-----------------------------------------
$xml->load($fileXML);
foreach ($xml->fetchElements('template') as $templatexml) {
$data = $xml->fetchElementsFromRecord($templatexml);
/* Figure out if this is added by a user or not */
if ($ignoreAddedEditedFlag === TRUE) {
$isAdded = 0;
$isEdited = 0;
} else {
$isAdded = (is_array($_MASTER[$data['template_group']][strtolower($data['template_name'])]) and !$_MASTER[$data['template_group']][strtolower($data['template_name'])]['template_user_added']) ? 0 : 1;
//.........这里部分代码省略.........
示例12: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* INIT */
$filesOK = NULL;
$extensions = get_loaded_extensions();
$extensionsOK = TRUE;
$extensionData = array();
/* Test Extensions */
$INSTALLDATA = array();
include IPS_ROOT_PATH . 'setup/xml/requiredextensions.php';
/*noLibHook*/
if (is_array($INSTALLDATA) && count($INSTALLDATA)) {
foreach ($INSTALLDATA as $data) {
if (!in_array($data['testfor'], $extensions)) {
//-----------------------------------------
// Added 'nohault' key which will show a
// warning but not prohibit installation
//-----------------------------------------
if ($data['nohault']) {
$data['_ok'] = 1;
// Anything but true or false
$extensionsOK = 1;
// Anything but true or false
} else {
$extensionsOK = FALSE;
}
} else {
$data['_ok'] = TRUE;
}
$extensionData[] = $data;
}
}
/* Check for conf_global.dist.php */
if (is_file(DOC_IPS_ROOT_PATH . 'conf_global.dist.php') and !is_file(DOC_IPS_ROOT_PATH . 'conf_global.php')) {
if (!@rename(DOC_IPS_ROOT_PATH . 'conf_global.dist.php', DOC_IPS_ROOT_PATH . 'conf_global.php')) {
$filesOK = FALSE;
$this->registry->output->addError("<strong>Вы должны переименовать файл 'conf_global.<b style='color:red'>dist.php</b>' в 'conf_global.<b style='color:red'>php</b>' перед продолжением.</strong>\n\t\t\t\t\t\t\t \t\t\t\t\t\t Этот файл можно найти в корневой директории IP.Board.");
}
}
/* All extensions loaded OK? */
if ($extensionsOK == TRUE and $filesOK === NULL) {
$filesOK = FALSE;
/* Fetch core writeable files */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPSSetUp::charSet);
try {
$xml->load(IPS_ROOT_PATH . 'setup/xml/writeablefiles.xml');
foreach ($xml->fetchElements('file') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['path']) {
$_path = DOC_IPS_ROOT_PATH . $data['path'];
if (!file_exists($_path)) {
if ($data['dir']) {
if (!@mkdir($_path, IPS_FOLDER_PERMISSION, TRUE)) {
$this->registry->output->addError('Директория "' . $data['path'] . '" не существует, создайте ее');
}
} else {
$this->registry->output->addError('Файл "' . $data['path'] . '" не существует, создайте его');
}
}
if (!is_writeable($_path)) {
if (!@chmod($_path, is_dir($_path) ? IPS_FOLDER_PERMISSION : IPS_FILE_PERMISSION)) {
if (is_dir($_path)) {
$this->registry->output->addError('Запись в директорию: "' . $data['path'] . '" невозможна , измените права доступа');
} else {
$this->registry->output->addError('Запись в файл "' . $data['path'] . '" невозможна, измените права доступа');
}
}
}
}
}
if (!count($this->registry->output->fetchErrors())) {
$filesOK = TRUE;
}
} catch (Exception $error) {
$filesOK = FALSE;
$this->registry->output->addError("Файл " . IPS_ROOT_PATH . 'setup/xml/writeablefiles.xml не найден');
}
}
/* Hide buttons? */
if ($filesOK !== TRUE or $extensionsOK != TRUE) {
$this->registry->output->setNextAction('');
$this->registry->output->setHideButton(TRUE);
}
/* Simply return the requirements page */
$this->registry->output->setTitle("Требования");
$this->registry->output->addContent($this->registry->output->template()->page_requirements($filesOK, $extensionsOK, $extensionData));
$this->registry->output->sendOutput();
}
示例13: doExecute
/**
* Execute selected method
*
* @access public
* @param object Registry object
* @return void
*/
public function doExecute(ipsRegistry $registry)
{
/* INIT */
$filesOK = NULL;
$extensions = get_loaded_extensions();
$extensionsOK = TRUE;
$extensionData = array();
/* Test Extensions */
include IPS_ROOT_PATH . 'setup/xml/requiredextensions.php';
if (is_array($INSTALLDATA)) {
foreach ($INSTALLDATA as $data) {
if (!in_array($data['testfor'], $extensions)) {
//-----------------------------------------
// Added 'nohault' key which will show a
// warning but not prohibit installation
//-----------------------------------------
if ($data['nohault']) {
$data['_ok'] = 1;
// Anything but true or false
$extensionsOK = 1;
// Anything but true or false
} else {
$extensionsOK = FALSE;
}
} else {
$data['_ok'] = TRUE;
}
$extensionData[] = $data;
}
}
/* All extensions loaded OK? */
if ($extensionsOK == TRUE and $filesOK === NULL) {
$filesOK = FALSE;
/* Fetch core writeable files */
require_once IPS_KERNEL_PATH . 'classXML.php';
$xml = new classXML(IPSSetUp::charSet);
try {
$xml->load(IPS_ROOT_PATH . 'setup/xml/writeablefiles.xml');
foreach ($xml->fetchElements('file') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['path']) {
$_path = DOC_IPS_ROOT_PATH . $data['path'];
if (!file_exists($_path)) {
if ($data['dir']) {
if (!@mkdir($_path, 0777, TRUE)) {
$this->registry->output->addError('Directory does not exist: "' . $data['path'] . '", please create it via FTP');
}
} else {
$this->registry->output->addError('File does not exist: "' . $data['path'] . '", please create it via FTP');
}
}
if (!is_writeable($_path)) {
if (!@chmod($_path, 0777)) {
if (is_dir($_path)) {
$this->registry->output->addError('Can not write to directory: "' . $data['path'] . '", please CHMOD to 777');
} else {
$this->registry->output->addError('Can not write to file: "' . $data['path'] . '", please CHMOD to 777');
}
}
}
}
}
if (!count($this->registry->output->fetchErrors())) {
$filesOK = TRUE;
}
} catch (Exception $error) {
$filesOK = FALSE;
$this->registry->output->addError("Cannot locate: " . IPS_ROOT_PATH . 'setup/xml/writeablefiles.xml');
}
}
/* Set next action */
$this->registry->output->setNextAction('apps');
/* Hide buttons? */
if ($filesOK !== TRUE or $extensionsOK != TRUE) {
$this->registry->output->setNextAction('');
$this->registry->output->setHideButton(TRUE);
}
/* Simply return the requirements page */
$this->registry->output->setTitle("Requirements");
$this->registry->output->addContent($this->registry->output->template()->page_requirements($filesOK, $extensionsOK, $extensionData, 'upgrade'));
$this->registry->output->sendOutput();
}
示例14: fetchXmlAppModules
/**
* Fetch Apps XML Modules File
*
* @access public
* @param string Application Directory
* @return array ..of data
*/
public static function fetchXmlAppModules($app)
{
//-----------------------------------------
// No modules?
//-----------------------------------------
if (!file_exists(IPSLib::getAppDir($app) . '/xml/' . $app . '_modules.xml')) {
return array();
}
/* INIT */
$modules = array();
/* Fetch core writeable files */
require_once IPS_KERNEL_PATH . 'classXML.php';
$xml = new classXML(IPSSetUp::charSet);
try {
require_once IPS_KERNEL_PATH . 'classXML.php';
$xml = new classXML(IPSSetUp::charSet);
$xml->load(IPSLib::getAppDir($app) . '/xml/' . $app . '_modules.xml');
/* Fetch info */
foreach ($xml->fetchElements('module') as $xmlelement) {
$data = $xml->fetchElementsFromRecord($xmlelement);
if ($data['sys_module_id']) {
unset($data['sys_module_id']);
}
$modules[$data['sys_module_key'] . intval($data['sys_module_admin'])] = $data;
}
return $modules;
} catch (Exception $error) {
return FALSE;
}
}
示例15: tasksImportAllApps
/**
* Import all tasks from XML
*
* @return @e void
*/
public function tasksImportAllApps()
{
/* INIT */
$tasks = array();
$_gmsg = array();
/* Grab current tasks */
$this->DB->build(array('select' => '*', 'from' => 'task_manager'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$tasks[$row['task_key']] = $row;
}
/* Grab XML class */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
/* Loop through all the applications */
foreach ($this->registry->getApplications() as $app => $__data) {
$stats = array('inserted' => 0, 'updated' => 0);
$xml = new classXML(IPS_DOC_CHAR_SET);
$file = IPSLib::getAppDir($app) . '/xml/' . $app . '_tasks.xml';
if (is_file($file)) {
$xml->load($file);
foreach ($xml->fetchElements('row') as $task) {
$entry = $xml->fetchElementsFromRecord($task);
/* Remove unneeded */
unset($entry['task_id']);
unset($entry['task_next_run']);
/* Update */
$entry['task_cronkey'] = $entry['task_cronkey'] ? $entry['task_cronkey'] : md5(uniqid(microtime()));
$entry['task_next_run'] = $entry['task_next_run'] ? $entry['task_next_run'] : time();
$entry['task_description'] = $entry['task_description'] ? $entry['task_description'] : '';
$entry['task_locked'] = intval($entry['task_locked']);
if ($tasks[$entry['task_key']]['task_key']) {
unset($entry['task_cronkey']);
unset($entry['task_enabled']);
$stats['updated']++;
$this->DB->update('task_manager', $entry, "task_key='" . $entry['task_key'] . "'");
} else {
$stats['inserted']++;
$this->DB->insert('task_manager', $entry);
$tasks[$entry['task_key']] = $entry;
}
}
}
$_gmsg[] = $app . ': ' . sprintf($this->lang->words['t_inserted'], $stats['inserted'], $stats['updated']);
/* In dev time stamp? */
if (IN_DEV) {
$cache = $this->caches['indev'];
$cache['import']['tasks'][$app] = time();
$this->cache->setCache('indev', $cache, array('donow' => 1, 'array' => 1));
}
}
/* Got a global message? */
if (count($_gmsg)) {
$this->registry->output->setMessage(implode('<br />', $_gmsg), 1);
}
/* Return */
$this->taskManagerOverview();
}