public function __construct() { parent::__construct(); if (!config::item('news_blog', 'news') && uri::segment(1) != 'news') { router::redirect('news/' . utf8::substr(uri::getURI(), 5)); } }
public function confirm($action = '') { // Do we have necessary data? if (input::get('oauth_token') && input::get('oauth_verifier')) { // Get temporary access token $this->initialize(session::item('twitter', 'remote_connect', 'token'), session::item('twitter', 'remote_connect', 'secret')); $access = $this->twitter->getAccessToken(input::get('oauth_verifier')); // Do we have temporary token? if ($access) { // Get saved token $token = $this->getToken(0, $access['user_id']); // Do we have saved token or are we logging in? if ($token || $action == 'login' && $token) { $this->users_model->login($token['user_id']); router::redirect(session::item('slug') . '#home'); } elseif (!$token || $action == 'signup') { // Get user data $this->initialize($access['oauth_token'], $access['oauth_token_secret']); $user = $this->getUser($access['user_id']); // Do we have user data? if ($user && isset($user->id)) { $connection = array('name' => 'twitter', 'twitter_id' => $user->id, 'token' => $access['oauth_token'], 'secret' => $access['oauth_token_secret']); session::set(array('connection' => $connection), '', 'remote_connect'); $account = array('username' => isset($user->name) ? $user->name : ''); session::set(array('account' => $account), '', 'signup'); router::redirect('users/signup#account'); } } } } router::redirect('users/login'); }
public function signUP($username, $pass, $passControl) { if ($pass !== $passControl) { return 'The passwords do not match.'; } if (!ctype_alnum(str_replace(array('-', '_'), '', $username))) { return 'This username contains forbidden characters. Please stick to alphanumerics, hyphens, and underscores.'; } if (strlen(trim($username)) < 4 || strlen(trim($username)) > 32) { return 'Your username is either too short or too long. It has to consist of 4-32 characters.'; } if (strlen(trim($pass)) < 4 || strlen(trim($pass)) > 32) { return 'This is not a valid password (too short or too long).'; } $userRows = database::fetchRows('users', 'id', 'name', $username); if ($userRows->num_rows != 1) { $user['name'] = trim($username); $user['password'] = trim($pass); database::addRow('users', $user); $_SESSION['user'] = $username; $_SESSION['loggedIn'] = true; router::redirect('u/' . $username); } else { return 'This username has already been taken.'; } }
public function __construct() { parent::__construct(); if (!users_helper::isLoggedin() || !session::permission('site_access_cp', 'system')) { router::redirect('cp/users/login'); } }
protected function _sendFeedback() { // Check if demo mode is enabled if (input::demo()) { return false; } // Extra rules $rules = array('name' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 2, 'max_length' => 255)), 'email' => array('rules' => array('required', 'is_string', 'trim', 'valid_email', 'min_length' => 4, 'max_length' => 255)), 'subject' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 5, 'max_length' => 255)), 'message' => array('rules' => array('required', 'is_string', 'trim', 'min_length' => 10, 'max_length' => 10000))); if (config::item('feedback_captcha', 'feedback') == 1 || config::item('feedback_captcha', 'feedback') == 2 && !users_helper::isLoggedin()) { $rules['captcha'] = array('rules' => array('is_captcha')); } validate::setRules($rules); // Validate form values if (!validate::run($rules)) { return false; } // Get values $email = input::post('email'); $subject = input::post('subject'); $message = input::post('message') . "\n\n--\n" . input::post('name') . ' <' . input::post('email') . '>' . "\n" . input::ipaddress(); // Send feedback if (!$this->feedback_model->sendFeedback($email, $subject, $message)) { if (!validate::getTotalErrors()) { view::setError(__('send_error', 'system')); } return false; } // Success view::setInfo(__('message_sent', 'feedback')); router::redirect('feedback'); }
public function __construct() { parent::__construct(); // Is this control panel? if (strtolower(uri::segment(1)) == 'cp' && !$this->isLoggedin() && (uri::segment(2) != 'users' || uri::segment(3) != 'login')) { router::redirect('cp/users/login'); } }
public function confirm() { $class = uri::segment(4); $action = uri::segment(5) == 'signup' ? 'signup' : 'login'; $service = $this->users_authentication_model->getService($class); if ($service) { loader::library('authentication/' . uri::segment(4), $service['settings'], 'users_authentication_' . $class . '_model'); $this->{'users_authentication_' . $class . '_model'}->confirm($action); } router::redirect('users/login'); }
public function __construct() { parent::__construct(); // Is user loggedin ? if (!users_helper::isLoggedin()) { router::redirect('users/login'); } elseif (!config::item('visitors_active', 'users')) { error::show404(); } loader::model('users/visitors', array(), 'users_visitors_model'); }
public function __construct() { parent::__construct(true); // Is user loggedin ? if (!users_helper::isLoggedin()) { router::redirect('users/login'); } elseif (!config::item('invoices_active', 'billing')) { router::redirect('users/settings'); } loader::model('billing/gateways'); loader::model('billing/transactions'); }
public function delete() { // Get URI vars $typeID = (int) uri::segment(6); $fieldID = (int) uri::segment(7); // Get user type if (!$typeID || !($type = $this->users_types_model->getType($typeID))) { view::setError(__('no_type', 'users_types')); router::redirect('cp/userstypes'); } // Delete profile question $this->deleteField('users', 'users_data_' . $type['keyword'], $typeID, $fieldID); }
public function index() { if ($_POST) { if ($this->model->Feedback($_POST)) { Session::setSession('done', 'Ваше письмо отправлено!'); router::redirect($_SERVER['REQUEST_URI']); exit; } else { Session::setSession('done', 'Ошибка в отправлении письма!'); router::redirect($_SERVER['REQUEST_URI']); } } }
public function checkout() { // Get URI vars $planID = (int) uri::segment(4); $gatewayID = uri::segment(5); // Get plan if (!$planID || !($plan = $this->plans_model->getPlan($planID, false)) || !$plan['active']) { view::setError(__('no_plan', 'billing_plans')); router::redirect('billing/plans'); } $retval = $this->process($gatewayID, session::item('user_id'), 'plans', $planID, $plan['name'], $plan['price'], '', 'billing/plans'); if (!$retval) { router::redirect('billing/plans/payment/' . $planID); } }
public function checkout() { // Get URI vars $packageID = (int) uri::segment(4); $gatewayID = uri::segment(5); // Get package if (!$packageID || !($package = $this->credits_model->getPackage($packageID)) || !$package['active']) { view::setError(__('no_package', 'billing_credits')); router::redirect('billing/credits'); } // Set package name $name = __('credits_info', 'billing_credits', array('%s' => $package['credits'])); $retval = $this->process($gatewayID, session::item('user_id'), 'credits', $packageID, $name, $package['price'], '', 'billing/credits'); if (!$retval) { router::redirect('billing/credits/payment/' . $packageID); } }
public function editMyblog() { if (Session::getSession('id_edit')) { config::set('heading', 'РЕДАКТИРОВАНИЕ'); $id = Session::getSession('id_edit'); $this->data['one_blog'] = $this->model->getOneBlog($id); } else { Session::setSession('error', 'блог с таким идентификатором не найден'); router::redirect(DEFAULT_PATH . 'myblog/'); } if ($_POST and isset($_POST['edit_done']) and clearData($_POST['edit_done']) and clearData($_POST['edit_done_text']) and clearData($_POST['edit_done_topic'])) { $id = clearData($_POST['edit_done']); $text = clearData($_POST['edit_done_text'], true); $topic = clearData($_POST['edit_done_topic']); if ($this->model->editRecord($id, $topic, $text)) { router::redirect($_SERVER['REQUEST_URI']); } else { Session::setSession('error', 'Ошибка в редактировании блога!'); router::redirect($_SERVER['REQUEST_URI']); } } }
protected function process($gatewayID, $userID, $type, $productID, $name, $amount, $params = '', $cancel = '', $success = '') { // Set return URLs $cancel = $cancel ? $cancel : 'users/settings'; $success = $success ? $success : 'billing/invoices'; // Get payment type if (!($type = $this->payments_model->getPaymentType($type))) { return false; } // Get gateway if (!$gatewayID || !($gateway = $this->gateways_model->getGateway($gatewayID)) || !$gateway['active']) { view::setError(__('no_gateway', 'billing_gateways')); return false; } // Create invoice if (!($invoiceID = $this->transactions_model->saveInvoice(0, $userID, $type['type_id'], $productID, $name, $amount, $params))) { view::setError(__('invoice_error', 'billing_transactions')); return false; } // Get invoice if (!($invoice = $this->transactions_model->getInvoice($invoiceID))) { view::setError(__('no_invoice', 'billing_transactions')); return false; } // Load payment library $payment = loader::library('payments/' . $gateway['keyword'], $gateway['settings'], null); // Get payment method $form = $payment->getForm($invoiceID, $name, $amount, $cancel, $success); // Is this a URL? if (preg_match('|^\\w+://|i', $form)) { router::redirect($form); } elseif (preg_match('|^<form|i', $form)) { view::load('billing/redirect', array('form' => $form)); return true; } view::setError(__('payment_invalid', 'billing_transactions')); }
public function update() { // Get URI vars $plugin = uri::segment(5); // Get plugins if (!($plugins = $this->recalculate_model->getPlugins())) { view::setInfo(__('no_plugins', 'system_plugins')); router::redirect('cp/system/config/system'); } // Get captcha if (!$plugin || !isset($plugins[$plugin])) { view::setError(__('no_plugin', 'utilities_counters')); router::redirect('cp/utilities/counters'); } // Load plugin model $model = loader::model($plugin . '/' . $plugin, array(), null); // Update counters $result = $model->updateDbCounters(); // Do we have redirect uri? if (isset($result['output']) && isset($result['redirect'])) { $result['redirect'] = $result['redirect'] ? 'update/' . $plugin . '/' . $result['redirect'] : ''; $result['output'] .= '<br/>' . __('progress_redirect', 'utilities_counters', array(), array('%' => html_helper::anchor('cp/utilities/counters/' . $result['redirect'], '\\1'))); if (!$result['redirect']) { view::setInfo(__('progress_done', 'utilities_counters', array('%1' => $plugins[$plugin]))); } // Assign vars view::assign(array('output' => $result['output'], 'redirect' => $result['redirect'])); if (input::isAjaxRequest()) { view::ajaxResponse(array('output' => $result['output'], 'redirect' => $result['redirect'])); } } // Set title view::setTitle(__('utilities_counters_manage', 'system_navigation') . ' - ' . $plugins[$plugin]); // Load view view::load('cp/utilities/counters/update'); }
protected function parseCounters($params = array(), $type = 'index') { // Assign vars view::assign(array('filters' => array(), 'values' => array())); // Do we have permission to search? if (session::permission('albums_search', 'pictures')) { // Get fields $filters = $this->fields_model->getFields('pictures', 1, 'edit', 'in_search', true); // Set extra fields $filters[] = array('name' => __('search_keyword', 'system'), 'type' => 'text', 'keyword' => 'q'); // Assign vars view::assign(array('filters' => $filters)); // Did user submit the filter form? if (input::post_get('do_search') && session::permission('albums_search', 'pictures')) { $values = array(); $params['total'] = $params['max'] = 0; // Check extra keyword $keyword = utf8::trim(input::post_get('q')); if ($keyword) { $params['join_columns'][] = $this->search_model->prepareValue($keyword, 'a', array('data_title', 'data_description')); $values['q'] = $keyword; } // Search albums $searchID = $this->search_model->searchData('picture_album', $filters, $params['join_columns'], $values); // Do we have any search terms? if ($searchID == 'no_terms') { view::setError(__('search_no_terms', 'system')); } elseif ($searchID == 'no_results') { view::setError(__('search_no_results', 'system')); return $params; } else { switch ($type) { case 'user': router::redirect('pictures/user/' . uri::segment(4) . '?search_id=' . $searchID); break; case 'manage': router::redirect('pictures/manage?search_id=' . $searchID); break; default: router::redirect('pictures?search_id=' . $searchID); break; } } } // Do we have a search ID? if (!input::post_get('do_search') && input::get('search_id')) { // Get search if (!($search = $this->search_model->getSearch(input::get('search_id')))) { view::setError(__('search_expired', 'system')); switch ($type) { case 'user': router::redirect('pictures/user/' . uri::segment(4)); break; case 'manage': router::redirect('pictures/manage'); break; default: router::redirect('pictures'); break; } } // Set results $params['join_columns'] = $search['conditions']['columns']; $params['join_items'] = $search['conditions']['items']; $params['values'] = $search['values']; $params['total'] = $search['results']; $params['max'] = config::item('max_search_results', 'system') && config::item('max_search_results', 'system') < $params['total'] ? config::item('max_search_results', 'system') : $params['total']; // Assign vars view::assign(array('values' => $search['values'])); } } if (!input::get('search_id')) { // Count albums if ($type == 'manage' && !$params['total'] || $type != 'manage' && !($params['total'] = $this->counters_model->countData('picture_album', 0, 0, $params['join_columns'], $params['join_items'], $params))) { if ($type == 'manage') { view::setInfo(__('no_albums_self', 'pictures')); } else { view::setInfo(__('no_albums', 'pictures')); } } $params['max'] = $params['total']; } return $params; }
protected function _saveLanguageData($plugin, $language, $default) { // Check if demo mode is enabled if (input::demo()) { return false; } // Create rules $rules = array(); foreach ($default as $section => $groups) { foreach ($groups as $group => $types) { foreach ($types as $type => $lang) { foreach ($lang as $keyword => $name) { $rules[$group . '_' . $keyword] = array('label' => '', 'rules' => array('trim', 'required')); } } } } // Assign rules validate::setRules($rules); // Validate fields if (!validate::run()) { return false; } // Get language data $languageData = array(); foreach ($default as $section => $groups) { foreach ($groups as $group => $types) { foreach ($types as $type => $lang) { foreach ($lang as $keyword => $name) { $cp = $type == 'cp' ? 1 : 0; // Set language data $data = array('value_' . $language => input::post($group . '_' . $keyword)); // Save language string $this->languages_model->saveLanguageData($plugin, $section, $group, $keyword, $data); } } } } // Recompile language pack $this->languages_model->compile($language); // Success view::setInfo(__('language_saved', 'system_languages')); router::redirect('cp/system/languages/translate/' . $plugin . '/' . $language); }
foreach ($searchIds as $key => $value) { $result = database::fetchRows('civilization', 'name, leader, id', 'id', $value); while ($resultRow = $result->fetch_row()) { echo '<div class="content"> <p class="text">'; echo $resultRow[0], ' - ', $resultRow[1]; $unique = database::fetchRows('uniques', 'name, description, type', 'civ_id', $resultRow[2]); while ($uniquesRow = $unique->fetch_row()) { echo '<br/>', $uniquesRow[0], ' (', $uniquesRow[2], '):<br/>', $uniquesRow[1]; } echo '</p></div>'; } } } else { $_SESSION['queryNotFound'] = true; router::redirect('Search'); } } else { echo '<div class="content"> <p class="title">Search for civs</p> <p class="text">'; require 'client/404.php'; echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '"> <input type="text" name="query" placeholder="Search civ"> <input type="submit" name="homeSearch" value="Search"> </form> </p> </div>'; $result = database::fetchRows('civilization', 'name, leader, id'); while ($resultRow = $result->fetch_row()) { echo '<div class="content">
public function delete() { // Check if demo mode is enabled if (input::demo(1, 'cp/plugins/messages/templates')) { return false; } // Get URI vars $templateID = (int) uri::segment(6); // Get template if (!$templateID || !($template = $this->messages_templates_model->getTemplate($templateID))) { view::setError(__('no_template', 'messages_templates')); router::redirect('cp/plugins/messages/templates'); } // Delete template $this->messages_templates_model->deleteTemplate($templateID, $template); // Success view::setInfo(__('template_deleted', 'messages_templates')); router::redirect('cp/plugins/messages/templates'); }
public function index() { router::redirect('http://www.socialscript.com/forum'); }
public function delete() { // Get URI vars $slugID = urldecode(utf8::trim(uri::segment(4))); // Do we have a slug ID? if ($slugID == '') { error::show404(); } // Get user if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) { error::show404(); } elseif ($user['user_id'] == session::item('user_id')) { router::redirect($user['slug']); } // Does user exist? if (!($blocked = $this->users_blocked_model->getUser($user['user_id'], true))) { view::setError(__('no_blocked_user', 'users_blocked')); router::redirect('users/blocked'); } // Delete blocked user $this->users_blocked_model->deleteBlockedUser(session::item('user_id'), $user['user_id']); // Success view::setInfo(__('user_unblocked', 'users_blocked')); router::redirect(input::get('page') ? 'users/blocked' : $user['slug']); }
<?php if (isset($uri[0])) { $slang = new slang($uri[0]); if ($slang->found()) { router::redirect('/index/' . $slang->country->id); } } router::redirect($session->lastpage);
public function toggle() { // Get URI vars $templateID = (int) uri::segment(5); // Get template if (!$templateID || !($template = $this->emailtemplates_model->getTemplate($templateID))) { view::setError(__('no_template', 'system_email_templates')); router::redirect('cp/system/config/system'); } $this->emailtemplates_model->toggleStatus($templateID, $template); router::redirect('cp/system/emailtemplates/browse/' . text_helper::entities(config::item('plugins', 'core', $template['plugin'], 'keyword'))); }
public function EditUserAdmin() { config::set('heading', 'РЕДАКТИРОВАНИЕ ПОЛЬЗОВАТЕЛЯ'); $temp_data = $this->model->getOneUser(Session::getSession('id_edit_user')); $this->data['one_user'] = $temp_data[0]; if ($_POST and isset($_POST['update-form'])) { $id = $_POST['user_id_for_update']; $email = $_POST['email']; $city = $_POST['city']; $country = $_POST['country']; $name = $_POST['username']; if ($this->model->editUser($id, $name, $email, $country, $city)) { router::redirect($_SERVER['REQUEST_URI']); } else { Session::setSession('error', 'Ошибка в редактировании пользователя!'); router::redirect($_SERVER['REQUEST_URI']); } } }
protected function parseCounters($params, $typeID) { // Set filters $filters = array(array('name' => __('user', 'system'), 'type' => 'text', 'keyword' => 'user'), array('name' => __('user_group', 'users'), 'type' => 'select', 'keyword' => 'group', 'items' => config::item('usergroups', 'core')), array('name' => __('user_type', 'users'), 'type' => 'select', 'keyword' => 'type_id', 'items' => config::item('usertypes', 'core', 'names'))); foreach (config::item('usertypes', 'core', 'keywords') as $id => $type) { $filters['types'][$id] = $this->fields_model->getFields('users', $id, 'edit'); } $filters[] = array('name' => __('verified', 'users'), 'type' => 'boolean', 'keyword' => 'verified'); $filters[] = array('name' => __('active', 'system'), 'type' => 'boolean', 'keyword' => 'active'); // Assign vars view::assign(array('filters' => $filters, 'values' => array())); // Did user submit the filter form? if (input::post_get('do_search')) { $values = array(); // Check extra user field $user = utf8::trim(input::post_get('user')); if ($user) { $params['join_columns'][] = $this->search_model->prepareValue($user, 'u', 'user'); $values['user'] = $user; } // Check extra verified field $verified = input::post_get('verified'); if ($verified != '') { $params['join_columns'][] = '`u`.`verified`=' . (int) $verified; $values['verified'] = $verified; } // Check extra status field $status = input::post_get('active'); if ($status != '') { $params['join_columns'][] = '`u`.`active`=' . (int) $status; $values['active'] = $status; } // Check extra group field $group = input::post_get('group'); if ($group != '' && config::item('usergroups', 'core', $group)) { $params['join_columns'][] = '`u`.`group_id`=' . $group; $values['group'] = $group; } // Check extra type field $typeID = input::post_get('type_id'); if ($typeID != '' && config::item('usertypes', 'core', 'keywords', $typeID)) { $params['join_columns'][] = '`u`.`type_id`=' . $typeID; $values['type_id'] = $typeID; } // Search users $searchID = $this->search_model->searchData('profile', $filters, $params['join_columns'], $values, array('type_id' => $typeID)); // Do we have any search terms? if ($searchID == 'no_terms') { view::setError(__('search_no_terms', 'system')); } elseif ($searchID == 'no_results') { view::setError(__('search_no_results', 'system')); $params['total'] = 0; return $params; } else { router::redirect('cp/users?search_id=' . $searchID); } } // Do we have a search ID? if (!input::post_get('do_search') && input::get('search_id')) { // Get search if (!($search = $this->search_model->getSearch(input::get('search_id')))) { view::setError(__('search_expired', 'system')); router::redirect('cp/users'); } // Combine results $params['join_columns'] = $search['conditions']['columns']; $params['join_items'] = $search['conditions']['items']; $params['values'] = $search['values']; $params['total'] = $search['results']; // Assign vars view::assign(array('values' => $search['values'])); } else { // Count users if (!($params['total'] = $this->counters_model->countData('user', 0, 0, $params['join_columns'], $params['join_items'], $params))) { view::setInfo(__('no_users', 'users')); } } return $params; }
<?php $nav = []; require 'inc.manage.php'; if (isset($uri[1])) { $slang = new slang($uri[1]); if ($slang->found()) { $slang->delete(); } } else { if (isset($uri[0]) && count($_POST) == 2) { $_POST['country#'] = intval($_POST['country#']); new slang($_POST); } } router::redirect('/manage/country');
public function delete() { // Check if demo mode is enabled if (input::demo(1, 'cp/content/newsletters')) { return false; } // Get URI vars $newsletterID = (int) uri::segment(5); // Get newsletter if (!$newsletterID || !($newsletter = $this->newsletters_model->getNewsletter($newsletterID))) { view::setError(__('no_newsletter', 'newsletters')); router::redirect('cp/content/newsletters'); } // Delete newsletter $this->newsletters_model->deleteNewsletter($newsletterID, $newsletter); // Success view::setInfo(__('newsletter_deleted', 'newsletters')); router::redirect('cp/content/newsletters'); }
<?php $ip = router::ip(); if (isset($uri[0]) && $uri[0] == 'cso78' || $ip == '77.169.50.118' || $ip == '127.0.0.1') { $session->admin = true; } if (!$session->admin) { router::redirect('/'); } $css = ['/style/material/main.css', '/style/material/white.css']; ?> <div id="nav" class="main"> <a href="#"><div></div></a> <a href="#nav"><div></div></a> <div class="medium"> <?php foreach ($nav as $navelement) { ?> <a href="<?php echo $navelement[0]; ?> "> <div> <div><?php echo $navelement[1]; ?> </div> <div><?php echo $navelement[2]; ?> </div>
public function delete($parentID = false, $actionID = false) { // Get URI vars $parentID = $parentID ? $parentID : (int) uri::segment(5); $pageID = $actionID ? $actionID : (int) uri::segment(6); // Check if demo mode is enabled if (input::demo(1, 'cp/content/pages/browse/' . $parentID)) { return false; } // Get parent if ($parentID && !($parent = $this->pages_model->getPage($parentID))) { view::setError(__('no_parent', 'pages')); router::redirect('cp/content/pages/browse/' . $parentID); } // Get page if (!$pageID || !($page = $this->pages_model->getPage($pageID)) || $page['parent_id'] != $parentID) { view::setError(__('no_page', 'pages')); router::redirect('cp/content/pages/browse/' . $parentID); } elseif ($page['system']) { view::setError(__('page_system_delete', 'pages')); router::redirect('cp/content/pages/browse/' . $parentID); } // Delete page $this->pages_model->deletePage($pageID, $page); // Is this an action call? if ($actionID) { return; } // Process query string $qstring = $this->parseQuerystring(); // Success view::setInfo(__('page_deleted', 'pages')); router::redirect('cp/content/pages/browse/' . $parentID . '?' . $qstring['url']); }