mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Fix scrutinizer code style
This commit is contained in:
parent
1757d8c6f5
commit
fee1e70ffa
14 changed files with 37 additions and 12 deletions
|
@ -180,6 +180,7 @@ class Api
|
|||
|
||||
if ($client) {
|
||||
// Create the session
|
||||
$data = array();
|
||||
$data['username'] = $client->username;
|
||||
$data['type'] = 'api';
|
||||
$data['value'] = $timestamp;
|
||||
|
@ -654,6 +655,7 @@ class Api
|
|||
*/
|
||||
public static function search_songs($input)
|
||||
{
|
||||
$array = array();
|
||||
$array['type'] = 'song';
|
||||
$array['rule_1'] = 'anywhere';
|
||||
$array['rule_1_input'] = $input['filter'];
|
||||
|
|
|
@ -743,6 +743,7 @@ class Art extends database_object
|
|||
// that displays cover art.
|
||||
// I'm leaving in the releaseuri info for the moment, though
|
||||
// it's not going to be used.
|
||||
$coverartsites = array();
|
||||
$coverartsites[] = array(
|
||||
'name' => "CD Baby",
|
||||
'domain' => "cdbaby.com",
|
||||
|
|
|
@ -379,12 +379,13 @@ class Artist extends database_object
|
|||
$sql = 'SELECT `id`, `mbid` FROM `artist` WHERE `name` LIKE ?';
|
||||
$db_results = Dba::read($sql, array($name));
|
||||
|
||||
$id_array = array();
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
$key = $row['mbid'] ?: 'null';
|
||||
$id_array[$key] = $row['id'];
|
||||
}
|
||||
|
||||
if (isset($id_array)) {
|
||||
if (count($id_array)) {
|
||||
if ($mbid) {
|
||||
if (isset($id_array['null']) && !$readonly) {
|
||||
$sql = 'UPDATE `artist` SET `mbid` = ? WHERE `id` = ?';
|
||||
|
|
|
@ -66,6 +66,7 @@ class Auth
|
|||
|
||||
xoutput_headers();
|
||||
|
||||
$results = array();
|
||||
$results['rfc3514'] = '<script type="text/javascript">reloadRedirect("' . $target . '")</script>';
|
||||
echo xoutput_from_array($results);
|
||||
} else {
|
||||
|
@ -134,6 +135,7 @@ class Auth
|
|||
// variations of the password. Increases collision chances, but
|
||||
// doesn't break things.
|
||||
// FIXME: Break things in the future.
|
||||
$hashed_password = array();
|
||||
$hashed_password[] = hash('sha256', $password);
|
||||
$hashed_password[] = hash('sha256',
|
||||
Dba::escape(stripslashes(htmlspecialchars(strip_tags($password)))));
|
||||
|
@ -169,6 +171,7 @@ class Auth
|
|||
*/
|
||||
private static function pam_auth($username, $password)
|
||||
{
|
||||
$results = array();
|
||||
if (!function_exists('pam_auth')) {
|
||||
$results['success'] = false;
|
||||
$results['error'] = 'The PAM PHP module is not installed';
|
||||
|
@ -274,6 +277,7 @@ class Auth
|
|||
//This is the ldap objectclass (required)
|
||||
$ldap_class = AmpConfig::get('ldap_objectclass');
|
||||
|
||||
$results = array();
|
||||
if (!($ldap_dn && $ldap_url && $ldap_filter && $ldap_class)) {
|
||||
debug_event('ldap_auth', 'Required config value missing', 1);
|
||||
$results['success'] = false;
|
||||
|
@ -367,6 +371,7 @@ class Auth
|
|||
*/
|
||||
private static function http_auth($username, $password)
|
||||
{
|
||||
$results = array();
|
||||
if (($_SERVER['REMOTE_USER'] == $username) ||
|
||||
($_SERVER['HTTP_REMOTE_USER'] == $username)) {
|
||||
$results['success'] = true;
|
||||
|
|
|
@ -506,6 +506,7 @@ abstract class Catalog extends database_object
|
|||
$data = Dba::fetch_row($db_results);
|
||||
$artists = $data[0];
|
||||
|
||||
$results = array();
|
||||
$results['songs'] = $songs;
|
||||
$results['albums'] = $albums;
|
||||
$results['artists'] = $artists;
|
||||
|
|
|
@ -120,7 +120,7 @@ class Plex_Api
|
|||
self::createError(401);
|
||||
}
|
||||
|
||||
if (empty($email)) {
|
||||
if (empty($email) && isset($username)) {
|
||||
$xml = self::get_users_account();
|
||||
if ((string) $xml->username == $username) {
|
||||
$email = (string) $xml->email;
|
||||
|
@ -137,7 +137,7 @@ class Plex_Api
|
|||
if (!empty($email)) {
|
||||
$user = User::get_from_email($email);
|
||||
}
|
||||
if (!$user || !$user->id) {
|
||||
if (!isset($user) || !$user->id) {
|
||||
debug_event('Access Denied', 'Unable to get an Ampache user match for email ' . $email, '3');
|
||||
self::createError(401);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ class Plex_Api
|
|||
}
|
||||
$ach = $reqheaders['Access-Control-Request-Headers'];
|
||||
if ($ach) {
|
||||
$headers = self::getPlexHeaders(true, $acl);
|
||||
$headers = self::getPlexHeaders(true, $ach);
|
||||
$headerkeys = array();
|
||||
foreach ($headers as $key => $value) {
|
||||
$headerkeys[] = strtolower($key);
|
||||
|
@ -652,14 +652,14 @@ class Plex_Api
|
|||
$art = new Art($id, "artist");
|
||||
} else if (Plex_XML_Data::isAlbum($key)) {
|
||||
$art = new Art($id, "album");
|
||||
} else if (Plex_XML_Data::isSong($key)) {
|
||||
} else if (Plex_XML_Data::isTrack($key)) {
|
||||
$art = new Art($id, "song");
|
||||
}
|
||||
|
||||
if ($art != null) {
|
||||
$art->get_db();
|
||||
|
||||
if (!$size) {
|
||||
if (!isset($size)) {
|
||||
self::setHeader($art->raw_mime);
|
||||
echo $art->raw;
|
||||
} else {
|
||||
|
@ -942,6 +942,7 @@ class Plex_Api
|
|||
$rating = $_REQUEST['rating'];
|
||||
|
||||
if ($identifier == 'com.plexapp.plugins.library') {
|
||||
$robj = null;
|
||||
if (Plex_XML_Data::isArtist($id)) {
|
||||
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "artist");
|
||||
} else if (Plex_XML_Data::isAlbum($id)) {
|
||||
|
|
|
@ -76,6 +76,7 @@ class scrobbler
|
|||
*/
|
||||
public function handshake()
|
||||
{
|
||||
$data = array();
|
||||
$as_socket = fsockopen($this->scrobble_host, 80, $errno, $errstr, 2);
|
||||
if (!$as_socket) {
|
||||
$this->error_msg = $errstr;
|
||||
|
|
|
@ -73,8 +73,11 @@ class Stream_Playlist
|
|||
|
||||
$sql = 'INSERT INTO `stream_playlist` ';
|
||||
|
||||
$fields = array();
|
||||
$fields[] = '`sid`';
|
||||
$values = array();
|
||||
$values[] = $this->id;
|
||||
$holders = array();
|
||||
$holders[] = '?';
|
||||
|
||||
foreach ($url->properties as $field) {
|
||||
|
|
|
@ -91,6 +91,7 @@ class User extends database_object
|
|||
$sql = 'SELECT COUNT(`id`) FROM `user`';
|
||||
$db_results = Dba::read($sql);
|
||||
$data = Dba::fetch_row($db_results);
|
||||
$results = array();
|
||||
$results['users'] = $data[0];
|
||||
|
||||
$time = time();
|
||||
|
@ -116,6 +117,7 @@ class User extends database_object
|
|||
return parent::get_from_cache('user',$id);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
// If the ID is -1 then
|
||||
if ($id == '-1') {
|
||||
$data['username'] = 'System';
|
||||
|
@ -294,6 +296,7 @@ class User extends database_object
|
|||
|
||||
$db_results = Dba::read($sql);
|
||||
$results = array();
|
||||
$type_array = array();
|
||||
/* Ok this is crapy, need to clean this up or improve the code FIXME */
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
$type = $r['catagory'];
|
||||
|
@ -354,7 +357,7 @@ class User extends database_object
|
|||
/* If its an artist */
|
||||
elseif ($type == 'artist') {
|
||||
$data = new Artist($r['object_id']);
|
||||
$data->count = $r['count'];
|
||||
//$data->count = $r['count'];
|
||||
$data->format();
|
||||
$data->f_name = $data->f_link;
|
||||
$items[] = $data;
|
||||
|
@ -388,7 +391,7 @@ class User extends database_object
|
|||
|
||||
// Incase they only have one user
|
||||
$users = array();
|
||||
|
||||
$ratings = array();
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
/* Store the fact that you rated this */
|
||||
$key = $r['object_id'];
|
||||
|
@ -933,6 +936,7 @@ class User extends database_object
|
|||
"WHERE `user_preference`.`preference` = `preference`.`id` AND `user_preference`.`user`='-1' AND `preference`.`catagory` !='system'";
|
||||
$db_results = Dba::read($sql);
|
||||
/* While through our base stuff */
|
||||
$zero_results = array();
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
$key = $r['preference'];
|
||||
$zero_results[$key] = $r['value'];
|
||||
|
@ -1177,6 +1181,7 @@ class User extends database_object
|
|||
|
||||
public function upload_avatar()
|
||||
{
|
||||
$upload = array();
|
||||
if (!empty($_FILES['avatar']['tmp_name'])) {
|
||||
$path_info = pathinfo($_FILES['avatar']['name']);
|
||||
$upload['file'] = $_FILES['avatar']['tmp_name'];
|
||||
|
|
|
@ -90,7 +90,7 @@ class vainfo
|
|||
try {
|
||||
$this->_raw = $this->_getID3->analyze(Core::conv_lc_file($file));
|
||||
} catch (Exception $error) {
|
||||
debug_event('getID3', "Broken file detected: $file: " . $error->message, 1);
|
||||
debug_event('getID3', "Broken file detected: $file: " . $error->getMessage(), 1);
|
||||
$this->_broken = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -228,6 +228,7 @@ class vainfo
|
|||
$order = (array) AmpConfig::get($config_key);
|
||||
|
||||
// Iterate through the defined key order adding them to an ordered array.
|
||||
$returned_keys = array();
|
||||
foreach ($order as $key) {
|
||||
if ($results[$key]) {
|
||||
$returned_keys[] = $key;
|
||||
|
@ -851,6 +852,8 @@ class vainfo
|
|||
|
||||
$key = array_shift($order);
|
||||
|
||||
$broken = array();
|
||||
$broken[$key] = array();
|
||||
$broken[$key]['title'] = '**BROKEN** ' . $this->filename;
|
||||
$broken[$key]['album'] = 'Unknown (Broken)';
|
||||
$broken[$key]['artist'] = 'Unknown (Broken)';
|
||||
|
|
|
@ -168,6 +168,7 @@ class Waveform
|
|||
|
||||
$handle = fopen($filename, "r");
|
||||
// wav file header retrieval
|
||||
$heading = array();
|
||||
$heading[] = fread($handle, 4);
|
||||
$heading[] = bin2hex(fread($handle, 4));
|
||||
$heading[] = fread($handle, 4);
|
||||
|
|
|
@ -224,6 +224,7 @@ function install_insert_db($db_user = null, $db_pass = null, $create_db = true,
|
|||
$sql_file = AmpConfig::get('prefix') . '/sql/ampache.sql';
|
||||
$query = fread(fopen($sql_file, 'r'), filesize($sql_file));
|
||||
$pieces = split_sql($query);
|
||||
$errors = array();
|
||||
for ($i=0; $i<count($pieces); $i++) {
|
||||
$pieces[$i] = trim($pieces[$i]);
|
||||
if (!empty($pieces[$i]) && $pieces[$i] != '#') {
|
||||
|
|
|
@ -262,7 +262,7 @@ if (!$media->file || !Core::is_readable(Core::conv_lc_file($media->file))) {
|
|||
}
|
||||
// FIXME: why are these separate?
|
||||
// Remove the song votes if this is a democratic song
|
||||
if ($demo_id) { $democratic->delete_from_oid($oid, 'song'); }
|
||||
if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, 'song'); }
|
||||
|
||||
debug_event('play', "Song $media->file ($media->title) does not have a valid filename specified", 2);
|
||||
header('HTTP/1.1 404 Invalid song, file not found or file unreadable');
|
||||
|
|
|
@ -49,8 +49,8 @@ switch ($_REQUEST['action']) {
|
|||
$playlist_name = scrub_in($_REQUEST['playlist_name']);
|
||||
$playlist_type = scrub_in($_REQUEST['type']);
|
||||
|
||||
Playlist::create($playlist_name, $playlist_type);
|
||||
$_SESSION['data']['playlist_id'] = $playlist->id;
|
||||
$playlist_id = Playlist::create($playlist_name, $playlist_type);
|
||||
$_SESSION['data']['playlist_id'] = $playlist_id;
|
||||
show_confirmation(T_('Playlist Created'), sprintf(T_('%1$s (%2$s) has been created'), $playlist_name, $playlist_type), 'playlist.php');
|
||||
break;
|
||||
case 'delete_playlist':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue