Пример #1
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');
 }
Пример #2
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');
 }
Пример #3
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);
 }
Пример #4
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');
 }
Пример #5
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');
 }
Пример #6
0
 public function __construct($tabs = true, $loggedin = true)
 {
     parent::__construct();
     // Is user loggedin ?
     if ($loggedin && !users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('users/settings', __('settings', 'users'));
     // Set tabs
     if ($tabs) {
         view::setTab('users/settings', __('settings', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(2) == 'settings' && (!uri::segment(3) || in_array(uri::segment(3), array('email', 'password', 'username', 'cancel'))) || uri::segment(1) == 'billing' && uri::segment(2) != 'invoices' ? 'active' : '') . ' icon-users-settings'));
         if (config::item('privacy_edit', 'users')) {
             view::setTab('users/settings/privacy', __('privacy', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(3) == 'privacy' ? 'active' : '') . ' icon-users-privacy'));
         }
         if (config::item('notifications_edit', 'users')) {
             view::setTab('users/settings/notifications', __('notifications', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(3) == 'notifications' ? 'active' : '') . ' icon-users-notifications'));
         }
         if (config::item('blacklist_active', 'users')) {
             view::setTab('users/blocked', __('blacklist', 'users'), array('class' => (uri::segment(1) == 'users' && uri::segment(2) == 'blocked' ? 'active' : '') . ' icon-users-blacklist'));
         }
     }
     // Filter hook
     hook::action('users/settings/tabs');
 }
Пример #7
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');
 }
Пример #8
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');
 }
Пример #9
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');
 }
Пример #10
0
 public function __construct()
 {
     parent::__construct();
     // Does user have permission to access this plugin?
     if (!session::permission('settings_manage', 'users')) {
         view::noAccess();
     }
     view::setCustomParam('section', 'users');
     view::setCustomParam('options', config::item('cp_top_nav', 'lists', 'users', 'items'));
     view::setTrail('cp/users', __('users', 'system_navigation'));
 }
Пример #11
0
 public function __construct()
 {
     parent::__construct();
     // Does user have permission to access this plugin?
     if (!session::permission('counters_manage', 'utilities')) {
         view::noAccess();
     }
     view::setCustomParam('section', 'system');
     view::setCustomParam('options', config::item('cp_top_nav', 'lists', 'system', 'items', 'system/utilities', 'items'));
     loader::model('utilities/counters', array(), 'recalculate_model');
     view::setTrail('cp/system/config/system', __('system', 'system_navigation'));
     view::setTrail('cp/utilities/counters', __('utilities_counters', 'system_navigation'));
 }
Пример #12
0
 public function __construct()
 {
     parent::__construct();
     if (!config::item('messages_active', 'messages')) {
         error::show404();
     } elseif (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('messages_access', 'messages')) {
         view::noAccess();
     }
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('messages/manage', __('messages', 'system_navigation'));
     loader::model('messages/messages');
 }
Пример #13
0
 public function __construct()
 {
     parent::__construct();
     // Does user have permission to access this plugin?
     if (!session::permission('license_manage', 'system')) {
         view::noAccess();
     }
     view::setCustomParam('section', 'help');
     view::setCustomParam('options', array('help/license' => array('name' => __('help_license', 'system_navigation'), 'uri' => 'help/license', 'keyword' => 'help/license', 'attr' => array('help license'), 'items' => array())));
     loader::model('system/license');
     view::setTrail('cp/help/license', __('help', 'system_navigation'));
     view::setTrail('cp/help/license', __('help_license', 'system_navigation'));
     // Check if demo mode is enabled
     if (input::demo(1, 'cp/system/config/system')) {
         return false;
     }
 }
Пример #14
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');
 }
Пример #15
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');
     }
 }
Пример #16
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');
 }
Пример #17
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');
 }
Пример #18
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);
 }
Пример #19
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');
 }
Пример #20
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');
 }
Пример #21
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');
 }
Пример #22
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');
 }
Пример #23
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);
 }
Пример #24
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');
 }
