示例#1
0
 /**
  * Main entry point
  *
  * @param	object		ipsRegistry reference
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Load lang and skin */
     $this->registry->class_localization->loadLanguageFile(array('admin_tools'));
     $this->html = $this->registry->output->loadTemplate('cp_skin_tools');
     /* URLs */
     $this->form_code = $this->html->form_code = 'module=tools&section=licensekey';
     $this->form_code_js = $this->html->form_code_js = 'module=tools&section=licensekey';
     /* What to do */
     switch ($this->request['do']) {
         case 'activate':
             $this->activate();
             break;
         case 'remove':
             IPSLib::updateSettings(array('ipb_reg_number' => ''));
             $this->settings['ipb_reg_number'] = '';
             // Deliberately no break as we'll do onto recahce and then default action
         // Deliberately no break as we'll do onto recahce and then default action
         case 'refresh':
             $this->recache();
             // Deliberately no break as we'll go on to the default action
         // Deliberately no break as we'll go on to the default action
         default:
             if ($this->settings['ipb_reg_number']) {
                 $this->overview();
             } else {
                 $this->activateForm();
             }
     }
     /* Output */
     $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
     $this->registry->output->sendOutput();
 }
示例#2
0
 /**
  * Save Settings
  */
 public function saveSettings()
 {
     if (isset(ipsRegistry::$request['viglink_manual'])) {
         IPSLib::updateSettings(array('viglink_enabled' => '1', 'viglink_api_key' => ipsRegistry::$request['viglink_api_key'], 'viglink_subid' => ''));
     } else {
         $json = $this->_makeApiCall();
         IPSLib::updateSettings(array('viglink_enabled' => '1', 'viglink_api_key' => $json['API_KEY'], 'viglink_subid' => $json['SUBID']));
     }
     ipsRegistry::getClass('output')->silentRedirect(ipsRegistry::$settings['_base_url'] . "app=core&module=applications&section=enhancements&do=edit&service=enhancements_core_viglink");
     return;
 }
 /**
  * Sets style last updated
  * @param	string	(Optional dir)
  */
 public function setStyleLastUpdated($time = 0)
 {
     $this->_styleLastUpdated = $time ? $time : intval(ipsRegistry::$settings['style_last_updated']);
     /* Do we need to update the setting? */
     if ($time && $time > ipsRegistry::$settings['style_last_updated']) {
         /* Rebuild DB */
         $this->_refreshDatabase();
         /* Update setting */
         IPSLib::updateSettings(array('style_last_updated' => $time + 1));
         /* Flsuh cache */
         $this->_flushCache();
     }
 }
示例#4
0
 /**
  * Main class entry point
  *
  * @access	public
  * @param	object		ipsRegistry 
  * @return	void
  */
 public function doExecute(ipsRegistry $registry)
 {
     $this->html = $this->registry->output->loadTemplate('cp_skin_convert');
     switch ($this->request['do']) {
         case 'save':
             IPSLib::updateSettings(array('conv_current' => $this->request['choice']));
             $this->registry->output->silentRedirect($this->settings['base_url'] . 'app=convert&module=setup&section=switch');
             break;
         default:
             $this->show_choices();
             break;
     }
     $this->registry->output->html .= $this->html->convertFooter();
     $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
     $this->registry->output->sendOutput();
     exit;
 }
示例#5
0
 /**
  * Check License Key
  *
  * @access	public
  * @return	bool
  */
 private function check($init = FALSE)
 {
     $this->request['lkey'] = $init ? ipsRegistry::$settings['ipb_reg_number'] : trim($this->request['lkey']);
     if (!$this->request['lkey'] and !$init) {
         return true;
     }
     $url = ipsRegistry::$settings['board_url'] ? ipsRegistry::$settings['board_url'] : ipsRegistry::$settings['base_url'];
     require_once IPS_KERNEL_PATH . 'classFileManagement.php';
     /*noLibHook*/
     $query = new classFileManagement();
     $response = $query->getFileContents("http://license.invisionpower.com/?a=check&key={$this->request['lkey']}&url={$url}");
     $response = json_decode($response, true);
     if ($response['result'] != 'ok') {
         if ($this->request['ignoreError']) {
             return TRUE;
         } else {
             return "License key check failed. Click next to continue anyway.";
         }
     } else {
         IPSLib::updateSettings(array('ipb_reg_number' => $this->request['lkey']));
         return TRUE;
     }
 }
示例#6
0
文件: smf.php 项目: mover5/imobackup
 /**
  * Convert custom profile fields
  *
  * @access	private
  * @return void
  **/
 private function convert_pfields()
 {
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => '*', 'from' => 'custom_fields', 'order' => 'id_field ASC');
     $loop = $this->lib->load('pfields', $main, array('pfields_groups'));
     $get = unserialize($this->settings['conv_extra']);
     $us = $get[$this->lib->app['name']];
     if (!$this->request['st']) {
         $us['pfield_group'] = null;
         IPSLib::updateSettings(array('conv_extra' => serialize($us)));
     }
     //-----------------------------------------
     // Do we have a group
     //-----------------------------------------
     if (!$us['pfield_group']) {
         $group = $this->lib->convertPFieldGroup(1, array('pf_group_name' => 'Converted', 'pf_group_key' => 'smf'), true);
         if (!$group) {
             $this->lib->error('There was a problem creating the profile field group');
         }
         $us['pfield_group'] = $group;
         $get[$this->lib->app['name']] = $us;
         IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     }
     //---------------------------
     // Loop
     //---------------------------
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         $content = '';
         $type = '';
         // What kind of field is this
         if ($row['field_type'] == 'textarea') {
             $type = 'textarea';
         } elseif ($row['field_type'] == 'select') {
             $type = 'drop';
             $options = explode(',', $row['field_options']);
             $save_options = array();
             foreach ($options as $key => $value) {
                 $us['pfields_values'][$row['col_name']][$value] = $key;
                 $save_options[] = "{$key}={$value}";
             }
             $content = implode('|', $save_options);
         } elseif ($row['field_type'] == 'radio') {
             $type = 'radio';
             $options = explode(',', $row['field_options']);
             $save_options = array();
             foreach ($options as $key => $value) {
                 $us['pfields_values'][$row['col_name']][$value] = $key;
                 $save_options[] = "{$key}={$value}";
             }
             $content = implode('|', $save_options);
         } elseif ($row['field_type'] == 'check') {
             $type = 'drop';
             $content = implode('|', array('1=Yes', '0=No'));
         } else {
             $type = 'input';
         }
         // Privacy
         switch ($row['private']) {
             case 1:
                 $hide = 0;
                 $edit = 0;
                 $admin = 0;
                 break;
             case 2:
                 $hide = 1;
                 $edit = 0;
                 $admin = 0;
                 break;
             case 3:
                 $hide = 1;
                 $edit = 0;
                 $admin = 1;
                 break;
             default:
                 $hide = 0;
                 $edit = 1;
                 $admin = 0;
                 break;
         }
         // Insert?
         $save = array('pf_title' => $row['field_name'], 'pf_desc' => $row['field_desc'], 'pf_content' => $content, 'pf_type' => $type, 'pf_not_null' => $row['show_reg'] == 2 ? 1 : 0, 'pf_member_hide' => $hide, 'pf_max_input' => $row['field_length'], 'pf_member_edit' => $edit, 'pf_show_on_reg' => (bool) $row['show_reg'], 'pf_admin_only' => $admin, 'pf_group_id' => $us['pfield_group'], 'pf_key' => $row['col_name']);
         $this->lib->convertPField($row['id_field'], $save);
         // Save
         $us['pfield_data'][$row['col_name']] = $row['id_field'];
     }
     // Save pfield_data
     $get[$this->lib->app['name']] = $us;
     IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     // Next, please!
     $this->lib->next();
 }
