当前位置: 首页>>代码示例>>PHP>>正文


PHP Preference::update方法代码示例

本文整理汇总了PHP中Preference::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Preference::update方法的具体用法?PHP Preference::update怎么用?PHP Preference::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Preference的用法示例。


在下文中一共展示了Preference::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_preferences

function update_preferences($pref_id = 0)
{
    /* Get current keys */
    $sql = "SELECT `id`,`name`,`type` FROM `preference`";
    /* If it isn't the System Account's preferences */
    if ($pref_id != '-1') {
        $sql .= " WHERE `catagory` != 'system'";
    }
    $db_results = Dba::read($sql);
    $results = array();
    // Collect the current possible keys
    while ($r = Dba::fetch_assoc($db_results)) {
        $results[] = array('id' => $r['id'], 'name' => $r['name'], 'type' => $r['type']);
    }
    // end collecting keys
    /* Foreach through possible keys and assign them */
    foreach ($results as $data) {
        /* Get the Value from POST/GET var called $data */
        $name = $data['name'];
        $apply_to_all = 'check_' . $data['name'];
        $new_level = 'level_' . $data['name'];
        $id = $data['id'];
        $value = scrub_in($_REQUEST[$name]);
        /* Some preferences require some extra checks to be performed */
        switch ($name) {
            case 'transcode_bitrate':
                $value = Stream::validate_bitrate($value);
                break;
            default:
                break;
        }
        if (preg_match('/_pass$/', $name)) {
            if ($value == '******') {
                unset($_REQUEST[$name]);
            } else {
                if (preg_match('/md5_pass$/', $name)) {
                    $value = md5($value);
                }
            }
        }
        /* Run the update for this preference only if it's set */
        if (isset($_REQUEST[$name])) {
            Preference::update($id, $pref_id, $value, $_REQUEST[$apply_to_all]);
        }
        if (Access::check('interface', '100') && $_REQUEST[$new_level]) {
            Preference::update_level($id, $_REQUEST[$new_level]);
        }
    }
    // end foreach preferences
    // Now that we've done that we need to invalidate the cached preverences
    Preference::clear_from_session();
}
开发者ID:cheese1,项目名称:ampache,代码行数:52,代码来源:preferences.php

示例2: load

 /**
  * load
  * This loads up the data we need into this object, this stuff comes 
  * from the preferences.
  */
 public function load($user)
 {
     $user->set_preferences();
     $data = $user->prefs;
     if (strlen(trim($data['growl_address']))) {
         $this->address = trim($data['growl_address']);
     } else {
         debug_event($this->name, 'No server address, not scrobbling', '3');
         return false;
     }
     $this->password = trim($data['growl_pass']);
     $this->message = trim($data['growl_message']);
     $registered_address = trim($data['growl_registered_address']);
     $confhash = md5($this->address . ':' . $this->password);
     if ($registered_address != $confhash) {
         $growl = $this->get_growl();
         $icon = AmpConfig::get('theme_path') . '/images/ampache.png';
         $growl->registerApplication($icon);
         debug_event($this->name, 'Growl registered.', '5');
         Preference::update('growl_registered_address', $user->id, $confhash);
     }
     $this->user_id = $user->id;
     return true;
 }
开发者ID:nioc,项目名称:ampache,代码行数:29,代码来源:Growl.plugin.php

示例3: Preference

<?php

