Exemple #1
0
 public function edit()
 {
     // Get URI vars
     $groupID = (int) uri::segment(6);
     // Get group
     $group = array();
     if ($groupID && !($group = $this->banners_groups_model->getGroup($groupID))) {
         view::setError(__('no_group', 'banners'));
         router::redirect('cp/content/banners/groups');
     }
     // Assign vars
     view::assign(array('groupID' => $groupID, 'group' => $group));
     // Process form values
     if (input::post('do_save_group')) {
         $this->_saveGroup($groupID);
     }
     // Set title
     view::setTitle($groupID ? __('group_edit', 'banners') : __('group_new', 'banners'));
     // Set trail
     view::setTrail('cp/content/banners/groups/edit/' . ($groupID ? $groupID : ''), $groupID ? __('group_edit', 'banners') . ' - ' . text_helper::entities($group['name']) : __('group_new', 'banners'));
     // Assign actions
     if ($groupID) {
         view::setAction('cp/content/banners/browse/' . $groupID, __('banners', 'banners'), array('class' => 'icon-text icon-banners'));
     }
     // Load view
     view::load('cp/content/banners/groups/edit');
 }
Exemple #2
0
 public function view()
 {
     // Get URI vars
     $newsID = (int) uri::segment(3);
     // Get news entry
     if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
         error::show404();
     }
     // Do we have views enabled?
     if (config::item('news_views', 'news')) {
         // Update views counter
         $this->news_model->updateViews($newsID);
     }
     // Load ratings
     if (config::item('news_rating', 'news') == 'stars') {
         // Load votes model
         loader::model('comments/votes');
         // Get votes
         $news['user_vote'] = $this->votes_model->getVote('news', $newsID);
     } elseif (config::item('news_rating', 'news') == 'likes') {
         // Load likes model
         loader::model('comments/likes');
         // Get likes
         $news['user_vote'] = $this->likes_model->getLike('news', $newsID);
     }
     // Assign vars
     view::assign(array('newsID' => $newsID, 'news' => $news));
     // Set title
     view::setTitle($news['data_title']);
     // Set meta tags
     view::setMetaDescription($news['data_meta_description']);
     view::setMetaKeywords($news['data_meta_keywords']);
     // Load view
     view::load('news/view');
 }
Exemple #3
0
 public function edit()
 {
     // Get URI vars
     $templateID = (int) uri::segment(6);
     // Get template
     $template = array();
     if ($templateID && !($template = $this->newsletters_templates_model->getTemplate($templateID, false))) {
         view::setError(__('no_template', 'newsletters_templates'));
         router::redirect('cp/content/newsletters/templates');
     }
     // Assign vars
     view::assign(array('templateID' => $templateID, 'template' => $template));
     // Process form values
     if (input::post('do_save_template')) {
         $this->_saveTemplate($templateID);
     }
     // Set title
     view::setTitle($templateID ? __('template_edit', 'newsletters_templates') : __('template_new', 'newsletters_templates'));
     // Set trail
     view::setTrail('cp/content/newsletters/templates/edit/' . ($templateID ? $templateID : ''), $templateID ? __('template_edit', 'newsletters_templates') . ' - ' . text_helper::entities($template['name']) : __('template_new', 'newsletters_templates'));
     // Load ckeditor
     view::includeJavascript('externals/ckeditor/ckeditor.js');
     // Load view
     view::load('cp/content/newsletters/templates/edit');
 }
Exemple #4
0
 public function edit()
 {
     // Get URI vars
     $subjectID = (int) uri::segment(6);
     // Get subject
     $subject = array();
     if ($subjectID && !($subject = $this->reports_subjects_model->getSubject($subjectID, false))) {
         view::setError(__('no_subject', 'reports_subjects'));
         router::redirect('cp/content/reports/subjects');
     }
     // Assign vars
     view::assign(array('subjectID' => $subjectID, 'subject' => $subject));
     // Process form values
     if (input::post('do_save_subject')) {
         $this->_saveSubject($subjectID);
     }
     // Set title
     view::setTitle($subjectID ? __('subject_edit', 'reports_subjects') : __('subject_new', 'reports_subjects'));
     // Set trail
     view::setTrail('cp/content/reports/subjects/edit/' . ($subjectID ? $subjectID : ''), $subjectID ? __('subject_edit', 'reports_subjects') . ' - ' . text_helper::entities($subject['name']) : __('subject_new', 'reports_subjects'));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Load view
     view::load('cp/content/reports/subjects/edit');
 }
