Exemplo n.º 1
0
 /**
  * Install templates
  *
  * @return	@e void
  */
 public function templates()
 {
     /* INIT */
     $vars = $this->getVars();
     $output = array();
     $errors = array();
     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);
     $skinCaching = new skinCaching($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;
     }
     foreach ($skinSets as $skinKey => $skinData) {
         /* Skin files first */
         if (is_file($this->app_full_path . 'xml/' . $vars['app_directory'] . '_' . $skinKey . '_templates.xml')) {
             $return = $skinFunctions->importTemplateAppXML($vars['app_directory'], $skinKey, $skinData['set_id'], TRUE);
             $output[] = sprintf($this->lang->words['redir__templates'], $return['insertCount'], $return['updateCount'], $skinData['set_name']);
         }
         /* Then CSS files */
         if (is_file($this->app_full_path . 'xml/' . $vars['app_directory'] . '_' . $skinKey . '_css.xml')) {
             //-----------------------------------------
             // Install
             //-----------------------------------------
             $return = $skinFunctions->importCSSAppXML($vars['app_directory'], $skinKey, $skinData['set_id']);
             $output[] = sprintf($this->lang->words['redir__cssfiles'], $return['insertCount'], $return['updateCount'], $skinData['set_name']);
         }
         /* And we can support replacements for good measure */
         if (is_file($this->app_full_path . 'xml/' . $vars['app_directory'] . '_replacements.xml')) {
             //-----------------------------------------
             // Install
             //-----------------------------------------
             $return = $skinFunctions->importReplacementsXMLArchive(file_get_contents($this->app_full_path . 'xml/' . $vars['app_directory'] . '_replacements.xml'), $skinKey);
             $output[] = $this->lang->words['redir__replacements'];
         }
     }
     /* Recache */
     //$skinCaching->rebuildPHPTemplates( 0 );
     //$skinCaching->rebuildCSS( 0 );
     //$skinCaching->rebuildReplacementsCache( 0 );
     /* No templates?  Give some sort of feedback */
     if (!count($output)) {
         $output[] = $this->lang->words['redir__no_templates'];
     }
     /* Show redirect... */
     $this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('languages', $vars));
 }