Пример #25
0
 public function notifications()
 {
     // Get URI vars
     $userID = (int) uri::segment(4);
     // Get user
     if (!$userID || !($user = $this->users_model->getUser($userID))) {
         view::setError(__('no_user', 'users'));
         router::redirect('cp/users');
     }
     // Create notifications settings
     $settings = array('general' => array('name' => __('options_general', 'users_privacy'), 'keyword' => 'general', 'type' => 'checkbox', 'items' => array(), 'value' => array()));
     // Filter hook
     $settings = hook::filter('users/settings/notifications/options', $settings, $user);
     // Assign vars
     view::assign(array('user' => $user, 'settings' => $settings));
     // Process form values
     if (input::post('do_save_notifications')) {
         $this->_saveNotifications($userID, $settings);
     }
     // Set title
     view::setTitle(__('notifications', 'users'));
     // Set trail
     view::setTrail('cp/users/edit/' . $userID, __('user_edit', 'users') . ' - ' . ($user['name1'] ? $user['name'] : $user['email']));
     view::setTrail('cp/users/notifications/' . $userID, __('notifications', 'users'));
     // Assign tabs
     $this->_userActions($userID, 'notifications');
     // Load view
     view::load('cp/users/notifications');
 }
Пример #26
0
 public function edit()
 {
     // Is user logged in?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('albums_post', 'pictures')) {
         view::noAccess(session::item('slug'));
     }
     // Get URI vars
     $albumID = (int) uri::segment(4);
     // Did user reach the max albums limit?
     if (!$albumID && session::permission('albums_limit', 'pictures') && session::permission('albums_limit', 'pictures') <= session::item('total_albums')) {
         view::setError(__('album_limit_reached', 'pictures', array('%limit%' => session::permission('albums_limit', 'pictures'))));
         router::redirect('pictures/albums/manage');
     }
     // Get fields
     $fields = $this->fields_model->getFields('pictures', 1, 'edit', 'in_account');
     // Get album
     $album = array();
     if ($albumID && (!($album = $this->pictures_albums_model->getAlbum($albumID, $fields, array('escape' => false, 'parse' => false))) || $album['user_id'] != session::item('user_id'))) {
         view::setError(__('no_album', 'pictures'));
         router::redirect('pictures/albums/manage');
     }
     // Privacy options
     $privacy = array();
     // Do we need to add privacy field?
     if (config::item('album_privacy_view', 'pictures')) {
         $items = $this->users_model->getPrivacyOptions(session::item('privacy_profile', 'config'));
         $privacy[] = array('name' => __('privacy_album_view', 'pictures_privacy', array(), array(), false), 'keyword' => 'privacy', 'type' => 'select', 'items' => $items, 'privacy' => config::item('privacy_default', 'users'));
     }
     // Do we need to add enable comments field?
     if (config::item('picture_comments', 'pictures') && config::item('picture_privacy_comments', 'pictures')) {
         $items = $this->users_model->getPrivacyOptions(session::item('privacy_profile', 'config'), false);
         $items[0] = __('privacy_comments_disable', 'comments_privacy');
         $privacy[] = array('name' => __('privacy_comments_post', 'comments_privacy', array(), array(), false), 'keyword' => 'comments', 'type' => 'select', 'items' => $items, 'comments' => config::item('privacy_default', 'users'));
     }
     // Do we need to add search field?
     if (config::item('album_privacy_public', 'pictures')) {
         $privacy[] = array('name' => __('privacy_search', 'system', array(), array(), false), 'keyword' => 'public', 'type' => 'boolean');
     }
     // Assign vars
     view::assign(array('albumID' => $albumID, 'album' => $album, 'fields' => $fields, 'privacy' => $privacy));
     // Process form values
     if (input::post('do_save_album')) {
         $this->_saveAlbum($albumID, $album, $fields);
     }
     // Set title
     view::setTitle(__($albumID ? 'album_edit' : 'album_new', 'pictures'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('pictures/manage', __('pictures_albums', 'system_navigation'));
     if ($albumID && $album['total_pictures'] + $album['total_pictures_i'] > 0) {
         view::setTrail('pictures/index/' . $album['album_id'] . '/' . text_helper::slug($album['data_title'], 100), __('album_view', 'pictures'), array('side' => true));
     }
     // Assign actions
     if ($albumID) {
         view::setAction('pictures/upload/' . $albumID, __('pictures_new', 'pictures'), array('class' => 'icon-text icon-pictures-new', 'data-role' => 'modal', 'data-title' => __('pictures_new', 'pictures')));
     }
     // Load view
     view::load('pictures/albums/edit');
 }
Пример #27
0
 public function send()
 {
     // Get URI vars
     $newsletterID = (int) uri::segment(5);
     $counter = (int) uri::segment(6, 0);
     $test = uri::segment(7) == 'test' ? 1 : 0;
     $step = config::item('emails_batch', 'newsletters');
     // Get newsletter
     if (!$newsletterID || !($newsletter = $this->newsletters_model->getNewsletter($newsletterID, false))) {
         view::setError(__('no_newsletter', 'newsletters'));
         router::redirect('cp/content/newsletters');
     }
     // Do we have recipients?
     if (!$newsletter['total_users']) {
         router::redirect('cp/content/newsletters/recipients/' . $newsletterID);
     }
     // Is this the first step?
     if (!$test && !$counter) {
         // Update total user count
         $searchID = $this->search_model->searchData('profile', array(), $newsletter['params']['conditions'], $newsletter['params']['values'], array('type_id' => isset($newsletter['params']['values']['type_id']) ? $newsletter['params']['values']['type_id'] : 0));
         // Do we have any search terms?
         if ($searchID == 'no_terms' || $searchID == 'no_results' || !($search = $this->search_model->getSearch($searchID))) {
             router::redirect('cp/content/newsletters/recipients/' . $newsletterID);
         }
         // Did total user count change?
         if ($search['results'] != $newsletter['total_users']) {
             $newsletter = array('total_users' => $search['results']);
             $this->newsletters_model->saveNewsletter($newsletterID, $newsletter);
         }
     } elseif ($test && !config::item('email_test', 'newsletters')) {
         view::setError(__('newsletters_test_none', 'newsletters', array(), array('%' => html_helper::anchor('cp/system/config/newsletters', '\\1'))));
         router::redirect('cp/content/newsletters/review/' . $newsletterID);
     }
     // Load email library
     loader::library('email');
     // Is this a test?
     if ($test) {
         $this->email->sendEmail(config::item('email_test', 'newsletters'), $newsletter['subject'], $newsletter['message_text'], $newsletter['message_html']);
         view::setInfo(__('newsletter_sent', 'newsletters'));
         router::redirect('cp/content/newsletters/review/' . $newsletterID);
     }
     // Get users
     $users = $this->users_model->getUsers('in_view', isset($newsletter['params']['values']['type_id']) ? $newsletter['params']['values']['type_id'] : 0, $newsletter['params']['conditions']['columns'], $newsletter['params']['conditions']['items'], false, $counter . ',' . $step);
     foreach ($users as $user) {
         if (!input::demo(0)) {
             $this->email->sendEmail($user['email'], $newsletter['subject'], $newsletter['message_text'], $newsletter['message_html'], $user);
         }
         $counter++;
     }
     // Do we have any users?
     if (!$users) {
         view::setInfo(__('newsletter_sent', 'newsletters'));
         $next = '';
     } else {
         $next = $counter;
     }
     // Update total sent
     $this->newsletters_model->saveNewsletter($newsletterID, array('total_sent' => $next ? $counter : 0));
     // Did total number of users change?
     if ($counter > $newsletter['total_users'] || !$next && $counter < $newsletter['total_users']) {
         $newsletter['total_users'] = $counter;
         $this->newsletters_model->saveNewsletter($newsletterID, array('total_users' => $counter));
     }
     $message = __('newsletter_sending_status', 'newsletters', array('%1' => $counter, '%2' => $newsletter['total_users']));
     $message .= '<br/>' . __('newsletter_sending_redirect', 'newsletters', array(), array('%' => html_helper::anchor('cp/content/newsletters/send/' . $newsletterID . '/' . $next, '\\1')));
     // Assign vars
     view::assign(array('newsletterID' => $newsletterID, 'newsletter' => $newsletter, 'counter' => $counter, 'redirect' => $next, 'output' => $message));
     if (input::isAjaxRequest()) {
         view::ajaxResponse(array('output' => $message, 'redirect' => $next));
     }
     // Set title
     view::setTitle(__('newsletter_sending', 'newsletters'));
     // Set trail
     view::setTrail('cp/content/newsletters/send/' . $newsletterID, __('newsletter_send', 'newsletters') . ' - ' . text_helper::entities($newsletter['subject']));
     // Load view
     view::load('cp/content/newsletters/send');
 }
Пример #28
0
 public function translate()
 {
     // Get URI vars
     $plugin = uri::segment(5);
     $language = uri::segment(6);
     // Get plugin
     if (!config::item('plugins', 'core', $plugin)) {
         view::setError(__('no_plugin', 'system_plugins'));
         router::redirect('cp/system/languages/plugins/' . $language);
     }
     // Is this a system language?
     if ($language == 'system') {
         $language = array('keyword' => 'system', 'name' => 'System');
     } elseif (!($language = $this->languages_model->getLanguage($language))) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/languages');
     }
     // Get default language data
     if (!($default = $this->languages_model->getLanguageData('system', $plugin))) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/languages');
     }
     // Get language data
     if (!($data = $this->languages_model->getLanguageData($language['keyword'], $plugin, true))) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/languages');
     }
     // Set language sections
     $sections = array();
     foreach ($data as $section => $groups) {
         foreach ($groups as $group => $types) {
             $translated = $total = 0;
             foreach ($types as $type => $items) {
                 foreach ($items as $index => $value) {
                     if (utf8::strcasecmp($default[$section][$group][$type][$index], $value)) {
                         $translated++;
                     }
                     $total++;
                 }
             }
             $translated = $translated ? round($translated / $total * 100) : 0;
             $translated = $translated > 100 ? 100 : $translated;
             if (__('language_' . $group, $plugin . '_config') !== false) {
                 $name = __('language_' . $group, $plugin . '_config');
             } elseif (__('language_' . $group, 'users_config') !== false) {
                 $name = __('language_' . $group, 'users_config');
             } elseif (__('language_' . $group, 'system_config') !== false) {
                 $name = __('language_' . $group, 'system_config');
             } elseif ($section == $group) {
                 $name = __('language_system', 'system_config');
             } else {
                 $name = '!' . $group;
             }
             $sections[$section . '_' . $group] = '[' . config::item('plugins', 'core', $section, 'name') . '] ' . $name . ($language['keyword'] != 'english' ? ' - ' . $translated . '%' : '') . (config::item('devmode', 'system') == 2 ? ' [' . $group . ']' : '');
         }
     }
     asort($sections);
     // Assign vars
     view::assign(array('plugin' => $plugin, 'default' => $default, 'sections' => $sections, 'language' => $data));
     // Process form values
     if (input::post('do_save_language')) {
         $this->_saveLanguageData($plugin, $language['keyword'], $default);
     }
     // Set title
     view::setTitle(__('language_translate', 'system_languages'));
     // Set trail
     view::setTrail('cp/system/languages/plugins/' . $language['keyword'], __('language_translate', 'system_languages') . ' - ' . text_helper::entities($language['name']));
     view::setTrail('cp/system/languages/translate/' . $plugin . '/' . $language['keyword'], text_helper::entities(config::item('plugins', 'core', $plugin, 'name')));
     // Load view
     view::load('cp/system/languages/translate');
 }