Exemple #5
0
 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');
 }
Exemple #6
0
 public function edit()
 {
     // Get URI vars
     $fieldID = (int) uri::segment(7);
     // Set title
     view::setTitle($fieldID ? __('edit_field', 'system_fields') : __('new_field', 'system_fields'));
     // Set trail
     view::setTrail('cp/system/fields/blogs/browse', __('fields', 'system_fields'));
     // Hide options array
     $hidden = array('html' => 0, 'in_search_advanced' => 0);
     if ($fieldID) {
         $field = $this->fields_model->getField($fieldID);
         if ($field) {
             switch ($field['keyword']) {
                 case 'title':
                     $hidden['required'] = 1;
                     $hidden['in_search'] = 0;
                     $hidden['system'] = 1;
                     break;
                 case 'body':
                     $hidden['required'] = 1;
                     $hidden['in_search'] = 0;
                     $hidden['system'] = 1;
                     break;
             }
         }
     }
     // Additional field configuration array
     $config = array(array('label' => __('config_in_view', 'system_fields'), 'keyword' => 'in_view', 'type' => 'boolean', 'rules' => array('intval')), array('label' => __('config_in_account', 'system_fields'), 'keyword' => 'in_account', 'type' => 'boolean', 'rules' => array('intval')), array('label' => __('config_in_list', 'system_fields'), 'keyword' => 'in_list', 'type' => 'boolean', 'rules' => array('intval')));
     // Edit custom field
     $this->editField('blogs', 'blogs_data', 0, $fieldID, $config, $hidden);
 }
Exemple #7
0
 public function set($plugin, $keyword, $replace = array(), $pageTitle = true)
 {
     if (!($data = $this->cache->item('core_meta_tags_' . $plugin . '_' . session::item('language')))) {
         $data = array();
         $result = $this->db->query("SELECT * FROM `:prefix:core_meta_tags` WHERE `plugin`=?", array($plugin))->result();
         foreach ($result as $tags) {
             $data[$tags['keyword']]['title'] = $tags['meta_title_' . session::item('language')];
             $data[$tags['keyword']]['description'] = $tags['meta_description_' . session::item('language')];
             $data[$tags['keyword']]['keywords'] = $tags['meta_keywords_' . session::item('language')];
         }
         $this->cache->set('core_meta_tags_' . $plugin . '_' . session::item('language'), $data, 60 * 60 * 24 * 30);
     }
     foreach ($replace as $section => $array) {
         foreach ($array as $k => $v) {
             $k = '[' . $section . '.' . $k . ']';
             if (is_array($v)) {
                 $v = count($v) == 1 ? current($v) : implode(',', $v);
             }
             $data[$keyword]['title'] = utf8::str_replace($k, $v, $data[$keyword]['title']);
             $data[$keyword]['description'] = utf8::str_replace($k, $v, $data[$keyword]['description']);
             $data[$keyword]['keywords'] = utf8::str_replace($k, $v, $data[$keyword]['keywords']);
         }
     }
     if (isset($data[$keyword])) {
         if ($pageTitle) {
             view::setTitle($data[$keyword]['title']);
         } else {
             view::setMetaTitle($data[$keyword]['title']);
         }
         view::setMetaDescription($data[$keyword]['description']);
         view::setMetaKeywords($data[$keyword]['keywords']);
     }
 }
