'; } /* ###################### * CHECK ADMIN PASSWORD # */###################### if (!isset($_SESSION['logged_admin']) or $_SESSION['logged_admin'] !== true) { header('Location:login.php?login=admin'); die('Cant\'t redirect to login.php'); } /* ############# * # CHECK DIR # */############# foreach ($dir_assoc as $dir) { if (!file_exists($dir)) { mkdir($dir); } } /* ############# * # MAIN SITE # */############# $output_panel = ''; if ($option == '') { // get version from db $db_vers_sql = 'SELECT version FROM config'; $db_vers_result = mysql_q($db_vers_sql); $db_version_assoc = mysql_fetch_assoc($db_vers_result); $db_version = $db_version_assoc['version']; // check tables if versions not match if ($db_version !== $version or isset($_GET['tables'])) { $output_panel_info.= create_table($mysql_tables, $mysql_indexes, $lang, $version, 0); // delete session var $_SESSION = array(); $_SESSION['logged_admin'] = true; } // Watched $overall_movies_sql = 'SELECT play_count, hide FROM movies'; $overall_movies_result = mysql_q($overall_movies_sql); $overall_movies_all = mysql_num_rows($overall_movies_result); $overall_movies_watched = 0; $overall_movies_hidden = 0; while ($overall_movies = mysql_fetch_array($overall_movies_result)) { if ($overall_movies['hide'] == 1) { $overall_movies_hidden++; } else { if ($overall_movies['play_count'] > 0) { $overall_movies_watched++; } } } $overall_movies_unwatched = $overall_movies_all - $overall_movies_watched; $overall_tvshows_sql = 'SELECT play_count, hide FROM tvshows'; $overall_tvshows_result = mysql_q($overall_tvshows_sql); $overall_tvshows_all = mysql_num_rows($overall_tvshows_result); $overall_tvshows_watched = 0; $overall_tvshows_hidden = 0; while ($overall_tvshows = mysql_fetch_array($overall_tvshows_result)) { if ($overall_tvshows['hide'] == 1) { $overall_tvshows_hidden++; } else { if ($overall_tvshows['play_count'] > 0) { $overall_tvshows_watched++; } } } $overall_tvshows_unwatched = $overall_tvshows_all - $overall_tvshows_watched; // Cached poster and fanarts $cached_dir = scandir('cache/'); $poster_cached = 0; $fanart_cached = 0; $exthumb_cached = 0; foreach ($cached_dir as $val) { if (preg_match_all('/_[0-9]+\.jpg/', $val, $res) == 1) { $poster_cached++; } if (preg_match_all('/_[0-9]+_f\.jpg/', $val, $res) == 1) { $fanart_cached++; } if (preg_match_all('/_[0-9]+_t[0-9]\.jpg/', $val, $res) == 1) { $exthumb_cached++; } } // Cached actors $cached_dir = scandir('cache/actors/'); $actors_cached = 0; foreach ($cached_dir as $val) { if (preg_match_all('/[0-9a-z]{10}\.jpg/', $val, $res) == 1) { $actors_cached++; } } // Directories $output_dirs = ''; foreach ($dir_assoc as $dir) { if (file_exists($dir)) { $output_dirs.= '
' . $lang['a_movies'] . ' | |
' . $lang['a_all'] . ' | ' . $overall_movies_all . ' |
' . $lang['a_watched'] . ' | ' . $overall_movies_watched . ' |
' . $lang['a_unwatched'] . ' | ' . $overall_movies_unwatched . ' |
' . $lang['a_hidden'] . ' | ' . $overall_movies_hidden . ' |
' . $lang['a_tvshows'] . ' | |
' . $lang['a_all'] . ' | ' . $overall_tvshows_all . ' |
' . $lang['a_watched'] . ' | ' . $overall_tvshows_watched . ' |
' . $lang['a_unwatched'] . ' | ' . $overall_tvshows_unwatched . ' |
' . $lang['a_hidden'] . ' | ' . $overall_tvshows_hidden . ' |
' . $lang['a_cache'] . ' | |
' . $lang['a_cached_posters'] . ' | ' . $poster_cached . ' |
' . $lang['a_cached_fanarts'] . ' | ' . $fanart_cached . ' |
' . $lang['a_cached_actors'] . ' | ' . $actors_cached . ' |
' . $lang['a_cached_exthumb'] . ' | ' . $exthumb_cached . ' |
' . $lang['a_server_settings'] . ' | |
GD | ' . (extension_loaded('gd') && function_exists('gd_info') ? '' . $lang['a_setting_on'] . '' : '' . $lang['a_setting_off'] . '') . ' |
CURL | ' . (function_exists('curl_version') ? '' . $lang['a_setting_on'] . '' : '' . $lang['a_setting_off'] . '') . ' |
MOD REWRITE | ' . (array_key_exists('HTTP_MOD_REWRITE', $_SERVER) ? '' . $lang['a_setting_on'] . '' : '' . $lang['a_setting_off'] . '') . ' |
ALLOW URL FOPEN | ' . (ini_get('allow_url_fopen') == 1 ? '' . $lang['a_setting_on'] . '' : '' . $lang['a_setting_off'] . '') . ' |
MAX EXECUTION TIME | ' . ini_get('max_execution_time') . ' |
UPLOAD MAX FILESIZE | ' . ini_get('upload_max_filesize') . ' |
POST MAX SIZE | ' . ini_get('post_max_size') . ' |
' . $lang['a_server_directories'] . ' | |
' . $lang['a_files_md5'] . ' |
Token: | ' . $new_token . ' |
' . $lang['a_xbmc_auto_conf_enabled'] . '
'; $d = 'disabled'; } else { $d = ''; } $output_panel.= ' '; } // Save connection if ($option == 'xbmc_save') { $xbmc_update_sql = 'UPDATE config SET xbmc_host = "' . $_POST['xbmc_host'] . '", xbmc_port = "' . $_POST['xbmc_port'] . '", xbmc_login = "' . $_POST['xbmc_login'] . '", xbmc_pass = "' . $_POST['xbmc_pass'] . '"'; mysql_q($xbmc_update_sql); $output_panel_info.= $lang['a_xbmc_saved'] . '