Exemplo n.º 2
0
 /**
  * Install templates
  *
  * @return void
  */
 public function install_templates()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $previous = $_REQUEST['previous'];
     //-----------------------------------------
     // Fetch next 'un
     //-----------------------------------------
     $next = IPSSetUp::fetchNextApplication($previous, '', $this->settings['gb_char_set']);
     /* Set up DB driver */
     $extra_install = $this->_setUpDBDriver(FALSE);
     /* 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');
         $order = 0;
         foreach ($xml->fetchElements('set') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             /* Ensure we have an order */
             $data['set_order'] = intval($order);
             $order++;
             $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')) {
                 //-----------------------------------------
                 // Adjust the table?
                 //-----------------------------------------
                 if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
                     $q = $extra_install->before_inserts_run('templates');
                 }
                 //-----------------------------------------
                 // Install
                 //-----------------------------------------
                 $return = $skinFunctions->importTemplateAppXML($next['key'], $skinKey, $skinData['set_id'], TRUE);
                 $output[] = $next['title'] . ": " . intval($return['insertCount']) . " шаблонов добавлено";
                 //-----------------------------------------
                 // Adjust the table?
                 //-----------------------------------------
                 if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
                     $q = $extra_install->after_inserts_run('templates');
                 }
             }
             if (is_file($_PATH . $next['key'] . '_' . $skinKey . '_css.xml')) {
                 //-----------------------------------------
                 // Adjust the table?
                 //-----------------------------------------
                 if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
                     $q = $extra_install->before_inserts_run('css');
                 }
                 //-----------------------------------------
                 // Install
                 //-----------------------------------------
                 $return = $skinFunctions->importCSSAppXML($next['key'], $skinKey, $skinData['set_id']);
                 $output[] = $next['title'] . ": " . intval($return['insertCount']) . " CSS файлов {$skinData['set_name']} добавлено";
                 //-----------------------------------------
                 // Adjust the table?
                 //-----------------------------------------
                 if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
                     $q = $extra_install->after_inserts_run('css');
                 }
             }
         }
         //-----------------------------------------
         // Done.. so get some more!
         //-----------------------------------------
         $this->_finishStep($output, "Установка: Шаблоны", 'install&do=templates&previous=' . $next['key']);
     } else {
         //-----------------------------------------
         // Recache templates
         //-----------------------------------------
         $output[] = "Добавление макросов";
         foreach ($skinSets as $skinKey => $skinData) {
             /* Replacements */
             $skinFunctions->importReplacementsXMLArchive(file_get_contents(IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml'), $skinKey);
         }
         $skinFunctions->rebuildSkinSetsCache();
         $output[] = "Шаблоны установлены";
         $this->_finishStep($output, "Установка: Шаблоны", 'install&do=tasks');
     }
 }
Exemplo n.º 3
0
 /**
  * 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[] = "Кеширование шаблонов";
         foreach ($skinSets as $skinKey => $skinData) {
             /* Replacements */
             if (is_file(IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml')) {
                 $skinFunctions->importReplacementsXMLArchive(file_get_contents(IPS_ROOT_PATH . 'setup/xml/skins/replacements_' . $skinKey . '.xml'), $skinKey);
             }
         }
         $skinFunctions->rebuildMobileSkinUserAgentsFromSetDataXml();
         $skinFunctions->rebuildSkinSetsCache();
         $output[] = "Все шаблоны обновлены";
         $this->_finishStep($output, "Обновление: Шаблоны", 'upgrade&do=tasks');
     }
 }
 /**
  * Install templates
  *
  * @return void
  */
 public function install_templates()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $previous = $_REQUEST['previous'];
     if (file_exists(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';
         $extra_install = new install_extra($this->registry);
     }
     //-----------------------------------------
     // Fetch next 'un
     //-----------------------------------------
     $next = IPSSetUp::fetchNextApplication($previous);
     /* Got any skin sets? */
     $count = $this->DB->buildAndFetch(array('select' => 'count(*) as count', 'from' => 'skin_collections'));
     if (!$count['count']) {
         //-----------------------------------------
         // Next...
         //-----------------------------------------
         $output[] = "Inserting template set data...";
         require_once IPS_KERNEL_PATH . 'classXML.php';
         $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_PUBLIC_PATH . 'resources/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';
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php';
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinImportExport.php';
     $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'] . ": Upgrading {$skinData['set_name']} templates...";
             if (file_exists($_PATH . $next['key'] . '_' . $skinKey . '_templates.xml')) {
                 //-----------------------------------------
                 // Install
                 //-----------------------------------------
                 $return = $skinFunctions->importTemplateAppXML($next['key'], $skinKey, $skinData['set_id'], TRUE);
                 $output[] = $next['title'] . ": " . intval($return['insertCount']) . " templates inserted";
             }
             if (file_exists($_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 files inserted";
             }
         }
         //-----------------------------------------
         // Done.. so get some more!
         //-----------------------------------------
         $this->_finishStep($output, "Upgrade: Templates", 'upgrade&do=templates&previous=' . $next['key']);
     } else {
         //-----------------------------------------
         // Recache templates
         //-----------------------------------------
         $output[] = "Recaching templates...";
         foreach ($skinSets as $skinKey => $skinData) {
             /* Replacements */
             if (file_exists(IPS_PUBLIC_PATH . 'resources/skins/replacements_' . $skinKey . '.xml')) {
                 $skinFunctions->importReplacementsXMLArchive(file_get_contents(IPS_PUBLIC_PATH . 'resources/skins/replacements_' . $skinKey . '.xml'));
             }
         }
         $skinFunctions->rebuildSkinSetsCache();
         $output[] = "All templates upgraded";
         $this->_finishStep($output, "Upgrade: Templates", 'upgrade&do=tasks');
     }
 }