示例#7
0
 /**
  * Archive Toggle
  *
  * @return	@e void
  */
 protected function _archiveToggle()
 {
     /* Update */
     IPSLib::updateSettings(array('archive_on' => $this->settings['archive_on'] ? 0 : 1));
     /* Done */
     $this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . $this->form_code . 'do=overview', TRUE);
 }
示例#8
0
文件: ning.php 项目: mover5/imobackup
 /**
  * Convert Posts
  *
  * @access	private
  * @return void
  **/
 private function convert_posts()
 {
     //---------------------------
     // Set up
     //---------------------------
     $loop = $this->lib->load('posts', FALSE);
     $discussionData = $this->_parseDiscussionListFile();
     //---------------------------
     // Loop
     //---------------------------
     foreach ($discussionData as $row) {
         // Get member name
         $memberId = $this->lib->getLink($row->contributorName, 'members', TRUE);
         if ($memberId) {
             $member = $this->DB->buildAndFetch(array('select' => 'members_display_name', 'from' => 'members', 'where' => "member_id='{$memberId}'"));
         }
         $topic_id = explode(':', $row->id);
         // Convert topic first post
         $save = array('author_id' => $row->contributorName, 'author_name' => $member['members_display_name'], 'use_sig' => 1, 'use_emo' => 1, 'ip_address' => '127.0.0.1', 'post_date' => strtotime($row->createdDate), 'post' => $this->fixPostData($row->description), 'queued' => 0, 'topic_id' => $topic_id[2]);
         $this->lib->convertPost($row->id, $save);
         if (!isset($row->comments)) {
             continue;
         }
         // Cycle topic reply posts
         foreach ($row->comments as $post) {
             $memberId = $this->lib->getLink($post->contributorName, 'members', TRUE);
             if ($memberId) {
                 $member = $this->DB->buildAndFetch(array('select' => 'members_display_name', 'from' => 'members', 'where' => "member_id='{$memberId}'"));
             }
             $post_id = explode(':', $post->id);
             $save = array('author_id' => $post->contributorName, 'author_name' => $member['members_display_name'], 'use_sig' => 1, 'use_emo' => 1, 'post_htmlstate' => 1, 'ip_address' => '127.0.0.1', 'post_date' => strtotime($post->createdDate), 'post' => $this->fixPostData($post->description), 'queued' => 0, 'topic_id' => $topic_id[2]);
             $this->lib->convertPost($post_id[2], $save);
         }
     }
     // Save that it's been completed
     $get = unserialize($this->settings['conv_completed']);
     $us = $get[$this->lib->app['name']];
     $us = is_array($us) ? $us : array();
     if (empty($this->lib->errors)) {
         $us = array_merge($us, array('posts' => true));
     } else {
         $us = array_merge($us, array('posts' => 'e'));
     }
     $get[$this->lib->app['name']] = $us;
     IPSLib::updateSettings(array('conv_completed' => serialize($get)));
     // Display
     if (!empty($this->lib->errors)) {
         $es = 'The following errors occurred: <ul>';
         foreach ($this->lib->errors as $e) {
             $es .= "<li>{$e}</li>";
         }
         $es .= '</ul>';
     } else {
         $es = 'No problems found.';
     }
     $info = $this->lib->menuRow('posts');
     $this->registry->output->html .= $this->lib->html->convertComplete($info['name'] . ' Conversion Complete.', array($es, $info['finish']));
     $this->sendOutput();
 }
示例#9
0
 public function next()
 {
     $this->runQueries();
     if ($this->usingKeys !== TRUE) {
         parent::next();
     }
     $total = $this->request['total'];
     $pc = round(100 / $total * $this->end);
     $message = $pc > 100 ? 'Finishing...' : "{$pc}% complete";
     // super hacky but I don't want to just ditch db logging altogether so let's just stop it for strict peoples.
     $isStrict = $this->DB->query('SELECT @@sql_mode');
     if (empty($isStrict)) {
         IPSLib::updateSettings(array('conv_error' => serialize($this->errors)));
     }
     $end = $this->end > $total ? $total : $this->end;
     //print "{$this->settings['base_url']}app=convert&module={$this->app['sw']}&section={$this->app['app_key']}&do={$this->request['do']}&lastKey=" . urlencode($this->lastKey) . "&count={$this->end}&cycle={$this->request['cycle']}&total={$total}<br />{$end} of {$total} converted<br />{$message}";exit;
     $this->registry->output->html .= $this->registry->output->global_template->temporaryRedirect("{$this->settings['base_url']}app=convert&module={$this->app['sw']}&section={$this->app['app_key']}&do={$this->request['do']}&lastKey=" . urlencode($this->lastKey) . "&count={$this->end}&cycle={$this->request['cycle']}&total={$total}&empty={$this->request['empty']}", "<strong>{$end} of {$total} converted</strong><br />{$message}<br /><br /><strong><a href='{$this->settings['base_url']}app=convert&module={$this->app['sw']}&section={$this->app['app_key']}&do={$this->request['do']}&st={$this->end}&cycle={$this->request['cycle']}&total={$total}'>Click here if you are not redirected.</a></strong>");
     $this->sendOutput();
 }
示例#10
0
 /**
  * Shows the cron information screen
  *
  * @return	@e void
  */
 public function showCronPage()
 {
     if (!$this->settings['task_cron_key']) {
         $this->settings['task_cron_key'] = md5(uniqid());
     }
     if (isset($this->request['toggle'])) {
         $this->settings['task_use_cron'] = intval($this->request['toggle']);
     }
     IPSLib::updateSettings(array('task_cron_key' => $this->settings['task_cron_key'], 'task_use_cron' => $this->settings['task_use_cron']));
     if (isset($this->request['toggle'])) {
         $this->registry->output->global_message = $this->lang->words['task_cron_mode_toggled_' . $this->settings['task_use_cron']];
         $this->taskManagerOverview();
     } else {
         $this->registry->output->html .= $this->html->taskCrons();
     }
 }
示例#11
0
 /**
  * Execute selected method
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     IPSLib::updateSettings(array('ipb_reg_number' => darkLAE::getLicenseKey()));
     $this->registry->autoLoadNextAction('upgrade');
 }
示例#12
0
 /**
  * Convert custom profile fields
  *
  * @access	private
  * @return void
  **/
 private function convert_pfields()
 {
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => '*', 'from' => 'user_field', 'order' => 'field_id ASC');
     $loop = $this->lib->load('pfields', $main, array('pfields_groups'));
     $get = unserialize($this->settings['conv_extra']);
     $us = $get[$this->lib->app['name']];
     if (!$this->request['st']) {
         $us['pfield_group'] = null;
         IPSLib::updateSettings(array('conv_extra' => serialize($us)));
     }
     //-----------------------------------------
     // Do we have a group
     //-----------------------------------------
     if (!$us['pfield_group']) {
         $group = $this->lib->convertPFieldGroup(1, array('pf_group_name' => 'Converted', 'pf_group_key' => 'xenforo'), true);
         if (!$group) {
             $this->lib->error('There was a problem creating the profile field group');
         }
         $us['pfield_group'] = $group;
         $get[$this->lib->app['name']] = $us;
         IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     }
     //---------------------------
     // Loop
     //---------------------------
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         // get data
         $data = array();
         if ($row['field_choices']) {
             $tmpData = unserialize($row['field_choices']);
             if (is_array($tmpData)) {
                 foreach ($tmpData as $key => $value) {
                     $data[] = "{$key}={$value}";
                 }
             }
         }
         // What kind of field is this?
         $e = explode("\n", $row['field_type']);
         switch ($e[0]) {
             case 'textbox':
                 $type = 'textarea';
                 break;
             case 'select':
                 $type = 'drop';
                 break;
             case 'radio':
                 $type = 'radio';
                 break;
             default:
                 $type = 'input';
                 break;
         }
         // make our name make sense
         $name = str_replace('_', ' ', $row['field_id']);
         $name = ucwords($name);
         // Insert
         $save = array('pf_title' => $name, 'pf_content' => implode('|', $data), 'pf_type' => $type, 'pf_not_null' => $row['required'], 'pf_member_hide' => $row['viewable_profile'] == '1' ? 0 : 1, 'pf_max_input' => $row['max_length'], 'pf_member_edit' => $row['user_editable'], 'pf_position' => $row['display_order'], 'pf_show_on_reg' => $row['show_registration'], 'pf_group_id' => $us['pfield_group'], 'pf_key' => $row['field_id']);
         $this->lib->convertPField($row['field_id'], $save);
     }
     // Save pfield_data
     $get[$this->lib->app['name']] = $us;
     IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     // Next, please!
     $this->lib->next();
 }