$key = '';
$dao_preference = new Preference();
if (Params::getParam('key') != '') {
    $key = Params::getParam('key');
} else {
    $key = osc_google_maps_key() != '' ? osc_google_maps_key() : '';
}
if (Params::getParam('option') == 'stepone') {
    $dao_preference->update(array("s_value" => $key), array("s_section" => "plugin-google_maps", "s_name" => "google_maps_key"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Congratulations. The plugin is now configured', 'google_maps') . '.</p></div>';
}
unset($dao_preference);
?>

<form action="<?php 
osc_admin_base_url(true);
?>
" method="post">
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="google_maps/admin.php" />
    <input type="hidden" name="option" value="stepone" />
    <div>
        <?php 
_e('Please enter your Google Maps', 'google_maps');
?>
 <label for="key" style="font-weight: bold;"><?php 
_e('developer key', 'google_maps');
?>
开发者ID:hashemgamal,项目名称:OSClass,代码行数:31,代码来源:admin.php

示例4: get_latest_version

 /**
  * Get latest available version from GitHub.
  * @param boolean $force
  * @return string
  */
 public static function get_latest_version($force = false)
 {
     $lastversion = '';
     // Forced or last check expired, check latest version from Github
     if ($force || self::lastcheck_expired() && AmpConfig::get('autoupdate')) {
         // Always update last check time to avoid infinite check on permanent errors (proxy, firewall, ...)
         $time = time();
         Preference::update('autoupdate_lastcheck', $GLOBALS['user']->id, $time);
         AmpConfig::set('autoupdate_lastcheck', $time, true);
         // Development version, get latest commit on develop branch
         if (self::is_develop()) {
             $commits = self::github_request('/commits/develop');
             if (!empty($commits)) {
                 $lastversion = $commits->sha;
                 Preference::update('autoupdate_lastversion', $GLOBALS['user']->id, $lastversion);
                 AmpConfig::set('autoupdate_lastversion', $lastversion, true);
                 $available = self::is_update_available(true);
                 Preference::update('autoupdate_lastversion_new', $GLOBALS['user']->id, $available);
                 AmpConfig::set('autoupdate_lastversion_new', $available, true);
             }
         } else {
             $tags = self::github_request('/tags');
             if (!empty($tags)) {
                 $lastversion = $tags[0]->name;
                 Preference::update('autoupdate_lastversion', $GLOBALS['user']->id, $lastversion);
                 AmpConfig::set('autoupdate_lastversion', $lastversion, true);
                 $available = self::is_update_available(true);
                 Preference::update('autoupdate_lastversion_new', $GLOBALS['user']->id, $available);
                 AmpConfig::set('autoupdate_lastversion_new', $available, true);
             }
         }
     } else {
         $lastversion = AmpConfig::get('autoupdate_lastversion');
     }
     return $lastversion;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:41,代码来源:autoupdate.class.php

示例5: exit

<?php

if (!defined('OC_ADMIN') || OC_ADMIN !== true) {
    exit('Access is not allowed.');
}
$dao_preference = new Preference();
$webid = Params::getParam('webid');
$option = Params::getParam('option');
if ($option == 'stepone') {
    $dao_preference->update(array("s_value" => $webid), array("s_section" => "plugin-yandex_maps", "s_name" => "yandex_maps_key"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Congratulations. The plugin is now configured', 'yandex_map') . '.</p></div>';
} else {
    $webid = osc_yandex_map_key();
}
?>

<form action="<?php 
osc_admin_base_url(true);
?>
" method="get">
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="yandex_maps/admin.php" />
    <input type="hidden" name="option" value="stepone" />
    <div>
        <p>
            <?php 
_e('Please enter your Yandex.Map ', 'yandex_maps');
?>
 <label for="id" style="font-weight: bold;"><?php 
_e('API key', 'yandex_maps');
开发者ID:bomvendador,项目名称:soroka_r,代码行数:31,代码来源:admin.php

示例6: set_active_instance

 /**
  * 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;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:15,代码来源:vlc.controller.php

示例7: createuser

 /**
  * createUser
  * Create a new user.
  * Takes the username, password and email with optional roles in parameters.
  */
 public static function createuser($input)
 {
     self::check_version($input, "1.1.0");
     $username = self::check_parameter($input, 'username');
     $password = self::check_parameter($input, 'password');
     $email = self::check_parameter($input, 'email');
     $ldapAuthenticated = $input['ldapAuthenticated'];
     $adminRole = $input['adminRole'] == 'true';
     //$settingsRole = $input['settingsRole'];
     //$streamRole = $input['streamRole'];
     //$jukeboxRole = $input['jukeboxRole'];
     $downloadRole = $input['downloadRole'] == 'true';
     $uploadRole = $input['uploadRole'] == 'true';
     //$playlistRole = $input['playlistRole'];
     $coverArtRole = $input['coverArtRole'] == 'true';
     //$commentRole = $input['commentRole'];
     //$podcastRole = $input['podcastRole'];
     $shareRole = $input['shareRole'] == 'true';
     if (Access::check('interface', 100)) {
         $access = 25;
         if ($adminRole) {
             $access = 100;
         } elseif ($coverArtRole) {
             $access = 75;
         }
         $password = self::decrypt_password($password);
         $user_id = User::create($username, $username, $email, null, $password, $access);
         if ($user_id > 0) {
             if ($downloadRole) {
                 Preference::update('download', $user_id, '1');
             }
             if ($uploadRole) {
                 Preference::update('allow_upload', $user_id, '1');
             }
             if ($shareRole) {
                 Preference::update('share', $user_id, '1');
             }
             $r = Subsonic_XML_Data::createSuccessResponse();
         } else {
             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }
开发者ID:bl00m,项目名称:ampache,代码行数:51,代码来源:subsonic_api.class.php

示例8: uninstall

 /**
  * uninstall
  * This runs the uninstall for the localplay controller we've
  * currently pimped out
  */
 public function uninstall()
 {
     // Run the players uninstaller
     $this->_player->uninstall();
     // If its our current player, reset player to nothing
     if (AmpConfig::get('localplay_controller') == $this->type) {
         Preference::update('localplay_controller', $GLOBALS['user']->id, '');
     }
     return true;
 }
开发者ID:ivan801,项目名称:ampache,代码行数:15,代码来源:localplay.class.php

示例9: T_

         $new_user = $_POST['db_username'];
         $new_pass = $_POST['db_password'];
         if (!strlen($new_user) || !strlen($new_pass)) {
             Error::add('general', T_('Error: Ampache SQL Username or Password missing'));
             require_once 'templates/show_install.inc.php';
             break;
         }
     }
     if (!$skip_admin) {
         if (!install_insert_db($new_user, $new_pass, $_REQUEST['create_db'], $_REQUEST['overwrite_db'], $_REQUEST['create_tables'])) {
             require_once 'templates/show_install.inc.php';
             break;
         }
     }
     // Now that it's inserted save the lang preference
     Preference::update('lang', '-1', AmpConfig::get('lang'));
     header('Location: ' . $web_path . "/install.php?action=show_create_config&local_db={$database}&local_host={$hostname}&local_port={$port}&htmllang={$htmllang}&charset={$charset}");
     break;
 case 'create_config':
     $download = !isset($_POST['write']);
     $download_htaccess_rest = isset($_POST['download_htaccess_rest']);
     $download_htaccess_play = isset($_POST['download_htaccess_play']);
     $write_htaccess_rest = isset($_POST['write_htaccess_rest']);
     $write_htaccess_play = isset($_POST['write_htaccess_play']);
     if ($write_htaccess_rest || $download_htaccess_rest) {
         $created_config = install_rewrite_rules($htaccess_rest_file, $_POST['web_path'], $download_htaccess_rest);
     } elseif ($write_htaccess_play || $download_htaccess_play) {
         $created_config = install_rewrite_rules($htaccess_play_file, $_POST['web_path'], $download_htaccess_play);
     } else {
         $created_config = install_create_config($download);
     }
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:install.php

示例10: Preference

<?php

$dao_preference = new Preference();
$webid = Params::getParam('webid');
$option = Params::getParam('option');
if ($option == 'stepone') {
    $dao_preference->update(array("s_value" => $webid), array("s_section" => "plugin-google_analytics", "s_name" => "google_analytics_id"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Congratulations. The plugin is now configured', 'google_analytics') . '.</p></div>';
} else {
    $webid = osc_google_analytics_id();
}
?>

<form action="<?php 
osc_admin_base_url(true);
?>
" method="get">
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="google_analytics/admin.php" />
    <input type="hidden" name="option" value="stepone" />
    
    <div>
        <?php 
_e('Please enter your Google Analytics', 'google_analytics');
?>
 <label for="webid" style="font-weight: bold;"><?php 
_e('Web property ID', 'google_analytics');
?>
</label>: <input type="text" name="webid" id="webid" value="<?php 
echo $webid;
开发者ID:acharei,项目名称:OSClass,代码行数:31,代码来源:admin.php

示例11: Preference

$adEmailEx = '';
$dao_preference = new Preference();
if (Params::getParam('adEmailEx') != '') {
    $adEmailEx = Params::getParam('adEmailEx');
} else {
    $adEmailEx = osc_item_adManage_adEmailEx() != '' ? osc_item_adManage_adEmailEx() : '';
}
$deleteDays = '';
$dao_preference = new Preference();
if (Params::getParam('deleteDays') != '') {
    $deleteDays = Params::getParam('deleteDays');
} else {
    $deleteDays = osc_item_adManage_deleteDays() != '' ? osc_item_adManage_deleteDays() : '';
}
if (Params::getParam('option') == 'stepone') {
    $dao_preference->update(array("s_value" => $expire_days), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_expire"));
    $dao_preference->update(array("s_value" => $payPost), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_payperpost"));
    $dao_preference->update(array("s_value" => $rTimes), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_repubTimes"));
    $dao_preference->update(array("s_value" => $freeTimes), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_freeRepubs"));
    $dao_preference->update(array("s_value" => $adEmailEx), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_expireEmail"));
    $dao_preference->update(array("s_value" => $deleteDays), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_deleteDays"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Settings Saved', 'adManage') . '.</p></div>';
}
unset($dao_preference);
?>


    <fieldset>
    <h2><?php 
_e('Advanced Ad Management Configuration', 'adManage');
?>
开发者ID:oanav,项目名称:closetshare,代码行数:31,代码来源:admin.php

示例12: array

 */
if (!defined('AJAX_INCLUDE')) {
    exit;
}
$results = array();
switch ($_REQUEST['action']) {
    case 'set_instance':
        // Make sure they they are allowed to do this
        if (!Access::check('localplay', '5')) {
            debug_event('DENIED', 'Error attempted to set instance without required level', '1');
            exit;
        }
        $type = $_REQUEST['instance'] ? 'localplay' : 'stream';
        $localplay = new Localplay(AmpConfig::get('localplay_controller'));
        $localplay->set_active_instance($_REQUEST['instance']);
        Preference::update('play_type', $GLOBALS['user']->id, $type);
        // We should also refesh the sidebar
        ob_start();
        require_once AmpConfig::get('prefix') . UI::find_template('sidebar.inc.php');
        $results['sidebar-content'] = ob_get_contents();
        ob_end_clean();
        break;
    case 'command':
        // Make sure they are allowed to do this
        if (!Access::check('localplay', '50')) {
            debug_event('DENIED', 'Attempted to control Localplay without sufficient access', '1');
            exit;
        }
        $localplay = new Localplay(AmpConfig::get('localplay_controller'));
        $localplay->connect();
        // Switch on valid commands
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:localplay.ajax.php

示例13: config_menu

            $fp_backup = fopen(osc_base_path() . "robots_backup.txt", "wb");
            fwrite($fp_backup, file_get_contents(osc_base_path() . "robots.txt"));
            fclose($fp_backup);
            message_ok(__('Backup file robots_backup.txt file was successfully created', 'all_in_one'));
        }
        $content = $robots;
    }
    $fp = fopen(osc_base_path() . "robots.txt", "wb");
    fwrite($fp, $content);
    fclose($fp);
    osc_reset_preferences();
    message_ok(__('robots.txt file was successfully updated', 'all_in_one'));
    if (!is_writable(osc_base_path() . "/robots.txt")) {
        message_error(__('It is impossible to write to robots.txt file, please change CHMOD settings on this file.', 'all_in_one'));
    }
    $dao_preference->update(array("s_value" => $robotsEnabled), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_robots_enabled"));
    $dao_preference->update(array("s_value" => $robots), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_robots"));
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="POST" enctype="multipart/form-data" >
    <input type="hidden" name="page" value="plugins" />
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:31,代码来源:robots.php

示例14: switch

UI::show_header();
switch ($_REQUEST['action']) {
    case 'install_localplay':
        $localplay = new Localplay($_REQUEST['type']);
        if (!$localplay->player_loaded()) {
            Error::add('general', T_('Install Failed, Controller Error'));
            Error::display('general');
            break;
        }
        // Install it!
        $localplay->install();
        // Go ahead and enable Localplay (Admin->System) as we assume they want to do that
        // if they are enabling this
        Preference::update('allow_localplay_playback', '-1', '1');
        Preference::update('localplay_level', $GLOBALS['user']->id, '100');
        Preference::update('localplay_controller', $GLOBALS['user']->id, $localplay->type);
        header("Location:" . AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay');
        break;
    case 'install_catalog_type':
        $type = scrub_in($_REQUEST['type']);
        $catalog = Catalog::create_catalog_type($type);
        if ($catalog == null) {
            Error::add('general', T_('Install Failed, Catalog Error'));
            Error::display('general');
            break;
        }
        $catalog->install();
        /* Show Confirmation */
        $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_catalog_types';
        $title = T_('Plugin Installed');
        $body = '';
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:modules.php

示例15: config_menu

    $freq = osc_get_preference('allSeo_sitemap_freq', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_freq', 'plugin-all_in_one') : '';
}
$sitemap_items = '';
if (Params::getParam('sitemap_items') != '') {
    $sitemap_items = Params::getParam('sitemap_items');
} else {
    $sitemap_items = osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') : '';
}
$sitemap_items_limit = '';
if (Params::getParam('sitemap_items_limit') != '') {
    $sitemap_items_limit = Params::getParam('sitemap_items_limit');
} else {
    $sitemap_items_limit = osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') : '';
}
if (Params::getParam('plugin_action') == 'done') {
    $dao_preference->update(array("s_value" => $freq), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_freq"));
    $dao_preference->update(array("s_value" => $sitemap_items), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_items"));
    $dao_preference->update(array("s_value" => $sitemap_items_limit), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_items_limit"));
    //Generate sitemap
    $execution_time = seo_sitemap_generator();
    message_ok(__('Sitemap.xml generated correctly in', 'all_in_one') . ' ' . round($execution_time, 2) . ' ' . __('seconds', 'all_in_one') . '.');
    osc_reset_preferences();
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>
  
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:30,代码来源:generate.php


注:本文中的Preference::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。