public function invoices() { // Get page $page = is_numeric(input::get('page')) && input::get('page') > 0 ? input::get('page') : 1; // Parameters $params = array('join_columns' => array('`t`.`user_id`=' . session::item('user_id'))); // Process query string $qstring = $this->parseQuerystring(config::item('invoices_per_page', 'billing'), session::item('total_transactions')); // Get invoices $invoices = array(); if (session::item('total_transactions')) { $invoices = $this->transactions_model->getTransactions($params['join_columns'], '', $qstring['limit']); } else { view::setInfo(__('no_invoices_user', 'billing_transactions')); } // Set pagination $config = array('base_url' => config::siteURL('billing/invoices?'), 'total_items' => session::item('total_transactions'), 'items_per_page' => config::item('invoices_per_page', 'billing'), 'current_page' => $page, 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Assign vars view::assign(array('invoices' => $invoices, 'pagination' => $pagination)); // Set title view::setTitle(__('invoices', 'billing_transactions')); // Load view view::load('billing/invoices'); }
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(); $authID = session::item('auth_id'); $userID = session::item('user_id'); $ipaddress = substr(input::ipaddress(), 0, 15); $useragent = substr(input::useragent(), 0, 255); $user = array(); if ($authID && ($user = $this->getSession($authID, $userID, $ipaddress, $useragent))) { if ($user['active_date'] < date_helper::now() - 60 * $this->timeout) { $this->saveSession($authID, $userID, $ipaddress, $useragent); if (isset($user['user_id']) && $user['user_id']) { $this->saveLastvisit($user['user_id']); } } } else { $cookie = cookie::item('sessdata'); $cookie = $cookie ? @json_decode($cookie, true) : array(); if ($cookie && is_array($cookie)) { $userID = isset($cookie['user_id']) ? $cookie['user_id'] : ''; $email = isset($cookie['email']) ? $cookie['email'] : ''; $passhash = isset($cookie['passhash']) ? $cookie['passhash'] : ''; if ($userID && is_numeric($userID) && $userID > 0) { if ($user = $this->getUser($userID, false, false)) { $newPasshash = $this->generatePasshash($email, $user['password']); if ($user['active'] && $user['verified'] && strcmp($email, $user['email']) == 0 && strcmp($passhash, $newPasshash) == 0) { $authID = $this->saveSession(0, $user['user_id'], $ipaddress, $useragent); $this->saveLastvisit($user['user_id']); } else { $user = array(); } } } } } if (!$user || !isset($user['user_id']) || !$user['user_id'] || !$this->createUserSession($user)) { $userID = 0; if (!$user) { $authID = $this->saveSession(0, $userID, $ipaddress, $useragent); } $this->createGuestSession(); } session::set('auth_id', $authID); session::set('user_id', $userID); // Is the site offline? if (!input::isCP() && !config::item('site_online', 'system') && !session::permission('site_access_offline', 'system') && uri::getURI() != 'site/offline' && uri::segment(1) != 'load') { router::redirect('site/offline'); } elseif (input::isCP() && !session::permission('site_access_cp', 'system') && (uri::getURI() != 'cp' && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license')) { router::redirect('cp/users/login'); } if (!input::isCP() && $this->isLoggedin() && session::permission('site_access_cp', 'system') && uri::segment(1) != 'load' && input::demo(0, '', session::item('user_id'))) { $this->logout(); view::setInfo('For the purposes of this demo you may not use front end of the site under the administrator account. As such we have now logged you out.<br/>Feel free ' . html_helper::anchor('users/signup', 'register on the site') . ' to test user end functionality or ' . html_helper::anchor('users/login', 'login') . ' using your existing account details if you have one already.'); router::redirect(); } }
public function plans() { // Get plans if (!($plans = $this->plans_model->getPlans())) { view::setInfo(__('no_plans_user', 'billing_plans')); } // Assign vars view::assign(array('plans' => $plans)); // Set title view::setTitle(__('plans', 'billing_plans')); // Load view view::load('billing/plans'); }
public function credits() { // Get packages if (!($packages = $this->credits_model->getPackages())) { view::setInfo(__('no_packages_user', 'billing_credits')); } // Assign vars view::assign(array('packages' => $packages)); // Set title view::setTitle(__('credits', 'billing_credits')); // Load view view::load('billing/credits'); }
public function manage() { // Does user have permission to view visitors? if (!session::permission('users_visitors_browse', 'users')) { view::noAccess(); } // Assign user from session to variable $user = session::section('session'); // Get fields $fields = array(); foreach (config::item('usertypes', 'core', 'keywords') as $categoryID => $keyword) { $fields[$categoryID] = $this->fields_model->getFields('users', $categoryID, 'view', 'in_list'); } // Parameters $params = array('total' => session::permission('users_visitors_limit', 'users') && session::permission('users_visitors_limit', 'users') < $user['total_visitors'] ? session::permission('users_visitors_limit', 'users') : $user['total_visitors'], 'profiles' => true); // Process query string $qstring = $this->parseQuerystring($params['total']); // Get visitors $visitors = array(); if ($params['total']) { $visitors = $this->users_visitors_model->getVisitors(session::item('user_id'), $qstring['order'], $qstring['limit'], $params); } else { view::setInfo(__('no_visitors', 'users_visitors')); } // Set pagination $config = array('base_url' => config::siteURL('users/visitors/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('visitors_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page'); $pagination = loader::library('pagination', $config, null); // Assign vars view::assign(array('user' => $user, 'visitors' => $visitors, 'fields' => $fields, 'pagination' => $pagination)); // Dow we have new visitors? if (session::item('total_visitors_new')) { // Reset new visitors counter $this->users_visitors_model->resetCounter(); } // Set title view::setTitle(__('my_visitors', 'system_navigation')); // Set trail view::setTrail(session::item('slug'), __('my_profile', 'system_navigation')); view::setTrail('users/visitors/manage', __('users_visitors', 'system_navigation')); // Load view view::load('users/visitors/manage'); }
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'); }
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']); }
protected function parseCounters($params) { // Do we have any conversations? if (!$params['total']) { view::setInfo(__('no_messages_self', 'messages')); } $params['max'] = $params['total']; return $params; }
public function delete() { // Check if demo mode is enabled if (input::demo(1, 'cp/content/banners')) { return false; } // Get URI vars $groupID = (int) uri::segment(6); // Get banner group if (!$groupID || !($group = $this->banners_groups_model->getGroup($groupID))) { view::setError(__('no_group', 'banners')); router::redirect('cp/content/banners/groups'); } // Delete banner group $this->banners_groups_model->deleteGroup($groupID, $group); // Success view::setInfo(__('group_deleted', 'banners')); router::redirect('cp/content/banners/groups'); }
protected function _saveMetaTags($plugin, $tags) { // Check if demo mode is enabled if (input::demo()) { return false; } $rules = array(); foreach ($tags as $keyword => $group) { foreach (config::item('languages', 'core', 'keywords') as $language) { $rules[$keyword . '_title_' . $language] = $rules[$keyword . '_description_' . $language] = $rules[$keyword . '_keywords_' . $language] = array('label' => '', 'rules' => array('is_string', 'trim', 'max_length' => 255)); } } validate::setRules($rules); if (!validate::run()) { return false; } foreach ($tags as $keyword => $group) { $data = array(); foreach (config::item('languages', 'core', 'keywords') as $language) { $data['meta_title_' . $language] = input::post($keyword . '_title_' . $language); $data['meta_description_' . $language] = input::post($keyword . '_description_' . $language); $data['meta_keywords_' . $language] = input::post($keyword . '_keywords_' . $language); } $this->metatags_model->saveMetaTags($plugin, $keyword, $data); } view::setInfo(__('meta_tags_saved', 'system_metatags')); router::redirect('cp/system/metatags/edit/' . $plugin); }
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); }
protected function parseCounters($params = array()) { // Assign vars view::assign(array('filters' => array(), 'values' => array())); // Do we have permission to search? if (session::permission('news_search', 'news')) { // Get fields $filters = $this->fields_model->getFields('news', 0, '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('news_search', 'news')) { $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, 'n', array('data_title_' . session::item('language'), 'data_body_' . session::item('language'))); $values['q'] = $keyword; } // Search news $searchID = $this->search_model->searchData('news', $filters, $params['join_columns'], $values, array('multilang' => true)); // 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 { router::redirect('news?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('news'); } // 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 news if (!($params['total'] = $this->counters_model->countData('news', 0, 0, $params['join_columns'], $params['join_items'], $params))) { view::setInfo(__('no_entries', 'news')); } $params['max'] = $params['total']; } return $params; }
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; }
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']); }
public function delete() { // Check if demo mode is enabled if (input::demo(1, 'cp/users/types')) { return false; } // Get URI vars $typeID = (int) uri::segment(5); // Is this one of the system types? if ($typeID == config::item('type_default_id', 'users')) { view::setError(__('type_delete_system', 'users_types')); router::redirect('cp/users/types'); } // Is this member's own type? if ($typeID == session::item('type_id')) { view::setError(__('type_delete_self', 'users_types')); router::redirect('cp/users/types'); } // Get user type if (!$typeID || !($type = $this->users_types_model->getType($typeID))) { view::setError(__('no_type', 'users_types')); router::redirect('cp/users/types'); } // Do we have any members of this type? if ($this->users_types_model->isUsers($typeID)) { view::setError(__('type_delete_users', 'users_types')); router::redirect('cp/users/types'); } // Delete user type if (!$this->users_types_model->deleteType($typeID, $type)) { view::setError(__('db_no_drop', 'system_fields')); router::redirect('cp/users/types'); } // Success view::setInfo(__('type_deleted', 'users_types')); router::redirect('cp/users/types'); }
public function delete() { // Is user loggedin ? if (!users_helper::isLoggedin()) { router::redirect('users/login'); } // 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 friend exist? if (!($friend = $this->users_friends_model->getFriend($user['user_id'], false))) { view::setError(__('no_friend', 'users_friends')); router::redirect($user['slug']); } // Delete friend $this->users_friends_model->deleteFriend($friend['user_id'], $friend['friend_id'], $friend['active']); // Success view::setInfo(__($friend['active'] ? 'friend_deleted' : 'friend_canceled', 'users_friends')); router::redirect(input::get('page') ? 'users/friends/requests' : $user['slug']); }
protected function deleteField($plugin, $table, $categoryID, $fieldID) { // Check if demo mode is enabled if (input::demo(1, 'cp/system/fields/' . $plugin . '/browse' . ($categoryID ? '/' . $categoryID : ''))) { return false; } // Get field if (!($field = $this->fields_model->getField($fieldID))) { view::setError(__('no_field', 'system_fields')); router::redirect('cp/system/fields/' . $plugin . '/browse/' . $categoryID); } // Is this a system field? if ($field['system']) { view::setError(__('no_system_delete', 'system_fields')); router::redirect('cp/system/fields/' . $plugin . '/browse/' . $categoryID); } // Delete field if (!$this->fieldsdb_model->deleteField($plugin, $table, $fieldID, $field)) { view::setError(__('db_no_column_drop', 'system_fields')); router::redirect('cp/system/fields/' . $plugin . '/browse/' . $categoryID); } // Success view::setInfo(__('field_deleted', 'system_fields')); router::redirect('cp/system/fields/' . $plugin . '/browse' . ($categoryID ? '/' . $categoryID : '')); }
public function delete() { // Check if demo mode is enabled if (input::demo(1, 'cp/content/reports/subjects')) { return false; } // Get URI vars $subjectID = (int) uri::segment(6); // Get subject if (!$subjectID || !($subject = $this->reports_subjects_model->getSubject($subjectID))) { view::setError(__('no_subject', 'reports_subjects')); router::redirect('cp/content/reports/subjects'); } // Delete subject $this->reports_subjects_model->deleteSubject($subjectID, $subject); // Success view::setInfo(__('subject_deleted', 'reports_subjects')); router::redirect('cp/content/reports/subjects'); }
public function sent() { view::setInfo(__('report_saved', 'reports')); view::load('system/elements/blank', array('autoclose' => true)); }
protected function _saveTemplate($templateID, $keyword) { // Check if demo mode is enabled if (input::demo()) { return false; } // Rules and input arrays $rules = $input = array(); // Build rules foreach (config::item('languages', 'core', 'keywords') as $languageID => $language) { // Make sure this is not a header/footer template if (!in_array($keyword, array('header', 'footer'))) { $rules['subject_' . $language] = array('label' => __('template_subject', 'system_email_templates') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required')); $input[] = 'subject_' . $language; } $rules['message_html_' . $language] = array('label' => __('template_message_html', 'system_email_templates') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required')); $rules['message_text_' . $language] = array('label' => __('template_message_text', 'system_email_templates') . (count(config::item('languages', 'core', 'keywords')) > 1 ? ' [' . config::item('languages', 'core', 'names', $languageID) . ']' : ''), 'rules' => array('trim', 'required')); $rules['active'] = array('label' => __('active', 'system'), 'rules' => array('required', 'intval')); $input[] = 'message_html_' . $language; $input[] = 'message_text_' . $language; $input[] = 'active'; } // Assign rules validate::setRules($rules); // Validate fields if (!validate::run()) { return false; } // Get template data $template = input::post($input); // Save template data $this->emailtemplates_model->saveTemplate($templateID, $template); // Success view::setInfo(__('template_saved', 'system_email_templates')); router::redirect('cp/system/emailtemplates/edit/' . $templateID); }
protected function parseCounters($params, $gateways) { // Set filter fields $filters = array(array('name' => __('receipt_id', 'billing_transactions'), 'type' => 'text', 'keyword' => 'receipt_id'), array('name' => __('product', 'billing'), 'type' => 'text', 'keyword' => 'product'), array('name' => __('payment_gateway', 'billing'), 'type' => 'select', 'items' => $gateways, 'keyword' => 'gateway_id'), array('name' => __('user', 'system'), 'type' => 'text', 'keyword' => 'user')); // 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 product field $product = input::post_get('product'); if ($product != '') { $params['join_columns'][] = "`i`.`name` LIKE '" . trim($this->db->escape($product, true), "'") . "'"; $values['product'] = $product; } // Check extra receipt field $receipt_id = input::post_get('receipt_id'); if ($receipt_id != '') { $params['join_columns'][] = "`t`.`receipt_id`=" . $this->db->escape($receipt_id); $values['receipt_id'] = $receipt_id; } // Check extra gateway field $gateway_id = input::post_get('gateway_id'); if ($gateway_id && isset($gateways[$gateway_id])) { $params['join_columns'][] = "`t`.`gateway_id`=" . $gateway_id; $values['gateway_id'] = $gateway_id; } // 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; } // Search transactions $searchID = $this->search_model->searchData('billing_transaction', $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')); $params['total'] = 0; return $params; } else { router::redirect('cp/billing/transactions?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/billing/transactions'); } // Combine results $params['join_columns'] = $search['conditions']['columns']; $params['values'] = $search['values']; $params['total'] = $search['results']; // Assign vars view::assign(array('values' => $search['values'])); } else { // Count transactions if (!($params['total'] = $this->counters_model->countData('billing_transaction', 0, 0, $params['join_columns'], array(), $params))) { view::setInfo(__('no_transactions', 'billing_transactions')); } } return $params; }
protected function parseCounters($params) { // Set filter fields $filters = array(array('name' => __('keyword', 'system'), 'type' => 'text', 'keyword' => 'q'), array('name' => __('reporter', 'reports'), 'type' => 'text', 'keyword' => 'user')); // 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 keyword field $keyword = utf8::trim(input::post_get('q')); if ($keyword) { $params['join_columns'][] = $this->search_model->prepareValue($keyword, 'r', 'message'); $values['q'] = $keyword; } // 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; } // Search reports $searchID = $this->search_model->searchData('report', $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')); $params['total'] = 0; return $params; } else { router::redirect('cp/content/reports?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/content/reports'); } // Combine results $params['join_columns'] = $search['conditions']['columns']; $params['values'] = $search['values']; $params['total'] = $search['results']; // Assign vars view::assign(array('values' => $search['values'])); } else { // Count reports if (!($params['total'] = $this->counters_model->countData('report', 0, 0, $params['join_columns'], array(), $params))) { view::setInfo(__('no_reports', 'reports')); } } return $params; }
protected function _resendHash() { // Create rules $rules = array('email' => array('label' => 'email', 'rules' => array('trim', 'required', 'max_length' => 255, 'valid_email'))); // Assign rules validate::setRules($rules); // Validate fields if (!validate::run()) { return false; } // Does user exist? if (!($user = $this->users_model->getUser(input::post('email')))) { validate::setFieldError('email', __('email_invalid', 'users_signup')); return false; } // Is user's email already verified? if ($user['verified']) { view::setError(__('user_already_verified', 'users_signup')); return false; } // Loader loader::library('email'); loader::model('system/requests'); // Is this a recent request? if ($this->requests_model->isRecentRequest('signup', $user['user_id'], 0, 5)) { // Success view::setError(__('request_recent_sendhash', 'users_signup')); return false; } // Save resend hash request $hash = $this->requests_model->saveRequest('signup', $user['user_id']); $user['security_hash'] = $hash; $user['activation_link'] = config::siteURL('users/signup/confirm/' . $user['user_id'] . '/' . $hash); // Send activation email $this->email->sendTemplate('users_account_confirm', $user['email'], $user, $user['language_id']); // Success view::setInfo(__('confirm_email', 'users_signup')); router::redirect('users/login/index/verify'); }
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 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'); }
protected function parseCounters($params) { // 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'); $filters[] = array('name' => __('user', 'system'), 'type' => 'text', 'keyword' => 'user'); // 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 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; } // 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; } // 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')); $params['total'] = 0; return $params; } else { router::redirect('cp/plugins/pictures/albums?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/plugins/pictures/albums'); } // 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 albums if (!($params['total'] = $this->counters_model->countData('picture_album', 0, 0, $params['join_columns'], $params['join_items'], $params))) { view::setInfo(__('no_albums', 'pictures')); } } return $params; }
public function delete() { // Get URI vars $groupID = (int) uri::segment(5); $bannerID = (int) uri::segment(6); // Check if demo mode is enabled if (input::demo(1, 'cp/content/banners/browse/' . $groupID)) { return false; } // Get banner if (!$bannerID || !($banner = $this->banners_model->getBanner($bannerID))) { view::setError(__('no_banner', 'banners')); router::redirect('cp/content/banners/browse/' . $groupID); } $this->banners_model->deleteBanner($groupID, $bannerID, $banner); view::setInfo(__('banner_deleted', 'banners')); router::redirect('cp/content/banners/browse/' . $groupID); }
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; }
public function delete() { // Check if demo mode is enabled if (input::demo(1, 'cp/billing/plans')) { return false; } // Get URI vars $planID = (int) uri::segment(5); // Get plan if (!$planID || !($plan = $this->plans_model->getPlan($planID))) { view::setError(__('no_plan', 'billing_plans')); router::redirect('cp/billing/plans'); } // Delete plan $this->plans_model->deletePlan($planID, $plan); // Success view::setInfo(__('plan_deleted', 'billing_plans')); router::redirect('cp/billing/plans'); }