示例#13
0
 /**
  * Saves um.. it
  *
  * @return	@e void		[Outputs to screen/redirects]
  */
 protected function _save()
 {
     /* Init */
     $webdav_on = intval($this->request['webdav_on']);
     /* Save */
     IPSLib::updateSettings(array('webdav_on' => $webdav_on));
     /* Relist */
     $this->registry->output->silentRedirect("{$this->settings['base_url']}{$this->html->form_code}");
 }
 /**
  * Uninstall a login method
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _loginUninstall()
 {
     //--------------------------------------------
     // INIT
     //--------------------------------------------
     $login_id = intval(ipsRegistry::$request['login_id']);
     $login = $this->DB->buildAndFetch(array('select' => 'login_id, login_enabled, login_folder_name', 'from' => 'login_methods', 'where' => 'login_id=' . $login_id));
     if (!$login['login_id']) {
         ipsRegistry::getClass('output')->global_message = $this->lang->words['l_404'];
         $this->_loginList();
         return;
     }
     $this->DB->delete('login_methods', 'login_id=' . $login_id);
     if ($login['login_folder_name'] == 'ipconverge') {
         IPSLib::updateSettings(array('ipconverge_enabled' => 0));
     }
     //-----------------------------------------
     // Recache
     //-----------------------------------------
     $this->loginsRecache();
     ipsRegistry::getClass('output')->global_message = $this->lang->words['l_uninstalled'];
     $this->_loginList();
 }
示例#15
0
 /**
  * Enable the converter's login method
  *
  * @access	private
  * @return	void
  */
 private function enableLogin()
 {
     //--------------------------------------------
     // INIT
     //--------------------------------------------
     require_once IPS_KERNEL_PATH . 'class_xml.php';
     $xml = new class_xml();
     $xml->doc_type = IPS_DOC_CHAR_SET;
     $login_id = basename('convert');
     //-----------------------------------------
     // Now get the XML data
     //-----------------------------------------
     $dh = opendir(IPS_PATH_CUSTOM_LOGIN);
     if ($dh !== false) {
         while (false !== ($file = readdir($dh))) {
             if (is_dir(IPS_PATH_CUSTOM_LOGIN . '/' . $file) and $file == $login_id) {
                 if (file_exists(IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml')) {
                     $file_content = file_get_contents(IPS_PATH_CUSTOM_LOGIN . '/' . $file . '/loginauth_install.xml');
                     $xml->xml_parse_document($file_content);
                     if (is_array($xml->xml_array['export']['group']['row'])) {
                         foreach ($xml->xml_array['export']['group']['row'] as $f => $entry) {
                             if (is_array($entry)) {
                                 foreach ($entry as $k => $v) {
                                     if ($f == 'VALUE' or $f == 'login_id') {
                                         continue;
                                     }
                                     $data[$f] = $v;
                                 }
                             }
                         }
                     }
                 } else {
                     ipsRegistry::getClass('output')->showError('Could not locate login method.');
                 }
                 $dir_methods[$file] = $data;
                 break;
             }
         }
         closedir($dh);
     }
     if (!is_array($dir_methods) or !count($dir_methods)) {
         ipsRegistry::getClass('output')->showError('An error occured while trying to enable the converter login method.');
     }
     //-----------------------------------------
     // Now verify it isn't installed
     //-----------------------------------------
     $login = $this->DB->buildAndFetch(array('select' => 'login_id', 'from' => 'login_methods', 'where' => "login_folder_name='" . $login_id . "'"));
     if (!$login['login_id']) {
         $max = $this->DB->buildAndFetch(array('select' => 'MAX(login_order) as highest_order', 'from' => 'login_methods'));
         $dir_methods[$login_id]['login_order'] = $max['highest_order'] + 1;
         $dir_methods[$login_id]['login_enabled'] = 1;
         $this->DB->insert('login_methods', $dir_methods[$login_id]);
     } else {
         $this->DB->update('login_methods', array('login_enabled' => 1), 'login_id=' . $login['login_id']);
     }
     //-----------------------------------------
     // Recache
     //-----------------------------------------
     $cache = array();
     $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $cache[$r['login_id']] = $r;
     }
     ipsRegistry::cache()->setCache('login_methods', $cache, array('array' => 1, 'deletefirst' => 1));
     //-----------------------------------------
     // Switch
     //-----------------------------------------
     IPSLib::updateSettings(array('conv_login' => 1));
 }
