function Edit() { $response = new ResponseManager(); // Check the token if (!Kit::CheckToken()) { trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR); } $data = new Setting(); // Get all of the settings in an array $settings = Config::GetAll(NULL, array('userChange' => 1, 'userSee' => 1)); // Go through each setting, validate it and add it to the array foreach ($settings as $setting) { // Check to see if we have a setting that matches in the provided POST vars. $value = Kit::GetParam($setting['setting'], _POST, $setting['type'], $setting['type'] == 'checkbox' ? NULL : $setting['default']); // Check the library location setting if ($setting['setting'] == 'LIBRARY_LOCATION') { // Check for a trailing slash and add it if its not there $value = rtrim($value, '/'); $value = rtrim($value, '\\') . DIRECTORY_SEPARATOR; // Attempt to add the directory specified if (!file_exists($value . 'temp')) { // Make the directory with broad permissions recursively (so will add the whole path) mkdir($value . 'temp', 0777, true); } if (!is_writable($value . 'temp')) { trigger_error(__('The Library Location you have picked is not writeable'), E_USER_ERROR); } } // Actually edit if (!$data->Edit($setting['setting'], $value)) { trigger_error($data->GetErrorMessage(), E_USER_ERROR); } } $response->SetFormSubmitResponse(__('Settings Updated'), false); $response->callBack = 'settingsUpdated'; $response->Respond(); }
<?php #-------------------------------------------------------------------# # TubeX - Copyright � 2009 JMB Software, Inc. All Rights Reserved. # # This file may not be redistributed in whole or significant part. # # TubeX IS NOT FREE SOFTWARE # #-------------------------------------------------------------------# # http://www.jmbsoft.com/ http://www.jmbsoft.com/license/ # #-------------------------------------------------------------------# require_once 'classes/Config.php'; require_once 'classes/Template.php'; $video_sorters = array('popular_today' => '`today_num_views` DESC', 'popular_week' => '`week_num_views` DESC', 'popular_month' => '`month_num_views` DESC', 'popular_all-time' => '`total_num_views` DESC', 'top-rated_today' => '`today_avg_rating` DESC', 'top-rated_week' => '`week_avg_rating` DESC', 'top-rated_month' => '`month_avg_rating` DESC', 'top-rated_all-time' => '`total_avg_rating` DESC', 'most-rated_today' => '`today_num_ratings` DESC', 'most-rated_week' => '`week_num_ratings` DESC', 'most-rated_month' => '`month_num_ratings` DESC', 'most-rated_all-time' => '`total_num_ratings` DESC', 'most-discussed_today' => '`today_num_comments` DESC', 'most-discussed_week' => '`week_num_comments` DESC', 'most-discussed_month' => '`month_num_comments` DESC', 'most-discussed_all-time' => '`total_num_comments` DESC', 'top-favorited_today' => '`today_num_favorited` DESC', 'top-favorited_week' => '`week_num_favorited` DESC', 'top-favorited_month' => '`month_num_favorited` DESC', 'top-favorited_all-time' => '`total_num_favorited` DESC'); $t = new Template(true, 3600); $t->Assign('g_config', Config::GetAll()); $t->Assign('g_logged_in', isset($_COOKIE[LOGIN_COOKIE])); $cookie = null; if (isset($_COOKIE[LOGIN_COOKIE])) { parse_str($_COOKIE[LOGIN_COOKIE], $cookie); $t->Assign('g_username', $cookie['username']); } $functions = array('videos' => 'tbxDisplayVideos', 'video-comments' => 'tbxDisplayVideoComments', 'tag' => 'tbxDisplayVideosByTag', 'search' => 'tbxDisplayVideosBySearch', 'category' => 'tbxDisplayVideosByCategory', 'videos-newest' => 'tbxDisplayVideosNewest', 'categories' => 'tbxDisplayCategories', 'profile' => 'tbxDisplayProfile', 'video' => 'tbxDisplayVideo', 'private' => 'tbxDisplayPrivateVideo'); if (isset($functions[$_REQUEST['r']])) { call_user_func($functions[$_REQUEST['r']]); } else { tbxDisplayIndex(); } function tbxDisplayIndex() { global $t; $t->cache_lifetime = Config::Get('cache_main'); $t->Assign('g_loc_home', true);
function tbxAdministratorEmail($administrator, $xtable, $template = null) { $DB = GetDB(); if (empty($template)) { $template = array(); $template['subject'] = Request::Get('subject'); $template['message'] = Request::Get('message'); } $t = new Template(); $t->Assign('g_config', Config::GetAll()); $t->AssignByRef('g_administrator', $administrator); $mailer = new Mailer(); $mailer->Mail($template, $t, $administrator['email'], $administrator['name']); }