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


PHP AmpConfig::set_by_array方法代码示例

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


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

示例1:

// Library and module includes we can't do with the autoloader
require_once $prefix . '/modules/getid3/getid3.php';
require_once $prefix . '/modules/phpmailer/class.phpmailer.php';
require_once $prefix . '/modules/phpmailer/class.smtp.php';
require_once $prefix . '/modules/infotools/AmazonSearchEngine.class.php';
require_once $prefix . '/modules/infotools/lastfm.class.php';
require_once $prefix . '/modules/musicbrainz/MusicBrainz.php';
require_once $prefix . '/modules/musicbrainz/Exception.php';
require_once $prefix . '/modules/musicbrainz/Clients/MbClient.php';
require_once $prefix . '/modules/musicbrainz/Clients/RequestsMbClient.php';
require_once $prefix . '/modules/ampacheapi/AmpacheApi.lib.php';
require_once $prefix . '/modules/EchoNest/Autoloader.php';
EchoNest_Autoloader::register();
/* Temp Fixes */
$results = Preference::fix_preferences($results);
AmpConfig::set_by_array($results, true);
// Modules (These are conditionally included depending upon config values)
if (AmpConfig::get('ratings')) {
    require_once $prefix . '/lib/rating.lib.php';
}
/* Set a new Error Handler */
$old_error_handler = set_error_handler('ampache_error_handler');
/* Check their PHP Vars to make sure we're cool here */
$post_size = @ini_get('post_max_size');
if (substr($post_size, strlen($post_size) - 1, strlen($post_size)) != 'M') {
    /* Sane value time */
    ini_set('post_max_size', '8M');
}
// In case the local setting is 0
ini_set('session.gc_probability', '5');
if (!isset($results['memory_limit']) || UI::unformat_bytes($results['memory_limit']) < UI::unformat_bytes('32M')) {
开发者ID:axelsimon,项目名称:ampache,代码行数:31,代码来源:init.php

示例2: init

 /**
  * init
  * This grabs the preferences and then loads them into conf it should be run on page load
  * to initialize the needed variables
  */
 public static function init()
 {
     $user_id = $GLOBALS['user']->id ? Dba::escape($GLOBALS['user']->id) : '-1';
     // First go ahead and try to load it from the preferences
     if (self::load_from_session($user_id)) {
         return true;
     }
     /* Get Global Preferences */
     $sql = "SELECT `preference`.`name`,`user_preference`.`value`,`syspref`.`value` AS `system_value` FROM `preference` " . "LEFT JOIN `user_preference` `syspref` ON `syspref`.`preference`=`preference`.`id` AND `syspref`.`user`='-1' AND `preference`.`catagory`='system' " . "LEFT JOIN `user_preference` ON `user_preference`.`preference`=`preference`.`id` AND `user_preference`.`user` = ? AND `preference`.`catagory`!='system'";
     $db_results = Dba::read($sql, array($user_id));
     $results = array();
     while ($row = Dba::fetch_assoc($db_results)) {
         $value = $row['system_value'] ? $row['system_value'] : $row['value'];
         $name = $row['name'];
         $results[$name] = $value;
     }
     // end while sys prefs
     /* Set the Theme mojo */
     if (strlen($results['theme_name']) > 0) {
         $results['theme_path'] = '/themes/' . $results['theme_name'];
         // In case the theme was removed
         if (!Core::is_readable(AmpConfig::get('prefix') . $results['theme_path'])) {
             unset($results['theme_path']);
         }
     }
     // Default theme if we don't get anything from their
     // preferences because we're going to want at least something otherwise
     // the page is going to be really ugly
     if (!isset($results['theme_path'])) {
         $results['theme_path'] = '/themes/reborn';
     }
     AmpConfig::set_by_array($results, true);
     $_SESSION['userdata']['preferences'] = $results;
     $_SESSION['userdata']['uid'] = $user_id;
 }
开发者ID:nioc,项目名称:ampache,代码行数:40,代码来源:preference.class.php

示例3: T_

    <td width="350px">
    <?php 
    echo T_('This test attempts to read config/ampache.cfg.php. If this fails the file either is not in the correct location or is not currently readable.');
    ?>
    </td>
</tr>
<tr>
    <td valign="top">
        <?php 
    echo T_('Configuration file validity');
    ?>
    </td>
    <td valign="top">
    <?php 
    $results = @parse_ini_file($configfile);
    AmpConfig::set_by_array($results);
    echo debug_result(check_config_values($results));
    ?>
    </td>
    <td>
    <?php 
    echo T_("This test makes sure that you have set all of the required configuration variables and that we are able to completely parse your config file.");
    ?>
    </td>
</tr>
<tr>
    <td valign="top"><?php 
    echo T_("Database connection");
    ?>
</td>
    <td valign="top">
开发者ID:bl00m,项目名称:ampache,代码行数:31,代码来源:show_test_table.inc.php

示例4: install_config_use_case

function install_config_use_case($case)
{
    $trconfig = array('use_auth' => 'true', 'ratings' => 'true', 'userflags' => 'true', 'sociable' => 'true', 'licensing' => 'false', 'wanted' => 'true', 'channel' => 'true', 'live_stream' => 'true', 'allow_public_registration' => 'false', 'cookie_disclaimer' => 'false', 'share' => 'false');
    $dbconfig = array('download' => '1', 'share' => '0', 'allow_video' => '1', 'home_now_playing' => '1', 'home_recently_played' => '1');
    switch ($case) {
        case 'minimalist':
            $trconfig['ratings'] = 'false';
            $trconfig['userflags'] = 'false';
            $trconfig['sociable'] = 'false';
            $trconfig['wanted'] = 'false';
            $trconfig['channel'] = 'false';
            $trconfig['live_stream'] = 'false';
            $dbconfig['download'] = '0';
            $dbconfig['allow_video'] = '0';
            // Hide sidebar by default to have a better 'minimalist first look'.
            setcookie('sidebar_state', 'collapsed', time() + 30 * 24 * 60 * 60, '/');
            break;
        case 'community':
            $trconfig['use_auth'] = 'false';
            $trconfig['licensing'] = 'true';
            $trconfig['wanted'] = 'false';
            $trconfig['live_stream'] = 'false';
            $trconfig['allow_public_registration'] = 'true';
            $trconfig['cookie_disclaimer'] = 'true';
            $trconfig['share'] = 'true';
            $dbconfig['download'] = '0';
            $dbconfig['share'] = '1';
            $dbconfig['home_now_playing'] = '0';
            $dbconfig['home_recently_played'] = '0';
            break;
        default:
            break;
    }
    AmpConfig::set_by_array($trconfig, true);
    foreach ($dbconfig as $preference => $value) {
        Preference::update($preference, -1, $value, true, true);
    }
}
开发者ID:nioc,项目名称:ampache,代码行数:38,代码来源:install.lib.php

示例5: init

 /**
  * init
  * This grabs the preferences and then loads them into conf it should be run on page load
  * to initialize the needed variables
  */
 public static function init()
 {
     $user_id = $GLOBALS['user']->id ? Dba::escape($GLOBALS['user']->id) : '-1';
     // First go ahead and try to load it from the preferences
     if (self::load_from_session($user_id)) {
         return true;
     }
     /* Get Global Preferences */
     $sql = "SELECT `preference`.`name`,`user_preference`.`value`,`syspref`.`value` AS `system_value` FROM `preference` " . "LEFT JOIN `user_preference` `syspref` ON `syspref`.`preference`=`preference`.`id` AND `syspref`.`user`='-1' AND `preference`.`catagory`='system' " . "LEFT JOIN `user_preference` ON `user_preference`.`preference`=`preference`.`id` AND `user_preference`.`user`='{$user_id}' AND `preference`.`catagory`!='system'";
     $db_results = Dba::read($sql);
     $results = array();
     while ($row = Dba::fetch_assoc($db_results)) {
         $value = $row['system_value'] ? $row['system_value'] : $row['value'];
         $name = $row['name'];
         $results[$name] = $value;
     }
     // end while sys prefs
     /* Set the Theme mojo */
     if (strlen($results['theme_name']) > 0) {
         $results['theme_path'] = '/themes/' . $results['theme_name'];
     } else {
         $results['theme_path'] = '/themes/reborn';
     }
     AmpConfig::set_by_array($results, true);
     $_SESSION['userdata']['preferences'] = $results;
     $_SESSION['userdata']['uid'] = $user_id;
 }
开发者ID:axelsimon,项目名称:ampache,代码行数:32,代码来源:preference.class.php

示例6: install_config_transcode_mode

function install_config_transcode_mode($mode)
{
    $trconfig = array('encode_target' => 'mp3', 'transcode_m4a' => 'required', 'transcode_flac' => 'required', 'transcode_mpc' => 'required', 'transcode_ogg' => 'allowed', 'transcode_wav' => 'required');
    if ($mode == 'ffmpeg' || $mode == 'avconv') {
        $trconfig['transcode_cmd'] = $mode . ' -i %FILE%';
        $trconfig['encode_args_mp3'] = '-vn -b:a %SAMPLE%K -c:a libmp3lame -f mp3 pipe:1';
        $trconfig['encode_args_ogg'] = '-vn -b:a %SAMPLE%K -c:a libvorbis -f ogg pipe:1';
        $trconfig['encode_args_wav'] = '-vn -b:a %SAMPLE%K -c:a pcm_s16le -f wav pipe:1';
        AmpConfig::set_by_array($trconfig, true);
    }
}
开发者ID:axelsimon,项目名称:ampache,代码行数:11,代码来源:install.lib.php


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