示例#16
0
 /**
  * Convert Posts
  *
  * @access	private
  * @return void
  **/
 private function convert_posts_bak()
 {
     $lastId = $this->request['lastId'] > 0 ? $this->request['lastId'] : 0;
     $lastTopic = $this->request['lastTopic'] > 0 ? $this->request['lastTopic'] : 0;
     $cycleCount = 0;
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => 'ft.TOPIC_OID', 'from' => array('IP_F_FORUM_TOPIC' => 'ft'), 'add_join' => array(array('select' => 't.IS_TOPIC_ARCHIVED', 'from' => array('IP_T_TOPIC' => 't'), 'where' => 't.TOPIC_OID = ft.TOPIC_OID', 'type' => 'left')), 'where' => "ft.TOPIC_OID > {$lastTopic}", 'order' => "ft.TOPIC_OID ASC");
     $loop = $this->lib->load('posts', FALSE, array());
     ipsRegistry::DB('hb')->build($main);
     $topicRes = ipsRegistry::DB('hb')->execute();
     //---------------------------
     // Loop
     //---------------------------
     while ($topic = ipsRegistry::DB('hb')->fetch($topicRes)) {
         //print "<PRE>";print_r($topic);
         $doArchive = $topic['IS_TOPIC_ARCHIVED'] == 1 ? TRUE : FALSE;
         $joinTables = array(array('from' => array('IP_F_FORUM_TOPIC' => 't'), 'where' => 'msg.TOPIC_OID = t.TOPIC_OID', 'type' => 'inner'));
         if (!$doArchive) {
             $joinTables = array_merge($joinTables, array(array('select' => 'con.*', 'from' => array('IP_C_CONTENT' => 'con'), 'where' => " msg.MESSAGE_OID = con.CONTENT_OID", 'type' => 'inner')));
         }
         ipsRegistry::DB('hb')->build(array('select' => 'msg.*', 'from' => array('IP_T' . ($doArchive ? '_ARCHIVED' : '') . '_MESSAGE' => 'msg'), 'add_join' => $joinTables, 'where' => "msg.TOPIC_OID='{$topic['TOPIC_OID']}' AND msg.MESSAGE_OID > '{$lastId}'", 'order' => 'msg.MESSAGE_OID ASC'));
         $postRes = ipsRegistry::DB('hb')->execute();
         while ($row = ipsRegistry::DB('hb')->fetch($postRes)) {
             //PRINT "<pre>";print_r($row);
             $data = ipsRegistry::DB('hb')->buildAndFetch(array('select' => $row['AUTHOR_OID'] == '' ? 'GUEST_USER_NAME' : 'DISPLAY_NAME', 'from' => $row['AUTHOR_OID'] == '' ? 'IP_C_GUEST_USER' : 'IP_USERS', 'where' => $row['AUTHOR_OID'] == '' ? "GUEST_USER_OID='{$row['GUEST_AUTHOR_OID']}'" : "USER_OID='{$row['AUTHOR_OID']}'"));
             $row = array_merge($row, $data);
             $save = array('topic_id' => $row['TOPIC_OID'], 'author_id' => $row['AUTHOR_OID'] != '' ? $row['AUTHOR_OID'] : $row['GUEST_AUTHOR_OID'], 'author_name' => $row['AUTHOR_OID'] != '' ? $row['DISPLAY_NAME'] : $row['GUEST_USER_NAME'], 'post_date' => intval(strtotime($row['DATETIME_CREATED'])), 'post' => $this->fixPostData($row['BODY']), 'ip_address' => $row['POSTER_IP'], 'use_sig' => $row['HAS_SIGNATURE'], 'use_emo' => 1, 'queued' => $row['IS_MESSAGE_VISIBLE'] == 1 ? 0 : 1);
             $this->lib->convertPost($row['MESSAGE_OID'], $save);
             $cycleCount++;
             // Check if we hit cycle limit.
             if ($cycleCount >= $this->request['cycle']) {
                 $this->request['st'] += $cycleCount;
                 $this->request['do'] = "posts&lastTopic={$topic['TOPIC_OID']}&lastId={$row['MESSAGE_OID']}";
                 $this->lib->next();
             }
         }
         $lastId = 0;
     }
     // Save that it's been completed
     $get = unserialize($this->settings['conv_completed']);
     $us = $get[$this->lib->app['name']];
     $us = is_array($us) ? $us : array();
     if (empty($this->lib->errors)) {
         $us = array_merge($us, array($action => true));
     } else {
         $us = array_merge($us, array($action => 'e'));
     }
     $get[$this->lib->app['name']] = $us;
     IPSLib::updateSettings(array('conv_completed' => serialize($get), 'post_order_column' => 'post_date'));
     // Display
     $this->lib->load('posts', array('select' => '*', 'from' => 'IP_F_FORUM_TOPIC', 'where' => '0'));
 }
示例#17
0
 /**
  * Edit - Save
  *
  * @access	private
  * @return	void
  */
 private function edit_save()
 {
     $edit = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'conv_apps', 'where' => "app_id='{$this->request['id']}'"));
     if (!$edit) {
         $this->registry->output->html .= $this->html->convertError("Invalid ID");
         return;
     }
     @(include_once IPS_ROOT_PATH . 'applications_addon/ips/convert/modules_admin/' . $edit['sw'] . '/' . $edit['app_key'] . '.php');
     if ($info['nodb'] && $this->request['custom']) {
         $get = unserialize($this->settings['conv_extra']);
         $us = $get[$edit['name']];
         $us = is_array($us) ? $us : array();
         $extra = is_array($us['core']) ? $us : array_merge($us, array('core' => array()));
         $get[$edit['name']] = $extra;
         foreach ($custom as $k => $v) {
             $get[$edit['name']]['core'][$k] = $_REQUEST[$k];
         }
         IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     } else {
         $this->DB->update('conv_apps', array('db_driver' => $this->request['hb_sql_driver'], 'db_host' => $this->request['hb_sql_host'], 'db_user' => $this->request['hb_sql_user'], 'db_pass' => $_REQUEST['hb_sql_pass'], 'db_db' => $this->request['hb_sql_database'], 'db_prefix' => $this->request['hb_sql_tbl_prefix']), "app_id='{$this->request['id']}'");
     }
     $this->registry->output->silentRedirect($this->settings['base_url'] . 'app=convert&module=setup&section=boink');
 }
示例#18
0
 /**
  * Save
  */
 public function save()
 {
     $exploded = explode('_', $this->request['service']);
     if (!IPSLib::appIsInstalled($exploded[1]) or !is_file(IPSLib::getAppDir($exploded[1]) . '/extensions/enhancements/' . $exploded[2] . '.php')) {
         $this->registry->output->showError($this->lang->words['err_no_enhancement'], 111801);
     }
     $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($exploded[1]) . '/extensions/enhancements/' . $exploded[2] . '.php', $this->request['service']);
     $class = new $classToLoad($this->registry);
     if (method_exists($class, 'check')) {
         $class->check();
     }
     if (isset($class->settings) and !empty($class->settings)) {
         $toSave = array();
         foreach ($class->settings as $key) {
             $toSave[$key] = $_POST[$key];
         }
         IPSLib::updateSettings($toSave, TRUE);
     } else {
         $output = $class->saveSettings();
         if ($output and is_string($output)) {
             $this->registry->output->html .= $output;
             return;
         }
     }
     $this->registry->output->redirect("{$this->settings['base_url']}app=core&amp;module=applications&amp;section=enhancements", $this->lang->words['enhancements_saved']);
 }
示例#19
0
 /**
  * Convert Forums
  *
  * @access	private
  * @return void
  **/
 private function convert_boards()
 {
     //---------------------------
     // Set up
     //---------------------------
     $mainBuild = array('select' => '*', 'from' => $this->prefixFull . 'boards', 'order' => 'ID_BOARD ASC');
     $this->start = intval($this->request['st']);
     $this->end = $this->start + intval($this->request['cycle']);
     $mainBuild['limit'] = array($this->start, $this->end);
     $this->errors = unserialize($this->settings['conv_error']);
     ipsRegistry::DB('hb')->build($mainBuild);
     ipsRegistry::DB('hb')->execute();
     if (!ipsRegistry::DB('hb')->getTotalRows()) {
         $action = 'forums';
         // Save that it's been completed
         $get = unserialize($this->settings['conv_completed']);
         $us = $get[$this->lib->app['name']];
         $us = is_array($us) ? $us : array();
         if (empty($this->errors)) {
             $us = array_merge($us, array($action => true));
         } else {
             $us = array_merge($us, array($action => 'e'));
         }
         $get[$this->app['name']] = $us;
         IPSLib::updateSettings(array('conv_completed' => serialize($get)));
         // Errors?
         if (!empty($this->errors)) {
             $es = 'The following errors occurred: <ul>';
             foreach ($this->errors as $e) {
                 $es .= "<li>{$e}</li>";
             }
             $es .= '</ul>';
         } else {
             $es = 'No problems found.';
         }
         // Display
         $this->registry->output->html .= $this->html->convertComplete($info['name'] . ' Conversion Complete.', array($es, $info['finish']));
         $this->sendOutput();
     }
     while ($row = ipsRegistry::DB('hb')->fetch()) {
         $records[] = $row;
     }
     $loop = $records;
     //---------------------------
     // Loop
     //---------------------------
     foreach ($loop as $row) {
         // Work out what the parent is
         if ($row['ID_PARENT']) {
             $parent = $row['ID_PARENT'];
         } else {
             $parent = 'c' . $row['ID_CAT'];
         }
         // Set info
         $save = array('parent_id' => $parent, 'position' => $row['boardOrder'], 'last_id' => $row['ID_LAST_MSG'], 'name' => $row['name'], 'description' => $row['description'], 'topics' => $row['numTopics'], 'posts' => $row['numPosts'], 'inc_postcount' => $row['countPosts']);
         // Save
         $this->lib->convertForum($row['ID_BOARD'], $save, array());
         //-----------------------------------------
         // Handle subscriptions
         //-----------------------------------------
         ipsRegistry::DB('hb')->build(array('select' => '*', 'from' => $this->prefixFull . 'log_notify', 'where' => "ID_BOARD={$row['ID_BOARD']}"));
         ipsRegistry::DB('hb')->execute();
         while ($tracker = ipsRegistry::DB('hb')->fetch()) {
             $savetracker = array('member_id' => $tracker['ID_MEMBER'], 'forum_id' => $tracker['ID_BOARD']);
             $this->lib->convertForumSubscription($tracker['ID_MEMBER'] . '-' . $tracker['ID_BOARD'], $savetracker);
         }
     }
     //-----------------------------------------
     // Next
     //-----------------------------------------
     $total = $this->request['total'];
     $pc = round(100 / $total * $this->end);
     $message = $pc > 100 ? 'Finishing...' : "{$pc}% complete";
     IPSLib::updateSettings(array('conv_error' => serialize($this->errors)));
     $end = $this->end > $total ? $total : $this->end;
     $this->registry->output->redirect("{$this->settings['base_url']}app=convert&module={$this->lib->app['sw']}&section={$this->lib->app['app_key']}&do={$this->request['do']}&st={$this->end}&cycle={$this->request['cycle']}&total={$total}", "{$end} of {$total} converted<br />{$message}");
 }
