本文整理汇总了PHP中IPSLib::updateSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::updateSettings方法的具体用法?PHP IPSLib::updateSettings怎么用?PHP IPSLib::updateSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::updateSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doExecute
/**
* 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§ion=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: saveSettings
/**
* 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;
}
示例3: setStyleLastUpdated
/**
* 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: doExecute
/**
* 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§ion=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: check
/**
* 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: convert_pfields
/**
* 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: _archiveToggle
/**
* 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: convert_posts
/**
* 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: next
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']}§ion={$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']}§ion={$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']}§ion={$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: showCronPage
/**
* 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: doExecute
/**
* 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: convert_pfields
/**
* 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: _save
/**
* 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}");
}
示例14: _loginUninstall
/**
* 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: enableLogin
/**
* 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));
}