/** * Write system templayes */ public function _writeSystemTemplates() { require_once IPS_ROOT_PATH . 'sources/classes/output/systemTemplates.php'; /*noLibHook*/ $systemTemplates = new systemTemplates(); $systemTemplates->writeDefaults(); $this->registry->output->addMessage("Запись шаблонов системы..."); $this->request['workact'] = ''; }
/** * Installs SQL schematic * * @return void */ public function install_sql() { //----------------------------------------- // INIT //----------------------------------------- $previous = $_REQUEST['previous']; $skip = $_REQUEST['_skip']; //----------------------------------------- // Write config //----------------------------------------- if (!$previous and !$skip) { /* Write Configuration Files */ $output[] = 'Запись файлов конфигурации<br />'; $test = IPSInstall::writeConfiguration(); //----------------------------------- // Check that it wrote //----------------------------------- if (!is_file(IPSSetUp::getSavedData('install_dir') . '/conf_global.php')) { $this->registry->output->setTitle("Установка: Ошибка"); $this->registry->output->setNextAction('install&do=sql'); $this->registry->output->setHideButton(TRUE); $this->registry->output->addError("Невозможна запись конфигурации в файл conf_global.php. Пожалуйста, убедитесь, что файл имеет полный доступ на чтение и запись."); $this->registry->output->addContent(""); $this->registry->output->sendOutput(); exit; } else { $INFO = array(); require IPSSetUp::getSavedData('install_dir') . '/conf_global.php'; /*noLibHook*/ if (!$INFO['sql_driver']) { $this->registry->output->setTitle("Установка: Ошибка"); $this->registry->output->setNextAction('install&do=sql'); $this->registry->output->setHideButton(TRUE); $this->registry->output->addError("Невозможна запись конфигурации в файл conf_global.php. Пожалуйста, убедитесь, что файл имеет полный доступ на чтение и запись."); $this->registry->output->addContent(""); $this->registry->output->sendOutput(); exit; } } } /* Set up DB driver */ $extra_install = $this->_setUpDBDriver(FALSE); //----------------------------------------- // Import System Templates // We have to do this here un case we counter a driver error //----------------------------------------- require_once IPS_ROOT_PATH . 'sources/classes/output/systemTemplates.php'; /*noLibHook*/ $systemTemplates = new systemTemplates(); $systemTemplates->writeDefaults(); //----------------------------------------- // Fetch next 'un //----------------------------------------- $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']); if ($next['key']) { //----------------------------------------- // INIT //----------------------------------------- $_PATH = IPSLib::getAppDir($next['key']) . '/setup/versions/install/sql/'; $_FILE = $_PATH . $next['key'] . '_' . strtolower(IPSSetUp::getSavedData('sql_driver')); //----------------------------------------- // Tables //----------------------------------------- if (is_file($_FILE . '_tables.php')) { $TABLE = array(); include $_FILE . '_tables.php'; /*noLibHook*/ if (is_array($TABLE) and count($TABLE)) { $output[] = $next['title'] . ": Создание таблиц"; foreach ($TABLE as $q) { preg_match("/CREATE TABLE (\\S+)(\\s)?\\(/", $q, $match); if ($match[1]) { $this->DB->dropTable(str_replace(IPSSetUp::getSavedData('db_pre'), '', $match[1])); } if ($extra_install and method_exists($extra_install, 'process_query_create')) { $q = $extra_install->process_query_create($q); } $this->DB->allow_sub_select = 1; $this->DB->error = ''; $this->DB->query($q); if ($this->DB->error) { $this->registry->output->addError(nl2br($q) . "<br /><br />" . $this->DB->error); } } } } //--------------------------------------------- // Create the fulltext index... //--------------------------------------------- if ($this->DB->checkFulltextSupport()) { if (is_file($_FILE . '_fulltext.php')) { $INDEX = array(); include $_FILE . '_fulltext.php'; /*noLibHook*/ if (is_array($INDEX) and count($INDEX)) { $output[] = $next['title'] . ": Создание индексов"; foreach ($INDEX as $q) { //--------------------------------------------- // Pass to handler //--------------------------------------------- if ($extra_install and method_exists($extra_install, 'process_query_index')) { $q = $extra_install->process_query_index($q); } //--------------------------------------------- // Pass query //--------------------------------------------- $this->DB->allow_sub_select = 1; $this->DB->error = ''; $this->DB->query($q); if ($this->DB->error) { $this->registry->output->addError(nl2br($q) . "<br /><br />" . $this->DB->error); } } } } } //----------------------------------------- // INSERTS //----------------------------------------- if (is_file($_FILE . '_inserts.php')) { $INSERT = array(); include $_FILE . '_inserts.php'; /*noLibHook*/ if (is_array($INSERT) && count($INSERT)) { $output[] = $next['title'] . ": Наполнение таблиц"; foreach ($INSERT as $q) { $q = str_replace("<%time%>", time(), $q); $q = str_replace('<%admin_name%>', IPSSetUp::getSavedData('admin_user'), $q); $q = str_replace('<%admin_seoname%>', IPSText::makeSeoTitle(IPSSetUp::getSavedData('admin_user')), $q); //--------------------------------------------- // Pass to handler //--------------------------------------------- if ($extra_install and method_exists($extra_install, 'process_query_insert')) { $q = $extra_install->process_query_insert($q); } $this->DB->allow_sub_select = 1; $this->DB->error = ''; $this->DB->query($q); if ($this->DB->error) { $this->registry->output->addError(nl2br($q) . "<br /><br />" . $this->DB->error); } } } } //----------------------------------------- // Sort out groups // This has to be here so the applications // can populate group settings appropriately //----------------------------------------- if ($next['key'] == 'core') { $output[] = "Добавление информации о группах..."; $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'); foreach ($xml->fetchElements('row') as $xmlelement) { $data = $xml->fetchElementsFromRecord($xmlelement); $this->DB->insert('groups', $data); } if ($extra_install and method_exists($extra_install, 'after_inserts_run')) { $q = $extra_install->after_inserts_run('groups'); } } //----------------------------------------- // Done.. so get some more! //----------------------------------------- $output = (is_array($output) and count($output)) ? $output : array(0 => $next['title'] . ": Наполнение таблиц завершено"); $this->_finishStep($output, "Установка: SQL", 'install&do=sql&previous=' . $next['key']); } else { //----------------------------------------- // NO MORE TO INSTALL //----------------------------------------- $output[] = "Действия SQL завершены"; IPSInstall::createAdminAccount(); //----------------------------------------- // Next... //----------------------------------------- $output = (is_array($output) and count($output)) ? $output : array(0 => $next['title'] . ": Наполнение таблиц завершено"); $this->_finishStep($output, "Установка: SQL", 'install&do=sql_steps'); } }
/** * Add <html> tags and such if it doesn't have any already * * @param string Subject * @param string HTML email * @return string VERY HTML email */ public function applyHtmlWrapper($subject, $content) { $unsubscribe = ''; if ($this->unsubscribe) { $unsubscribe = " · <#UNSUBSCRIBE#>"; } /* Due to some legacy methods with mail queue, buildMessage can be called twice * for good reason, but it can then re-apply the wrapper. So we add a unique comment * and then check for this. */ if (!stristr($content, '<!--ipb.wrapper.added-->')) { $content = '<!--ipb.wrapper.added-->' . $content; /* Inline wrapper */ if ($this->htmlWrapper) { return str_ireplace('<#content#>', $content, $this->htmlWrapper); } /* Attempt to load external wrapper */ if (!is_object($this->_loadedHtmlTemplateClass)) { if (!is_file(IPS_CACHE_PATH . 'cache/skin_cache/system/emailWrapper.php')) { require_once IPS_ROOT_PATH . 'sources/classes/output/systemTemplates.php'; $systemTemplates = new systemTemplates(); $systemTemplates->writeDefaults(); } /* Still nothing? */ if (!is_file(IPS_CACHE_PATH . 'cache/skin_cache/system/emailWrapper.php')) { /* Still here? Fail safe */ return $this->parseWithDefaultHtmlWrapper($content); } $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/output/systemTemplates.php', 'systemTemplates'); $systemTemplates = new $classToLoad(); $this->_loadedHtmlTemplateClass = $systemTemplates->getClass('emailWrapper'); } return $this->_loadedHtmlTemplateClass->getTemplate($content, $unsubscribe, ipsRegistry::$settings); } return $content; }