if ($config['debug'] && $_SERVER['SERVER_ADDR'] == '127.0.0.1') { usleep(rand(200, 1000) * 1000); } // load languages and config into Smarty tpl_language(); tpl_list($result); $content = $smarty->fetch('list.tpl'); # file_append('log.txt', $content); header('X-JSON: ' . json_encode(array('count' => count($result)))); echo $content; exit; } // make sure we have an owner to filter search if ($config['multiuser']) { // get owner from session- or use current user session_default('owner', get_username(get_current_user_id())); $all = $lang['filter_any']; } // prepare fieldselect $search_fields = array('title' => $lang['title'], 'subtitle' => $lang['subtitle'], 'director' => $lang['director'], 'actors' => $lang['cast'], 'plot' => $lang['plot'], 'year' => $lang['year'], 'country' => $lang['country'], 'diskid' => $lang['diskid'], 'owner' => $lang['owner'], 'mediatype' => $lang['mediatype'], 'language' => $lang['language'], 'comment' => $lang['comment'], 'audio_codec' => $lang['audiocodec'], 'video_codec' => $lang['videocodec']); // search fields to replace by physical name $replace_fields = array('mediatype' => TBL_MEDIATYPES . '.name', 'owner' => TBL_USERS . '.name', 'diskid' => TBL_DATA . '.diskid'); // add custom fields for ($i = 1; $i <= 4; $i++) { if (!empty($config['custom' . $i])) { $search_fields['custom' . $i] = $config['custom' . $i]; } } // remove empty fields and make array if (!is_array($fields)) { $fields = array($fields);
$_SESSION['timezone'] = $configuration->config_values['application']['timezone']; $_SESSION['template'] = $configuration->config_values['template']['default_template']; $_SESSION['userlevel'] = -1; $_SESSION['warnlevel'] = 0; $_SESSION['ip'] = $ip; $_SESSION['activitylevel'] = 0; $_SESSION['email'] = NULL; $_SESSION['banned'] = false; $_SESSION['useragent'] = $_SERVER['HTTP_USER_AGENT']; } //if no session started start one if (session_id() == "" && !isset($_SESSION['logged'])) { session_start(); } if (!isset($_SESSION['logged']) || empty($_SESSION['logged'])) { session_default($configuration, $ip); } if (isset($_SESSION['logged']) && $_SESSION['logged'] == 'true' && !empty($_SESSION['language'])) { $language = $_SESSION['language']; } else { $language = $configuration->config_values['application']['language']; } //////////////////////////////////// // Include core language files //////////////////////////////////// include __SITE_PATH . "/application/language/" . $language . "/core.lang.php"; include __SITE_PATH . "/application/language/" . $language . "/error.lang.php"; //////////////////////////////////// // Create template object //////////////////////////////////// $TEMPLATE = new TEMPLATE("./" . $configuration->config_values['template']['template_dir'] . "/" . $configuration->config_values['template']['default_template'] . "/", "./" . $configuration->config_values['template']['template_dir'] . "/static/");