示例#20
0
 /**
  * Convert custom profile fields
  *
  * @access	private
  * @return void
  **/
 private function convert_pfields()
 {
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => '*', 'from' => 'user_field', 'order' => 'id ASC');
     $loop = $this->lib->load('pfields', $main, array('pfields_groups'));
     //-----------------------------------------
     // Create an unfiled group
     //-----------------------------------------
     if (!$us['pfield_group']) {
         $group = $this->lib->convertPFieldGroup(99, array('pf_group_name' => 'Converted', 'pf_group_key' => 'phpmyforum'), true);
         if (!$group) {
             $this->lib->error('There was a problem creating the profile field group');
         }
         $us['pfield_group'] = $group;
         $get[$this->lib->app['name']] = $us;
         IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     }
     //---------------------------
     // Loop
     //---------------------------
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         // pf_content
         $options = $row['options'] ? unserialize($row['options']) : array();
         $pf_content = array();
         foreach ($options as $k => $v) {
             $pf_content[] = "{$k}={$v}";
         }
         // pf_type
         $py_type = 'input';
         switch ($row['typ']) {
             case 2:
                 $pf_type = 'textarea';
                 break;
             case 3:
                 $pf_type = 'radio';
                 $pf_content = array('0=Yes', '1=No');
                 break;
             case 4:
                 $pf_type = 'textarea';
                 break;
         }
         // Finalise
         $save = array('pf_title' => $row['name_edit'], 'pf_desc' => $row['comment'], 'pf_content' => implode('|', $pf_content), 'pf_type' => $pf_type, 'pf_not_null' => $row['required'], 'pf_member_hide' => $row['profile'] ? 0 : 1, 'pf_max_input' => $row['maxlength'], 'pf_member_edit' => $row['rang'], 'pf_position' => $row['displayorder'], 'pf_show_on_reg' => $row['signup'], 'pf_group_id' => 99, 'pf_key' => $row['name']);
         // And save
         $this->lib->convertPField($row['id'], $save);
     }
     $this->lib->next();
 }
示例#21
0
 /**
  * Convert Entries
  *
  * @access	private
  * @return 	void
  **/
 private function convert_blog_entries()
 {
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => 'b.*', 'from' => array('blog' => 'b'), 'order' => 'b.blogid ASC', 'add_join' => array(array('select' => 't.*', 'from' => array('blog_text' => 't'), 'where' => "b.firstblogtextid=t.blogtextid", 'type' => 'left')));
     $loop = $this->lib->load('blog_entries', $main);
     //-----------------------------------------
     // We need to log text ids
     //-----------------------------------------
     $get = unserialize($this->settings['conv_extra']);
     $us = $get[$this->lib->app['name']];
     if (!$this->request['st']) {
         $us['blog_text_ids'] = array();
         IPSLib::updateSettings(array('conv_extra' => serialize($us)));
     }
     //---------------------------
     // Loop
     //---------------------------
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         // Odd issue...
         if (!isset($row['blogtextid']) || empty($row['blogtextid'])) {
             continue;
         }
         //-----------------------------------------
         // Has this been editted?
         //-----------------------------------------
         $log = false;
         ipsRegistry::DB('hb')->build(array('select' => '*', 'from' => 'blog_editlog', 'where' => "blogtextid={$row['blogtextid']}", 'order' => 'dateline ASC'));
         ipsRegistry::DB('hb')->execute();
         while ($editlog = ipsRegistry::DB('hb')->fetch()) {
             $log = $editlog;
         }
         //-----------------------------------------
         // Carry on
         //-----------------------------------------
         $save = array('blog_id' => $row['bloguserid'], 'entry_author_id' => $row['userid'], 'entry_author_name' => $row['username'], 'entry_date' => $row['dateline'], 'entry_name' => $row['title'], 'entry' => $this->fixPostData($row['pagetext']), 'entry_status' => $row['state'] == 'visible' ? 'published' : 'draft', 'entry_num_comments' => $row['comments_visible'], 'entry_last_comment_date' => $row['lastcomment'], 'entry_last_comment_name' => $row['lastcommenter'], 'entry_queued_comments' => $row['comments_moderation'], 'entry_has_attach' => $row['attach'], 'entry_edit_time' => $log ? $log['dateline'] : '', 'entry_edit_name' => $log ? $log['username'] : '', 'entry_use_emo' => $row['allowsmilie'], 'entry_trackbacks' => $row['trackback_visible'], 'entry_last_update' => $log ? $log['dateline'] : $row['dateline']);
         $this->lib->convertEntry($row['blogid'], $save);
         //-----------------------------------------
         // Save the entry ID so it's not confused with the comments
         //-----------------------------------------
         $us['blog_text_ids'][] = $row['blogtextid'];
     }
     // Save entry ids
     $get[$this->lib->app['name']] = $us;
     IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     // Next, please!
     $this->lib->next();
 }
示例#22
0
 /**
  * Loads the next cycle
  *
  * @access 	public
  * @return 	void
  **/
 public function next()
 {
     $total = $this->request['total'];
     $pc = round(100 / $total * $this->end);
     $message = $pc > 100 ? 'Finishing...' : "{$pc}% complete";
     IPSLib::updateSettings(array('conv_error' => serialize($this->errors)));
     $end = $this->end > $total ? $total : $this->end;
     $this->registry->output->redirect("{$this->settings['base_url']}app=convert&module={$this->app['sw']}&section={$this->app['app_key']}&do={$this->request['do']}&st={$this->end}&cycle={$this->request['cycle']}&total={$total}", "{$end} of {$total} converted<br />{$message}");
 }
 /**
  * Toggles the setting 'registration_qanda'
  *
  * @access	private
  * @return	void
  * @author	Brandon
  */
 private function _switchOn()
 {
     /* Switch it on */
     IPSLib::updateSettings(array('registration_qanda' => 1));
     /* Done */
     $this->registry->output->silentRedirect($this->settings['base_url'] . $this->form_code);
 }