Exemple #8
0
 public function payment()
 {
     // Get URI vars
     $packageID = (int) uri::segment(4);
     // Get package
     if (!$packageID || !($package = $this->credits_model->getPackage($packageID)) || !$package['active']) {
         view::setError(__('no_package', 'billing_credits'));
         router::redirect('billing/credits');
     }
     // Get gateways
     if (!($gateways = $this->gateways_model->getGateways())) {
         view::setError(__('no_gateways_user', 'billing_gateways'));
         router::redirect('billing/credits');
     }
     // Product
     $package['product_id'] = $packageID;
     $package['name'] = __('credits_info', 'billing_credits', array('%s' => $package['credits']));
     $package['type'] = 'credits';
     // Assign vars
     view::assign(array('product' => $package, 'gateways' => $gateways, 'location' => 'billing/credits/payment/' . $packageID));
     // Set title
     view::setTitle(__('payment', 'billing_transactions'));
     // Set trail
     view::setTrail('billing/credits', __('credits', 'billing_credits'));
     // Load view
     view::load('billing/payment');
 }
Exemple #9
0
 public function payment()
 {
     // Get URI vars
     $planID = (int) uri::segment(4);
     // Get plan
     if (!$planID || !($plan = $this->plans_model->getPlan($planID)) || !$plan['active']) {
         view::setError(__('no_plan', 'billing_plans'));
         router::redirect('billing/plans');
     }
     // Get gateways
     if (!($gateways = $this->gateways_model->getGateways())) {
         view::setError(__('no_gateways_user', 'billing_gateways'));
         router::redirect('billing/plans');
     }
     // Product
     $plan['product_id'] = $planID;
     $plan['type'] = 'plans';
     // Assign vars
     view::assign(array('product' => $plan, 'gateways' => $gateways, 'location' => 'billing/plans/payment/' . $planID));
     // Set title
     view::setTitle(__('payment', 'billing_transactions'));
     // Set trail
     view::setTrail('billing/plans', __('plans', 'billing_plans'));
     // Load view
     view::load('billing/payment');
 }
