コード例 #1
0
ファイル: init.php プロジェクト: axelsimon/ampache
// 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')) {
コード例 #2
0
ファイル: preference.class.php プロジェクト: nioc/ampache
 /**
  * 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;
 }
コード例 #3
0
ファイル: show_test_table.inc.php プロジェクト: bl00m/ampache
    <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">
コード例 #4
0
ファイル: install.lib.php プロジェクト: nioc/ampache
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);
    }
}
コード例 #5
0
 /**
  * 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;
 }
コード例 #6
0
ファイル: install.lib.php プロジェクト: axelsimon/ampache
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);
    }
}