示例#24
0
 /**
  * Delete the group
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function _doDelete()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['id'] = intval($this->request['id']);
     $this->request['to_id'] = intval($this->request['to_id']);
     //-----------------------------------------
     // Auth check...
     //-----------------------------------------
     ipsRegistry::getClass('adminFunctions')->checkSecurityKey($this->request['secure_key']);
     //-----------------------------------------
     // Check
     //-----------------------------------------
     if (!$this->request['id']) {
         $this->registry->output->showError($this->lang->words['g_whichgroup'], 1122);
     }
     if ($this->request['id'] < 6) {
         $this->registry->output->showError($this->lang->words['g_preset'], 1124);
     }
     if (!$this->request['to_id']) {
         $this->registry->output->showError($this->lang->words['g_mecries'], 1123);
     }
     //-----------------------------------------
     // Check to make sure that the relevant groups exist.
     //-----------------------------------------
     $original = $this->caches['group_cache'][$this->request['id']];
     $move_to = $this->caches['group_cache'][$this->request['to_id']];
     if (!count($original)) {
         $this->registry->output->showError($this->lang->words['g_whichgroup'], 1125);
     }
     if (!count($move_to)) {
         $this->registry->output->showError($this->lang->words['g_mecries'], 1126);
     }
     //-----------------------------------------
     // Check restrictions.
     //-----------------------------------------
     if ($original['g_access_cp']) {
         $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('groups_delete_admin');
         $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('member_move_admin1', 'members', 'members');
     } else {
         if ($move_to['g_access_cp']) {
             $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('member_move_admin2', 'members', 'members');
         }
     }
     //-----------------------------------------
     // Move and delete
     //-----------------------------------------
     $this->DB->update('members', array('member_group_id' => $this->request['to_id']), 'member_group_id=' . $this->request['id']);
     $this->DB->delete('groups', "g_id=" . $this->request['id']);
     $this->DB->delete('admin_permission_rows', "row_id_type='group' AND row_id=" . $this->request['id']);
     //-----------------------------------------
     // Can't promote to non-existent group
     //-----------------------------------------
     foreach ($this->cache->getCache('group_cache') as $row) {
         $promotion = explode('&', $row['g_promotion']);
         if ($promotion[0] == $this->request['id']) {
             $this->DB->update('groups', array('g_promotion' => '-1&-1'), 'g_id=' . $row['g_id']);
         }
     }
     //-----------------------------------------
     // Remove from moderators table
     //-----------------------------------------
     $this->DB->delete('moderators', "is_group=1 AND group_id=" . $this->request['id']);
     //-----------------------------------------
     // Remove as a secondary group
     //-----------------------------------------
     $this->DB->build(array('select' => 'member_group_id, mgroup_others, member_id', 'from' => 'members', 'where' => "mgroup_others LIKE '%," . $this->request['id'] . ",%'"));
     $exg = $this->DB->execute();
     while ($others = $this->DB->fetch($exg)) {
         $extra = array();
         $extra = explode(",", IPSText::cleanPermString($others['mgroup_others']));
         $to_insert = array();
         if (count($extra)) {
             foreach ($extra as $mgroup_other) {
                 if ($mgroup_other != $this->request['id']) {
                     if ($mgroup_other != "") {
                         $to_insert[] = $mgroup_other;
                     }
                 }
             }
             if (count($to_insert)) {
                 $new_others = ',' . implode(',', $to_insert) . ',';
             } else {
                 $new_others = "";
             }
             $this->DB->update('members', array('mgroup_others' => $new_others), 'member_id=' . $others['member_id']);
         }
     }
     //-----------------------------------------
     // Fix settings
     //-----------------------------------------
     $_toUpdate = array();
     $this->DB->build(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_extra='#show_groups#'"));
     $o = $this->DB->execute();
     while ($r = $this->DB->fetch($o)) {
         /* Dropdown with the deleted group selected? Return to default. */
         if ($r['conf_type'] == 'dropdown' and $r['conf_value'] == $this->request['id']) {
             $_toUpdate[$r['conf_key']] = $r['conf_default'];
         } else {
             if ($r['conf_type'] == 'multi' and strpos($r['conf_value'], (string) $this->request['id']) !== false) {
                 $_values = explode(',', $r['conf_value']);
                 $_newValues = array();
                 foreach ($_values as $_value) {
                     if ($_value != $this->request['id']) {
                         $_newValues[] = $_value;
                     }
                 }
                 $_toUpdate[$r['conf_key']] = count($_newValues) ? $_newValues : $r['conf_default'];
             }
         }
     }
     if (count($_toUpdate)) {
         /* The multiselect settings have evalphp which forces it to inspect $_POST */
         $_POST = array_merge($_POST, $_toUpdate);
         IPSLib::updateSettings($_toUpdate);
     }
     //-----------------------------------------
     // Rebuild caches
     //-----------------------------------------
     $this->rebuildGroupCache();
     $this->cache->rebuildCache('moderators', 'forums');
     ipsRegistry::getClass('adminFunctions')->saveAdminLog(sprintf($this->lang->words['g_removedlog'], $original['g_title']));
     $this->registry->output->global_message = $this->lang->words['g_removed'];
     $this->_mainScreen();
 }
示例#25
0
 /**
  * Edit Settings
  */
 public function editSettings()
 {
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php';
     /*noLibHook*/
     require_once IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php';
     /*noLibHook*/
     $skinFunctions = new skinCaching(ipsRegistry::instance());
     if (ipsRegistry::$request['recache']) {
         $skinFunctions->flushipscdn();
         ipsRegistry::getClass('output')->redirect(ipsRegistry::$settings['_base_url'] . "app=core&amp;module=applications&amp;section=enhancements&amp;do=edit&amp;service=enhancements_core_ipscdn", ipsRegistry::getClass('class_localization')->words['cdn_recached']);
     }
     if (ipsRegistry::$request['disable']) {
         IPSLib::updateSettings(array('ips_cdn' => FALSE, 'ipb_img_url' => '', 'ipb_css_url' => '', 'ipb_js_url' => '', 'upload_url' => ''));
         if (IPSLib::appIsInstalled('gallery')) {
             $this_script = str_replace('\\', '/', getenv('SCRIPT_FILENAME'));
             $url = ipsRegistry::$settings['_original_base_url'];
             if ($this_script) {
                 $this_script = str_replace('/' . CP_DIRECTORY . '/index.php', '', $this_script);
                 if (substr(ipsRegistry::$settings['gallery_images_path'], 0, strlen($this_script)) === $this_script) {
                     $url = str_replace('\\', '/', str_replace($this_script, $url, ipsRegistry::$settings['gallery_images_path']));
                 }
             } else {
                 $url .= '/uploads';
             }
             IPSLib::updateSettings(array('gallery_images_path' => $url));
         }
         IPSContentCache::truncate('post');
         IPSContentCache::truncate('sig');
         /* Set skin sets to recache */
         $skinFunctions->flagSetForRecache();
         ipsRegistry::getClass('output')->redirect(ipsRegistry::$settings['_base_url'] . "app=core&amp;module=applications&amp;section=enhancements", ipsRegistry::getClass('class_localization')->words['cdn_disabled']);
         return;
     }
     if (!ipsRegistry::$settings['ipb_reg_number']) {
         ipsRegistry::getClass('output')->showError(sprintf(ipsRegistry::getClass('class_localization')->words['enhancements_ipscdn_error_nokey'], ipsRegistry::getClass('output')->buildUrl('app=core&module=tools&section=licensekey', 'admin')));
     }
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement');
     $file = new $classToLoad();
     $return = NULL;
     if ($json = @json_decode($ping, TRUE)) {
         if ($json['ENABLED'] and $json['BYTES'] > 0) {
             if (!ipsRegistry::$settings['ips_cdn'] and !ipsRegistry::$request['enable']) {
                 return $this->html->cdnInactive($json);
             } else {
                 $settings = array('ips_cdn' => TRUE, 'ipb_img_url' => $json['URL'], 'ipb_css_url' => rtrim($json['URL'], '/') . '/', 'ipb_js_url' => rtrim($json['URL'], '/') . '/', 'upload_url' => $json['URL'] . '/uploads');
                 if (IPSLib::appIsInstalled('downloads')) {
                     if (substr(ipsRegistry::$settings['idm_localsspath'], 0, 11) === '{root_path}') {
                         $settings['idm_screenshot_url'] = str_replace('{root_path}', $json['URL'], ipsRegistry::$settings['idm_localsspath']);
                     }
                 }
                 if (IPSLib::appIsInstalled('gallery')) {
                     $this_script = str_replace('\\', '/', getenv('SCRIPT_FILENAME'));
                     if ($this_script) {
                         $this_script = str_replace('/' . CP_DIRECTORY . '/index.php', '', $this_script);
                         if (substr(ipsRegistry::$settings['gallery_images_path'], 0, strlen($this_script)) === $this_script) {
                             $settings['gallery_images_url'] = str_replace('\\', '/', str_replace($this_script, $json['URL'], ipsRegistry::$settings['gallery_images_path']));
                         }
                     }
                 }
                 $_settings = array();
                 foreach ($settings as $k => $v) {
                     if (ipsRegistry::$settings[$k] != $v) {
                         $_settings[$k] = $v;
                     }
                 }
                 if (!empty($_settings)) {
                     IPSLib::updateSettings($settings);
                 }
                 /* Set skin sets to recache */
                 $skinFunctions->flagSetForRecache();
             }
         } else {
             $licenseData = ipsRegistry::cache()->getCache('licenseData');
             if ($licenseData['key']['url'] != ipsRegistry::$settings['board_url']) {
                 ipsRegistry::getClass('output')->showError(ipsRegistry::getClass('class_localization')->words['enhancements_ipscdn_error_url']);
             }
             /* Set skin sets to recache */
             $skinFunctions->flagSetForRecache();
             return $this->html->cdnNotEnabled($json);
         }
     } else {
         ipsRegistry::getClass('output')->showError(sprintf(ipsRegistry::getClass('class_localization')->words['enhancements_ipscdn_error_key'], ipsRegistry::getClass('output')->buildUrl('app=core&module=tools&section=licensekey', 'admin')));
     }
     return $this->html->cdnOverview($json);
 }