Exemple #10
0
 public function manage()
 {
     // 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' => $user['total_blocked'], 'profiles' => true);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Get blocked users
     $users = array();
     if ($params['total']) {
         $users = $this->users_blocked_model->getUsers(session::item('user_id'), $qstring['order'], $qstring['limit'], $params);
     } else {
         view::setInfo(__('no_blocked_users', 'users_blocked'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('users/blocked/manage?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('blocked_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'users' => $users, 'fields' => $fields, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('blacklist', 'users'));
     // Load view
     view::load('users/blocked/manage');
 }
Exemple #11
0
 public function settings()
 {
     // Get URI vars
     $keyword = uri::segment(5);
     // Get service
     if (!$keyword || !($service = $this->users_authentication_model->getService($keyword))) {
         view::setError(__('no_service', 'users_authentication'));
         router::redirect('cp/users/authentication');
     }
     // Get manifest
     $manifest = $this->users_authentication_model->getManifest($keyword);
     // Is demo mode enabled?
     if (input::demo(0)) {
         foreach ($service['settings'] as $k => $v) {
             if ($v) {
                 $service['settings'][$k] = 'hidden in this demo';
             }
         }
     }
     // Assign vars
     view::assign(array('manifest' => $manifest, 'service' => $service));
     // Process form values
     if (input::post('do_save_settings')) {
         $this->_saveSettings($keyword, $manifest, $service);
     }
     // Set title
     view::setTitle(__('settings', 'system'));
     // Set trail
     view::setTrail('cp/users/authentication/settings/' . $keyword, __('settings', 'system') . ' - ' . text_helper::entities($service['name']));
     // Load view
     view::load('cp/users/authentication/settings');
 }
Exemple #12
0
 public function edit()
 {
     // Get URI vars
     $templateID = (int) uri::segment(6);
     // Get template
     $template = array();
     if ($templateID && !($template = $this->messages_templates_model->getTemplate($templateID, false))) {
         view::setError(__('no_template', 'messages_templates'));
         router::redirect('cp/plugins/messages/templates');
     }
     // Assign vars
     view::assign(array('templateID' => $templateID, 'template' => $template));
     // Process form values
     if (input::post('do_save_template')) {
         $this->_saveTemplate($templateID);
     }
     // Set title
     view::setTitle($templateID ? __('template_edit', 'messages_templates') : __('template_new', 'messages_templates'));
     // Set trail
     view::setTrail('cp/plugins/messages/templates/edit/' . ($templateID ? $templateID : ''), $templateID ? __('template_edit', 'messages_templates') . ' - ' . text_helper::entities($template['name']) : __('template_new', 'messages_templates'));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Load view
     view::load('cp/plugins/messages/templates/edit');
 }
Exemple #13
0
 public function results()
 {
     if (!input::get('search_id')) {
         $this->index();
         return;
     }
     // Parameters
     $params = array('join_columns' => array('`u`.`verified`=1', '`u`.`active`=1', '`u`.`group_id` IN (' . implode(',', session::permission('users_groups_browse', 'users')) . ')', '`u`.`type_id` IN (' . implode(',', session::permission('users_types_browse', 'users')) . ')'), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring($params['max']);
     // Get users
     $users = array();
     if ($params['total']) {
         $users = $this->users_model->getUsers('in_list', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Get fields
     $fields = $this->fields_model->getFields('users', isset($params['values']['type_id']) ? $params['values']['type_id'] : 0, 'view', 'in_list');
     // Set pagination
     $config = array('base_url' => config::siteURL('users/results?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => config::item('max_search_results', 'system'), 'items_per_page' => config::item('users_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('users' => $users, 'fields' => $fields, 'pagination' => $pagination));
     // Set meta tags
     $this->metatags_model->set('users', 'users_search_results');
     // Set title
     view::setTitle(__('search_results', 'system'), false);
     // Assign actions
     view::setAction('users?' . substr($qstring['url'], 0, -1), __('search_modify', 'system'), array('class' => 'icon-text icon-users-search-edit'));
     // Load view
     view::load('users/index');
 }
Exemple #14
0
 public function index()
 {
     // Process form values
     if (input::post('do_send_feedback')) {
         $this->_sendFeedback();
     }
     // Set meta tags
     $this->metatags_model->set('feedback', 'feedback_index');
     // Set title
     view::setTitle(__('feedback_contact', 'system_navigation'), false);
     // Load view
     view::load('feedback/index');
 }
Exemple #15
0
 public function index()
 {
     // Get license details
     if (!($license = $this->license_model->getLicense())) {
         view::setError(__('no_license', 'system_license'));
         router::redirect('cp/help/license/change');
     }
     // Assign vars
     view::assign(array('license' => $license));
     // Set title
     view::setTitle(__('help_license', 'system_navigation'));
     // Load view
     view::load('cp/help/license/view');
 }
Exemple #16
0
 public function submit()
 {
     // Does user have permission to submit reports?
     if (!session::permission('reports_post', 'reports')) {
         view::setError(__('no_action', 'system'));
         view::load('system/elements/blank', array('autoclose' => true));
         return false;
     }
     $resource = uri::segment(3);
     $itemID = uri::segment(4);
     if (!$resource || !($resourceID = config::item('resources', 'core', $resource, 'resource_id')) || !config::item('resources', 'core', $resource, 'report')) {
         view::setError(__('resource_invalid', 'system'));
         view::load('system/elements/blank', array('autoclose' => true));
         return false;
     }
     if (!$itemID || !is_numeric($itemID) || $itemID < 0) {
         view::setError(__('item_invalid', 'reports'));
         view::load('system/elements/blank', array('autoclose' => true));
         return false;
     }
     // Does this item exist?
     if (!($userID = $this->reports_model->getUserID($resource, $itemID))) {
         view::setError(__('item_invalid', 'reports'));
         view::load('system/elements/blank', array('autoclose' => true));
         return false;
     }
     // Did we report this already?
     if ($this->reports_model->isReported($resourceID, $itemID)) {
         view::setError(__('report_exists', 'reports'));
         view::load('system/elements/blank', array('autoclose' => true));
         return false;
     }
     // Get subjects
     $subjects = array();
     $data = $this->reports_subjects_model->getSubjects(false, true);
     foreach ($data as $subject) {
         $subjects[$subject['subject_id']] = $subject['name'];
     }
     $subjects = $subjects ? array('' => __('select', 'system')) + $subjects : $subjects;
     // Assign vars
     view::assign(array('subjects' => $subjects));
     // Process form values
     if (input::post('do_submit_report')) {
         $this->_submitReport($resource, $resourceID, $userID, $itemID, $subjects);
     }
     // Set title
     view::setTitle(__('report_submit', 'reports'));
     // Load view
     view::load('report/index');
 }
Exemple #17
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array("`u`.`picture_id`!=0"), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params, 0);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Actions
     $actions = array(0 => __('select', 'system'), 'approve' => __('approve', 'system'), 'decline' => __('decline', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected albums
         if (input::post('action') && isset($actions[input::post('action')]) && input::post('user_id') && is_array(input::post('user_id'))) {
             foreach (input::post('user_id') as $userID) {
                 $userID = (int) $userID;
                 if ($userID && $userID > 0) {
                     $this->action(input::post('action'), $userID);
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get pictures
     $users = array();
     if ($params['total']) {
         $users = $this->users_model->getUsers('in_list', isset($params['values']['type']) ? $params['values']['type'] : 0, $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/users/pictures/browse?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->picturesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('users' => $users, 'pagination' => $pagination, 'actions' => $actions));
     // Set title
     view::setTitle(__('users_pictures_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/users/pictures/browse?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#pictures-search\').toggle();return false;'));
     // Load view
     view::load('cp/users/pictures/browse');
 }
Exemple #18
0
 public function view()
 {
     // Get URI vars
     $listID = uri::segment(6);
     // Get list
     if (!$listID || !($list = $this->lists_model->getList($listID))) {
         router::redirect('cp/system/config/system');
     }
     // Did we submit the form?
     if (input::post('action') == 'reorder' && input::post('ids')) {
         $this->_reorderItems();
     }
     // Get items
     if (!($items = $this->lists_model->getItems($listID))) {
         router::redirect('cp/system/config/system');
     }
     // Create table grid
     $grid = array('uri' => 'cp/system/templates/navigation', 'keyword' => 'templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'active' => array('html' => __('active', 'system'), 'class' => 'status')), 'content' => array());
     // Create grid content
     foreach ($items as $item) {
         $grid['content'][] = array('name' => array('html' => $item['name']), 'status' => array('html' => html_helper::anchor('cp/system/templates/navigation/togglestatus/' . $item['item_id'], $item['active'] ? __('yes', 'system') : __('no', 'system'), array('class' => $item['active'] ? 'label success small' : 'label important small'))));
     }
     // Filter hooks
     hook::filter('cp/system/templates/navigation/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid, 'items' => $items, 'listID' => $listID));
     // Set title
     view::setTitle(__('system_templates_navigation_manage', 'system_navigation'));
     // Set trail
     view::setTrail('cp/system/templates/navigation/view/' . $listID, $list['name']);
     // Set actions
     view::setAction('#', __('done', 'system'), array('class' => 'icon-text icon-system-done', 'onclick' => 'saveSortable();return false;', 'id' => 'actions_link_save'));
     view::setAction('#', __('cancel', 'system'), array('class' => 'icon-text icon-system-cancel', 'onclick' => 'cancelSortable();return false;', 'id' => 'actions_link_cancel'));
     view::setAction('#', __('reorder', 'system'), array('class' => 'icon-text icon-system-sort', 'onclick' => 'switchSortable();return false;', 'id' => 'actions_link_reorder'));
     // Include sortable vendor files
     view::includeJavascript('externals/html5sortable/html5sortable.js');
     view::includeStylesheet('externals/html5sortable/style.css');
     // Load view
     if (input::isAjaxRequest()) {
         view::load('cp/system/templates/navigation/items/browse_' . (input::post('view') == 'list' ? 'list' : 'grid'));
     } else {
         view::load('cp/system/templates/navigation/items/browse');
     }
 }
Exemple #19
0
 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');
 }
Exemple #20
0
 public function edit()
 {
     // Get URI vars
     $typeID = (int) uri::segment(5);
     // Get type
     $type = array();
     if ($typeID && !($type = $this->users_types_model->getType($typeID, false))) {
         view::setError(__('no_type', 'users_types'));
         router::redirect('cp/users/types');
     }
     $fields = array();
     // Do we have an existing type?
     if ($typeID) {
         // Get text fields
         $fields = array('' => __('none', 'system'));
         foreach ($this->fields_model->getFields('users', $typeID) as $field) {
             if ($field['type'] == 'text') {
                 $fields[$field['keyword']] = $field['name'];
             }
         }
     }
     // Assign vars
     view::assign(array('typeID' => $typeID, 'type' => $type, 'fields' => $fields));
     // Process form values
     if (input::post('do_save_type')) {
         $this->_saveType($typeID, $type, $fields);
     }
     // Set title
     view::setTitle($typeID ? __('type_edit', 'users_types') : __('type_new', 'users_types'));
     // Set trail
     view::setTrail('cp/users/types/edit/' . ($typeID ? $typeID : ''), $typeID ? __('type_edit', 'users_types') . ' - ' . text_helper::entities($type['name']) : __('type_new', 'users_types'));
     // Set trail
     if ($typeID) {
         // Assign actions
         view::setAction('cp/system/fields/users/browse/' . $typeID, __('profile_questions', 'users_types'), array('class' => 'icon-text icon-system-fields'));
     }
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Load view
     view::load('cp/users/types/edit');
 }
Exemple #21
0
 public function browse()
 {
     // Get user and last notice ID
     $lastID = (int) input::post_get('last_id', 0);
     // Get notices
     $notices = $this->timeline_notices_model->getNotices(session::item('user_id'), $lastID, config::item('notices_per_page', 'timeline'));
     // Set title
     view::setTitle(__('my_timeline_notifications', 'system_navigation'));
     // Dow we have new notifications?
     if (session::item('total_notices_new')) {
         // Reset new notifications counter
         $this->timeline_notices_model->resetCounter();
     }
     // Load view
     if (input::isAjaxRequest()) {
         $output = view::load('timeline/notices/items', array('notices' => $notices), true);
         view::ajaxResponse($output);
     } else {
         view::load('timeline/notices/index', array('notices' => $notices));
     }
 }
Exemple #22
0
 public function edit()
 {
     // 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');
     }
     // Set title
     view::setTitle($fieldID ? __('edit_field', 'system_fields') : __('new_field', 'system_fields'));
     // Set trail
     view::setTrail('cp/users/types/edit/' . $typeID, __('type_edit', 'users_types') . ' - ' . $type['name']);
     view::setTrail('cp/system/fields/users/browse/' . ($typeID ? $typeID : ''), __('profile_questions', 'users_types'));
     // Hide options array
     $hidden = array('html' => 0, 'system' => 0);
     // Additional field configuration array
     $config = array(array('label' => __('config_in_signup', 'system_fields'), 'keyword' => 'in_signup', 'type' => 'boolean', 'rules' => array('intval'), 'default' => 0), array('label' => __('config_in_view', 'system_fields'), 'keyword' => 'in_view', 'type' => 'boolean', 'rules' => array('intval')), array('label' => __('config_in_account', 'system_fields'), 'keyword' => 'in_account', 'type' => 'boolean', 'rules' => array('intval')), array('label' => __('config_in_list', 'system_fields'), 'keyword' => 'in_list', 'type' => 'boolean', 'rules' => array('intval')));
     // Edit profile question
     $this->editField('users', 'users_data_' . $type['keyword'], $typeID, $fieldID, $config, $hidden);
 }
Exemple #23
0
 public function edit()
 {
     // Get URI vars
     $packageID = (int) uri::segment(5);
     // Get package
     $package = array();
     if ($packageID && !($package = $this->credits_model->getPackage($packageID))) {
         view::setError(__('no_package', 'billing_credits'));
         router::redirect('cp/billing/credits');
     }
     // Assign vars
     view::assign(array('packageID' => $packageID, 'package' => $package));
     // Process form values
     if (input::post('do_save_package')) {
         $this->_savePackage($packageID);
     }
     // Set title
     view::setTitle($packageID ? __('package_edit', 'billing_credits') : __('package_new', 'billing_credits'));
     // Set trail
     view::setTrail('cp/billing/credits/edit/' . ($packageID ? $packageID : ''), $packageID ? __('package_edit', 'billing_credits') : __('package_new', 'billing_credits'));
     // Load view
     view::load('cp/billing/credits/edit');
 }
Exemple #24
0
 public function edit()
 {
     // Get URI vars
     $plugin = uri::segment(5, 'system');
     // Assign vars
     view::assign(array('plugin' => $plugin));
     // Does plugin exist?
     if (!config::item('plugins', 'core', $plugin)) {
         view::setError(__('no_config_plugin', 'system_config'));
         router::redirect('cp/system/config/' . $plugin);
     }
     // Get meta tags
     if (!($tags = $this->metatags_model->getMetaTags($plugin))) {
         view::setError(__('no_meta_tags', 'system_metatags'));
         router::redirect('cp/system/config/' . $plugin);
     }
     // Process form values
     if (input::post('do_save_meta_tags')) {
         $this->_saveMetaTags($plugin, $tags);
     }
     // Assign vars
     view::assign(array('tags' => $tags));
     // Set title
     view::setTitle(__('system_meta_tags_manage', 'system_navigation'));
     // Set trail
     view::setTrail('cp/system/metatags/edit/' . $plugin, text_helper::entities(config::item('plugins', 'core', $plugin, 'name')));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Set tabs
     foreach ($tags as $keyword => $group) {
         view::setTab('#' . $keyword, __($keyword, $plugin . '_metatags'), array('class' => 'group_' . $keyword));
     }
     // Load view
     view::load('cp/system/metatags/edit');
 }
Exemple #25
0
 public function settings()
 {
     // Get URI vars
     $keyword = uri::segment(5);
     // Get template
     if (!$keyword || !($template = $this->templates_model->getTemplate($keyword))) {
         view::setError(__('no_template', 'system_templates'));
         router::redirect('cp/system/templates');
     }
     // Get manifest
     $manifest = $this->templates_model->getManifest($keyword);
     // Do we have any settings for this template?
     if (!$manifest['settings']) {
         view::setError(__('no_template_settings', 'system_templates'));
         router::redirect('cp/system/templates');
     }
     // Legacy support for non-groupped settings
     if (!array_key_exists('settings', current($manifest['settings']))) {
         $manifest['settings'] = array(array('name' => 'General', 'settings' => $manifest['settings']));
     }
     // Set tabs
     foreach ($manifest['settings'] as $groupID => $group) {
         view::setTab('#' . $groupID, isset($group['name']) ? $group['name'] : 'General', array('class' => 'settings_' . $groupID));
     }
     // Assign vars
     view::assign(array('manifest' => $manifest, 'template' => $template));
     // Process form values
     if (input::post('do_save_settings')) {
         $this->_saveSettings($keyword, $manifest, $template);
     }
     // Set title
     view::setTitle(__('settings', 'system'));
     // Set trail
     view::setTrail('cp/system/templates/settings/' . $keyword, __('settings', 'system') . ' - ' . text_helper::entities($template['name']));
     // Load view
     view::load('cp/system/templates/settings');
 }
Exemple #26
0
 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');
 }
Exemple #27
0
 public function settings()
 {
     // Get URI vars
     $keyword = uri::segment(5);
     // Get gateway
     if (!$keyword || !($gateway = $this->gateways_model->getGateway($keyword))) {
         view::setError(__('no_gateway', 'billing_gateways'));
         router::redirect('cp/billing/gateways');
     }
     // Get manifest
     $manifest = $this->gateways_model->getManifest($keyword);
     $settings = array();
     // Create settings
     foreach ($manifest['settings'] as $setting) {
         if ($setting['type'] != 'system') {
             $settings[] = $setting;
         }
     }
     // Do we have any settings for this gateway?
     if (!$manifest['settings']) {
         view::setError(__('no_gateway_settings', 'billing_gateways'));
         router::redirect('cp/billing/gateways');
     }
     // Assign vars
     view::assign(array('manifest' => $manifest, 'gateway' => $gateway, 'settings' => $settings));
     // Process form values
     if (input::post('do_save_settings')) {
         $this->_saveSettings($keyword, $manifest, $gateway, $settings);
     }
     // Set title
     view::setTitle(__('settings', 'system'));
     // Set trail
     view::setTrail('cp/billing/gateways/settings/' . $keyword, __('settings', 'system') . ' - ' . text_helper::entities($gateway['name']));
     // Load view
     view::load('cp/billing/gateways/settings');
 }
Exemple #28
0
 public function settings()
 {
     // Get URI vars
     $keyword = uri::segment(5);
     // Get captcha
     if (!$keyword || !($captcha = $this->captchas_model->getCaptcha($keyword))) {
         view::setError(__('no_captcha', 'security_forms'));
         router::redirect('cp/security/forms');
     }
     // Get manifest
     $manifest = $this->captchas_model->getManifest($keyword);
     // Assign vars
     view::assign(array('manifest' => $manifest, 'captcha' => $captcha));
     // Process form values
     if (input::post('do_save_settings')) {
         $this->_saveSettings($keyword, $manifest, $captcha);
     }
     // Set title
     view::setTitle(__('settings', 'system'));
     // Set trail
     view::setTrail('cp/security/forms/settings/' . $keyword, __('settings', 'system') . ' - ' . text_helper::entities($captcha['name']));
     // Load view
     view::load('cp/security/forms/settings');
 }
Exemple #29
0
 public function settings()
 {
     // Get URI vars
     $keyword = uri::segment(5);
     // Get service
     if (!$keyword || !($service = $this->storage_model->getService($keyword))) {
         view::setError(__('no_service', 'system_storage'));
         router::redirect('cp/system/storage');
     }
     // Get manifest
     $manifest = $this->storage_model->getManifest($keyword);
     // Assign vars
     view::assign(array('manifest' => $manifest, 'service' => $service));
     // Process form values
     if (input::post('do_save_settings')) {
         $this->_saveSettings($keyword, $manifest, $service);
     }
     // Set title
     view::setTitle(__('settings', 'system'));
     // Set trail
     view::setTrail('cp/system/storage/settings/' . $keyword, __('settings', 'system') . ' - ' . text_helper::entities($service['name']));
     // Load view
     view::load('cp/system/storage/settings');
 }
Exemple #30
0
 public function edit()
 {
     // Get URI vars
     $typeID = (int) uri::segment(6);
     $fieldID = (int) uri::segment(7);
     $typeID = $typeID == 0 || $typeID == 1 ? $typeID : 0;
     // Set title
     view::setTitle($fieldID ? __('edit_field', 'system_fields') : __('new_field', 'system_fields'));
     // Set trail
     view::setTrail('cp/system/fields/pictures', __('fields', 'system_fields'));
     if ($typeID == 1) {
         view::setTrail('cp/system/fields/pictures/browse/1', __('pictures_albums', 'system_navigation'));
     }
     // Hide options array
     $hidden = array('html' => 0, 'in_search_advanced' => 0);
     if ($fieldID) {
         $field = $this->fields_model->getField($fieldID);
         if ($field) {
             switch ($field['keyword']) {
                 case 'title':
                     $hidden['required'] = 1;
                     $hidden['in_search'] = 0;
                     $hidden['system'] = 1;
                     break;
                 case 'description':
                     $hidden['in_search'] = 0;
                     $hidden['system'] = 1;
                     break;
             }
         }
     }
     // Additional field configuration array
     $config = array(array('label' => __('config_in_view', 'system_fields'), 'keyword' => 'in_view', 'type' => 'boolean', 'rules' => array('intval')), array('label' => __('config_in_account', 'system_fields'), 'keyword' => 'in_account', 'type' => 'boolean', 'rules' => array('intval')), array('label' => __('config_in_list', 'system_fields'), 'keyword' => 'in_list', 'type' => 'boolean', 'rules' => array('intval')));
     // Edit custom field
     $this->editField('pictures', 'pictures_' . ($typeID == 1 ? 'albums_' : '') . 'data', $typeID, $fieldID, $config, $hidden);
 }