/**
  * Import Hooks
  *
  * @access	public
  * @return	void
  **/
 public function hooks()
 {
     /* INIT */
     $vars = $this->getVars();
     $output = array();
     $errors = array();
     $knownSettings = array();
     $this->registry->class_localization->loadLanguageFile(array('admin_tools'));
     if (file_exists($this->app_full_path . 'xml/hooks.xml')) {
         /* Get the hooks class */
         require_once IPS_ROOT_PATH . 'applications/core/modules_admin/applications/hooks.php';
         $hooks = new admin_core_applications_hooks();
         $hooks->makeRegistryShortcuts($this->registry);
         $return = $hooks->installAppHooks($vars['app_directory']);
         $this->cache->rebuildCache('hooks', 'global');
         $output[] = sprintf($this->lang->words['redir__hooks'], $return['inserted'], $return['updated']);
     } else {
         $this->registry->output->global_message = $this->lang->words['hooks_nofile'];
         $output[] = $this->registry->output->global_message;
     }
     /* Clear main messaage */
     $this->registry->output->global_message = '';
     /* Show redirect... */
     $this->showRedirectScreen($vars['app_directory'], $output, $errors, $this->getNextURL('tplcache', $vars));
 }
Пример #2
0
 /**
  * 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']);
     //-----------------------------------------
     // Insert tasks
     //-----------------------------------------
     if ($next['key']) {
         $output[] = $next['title'] . ": Обновление модификаций";
         $_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
         if (is_file($_PATH . 'hooks.xml')) {
             //-----------------------------------------
             // 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'] . " модификаций, обновлено " . $result['updated'];
         }
         //-----------------------------------------
         // Done.. so get some more!
         //-----------------------------------------
         $this->_finishStep($output, "Обновление: Модификации", 'upgrade&do=other&previous=' . $next['key']);
     } else {
         //-----------------------------------------
         // ****** USER AGENTS
         //-----------------------------------------
         $output[] = "Добавление user-agent`ов по-умолчанию";
         require_once IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php';
         /*noLibHook*/
         $userAgentFunctions = new userAgentFunctions($this->registry);
         $userAgentFunctions->rebuildMasterUserAgents();
         //-----------------------------------------
         // Next...
         //-----------------------------------------
         $this->_finishStep($output, "Обновление: Другие данные", 'upgrade&do=caches');
     }
 }
 /**
  * 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');
         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');
         }
         //-----------------------------------------
         // ****** ATTACHMENTS
         //-----------------------------------------
         $output[] = "Inserting attachment type information...";
         if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
             $q = $extra_install->before_inserts_run('attachments');
         }
         $xml = new classXML(IPSSetUp::charSet);
         $xml->load(IPS_ROOT_PATH . 'setup/xml/attachments.xml');
         foreach ($xml->fetchElements('attachtype') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             unset($data['atype_id']);
             $this->DB->insert('attachments_type', $data);
         }
         if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
             $q = $extra_install->after_inserts_run('attachments');
         }
         //-----------------------------------------
         // Build Calendar RSS
         //-----------------------------------------
         if (IPSLib::appIsInstalled('calendar')) {
             require_once IPSLib::getAppDir('calendar') . '/modules_admin/calendar/calendars.php';
             $cal = new admin_calendar_calendar_calendars();
             $cal->makeRegistryShortcuts($this->registry);
             $output[] = "Building calendar RSS...";
             $cal->calendarRSSCache();
         }
         /* If this is windows, change the locale for the language pack */
         if (strpos(strtolower(PHP_OS), 'win') === 0) {
             $this->DB->update('core_sys_lang', array('lang_short' => 'en-US'), 'lang_id=1');
         } else {
             $this->DB->update('core_sys_lang', array('lang_short' => 'en_US'), 'lang_id=1');
         }
     }
     //-----------------------------------------
     // Next...
     //-----------------------------------------
     $this->_finishStep($output, "Install: Other Data", 'install&do=caches');
 }
Пример #4
0
 /**
  * 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')) {
             $q = $extra_install->before_inserts_run('attachments');
         }
         $xml = new classXML(IPSSetUp::charSet);
         $xml->load(IPS_ROOT_PATH . 'setup/xml/attachments.xml');
         foreach ($xml->fetchElements('attachtype') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             unset($data['atype_id']);
             $this->DB->insert('attachments_type', $data);
         }
         if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
             $q = $extra_install->after_inserts_run('attachments');
         }
         //-----------------------------------------
         // Build Calendar RSS
         //-----------------------------------------
         if (IPSLib::appIsInstalled('calendar')) {
             require_once IPSLib::getAppDir('calendar') . '/modules_admin/calendar/calendars.php';
             /*noLibHook*/
             $cal = new admin_calendar_calendar_calendars();
             $cal->makeRegistryShortcuts($this->registry);
             $output[] = "Обновление RSS календаря";
             $cal->calendarRSSCache();
         }
         /* If this is windows, change the locale for the language pack */
         if (strpos(strtolower(PHP_OS), 'win') === 0) {
             $this->DB->update('core_sys_lang', array('lang_short' => 'Russian_Russia.65001'), 'lang_id=1');
         } else {
             $this->DB->update('core_sys_lang', array('lang_short' => 'ru_RU.UTF-8'), 'lang_id=1');
         }
     }
     //-----------------------------------------
     // Next...
     //-----------------------------------------
     $this->_finishStep($output, "Установка: Другие данные", 'install&do=caches');
 }
 /**
  * Install Other stuff
  *
  * @return void
  */
 public function install_other()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $previous = $_REQUEST['previous'];
     //-----------------------------------------
     // HOOKS: Fetch next 'un
     //-----------------------------------------
     $next = IPSSetUp::fetchNextApplication($previous, 'hooks.xml');
     //-----------------------------------------
     // Insert tasks
     //-----------------------------------------
     if ($next['key']) {
         $output[] = $next['title'] . ": Updating hooks...";
         $_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
         if (file_exists($_PATH . 'hooks.xml')) {
             //-----------------------------------------
             // 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[] = $next['title'] . " hooks: " . $result['inserted'] . " inserted, " . $result['updated'] . " updated";
         }
         //-----------------------------------------
         // Done.. so get some more!
         //-----------------------------------------
         $this->_finishStep($output, "Upgrade: Hook", 'upgrade&do=other&previous=' . $next['key']);
     } else {
         //-----------------------------------------
         // ****** USER AGENTS
         //-----------------------------------------
         $output[] = "Inserting default user agents...";
         require_once IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php';
         $userAgentFunctions = new userAgentFunctions($this->registry);
         $userAgentFunctions->rebuildMasterUserAgents();
         //-----------------------------------------
         // Build Calendar RSS
         //-----------------------------------------
         if (IPSLib::appIsInstalled('calendar')) {
             require_once IPSLib::getAppDir('calendar') . '/modules_admin/calendar/calendars.php';
             $cal = new admin_calendar_calendar_calendars();
             $cal->makeRegistryShortcuts($this->registry);
             $output[] = "Building calendar RSS...";
             $cal->calendarRSSCache();
         }
         //-----------------------------------------
         // Next...
         //-----------------------------------------
         $this->_finishStep($output, "Upgrade: Other Data", 'upgrade&do=caches');
     }
 }