示例#26
0
 /**
  * Convert Emoticons
  *
  * @access	private
  * @return void
  **/
 private function convert_emoticons()
 {
     //-----------------------------------------
     // Were we given more info?
     //-----------------------------------------
     $this->lib->saveMoreInfo('emoticons', array('emo_path', 'emo_opt'));
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => '*', 'from' => $this->pf . 'smiley', 'order' => 'smileyID ASC');
     $loop = $this->lib->load('emoticons', $main);
     //-----------------------------------------
     // We need to know the path and how to handle duplicates
     //-----------------------------------------
     $this->lib->getMoreInfo('emoticons', $loop, array('emo_path' => array('type' => 'text', 'label' => 'The path to the folder your wcf folder (no trailing slash - usually path_to_woltlab/wcf):'), 'emo_opt' => array('type' => 'dupes', 'label' => 'How do you want to handle duplicate emoticons?')), 'path');
     $get = unserialize($this->settings['conv_extra']);
     $us = $get[$this->lib->app['name']];
     IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     $path = $us['emo_path'];
     //-----------------------------------------
     // Check all is well
     //-----------------------------------------
     if (!is_writable(DOC_IPS_ROOT_PATH . 'public/style_emoticons/')) {
         $this->lib->error('Your IP.Board emoticons path is not writeable. ' . DOC_IPS_ROOT_PATH . 'public/style_emoticons/');
     }
     if (!is_readable($path)) {
         $this->lib->error('Your remote emoticons path is not readable.');
     }
     //---------------------------
     // Loop
     //---------------------------
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         $save = array('typed' => $row['smileyCode'], 'image' => $row['smileyPath'], 'clickable' => 1, 'emo_set' => 'default');
         $done = $this->lib->convertEmoticon($row['smileyID'], $save, $us['emo_opt'], $path);
     }
     $this->lib->next();
 }
示例#27
0
 /**
  * Convert Forums
  *
  * @access	private
  * @return void
  **/
 private function convert_forum_info()
 {
     //---------------------------
     // Set up
     //---------------------------
     $mainBuild = array('select' => '*', 'from' => 'forum_info', 'order' => 'FORUM_ID ASC');
     $this->start = intval($this->request['st']);
     $this->end = $this->start + intval($this->request['cycle']);
     $mainBuild['limit'] = array($this->start, $this->end);
     $this->lib->errors = unserialize($this->settings['conv_error']);
     ipsRegistry::DB('hb')->build($mainBuild);
     ipsRegistry::DB('hb')->execute();
     if (!ipsRegistry::DB('hb')->getTotalRows()) {
         $action = 'forums';
         // Save that it's been completed
         $get = unserialize($this->settings['conv_completed']);
         $us = $get[$this->lib->app['name']];
         $us = is_array($us) ? $us : array();
         if (empty($this->lib->errors)) {
             $us = array_merge($us, array($action => true));
         } else {
             $us = array_merge($us, array($action => 'e'));
         }
         $get[$this->app['name']] = $us;
         IPSLib::updateSettings(array('conv_completed' => serialize($get)));
         // Errors?
         if (!empty($this->lib->errors)) {
             $es = 'The following errors occurred: <ul>';
             foreach ($this->lib->errors as $e) {
                 $es .= "<li>{$e}</li>";
             }
             $es .= '</ul>';
         } else {
             $es = 'No problems found.';
         }
         // Display
         $this->registry->output->html .= $this->html->convertComplete($info['name'] . ' Conversion Complete.', array($es, $info['finish']));
         $this->sendOutput();
     }
     while ($row = ipsRegistry::DB('hb')->fetch()) {
         $records[] = $row;
     }
     $loop = $records;
     //---------------------------
     // Loop
     //---------------------------
     foreach ($loop as $row) {
         $parent = 'c' . $row['CATEGORY'];
         // Set info
         $save = array('parent_id' => $parent, 'position' => $row['FORUM_POSITION'], 'last_id' => $row['L_TOPIC_ID'], 'name' => $row['FORUM_NAME'], 'description' => $row['FORUM_DESC'], 'topics' => $row['FORUM_TOPICS'], 'posts' => $row['FORUM_POSTS'], 'inc_postcount' => 1);
         // Save
         $this->lib->convertForum($row['FORUM_ID'], $save, array());
         $res = ipsRegistry::DB('hb')->buildAndFetchAll(array('select' => '*', 'from' => 'forum_subscriptions', 'where' => "FORUM_ID = {$row['FORUM_ID']} AND TOPIC_ID = 0"));
         foreach ($res as $k => $sub) {
             $savesub = array('member_id' => $sub['MEMBER_ID'], 'forum_id' => $sub['FORUM_ID'], 'type' => 'immediate');
             $this->lib->convertForumSubscription($sub['ID'], $savesub);
         }
     }
     //-----------------------------------------
     // Next
     //-----------------------------------------
     $total = $this->request['total'];
     $pc = round(100 / $total * $this->end);
     $message = $pc > 100 ? 'Finishing...' : "{$pc}% complete";
     IPSLib::updateSettings(array('conv_error' => serialize($this->lib->errors)));
     $end = $this->end > $total ? $total : $this->end;
     $this->registry->output->redirect("{$this->settings['base_url']}app=convert&module={$this->lib->app['sw']}&section={$this->lib->app['app_key']}&do={$this->request['do']}&st={$this->end}&cycle={$this->request['cycle']}&total={$total}", "{$end} of {$total} converted<br />{$message}");
 }
