function preference($args) { // Preference methods automatically refer only to preferences // belonging to the current user. $method = $_SERVER['REQUEST_METHOD']; switch ($method) { case 'GET': $name = getUserGetVar('name'); if ($name) { $preferenceDao = new PreferenceDAO(); $preference =& $preferenceDao->getPreference($name); if (null == $preference) { header('HTTP/1.1 404 Not Found'); echo '<h1>404 Not Found</h1><p>No such preference</p>'; } else { header('Content-type: text/plain'); echo $preference->getPreferenceName() . ':' . $preference->getPreferenceValue(); } } else { $preferenceDao = new PreferenceDAO(); $preferences =& $preferenceDao->getPreferences(); header('Content-type: text/plain'); $first = true; foreach ($preferences as $pref) { if (!$first) { echo "\n"; } else { $first = false; } echo $pref->getPreferenceName() . ':' . $pref->getPreferenceValue(); } } break; case 'POST': $name = getUserGetVar('name'); $value = getUserPostVar('value'); if (null == $name || null == $value) { header('HTTP/1.1 400 Bad Request'); echo "<h1>400 Bad Request</h1><p>Must specify name and vaule parameters</p>"; } else { if ('annotations.show' == $name || 'annotations.show-user' == $name || 'annotations.note-edit-mode' == $name) { $preference = new Preference(); $preference->setPreferenceName($name); $preference->setPreferenceValue($value); $preferenceDao = new PreferenceDAO(); if (null == $preferenceDao->getPreference($name)) { $preferenceDao->insertPreference($preference); } else { $preferenceDao->updatePreference($preference); } header('HTTP/1.1 204 Preference Set'); } else { header('HTTP/1.1 404 Invalid Preference'); echo "<h1>404 Invalid Preference</h1><p>The preference name you specificed is not valid.</p>"; } } break; } }
function read_prefs() { if (!isset($this->preference)) { $preference_factory = new Preference(); $preferences = $preference_factory->find_all(); $this->preference = $preferences[0]; } }
function index() { if ($this->request->is_post()) { $preference = new Preference($_POST); $preference->save(); } $preference_factory = new Preference(); $preferences = $preference_factory->find_all(); $this->preference = $preferences[0]; }
function __construct() { parent::__construct(); osc_run_hook('init_admin'); // check if exist a new version each day if (time() - osc_last_version_check() > 24 * 3600) { $data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?'); $data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data); $json = json_decode($data); if ($json->version > osc_version()) { osc_set_preference('update_core_json', $data); } else { osc_set_preference('update_core_json', ''); } osc_set_preference('last_version_check', time()); osc_reset_preferences(); } $config_version = str_replace('.', '', OSCLASS_VERSION); $config_version = preg_replace('|-.*|', '', $config_version); if ($config_version > Preference::newInstance()->get('version')) { if (get_class($this) == 'CAdminTools') { } else { if (get_class($this) != 'CAdminUpgrade') { $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade'); } } } }
public static function newInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
public static function getInstance() { if (empty(self::$instance)) { self::$instance = new Preference(); } return self::$instance; }
/** * upgrade * This is a recommended plugin function */ public function upgrade() { $from_version = Plugin::get_plugin_version($this->name); if ($from_version < 2) { Preference::insert('catalogfav_columns', 'Catalog favorites columns', '1', '25', 'integer', 'plugins'); } return true; }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $actif = "preference"; $mode = 'preference'; $profil = Preference::first(); return view('admin.param-config', compact('actif', 'mode', 'profil')); }
/** * uninstall * This is a required plugin function */ public function uninstall() { Preference::delete('amazon_base_url'); Preference::delete('amazon_max_results_pages'); Preference::delete('amazon_developer_public_key'); Preference::delete('amazon_developer_private_api_key'); Preference::delete('amazon_developer_associate_tag'); return true; }
function basic_info() { require_once ABS_PATH . 'oc-includes/osclass/model/Admin.php'; require_once ABS_PATH . 'oc-includes/osclass/model/Preference.php'; Admin::newInstance()->insert(array('s_name' => 'Administrator', 's_username' => 'admin', 's_password' => sha1('admin'), 's_email' => $_POST['email'])); $mPreference = Preference::newInstance(); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'pageTitle', 's_value' => $_POST['webtitle'], 'e_type' => 'STRING')); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'contactEmail', 's_value' => $_POST['email'], 'e_type' => 'STRING')); }
function __construct() { parent::__construct(); // check if is moderator and can enter to this page if ($this->isModerator()) { if (!in_array($this->page, array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats', ''))) { osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin'); $this->redirectTo(osc_admin_base_url()); } } osc_run_hook('init_admin'); // check if exist a new version each day if (time() - osc_last_version_check() > 24 * 3600) { $data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?'); $data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data); $json = json_decode($data); if ($json->version > osc_version()) { osc_set_preference('update_core_json', $data); } else { osc_set_preference('update_core_json', ''); } osc_set_preference('last_version_check', time()); osc_reset_preferences(); } $config_version = str_replace('.', '', OSCLASS_VERSION); $config_version = preg_replace('|-.*|', '', $config_version); if ($config_version > Preference::newInstance()->get('version')) { if (get_class($this) == 'CAdminTools') { } else { if (get_class($this) != 'CAdminUpgrade') { $this->redirectTo(osc_admin_base_url(true) . '?page=upgrade'); } } } // show messages subscribed $status_subscribe = Params::getParam('subscribe_osclass'); if ($status_subscribe != '') { switch ($status_subscribe) { case -1: osc_add_flash_error_message(_m('Entered an invalid email'), 'admin'); break; case 0: osc_add_flash_warning_message(_m("You're already subscribed"), 'admin'); break; case 1: osc_add_flash_ok_message(_m('Subscribed correctly'), 'admin'); break; default: osc_add_flash_warning_message(_m("Error subscribing"), 'admin'); break; } } // show donation successful if (Params::getParam('donation') == 'successful') { osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin'); } }
function customHead() { $all = Preference::newInstance()->findValueByName('location_todo'); if ($all == '') { $all = 0; } $worktodo = LocationsTmp::newInstance()->count(); ?> <script type="text/javascript"> function reload() { window.location = '<?php echo osc_admin_base_url(true) . '?page=tools&action=locations'; ?> '; } function ajax_() { $.ajax({ type: "POST", url: '<?php echo osc_admin_base_url(true); ?> ?page=ajax&action=location_stats&<?php echo osc_csrf_token_url(); ?> ', dataType: 'json', success: function(data) { if(data.status=='done') { }else{ var pending = data.pending; var all = <?php echo osc_esc_js($all); ?> ; var percent = parseInt( ((all-pending)*100) / all ); $('span#percent').html(percent); ajax_(); } } }); } $(document).ready(function(){ if(<?php echo $worktodo; ?> > 0) { ajax_(); } }); </script> <?php }
public function getHideArchive() { $userId = Yii::app()->user->id; if ($userId) { $preference = Preference::model()->find("userId = {$userId} AND hideProject = 'archive'"); if ($preference) { return false; } else { return true; } } return true; }
function setCategoryInBdd($categories_id) { global $bdd; global $_TABLES; if (!is_null($bdd) && !is_null($_TABLES)) { if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $objPreference = new Preference($bdd, $_TABLES); $objPreference->removeAllPreferenceByUser($user_id); if (count($categories_id) > 0) { foreach ($categories_id as $key => $category_id) { $objPreference->addPreferenceByUser($user_id, $category_id); } } return true; } else { return false; } } else { error_log("BDD ERROR : " . json_encode($bdd)); error_log("TABLES ERROR : " . json_encode($_TABLES)); } }
function google_analytics_actions() { $dao_preference = new Preference(); $option = Params::getParam('option'); if (Params::getParam('file') != 'google_analytics/admin.php') { return ''; } if ($option == 'stepone') { $webid = Params::getParam('webid'); Preference::newInstance()->update(array("s_value" => $webid), array("s_section" => "plugin-google_analytics", "s_name" => "google_analytics_id")); osc_add_flash_ok_message(__('The tracking ID has been updated', 'google_analytics'), 'admin'); osc_redirect_to(osc_admin_render_plugin_url('google_analytics/admin.php')); } }
function basic_info() { require_once LIB_PATH . 'osclass/model/Admin.php'; require_once LIB_PATH . 'osclass/model/Preference.php'; require_once LIB_PATH . 'osclass/helpers/hSecurity.php'; if ($_POST['s_name'] == '') { $admin = 'admin'; } else { $admin = $_POST['s_name']; } if ($_POST['s_passwd'] == '') { $password = osc_genRandomPassword(); } else { $password = $_POST['s_passwd']; } Admin::newInstance()->insert(array('s_name' => 'Administrator', 's_username' => $admin, 's_password' => sha1($password), 's_email' => $_POST['email'])); $mPreference = Preference::newInstance(); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'pageTitle', 's_value' => $_POST['webtitle'], 'e_type' => 'STRING')); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'contactEmail', 's_value' => $_POST['email'], 'e_type' => 'STRING')); $body = 'Welcome ' . $_POST['webtitle'] . ',<br/><br/>'; $body .= 'Your OSClass installation at ' . WEB_PATH . ' is up and running. You can access to the administration panel with this data access:<br/>'; $body .= '<ul>'; $body .= '<li>username: '******'</li>'; $body .= '<li>password: '******'</li>'; $body .= '</ul>'; $body .= 'Regards,<br/>'; $body .= 'The <a href=\'http://osclass.org/\'>OSClass</a> team'; $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } try { require_once LIB_PATH . 'phpmailer/class.phpmailer.php'; $mail = new PHPMailer(true); $mail->CharSet = "utf-8"; $mail->Host = "localhost"; $mail->From = 'osclass@' . $sitename; $mail->FromName = 'OSClass'; $mail->Subject = 'OSClass successfully installed!'; $mail->AddAddress($_POST['email'], 'OSClass administrator'); $mail->Body = $body; $mail->AltBody = $body; if (!$mail->Send()) { return array('email_status' => $_POST['email'] . "<br>" . $mail->ErrorInfo, 's_password' => $password); } else { return array('email_status' => '', 's_password' => $password); } } catch (phpmailerException $exception) { } }
function basic_info() { require_once LIB_PATH . 'osclass/model/Admin.php'; require_once LIB_PATH . 'osclass/helpers/hSecurity.php'; $admin = Params::getParam('s_name'); if ($admin == '') { $admin = 'admin'; } $password = Params::getParam('s_passwd', false, false); if ($password == '') { $password = osc_genRandomPassword(); } Admin::newInstance()->insert(array('s_name' => 'Administrator', 's_username' => $admin, 's_password' => osc_hash_password($password), 's_email' => Params::getParam('email'))); $mPreference = Preference::newInstance(); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'pageTitle', 's_value' => Params::getParam('webtitle'), 'e_type' => 'STRING')); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'contactEmail', 's_value' => Params::getParam('email'), 'e_type' => 'STRING')); $body = sprintf(__('Привет %s,'), Params::getParam('webtitle')) . "<br/><br/>"; $body .= sprintf(__('Osclass успешно установлен %s и запущен. Вы можете получить доступ к панели администрирования:'), WEB_PATH) . '<br/>'; $body .= '<ul>'; $body .= '<li>' . sprintf(__('username: %s'), $admin) . '</li>'; $body .= '<li>' . sprintf(__('password: %s'), $password) . '</li>'; $body .= '</ul>'; $body .= sprintf(__('Помните, если у вас появяться вопросы вы можете прочитать <a href="%1$s">документацию</a>, спросить на <a href="%2$s">форуме</a> или в <a href="%3$s">блоге</a>.'), 'http://os-class.ru/wiki', 'http://os-class.ru/frm', 'http://os-class.ru/category/articles'); $body .= sprintf(' ' . __('Osclass doesn’t run any developments but we can put you in touch with third party developers through a Premium Support. And hey, if you would like to contribute to Osclass - learn how <a href="%1$s">here</a>!'), 'http://blog.osclass.org/2012/11/22/how-to-collaborate-to-osclass/') . '<br/><br/>'; $body .= __('Аплодисменты,') . "<br/>"; $body .= __('Ваш <a href="http://os-class.ru/">Osclass Rus Team</a> team'); $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } try { require_once LIB_PATH . 'phpmailer/class.phpmailer.php'; $mail = new PHPMailer(true); $mail->CharSet = "utf-8"; $mail->Host = "localhost"; $mail->From = 'osclass@' . $sitename; $mail->FromName = 'Osclass'; $mail->Subject = 'Osclass успешно установлен!'; $mail->AddAddress(Params::getParam('email'), 'Osclass administrator'); $mail->Body = $body; $mail->AltBody = $body; if (!$mail->Send()) { return array('email_status' => Params::getParam('email') . "<br>" . $mail->ErrorInfo, 's_password' => $password); } return array('email_status' => '', 's_password' => $password); } catch (phpmailerException $exception) { return array('email_status' => Params::getParam('email') . "<br>" . $exception->errorMessage(), 's_password' => $password); } }
function basic_info() { require_once LIB_PATH . 'osclass/model/Admin.php'; require_once LIB_PATH . 'osclass/helpers/hSecurity.php'; $admin = Params::getParam('s_name'); if ($admin == '') { $admin = 'admin'; } $password = Params::getParam('s_passwd', false, false); if ($password == '') { $password = osc_genRandomPassword(); } Admin::newInstance()->insert(array('s_name' => 'Administrator', 's_username' => $admin, 's_password' => osc_hash_password($password), 's_email' => Params::getParam('email'))); $mPreference = Preference::newInstance(); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'pageTitle', 's_value' => Params::getParam('webtitle'), 'e_type' => 'STRING')); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'contactEmail', 's_value' => Params::getParam('email'), 'e_type' => 'STRING')); $body = sprintf(__('Hi %s,'), Params::getParam('webtitle')) . "<br/><br/>"; $body .= sprintf(__('Your Osclass installation at %s is up and running. You can access the administration panel with these details:'), WEB_PATH) . '<br/>'; $body .= '<ul>'; $body .= '<li>' . sprintf(__('username: %s'), $admin) . '</li>'; $body .= '<li>' . sprintf(__('password: %s'), $password) . '</li>'; $body .= '</ul>'; $body .= sprintf(__('Remember that for any doubts you might have you can consult our <a href="%1$s">documentation</a>, <a href="%2$s">forum</a> or <a href="%3$s">blog</a>.'), 'http://doc.osclass.org/', 'http://forums.osclass.org/', 'http://blog.osclass.org/'); $body .= sprintf(' ' . __('Osclass doesn’t run any developments but we can put you in touch with third party developers through a Premium Support. And hey, if you would like to contribute to Osclass - learn how <a href="%1$s">here</a>!'), 'http://blog.osclass.org/2012/11/22/how-to-collaborate-to-osclass/') . '<br/><br/>'; $body .= __('Cheers,') . "<br/>"; $body .= __('The <a href="http://osclass.org/">Osclass</a> team'); $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } try { require_once LIB_PATH . 'phpmailer/class.phpmailer.php'; $mail = new PHPMailer(true); $mail->CharSet = "utf-8"; $mail->Host = "localhost"; $mail->From = 'osclass@' . $sitename; $mail->FromName = 'Osclass'; $mail->Subject = 'Osclass successfully installed!'; $mail->AddAddress(Params::getParam('email'), 'Osclass administrator'); $mail->Body = $body; $mail->AltBody = $body; if (!$mail->Send()) { return array('email_status' => Params::getParam('email') . "<br>" . $mail->ErrorInfo, 's_password' => $password); } return array('email_status' => '', 's_password' => $password); } catch (phpmailerException $exception) { return array('email_status' => Params::getParam('email') . "<br>" . $exception->errorMessage(), 's_password' => $password); } }
function init_db() { if (!Preference::exists('myplex_username')) { Preference::insert('myplex_username', 'myPlex Username', '', '25', 'string', 'internal'); Preference::insert('myplex_authtoken', 'myPlex Auth Token', '', '25', 'string', 'internal'); Preference::insert('myplex_published', 'Plex Server is published to myPlex', '0', '25', 'boolean', 'internal'); Preference::insert('plex_uniqid', 'Plex Server Unique Id', uniqid(), '25', 'string', 'internal'); Preference::insert('plex_servername', 'Plex Server Name', 'Ampache', '25', 'string', 'internal'); Preference::insert('plex_public_address', 'Plex Public Address', '', '25', 'string', 'internal'); Preference::insert('plex_public_port', 'Plex Public Port', '32400', '25', 'string', 'internal'); Preference::insert('plex_local_auth', 'myPlex authentication required on local network', '0', '25', 'boolean', 'internal'); Preference::insert('plex_match_email', 'Link myPlex users to Ampache based on e-mail address', '1', '25', 'boolean', 'internal'); User::rebuild_all_preferences(); } }
public function getPreferenceByKeyName($preferenceKeyName) { $preference = Preference::where('keyName', $preferenceKeyName)->first(); if ($preference != null) { $userPreference = PreferenceUser::where('preference_id', $preference->id)->where('user_id', $this->id)->first(); if ($userPreference == null) { $userPreference = new PreferenceUser(); $userPreference->user_id = $this->id; $userPreference->preference_id = $preference->id; $userPreference->value = $preference->default; $userPreference->save(); } return $userPreference; } return null; }
function basic_info() { require_once LIB_PATH . 'osclass/model/Admin.php'; require_once LIB_PATH . 'osclass/helpers/hSecurity.php'; $admin = Params::getParam('s_name'); if ($admin == '') { $admin = 'admin'; } $password = Params::getParam('s_passwd', false, false); if ($password == '') { $password = osc_genRandomPassword(); } Admin::newInstance()->insert(array('s_name' => 'Administrator', 's_username' => $admin, 's_password' => sha1($password), 's_email' => Params::getParam('email'))); $mPreference = Preference::newInstance(); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'pageTitle', 's_value' => Params::getParam('webtitle'), 'e_type' => 'STRING')); $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'contactEmail', 's_value' => Params::getParam('email'), 'e_type' => 'STRING')); $body = sprintf(__('Welcome %s,'), Params::getParam('webtitle')) . "<br/><br/>"; $body .= sprintf(__('Your OSClass installation at %s is up and running. You can access the administration panel with these details:'), WEB_PATH) . "<br/>"; $body .= '<ul>'; $body .= '<li>' . sprintf(__('username: %s'), $admin) . '</li>'; $body .= '<li>' . sprintf(__('password: %s'), $password) . '</li>'; $body .= '</ul>'; $body .= __('Regards,') . "<br/>"; $body .= __('The <a href="http://osclass.org/">OSClass</a> team'); $sitename = strtolower($_SERVER['SERVER_NAME']); if (substr($sitename, 0, 4) == 'www.') { $sitename = substr($sitename, 4); } try { require_once LIB_PATH . 'phpmailer/class.phpmailer.php'; $mail = new PHPMailer(true); $mail->CharSet = "utf-8"; $mail->Host = "localhost"; $mail->From = 'osclass@' . $sitename; $mail->FromName = 'OSClass'; $mail->Subject = 'OSClass successfully installed!'; $mail->AddAddress(Params::getParam('email'), 'OSClass administrator'); $mail->Body = $body; $mail->AltBody = $body; if (!$mail->Send()) { return array('email_status' => Params::getParam('email') . "<br>" . $mail->ErrorInfo, 's_password' => $password); } return array('email_status' => '', 's_password' => $password); } catch (phpmailerException $exception) { return array('email_status' => Params::getParam('email') . "<br>" . $exception->errorMessage(), 's_password' => $password); } }
/** * @param $providerURL Endereço do Discovery remoto * @param $requesterNSA NSA ID do requisitante * @param $requesterURL Endereço do Discovery local para receber notificações */ static function subscribe($providerURL, $requesterNSA, $requesterURL) { $ch = curl_init(); $message = '<?xml version="1.0" encoding="UTF-8"?><tns:subscriptionRequest ' . 'xmlns:tns="http://schemas.ogf.org/nsi/2014/02/discovery/types">' . '<requesterId>urn:ogf:network:' . Preference::findOneValue(Preference::MEICAN_NSA) . '</requesterId>' . '<callback>' . Url::toRoute("/topology/discovery/notification", "http") . '</callback>' . '<filter>' . '<include>' . '<event>All</event>' . '</include>' . '</filter>' . '</tns:subscriptionRequest>'; $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $message, CURLOPT_HTTPHEADER => array('Accept-encoding: application/xml;charset=utf-8', 'Content-Type: application/xml;charset=utf-8'), CURLOPT_USERAGENT => 'Meican', CURLOPT_URL => $providerURL . '/subscriptions'); curl_setopt_array($ch, $options); Yii::trace($message); $output = curl_exec($ch); Yii::trace($output); curl_close($ch); $parser = new NSIParser(); $parser->loadXml($output); $parser->parseSubscriptions(); foreach ($parser->getData()['subs'] as $subId => $sub) { return (string) $subId; } }
function doModel() { parent::doModel(); //specific things for this class switch ($this->action) { case 'add_post_default': // add default category and reorder parent categories $fields['fk_i_parent_id'] = NULL; $fields['i_expiration_days'] = 0; $fields['i_position'] = 0; $fields['b_enabled'] = 1; $default_locale = osc_language(); $aFieldsDescription[$default_locale]['s_name'] = "NEW CATEGORY, EDIT ME!"; $categoryId = $this->categoryManager->insert($fields, $aFieldsDescription); // reorder parent categories. NEW category first $rootCategories = $this->categoryManager->findRootCategories(); foreach ($rootCategories as $cat) { $order = $cat['i_position']; $order++; $this->categoryManager->updateOrder($cat['pk_i_id'], $order); } $this->categoryManager->updateOrder($categoryId, '0'); $this->redirectTo(osc_admin_base_url(true) . '?page=categories'); break; case 'settings': // calling the categories settings view $this->doView('categories/settings.php'); break; case 'settings_post': // updating categories option $selectableParent = Params::getParam('selectable_parent_categories'); $updated = Preference::newInstance()->update(array('s_value' => $selectableParent), array('s_name' => 'selectable_parent_categories')); if ($updated > 0) { osc_add_flash_ok_message(_m("Categories' settings have been updated"), 'admin'); } $this->redirectTo(osc_admin_base_url(true) . '?page=categories&action=settings'); break; default: // $this->_exportVariableToView("categories", $this->categoryManager->toTreeAll()); $this->doView("categories/index.php"); } }
/** * uninstall * This is a required plugin function. It removes our preferences from * the database returning it to its original form */ public function uninstall() { Preference::delete('stream_control_bandwidth_max'); Preference::delete('stream_control_bandwidth_days'); return true; }
/** * uninstall * This is a required plugin function */ public function uninstall() { Preference::delete('tadb_api_key'); return true; }
public function setRules() { Preference::newInstance()->update(array('s_value' => serialize($this->rules)), array('s_name' => 'rewrite_rules')); }
/** * get_session * This call the getSession method and properly updates the preferences as needed. * This requires a userid so it knows whose crap to update. */ public function get_session($user_id, $token) { $scrobbler = new scrobbler($this->api_key, $this->scheme, $this->api_host, '', $this->secret); $session_key = $scrobbler->get_session_key($token); if (!$session_key) { debug_event($this->name, 'getSession Failed: ' . $scrobbler->error_msg, '3'); return false; } $this->challenge = $session_key; // Update the preferences Preference::update('lastfm_challenge', $user_id, $session_key); debug_event($this->name, 'getSession Successful', '3'); return true; }
function google_analytics_call_after_uninstall() { Preference::newInstance()->delete(array("s_section" => "plugin-google_analytics", "s_name" => "google_analytics_id")); }
/** * set_active_instance * This sets the specified instance as the 'active' one */ public function set_active_instance($uid, $user_id = '') { // Not an admin? bubkiss! if (!$GLOBALS['user']->has_access('100')) { $user_id = $GLOBALS['user']->id; } $user_id = $user_id ? $user_id : $GLOBALS['user']->id; Preference::update('vlc_active', $user_id, intval($uid)); AmpConfig::set('vlc_active', intval($uid), true); return true; }
function butler_uninstall() { Preference::newInstance()->delete(array('s_section' => 'butler')); }