Esempio n. 1
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');
 }
 /**
  * Recaches calendars
  *
  * @access	private
  * @return	void
  */
 private function calendarCallRecache()
 {
     require_once IPS_ROOT_PATH . 'applications_addon/ips/calendar/modules_admin/calendar/calendars.php';
     $calendars = new admin_calendar_calendar_calendars($this->registry);
     $calendars->makeRegistryShortcuts($this->registry);
     $calendars->calendarRebuildCache(0);
 }
 /**
  * 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');
 }
 /**
  * Grab the RSS document content and return it
  *
  * @access	public
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cal_id = intval(ipsRegistry::$request['id']);
     $rss_data = array();
     $to_print = '';
     $this->expires = time();
     //-----------------------------------------
     // Get RSS export
     //-----------------------------------------
     $rss_data = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'cal_calendars', 'where' => 'cal_id=' . $cal_id));
     //-----------------------------------------
     // Got one?
     //-----------------------------------------
     if ($rss_data['cal_id'] and $rss_data['cal_rss_export']) {
         //-----------------------------------------
         // Correct expires time
         //-----------------------------------------
         $this->expires = $this->expires + $rss_data['cal_rss_update'] * 60;
         //-----------------------------------------
         // Need to recache?
         //-----------------------------------------
         $time_check = time() - $rss_data['cal_rss_update'] * 60;
         if (!$rss_data['cal_rss_cache'] or $time_check > $rss_data['cal_rss_update_last']) {
             //-----------------------------------------
             // Yes
             //-----------------------------------------
             define('IN_ACP', 1);
             require_once IPSLib::getAppDir('calendar') . '/modules_admin/calendar/calendars.php';
             $rss_export = new admin_calendar_calendar_calendars();
             $rss_export->makeRegistryShortcuts(ipsRegistry::instance());
             return $rss_export->calendarRSSCache($rss_data['cal_id'], 0);
         } else {
             //-----------------------------------------
             // No
             //-----------------------------------------
             return $rss_data['cal_rss_cache'];
         }
     }
 }
 /**
  * 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');
     }
 }