示例#28
0
 /**
  * Convert Ranks
  *
  * @access	private
  * @return void
  **/
 private function convert_ranks()
 {
     //-----------------------------------------
     // Were we given more info?
     //-----------------------------------------
     $this->lib->saveMoreInfo('ranks', array('rank_opt'));
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => '*', 'from' => 'customranks', 'order' => 'rankid ASC');
     $loop = $this->lib->load('ranks', $main);
     //-----------------------------------------
     // We need to know what do do with duplicates
     //-----------------------------------------
     $this->lib->getMoreInfo('ranks', $loop, array('rank_opt' => array('type' => 'dupes', 'label' => 'How do you want to handle duplicate ranks?')));
     $get[$this->lib->app['name']] = $us;
     IPSLib::updateSettings(array('conv_extra' => serialize($get)));
     //---------------------------
     // Loop
     //---------------------------
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         $save = array('posts' => $row['minposts'], 'title' => $row['rankname']);
         $this->lib->convertRank($row['rankid'], $save, $us['rank_opt']);
     }
     $this->lib->next();
 }
示例#29
0
 /**
  * Convert Forums
  *
  * @access	private
  * @return void
  **/
 private function convert_boards()
 {
     //---------------------------
     // Set up
     //---------------------------
     $mainBuild = array('select' => '*', 'from' => 'sfforums', 'order' => 'forum_id ASC');
     $this->start = intval($this->request['st']);
     $this->end = $this->start + intval($this->request['cycle']);
     $mainBuild['limit'] = array($this->start, $this->end);
     $this->lib->errors = array();
     # unserialize($this->settings['conv_error']);
     ipsRegistry::DB('hb')->build($mainBuild);
     ipsRegistry::DB('hb')->execute();
     if (!ipsRegistry::DB('hb')->getTotalRows()) {
         $action = 'forums';
         // Save that it's been completed
         $get = unserialize($this->settings['conv_completed']);
         $us = $get[$this->lib->app['name']];
         $us = is_array($us) ? $us : array();
         if (empty($this->lib->errors)) {
             $us = array_merge($us, array($action => true));
         } else {
             $us = array_merge($us, array($action => 'e'));
         }
         $get[$this->app['name']] = $us;
         IPSLib::updateSettings(array('conv_completed' => serialize($get)));
         // Errors?
         if (!empty($this->lib->errors)) {
             $es = 'The following errors occurred: <ul>';
             foreach ($this->lib->errors as $e) {
                 $es .= "<li>{$e}</li>";
             }
             $es .= '</ul>';
         } else {
             $es = 'No problems found.';
         }
         // Display
         $this->registry->output->html .= $this->html->convertComplete($info['name'] . ' Conversion Complete.', array($es, $info['finish']));
         $this->sendOutput();
     }
     while ($row = ipsRegistry::DB('hb')->fetch()) {
         $records[] = $row;
     }
     $loop = $records;
     //---------------------------
     // Loop
     //---------------------------
     foreach ($loop as $row) {
         // Permissions will need to be reconfigured
         $perms = array();
         //-----------------------------------------
         // And go
         //-----------------------------------------
         $save = array('parent_id' => $row['group_id'] ? 'c' . $row['group_id'] : -1, 'position' => $row['forum_seq'], 'name' => $row['forum_name'], 'description' => $row['forum_desc'], 'password' => '', 'show_rules' => $row['forum_message'] ? 2 : 0, 'rules_text' => $row['forum_message'], 'rules_title' => $row['forum_name'], 'sub_can_post' => $row['parent'] ? 1 : 0, 'redirect_on' => 0, 'redirect_url' => '', 'redirect_hits' => 0, 'status' => $row['forum_status'] == 1 ? 0 : 1, 'posts' => $row['post_count'], 'topics' => $row['topic_count']);
         $this->lib->convertForum($row['forum_id'], $save, $perms);
     }
     //-----------------------------------------
     // Next
     //-----------------------------------------
     $total = $this->request['total'];
     $pc = round(100 / $total * $this->end);
     $message = $pc > 100 ? 'Finishing...' : "{$pc}% complete";
     IPSLib::updateSettings(array('conv_error' => serialize($this->lib->errors)));
     $end = $this->end > $total ? $total : $this->end;
     $this->registry->output->redirect("{$this->settings['base_url']}app=convert&module={$this->lib->app['sw']}&section={$this->lib->app['app_key']}&do={$this->request['do']}&st={$this->end}&cycle={$this->request['cycle']}&total={$total}", "{$end} of {$total} converted<br />{$message}");
 }
示例#30
-1
 /**
  * Save Settings
  */
 public function saveSettings()
 {
     /* Are we turning off? */
     if (ipsRegistry::$request['off']) {
         IPSLib::updateSettings(array('mandrill_username' => '', 'mandrill_api_key' => ''));
         ipsRegistry::getClass('output')->silentRedirect(ipsRegistry::$settings['_base_url'] . "app=core&amp;module=applications&amp;section=enhancements&amp;do=edit&amp;service=enhancements_members_mandrill");
         return;
     }
     /* Load language files so we have error messages if we need em */
     ipsRegistry::getClass('class_localization')->loadLanguageFile('admin_bulkmail', 'members');
     /* Are we adding new values or just enabling SMTP? */
     if (ipsRegistry::$request['smtp_on']) {
         ipsRegistry::$request['username'] = ipsRegistry::$settings['mandrill_username'];
         ipsRegistry::$request['api_key'] = ipsRegistry::$settings['mandrill_api_key'];
         ipsRegistry::$request['smtp'] = 1;
         $update = array();
     } else {
         /* Trim (like a haircut, but with strings) */
         ipsRegistry::$request['username'] = trim(ipsRegistry::$request['username']);
         ipsRegistry::$request['api_key'] = trim(ipsRegistry::$request['api_key']);
         /* If we don't have anything, tell them off */
         if (!ipsRegistry::$request['username'] or !ipsRegistry::$request['username']) {
             return $this->editSettings('mandrill_setup_noinfo');
         }
         /* Now shoot that over to Mandrill to make sure they're cool with it */
         require_once IPSLib::getAppDir('members') . '/sources/classes/mandrill.php';
         $mandrill = new Mandrill(ipsRegistry::$request['api_key']);
         $info = $mandrill->users_info();
         if ($info === NULL or $info->username != ipsRegistry::$request['username']) {
             return $this->editSettings('mandrill_bad_credentials');
         }
         /* So we're saving at least the API key and the username */
         $update = array('mandrill_username' => ipsRegistry::$request['username'], 'mandrill_api_key' => ipsRegistry::$request['api_key']);
     }
     /* Fire that off to IPS so Mandrill knows it's one of ours */
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement');
     $file = new $classToLoad();
     $json = NULL;
     /* If they want to use Mandrill for SMTP too, that call will contain the SMTP info,
        so set it if we got it, or if the call failed, throw an error */
     if (ipsRegistry::$request['smtp']) {
         if ($json) {
             $json = json_decode($json, TRUE);
             $update = array_merge($update, $json);
         } else {
             return $this->editSettings('mandrill_error');
         }
     }
     /* Update the settings */
     IPSLib::updateSettings($update);
     /* And boink the hell out of it */
     ipsRegistry::getClass('output')->silentRedirect(ipsRegistry::$settings['_base_url'] . "app=core&amp;module=applications&amp;section=enhancements&amp;do=edit&amp;service=enhancements_members_mandrill");
     return;
 }