Пример #29
0
 public function edit()
 {
     // Get URI vars
     $parentID = (int) uri::segment(5);
     $pageID = (int) uri::segment(6);
     // Get fields
     $fields = $this->fields_model->getFields('pages', 0, 'edit');
     // Get parent pages
     $parents = $parentID ? $this->pages_model->getParents($parentID) : array();
     $parent = $parentID ? end($parents) : array();
     if ($parentID && !$parents) {
         view::setError(__('no_parent', 'pages'));
         router::redirect('cp/content/pages');
     }
     // Get page
     $page = array();
     if ($pageID && !($page = $this->pages_model->getPage($pageID, $fields, array('escape' => false, 'parse' => false, 'multilang' => true)))) {
         view::setError(__('no_page', 'pages'));
         router::redirect('cp/content/pages/browse/' . $parentID);
     }
     $trail = array();
     foreach ($parents as $parent) {
         $trail[] = $parent['keyword'];
     }
     // Options
     $options = array();
     // Custom filename
     $options[] = array('name' => __('page_custom_file', 'pages', array(), array(), false), 'keyword' => 'file_name', 'type' => 'text', 'value' => '', 'class' => 'input-xlarge', 'rules' => array('trim', 'callback__is_valid_file_name'));
     // Do we need to add enable comments field?
     if (config::item('page_comments', 'pages')) {
         $options[] = array('name' => __('comments_enable', 'comments', array(), array(), false), 'keyword' => 'comments', 'type' => 'boolean', 'value' => 1, 'rules' => 'intval');
     }
     // Do we need to add enable likes field?
     if (config::item('page_rating', 'pages') == 'likes') {
         $options[] = array('name' => __('likes_enable', 'comments', array(), array(), false), 'keyword' => 'likes', 'type' => 'boolean', 'value' => 1, 'rules' => 'intval');
     } elseif (config::item('page_rating', 'pages') == 'stars') {
         $options[] = array('name' => __('rating_enable', 'comments', array(), array(), false), 'keyword' => 'votes', 'type' => 'boolean', 'value' => 1, 'rules' => 'intval');
     }
     // Trail field
     $options[] = array('name' => __('page_trail', 'pages', array(), array(), false), 'keyword' => 'trail', 'type' => 'boolean', 'value' => 1, 'rules' => 'intval');
     // Active field
     $options[] = array('name' => __('active', 'system', array(), array(), false), 'keyword' => 'active', 'type' => 'boolean', 'value' => 1, 'rules' => 'intval');
     // Assign vars
     view::assign(array('parentID' => $parentID, 'pageID' => $pageID, 'parent' => $parent, 'page' => $page, 'fields' => $fields, 'options' => $options));
     // Process form values
     if (input::post('do_save_page')) {
         $this->_savePage($pageID, $parentID, $page, $fields, $options, $trail);
     }
     // Set title
     view::setTitle(__('page_edit', 'pages'));
     // Set trail
     view::setTrail('cp/content/pages/browse', __('pages', 'pages'));
     foreach ($parents as $parent) {
         view::setTrail('cp/content/pages/edit/' . $parent['parent_id'] . '/' . $parent['page_id'], $parent['data_title']);
     }
     view::setTrail('cp/content/pages/edit/' . $parentID . '/' . ($pageID ? $pageID : ''), $pageID ? __('page_edit', 'pages') . ' - ' . text_helper::entities($page['data_title_' . session::item('language')]) : __('page_new', 'pages'));
     // Assign actions
     if ($pageID) {
         view::setAction(implode('/', $trail) . ($trail ? '/' : '') . $page['keyword'], __('page_view', 'pages'), array('class' => 'icon-text icon-pages-view'));
         view::setAction('cp/content/pages/browse/' . $pageID, __('page_inner', 'pages'), array('class' => 'icon-text icon-pages-inner'));
     } elseif ($parentID) {
         view::setAction('cp/content/pages/browse/' . $parentID, __('page_inner', 'pages'), array('class' => 'icon-text icon-pages-inner'));
     }
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Load view
     view::load('cp/content/pages/edit');
 }
Пример #30
0
 public function edit()
 {
     // 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');
     }
     // Assign vars
     view::assign(array('templateID' => $templateID, 'template' => $template));
     // Process form values
     if (input::post('do_save_template')) {
         $this->_saveTemplate($templateID, $template['keyword']);
     }
     // Set title
     view::setTitle(__($template['keyword'], 'system_email_templates'));
     // Set trail
     view::setTrail('cp/system/emailtemplates/browse/' . $template['plugin'], text_helper::entities(config::item('plugins', 'core', $template['plugin'], 'name')));
     view::setTrail('cp/system/emailtemplates/edit/' . $templateID, __($template['keyword'], 'system_email_templates'));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Load ckeditor
     view::includeJavascript('externals/ckeditor/ckeditor.js');
     // Load view
     view::load('cp/system/emailtemplates/edit');
 }