示例#1
0
文件: news.php 项目: soremi/tutornavi
 public function index()
 {
     // Parameters
     $params = array('join_columns' => array('`n`.`active`=1'), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring(config::item('news_per_page', 'news'), $params['max']);
     // Get news
     $news = array();
     if ($params['total']) {
         $news = $this->news_model->getEntries('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('news?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('news_per_page', 'news'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('news' => $news, 'pagination' => $pagination));
     // Set meta tags
     $this->metatags_model->set('news', 'news_index');
     // Set title
     view::setTitle(__(config::item('news_blog', 'news') ? 'blog' : 'news', 'system_navigation'), false);
     // Assign actions
     if (session::permission('news_search', 'news') && ($params['total'] || input::post_get('do_search'))) {
         view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#news-search\').toggle();return false;'));
     }
     // Load view
     view::load('news/index');
 }
示例#2
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');
 }
示例#3
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');
 }
示例#4
0
 public function browse()
 {
     // Get URI vars
     $groupID = (int) uri::segment(5);
     // Get group
     if (!$groupID || !($group = $this->banners_groups_model->getGroup($groupID))) {
         view::setError(__('no_group', 'banners'));
         router::redirect('cp/content/banners/groups');
     }
     // Process query string
     $params = $this->parseQuerystring();
     // Get banners
     if (!($banners = $this->banners_model->getBanners($groupID, $params))) {
         view::setInfo(__('no_banners', 'banners'));
     }
     // Create table grid
     $grid = array('uri' => 'cp/content/banners/browse/' . $groupID, 'keyword' => 'banners', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'total_views' => array('html' => __('banner_views', 'banners'), 'class' => 'views', 'sortable' => true), 'total_clicks' => array('html' => __('banner_clicks', 'banners'), 'class' => 'clicks', 'sortable' => true), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($banners as $banner) {
         $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/banners/edit/' . $groupID . '/' . $banner['banner_id'], text_helper::truncate(text_helper::entities($banner['name']), 64))), 'total_views' => array('html' => $banner['total_views']), 'total_clicks' => array('html' => $banner['total_clicks']), 'status' => array('html' => $banner['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/banners/edit/' . $groupID . '/' . $banner['banner_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/banners/delete/' . $groupID . '/' . $banner['banner_id'], __('delete', 'system'), array('data-html' => __('banner_delete?', 'banners'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/content/banners/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid));
     // Set title
     view::setTitle(__('banners_manage', 'system_navigation'));
     // Set trail
     view::setTrail('cp/content/banners/groups/edit/' . $groupID, __('group_edit', 'banners') . ' - ' . text_helper::entities($group['name']));
     view::setTrail('cp/content/banners/browse/' . $groupID, __('banners', 'banners'));
     // Assign actions
     view::setAction('cp/content/banners/edit/' . $groupID, __('banner_new', 'banners'), array('class' => 'icon-text icon-banners-new'));
     // Load view
     view::load('cp/content/banners/browse');
 }
示例#5
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');
 }
示例#6
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');
 }
示例#7
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array(), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // 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 blogs
         if (input::post('action') && isset($actions[input::post('action')]) && input::post('blog_id') && is_array(input::post('blog_id'))) {
             foreach (input::post('blog_id') as $blogID) {
                 $blogID = (int) $blogID;
                 if ($blogID && $blogID > 0) {
                     $this->action(input::post('action'), $blogID);
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get blogs
     $blogs = array();
     if ($params['total']) {
         $blogs = $this->blogs_model->getBlogs('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/plugins/blogs', 'keyword' => 'blogs', 'header' => array('check' => array('html' => 'blog_id', 'class' => 'check'), 'data_title' => array('html' => __('name', 'system'), 'class' => 'name', 'sortable' => true), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($blogs as $blog) {
         if ($blog['active'] == 1) {
             $status = html_helper::anchor('cp/plugins/blogs/decline/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('active', 'system'), array('class' => 'label small success'));
         } else {
             $status = html_helper::anchor('cp/plugins/blogs/approve/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], $blog['active'] ? __('pending', 'system') : __('inactive', 'system'), array('class' => 'label small ' . ($blog['active'] ? 'info' : 'important')));
         }
         $grid['content'][] = array('check' => array('html' => $blog['blog_id']), 'data_title' => array('html' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], text_helper::truncate($blog['data_title'], 64))), 'user' => array('html' => users_helper::anchor($blog['user'])), 'post_date' => array('html' => date_helper::formatDate($blog['post_date'])), 'status' => array('html' => $status), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/blogs/edit/' . $blog['blog_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/blogs/delete/' . $blog['blog_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('blog_delete?', 'blogs'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/plugins/blogs?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->blogsPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/plugins/blogs/browse/grid', $grid);
     hook::filter('cp/plugins/blogs/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('blogs_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/plugins/blogs?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#blogs-search\').toggle();return false;'));
     // Load view
     view::load('cp/plugins/blogs/browse');
 }
示例#8
0
 public function browse()
 {
     // Parameters
     $params = array('join_columns' => array());
     // Process filters
     $params = $this->parseCounters($params);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Actions
     $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected messages
         if (input::post('action') == 'delete') {
             if (input::post('message_id') && is_array(input::post('message_id'))) {
                 foreach (input::post('message_id') as $messageID) {
                     $messageID = (int) $messageID;
                     if ($messageID && $messageID > 0) {
                         $this->delete($messageID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get messages
     $messages = array();
     if ($params['total']) {
         $messages = $this->messages_model->getMessages($params['join_columns'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/plugins/messages', 'keyword' => 'messages', 'header' => array('check' => array('html' => 'message_id', 'class' => 'check'), 'message' => array('html' => __('message', 'messages'), 'class' => 'name'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'post_date' => array('html' => __('post_date', 'system'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($messages as $message) {
         $grid['content'][] = array('check' => array('html' => $message['message_id']), 'message' => array('html' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], text_helper::truncate($message['message'], 64))), 'user' => array('html' => users_helper::anchor($message['user'])), 'post_date' => array('html' => date_helper::formatDate($message['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/plugins/messages/edit/' . $message['message_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/plugins/messages/delete/' . $message['message_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('message_delete?', 'messages'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/plugins/messages?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->messagesPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/plugins/messages/browse/grid', $grid);
     hook::filter('cp/plugins/messages/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('messages_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/plugins/messages?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#messages-search\').toggle();return false;'));
     // Load view
     view::load('cp/plugins/messages/browse');
 }
示例#9
0
 public function browse($privacy = 1)
 {
     if ($privacy == 1 && !config::item('timeline_public_feed', 'timeline')) {
         if (users_helper::isLoggedin() && config::item('timeline_user_feed', 'timeline')) {
             $privacy = 2;
         } else {
             error::show404();
         }
     }
     // Get last action ID
     $lastID = (int) input::post_get('last_id', 0);
     // Does user have permission to view this user group/type?
     if (!session::permission('users_groups_browse', 'users') || !session::permission('users_types_browse', 'users')) {
         view::noAccess();
     }
     // Get actions
     $actions = $this->timeline_model->getActions(0, $privacy, $lastID, config::item('actions_per_page', 'timeline'));
     $ratings = array();
     // Do we have actions and are we logged in?
     if ($actions && users_helper::isLoggedin()) {
         foreach ($actions as $action) {
             if ($action['rating']) {
                 $ratings[$action['relative_resource']][] = $action['item_id'];
             } else {
                 $ratings['timeline'][] = $action['action_id'];
             }
         }
         // Load votes and like models
         loader::model('comments/votes');
         loader::model('comments/likes');
         // Get likes and votes
         $likes = $this->likes_model->getMultiLikes($ratings);
         $votes = $this->votes_model->getMultiVotes($ratings);
         $ratings = $likes + $votes;
     }
     // Can we post messages?
     $post = session::permission('messages_post', 'timeline') ? true : false;
     // Update comments pagination
     config::set('comments_per_page', config::item('comments_per_page', 'timeline'), 'comments');
     // Set meta tags
     $this->metatags_model->set('timeline', 'timeline_index');
     // Set title
     view::setTitle(__($privacy == 2 ? 'my_timeline' : 'timeline_feed', 'system_navigation'), false);
     // Assign actions
     if ($privacy == 1 && config::item('timeline_user_feed', 'timeline') && users_helper::isLoggedin()) {
         view::setAction('timeline/manage', __('timeline_user', 'timeline'), array('class' => 'icon-text icon-timeline-public'));
     } elseif ($privacy == 2 && config::item('timeline_public_feed', 'timeline')) {
         view::setAction('timeline', __('timeline_public', 'timeline'), array('class' => 'icon-text icon-timeline-public'));
     }
     // Load view
     if (input::isAjaxRequest()) {
         $output = view::load('timeline/actions', array('actions' => $actions, 'user' => array(), 'post' => $post, 'ratings' => $ratings), true);
         view::ajaxResponse($output);
     } else {
         view::load('timeline/index', array('actions' => $actions, 'user' => array(), 'post' => $post, 'ratings' => $ratings));
     }
 }
示例#10
0
 public function browse()
 {
     // Get URI vars
     $typeID = (int) uri::segment(6);
     $typeID = $typeID == 0 || $typeID == 1 ? $typeID : 0;
     // Set title
     view::setTitle(__('fields', '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'));
     }
     // Assign actions
     view::setAction('cp/system/fields/pictures/browse/1', __('album_fields', 'pictures'), array('class' => 'icon-text icon-system-fields'));
     // Browse custom fields
     $this->browseFields('pictures', 'pictures_' . ($typeID == 1 ? 'albums_' : '') . 'data', $typeID);
 }
示例#11
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');
 }
示例#12
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');
     }
 }
示例#13
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');
 }
示例#14
0
 public function browse()
 {
     // Get templates
     if (!($templates = $this->newsletters_templates_model->getTemplates())) {
         view::setInfo(__('no_templates', 'newsletters_templates'));
     }
     // Create table grid
     $grid = array('uri' => 'cp/content/newsletters/templates/browse', 'keyword' => 'newsletters_templates', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($templates as $template) {
         $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/newsletters/templates/edit/' . $template['template_id'], text_helper::truncate($template['name'], 64))), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/content/newsletters/templates/edit/' . $template['template_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/newsletters/templates/delete/' . $template['template_id'], __('delete', 'system'), array('data-html' => __('template_delete?', 'newsletters_templates'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/content/newsletters/templates/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid));
     // Set title
     view::setTitle(__('newsletters_templates_manage', 'system_navigation'));
     // Set action
     view::setAction('cp/content/newsletters/templates/edit', __('template_new', 'newsletters_templates'), array('class' => 'icon-text icon-newsletters-templates-new'));
     // Load view
     view::load('cp/content/newsletters/templates/browse');
 }
示例#15
0
 public function browse()
 {
     // Get newsletters
     if (!($newsletters = $this->newsletters_model->getNewsletters())) {
         view::setInfo(__('no_newsletters', 'newsletters'));
     }
     // Create table grid
     $grid = array('uri' => 'cp/content/newsletters/browse', 'keyword' => 'newsletters', 'header' => array('name' => array('html' => __('newsletter_subject', 'newsletters'), 'class' => 'name'), 'status' => array('html' => __('status', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($newsletters as $newsletter) {
         $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/content/newsletters/edit/' . $newsletter['newsletter_id'], text_helper::truncate($newsletter['subject'], 64))), 'status' => array('html' => $newsletter['total_sent'] ? '<span class="label small info">' . __('pending', 'system') . '</span>' : '<span class="label small success">' . __('active', 'system') . '</span>'), 'actions' => array('html' => array('send' => html_helper::anchor('cp/content/newsletters/review/' . $newsletter['newsletter_id'], __('newsletter_review', 'newsletters'), array('class' => 'review')), 'edit' => html_helper::anchor('cp/content/newsletters/edit/' . $newsletter['newsletter_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/content/newsletters/delete/' . $newsletter['newsletter_id'], __('delete', 'system'), array('data-html' => __('newsletter_delete?', 'newsletters'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/content/newsletters/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid));
     // Set title
     view::setTitle(__('newsletters_manage', 'system_navigation'));
     // Set action
     view::setAction('cp/content/newsletters/edit', __('newsletter_new', 'newsletters'), array('class' => 'icon-text icon-newsletters-new'));
     // Load view
     view::load('cp/content/newsletters/browse');
 }
示例#16
0
 public function browse()
 {
     // Get packages
     if (!($packages = $this->credits_model->getPackages(false))) {
         view::setInfo(__('no_packages', 'billing_credits'));
     }
     // Create table grid
     $grid = array('uri' => 'cp/billing/credits/browse', 'keyword' => 'billing_credits', 'header' => array('credits' => array('html' => __('credits', 'billing_credits'), 'class' => 'credits'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'active' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($packages as $package) {
         $grid['content'][] = array('credits' => array('html' => html_helper::anchor('cp/billing/credits/edit/' . $package['package_id'], $package['credits'])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $package['price']), 'active' => array('html' => $package['active'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/credits/edit/' . $package['package_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/credits/delete/' . $package['package_id'], __('delete', 'system'), array('data-html' => __('package_delete?', 'billing_credits'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/billing/credits/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid));
     // Set title
     view::setTitle(__('billing_credits_manage', 'system_navigation'));
     // Assign actions
     view::setAction('cp/billing/credits/edit', __('package_new', 'billing_credits'), array('class' => 'icon-text icon-billing-packages-new'));
     // Load view
     view::load('cp/billing/credits/browse');
 }
示例#17
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');
 }
示例#18
0
 public function browse()
 {
     // Get languages
     if (!($languages = $this->languages_model->scanLanguages())) {
         view::setError(__('no_language', 'system_languages'));
         router::redirect('cp/system/config/system');
     }
     // Create table grid
     $grid = array('uri' => 'cp/system/languages', 'keyword' => 'languages', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'translation' => array('html' => __('language_translation_pct', 'system_languages'), 'class' => 'translation'), 'status' => array('html' => __('default', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($languages as $language) {
         $actions = $status = array();
         if (isset($language['language_id']) && $language['language_id']) {
             // Get default language data
             if (!($default = $this->languages_model->getLanguageData('system'))) {
                 view::setError(__('no_language', 'system_languages'));
                 router::redirect('cp/system/languages');
             }
             // Get language data
             if (!($data = $this->languages_model->getLanguageData($language['keyword']))) {
                 view::setError(__('no_language', 'system_languages'));
                 router::redirect('cp/system/languages');
             }
             // Set language sections
             $translated = $total = 0;
             foreach ($data as $plugin => $langs) {
                 foreach ($langs as $section => $groups) {
                     foreach ($groups as $group => $types) {
                         foreach ($types as $type => $items) {
                             foreach ($items as $index => $value) {
                                 if (utf8::strcasecmp($default[$plugin][$section][$group][$type][$index], $value)) {
                                     $translated++;
                                 }
                                 $total++;
                             }
                         }
                     }
                 }
             }
             $translated = $translated ? round($translated / $total * 100) : 0;
             $translated = $translated > 100 ? 100 : $translated;
             $name['html'] = html_helper::anchor('cp/system/languages/plugins/' . $language['keyword'], text_helper::entities($language['name']));
             $translation['html'] = ($language['keyword'] == 'english' ? '100' : $translated) . '%';
             $status['html'] = $language['default'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : html_helper::anchor('cp/system/languages/setdefault/' . $language['keyword'], __('no', 'system'), array('class' => 'label important small'));
             $actions['html']['plugins'] = html_helper::anchor('cp/system/languages/plugins/' . $language['keyword'], __('language_translate', 'system_languages'), array('class' => 'translate'));
             $actions['html']['edit'] = html_helper::anchor('cp/system/languages/edit/' . $language['keyword'], __('edit', 'system'), array('class' => 'edit'));
             $actions['html']['import'] = html_helper::anchor('cp/system/languages/import/' . $language['keyword'], __('language_import', 'system_languages'), array('data-html' => __('language_import?', 'system_languages'), 'data-role' => 'confirm', 'class' => 'import'));
             $actions['html']['export'] = html_helper::anchor('cp/system/languages/export/' . $language['keyword'], __('language_export', 'system_languages'), array('data-html' => __('language_export?', 'system_languages'), 'data-role' => 'confirm', 'class' => 'export'));
             $actions['html']['uninstall'] = html_helper::anchor('cp/system/languages/uninstall/' . $language['keyword'], __('uninstall', 'system'), array('data-html' => __('language_uninstall?', 'system_languages'), 'data-role' => 'confirm', 'class' => 'uninstall'));
         } else {
             $name['html'] = text_helper::entities($language['name']);
             $translation['html'] = __('language_translation_not_installed', 'system_languages');
             $status['html'] = '<span class="label important small">' . __('no', 'system') . '</span>';
             $actions['html']['install'] = html_helper::anchor('cp/system/languages/install/' . $language['keyword'], __('install', 'system'), array('class' => 'install'));
             if ($language['keyword'] != 'english') {
                 $actions['html']['delete'] = html_helper::anchor('cp/system/languages/delete/' . $language['keyword'], __('delete', 'system'), array('data-html' => __('language_delete?', 'system_languages'), 'data-role' => 'confirm', 'class' => 'delete'));
             }
         }
         $grid['content'][] = array('name' => $name, 'translation' => $translation, 'status' => $status, 'actions' => $actions);
     }
     // Filter hooks
     hook::filter('cp/system/languages/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid));
     // Set title
     view::setTitle(__('system_languages_manage', 'system_navigation'));
     // Assign actions
     view::setAction('cp/system/languages/edit', __('language_new', 'system_languages'), array('class' => 'icon-text icon-system-languages-new'));
     // Load view
     view::load('cp/system/languages/browse');
 }
示例#19
0
 public function view()
 {
     // Get URI vars
     $conversationID = (int) uri::segment(3);
     // Get conversation
     if (!$conversationID || !($conversation = $this->messages_model->getConversation($conversationID, session::item('user_id'))) || $conversation['deleted']) {
         view::setError(__('no_conversation', 'messages'));
         router::redirect('messages/manage');
     }
     if ($conversation['user_id'] != session::item('user_id') && !in_array($conversation['users'][$conversation['user_id']]['group_id'], session::permission('messages_view', 'messages'))) {
         view::noAccess();
     }
     // Mark conversation as read
     if ($conversation['new']) {
         $this->messages_model->markRead($conversationID, session::item('user_id'));
     }
     // Assign vars
     view::assign(array('conversationID' => $conversationID, 'conversation' => $conversation));
     // Process form values
     if (input::post('do_save_message')) {
         $this->_saveMessage($conversationID, $conversation);
     }
     // Set title
     view::setTitle($conversation['subject']);
     // Do we have more than 1 recipient?
     if ($conversation['total_recipients'] > 1) {
         // Assign actions
         view::setAction('messages/people/' . $conversationID, __('conversation_participants', 'messages'), array('class' => 'icon-text icon-messages-people'));
     }
     // Load view
     view::load('messages/view');
 }
示例#20
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');
 }
示例#21
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');
 }
示例#22
0
 public function edit()
 {
     // Get URI vars
     $planID = (int) uri::segment(5);
     // Get plan
     $plan = array();
     if ($planID && !($plan = $this->plans_model->getPlan($planID, false))) {
         view::setError(__('no_plan', 'billing_plans'));
         router::redirect('cp/billing/plans');
     }
     // Set user groups
     $groups = config::item('usergroups', 'core');
     unset($groups[config::item('group_guests_id', 'users')]);
     unset($groups[config::item('group_cancelled_id', 'users')]);
     // Set cycles
     $cycles = array(1 => __('days', 'date'), 2 => __('weeks', 'date'), 3 => __('months', 'date'), 4 => __('years', 'date'));
     // Assign vars
     view::assign(array('planID' => $planID, 'plan' => $plan, 'groups' => $groups, 'cycles' => $cycles));
     // Process form values
     if (input::post('do_save_plan')) {
         $this->_savePlan($planID);
     }
     // Set title
     view::setTitle($planID ? __('plan_edit', 'billing_plans') : __('plan_new', 'billing_plans'));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Set trail
     view::setTrail('cp/billing/plans/edit/' . ($planID ? $planID : ''), $planID ? __('plan_edit', 'billing_plans') . ' - ' . text_helper::entities($plan['name']) : __('plan_new', 'billing_plans'));
     // Load view
     view::load('cp/billing/plans/edit');
 }
示例#23
0
 protected function editField($plugin, $table, $categoryID, $fieldID, $config = array(), $hidden = array())
 {
     // Get field
     $field = array();
     if ($fieldID && !($field = $this->fields_model->getField($fieldID))) {
         view::setError(__('no_field', 'system_fields'));
         router::redirect('cp/system/fields/' . $plugin . '/browse' . ($categoryID ? '/' . $categoryID : ''));
     }
     // Field types
     $types = $this->fieldsdb_model->getTypes(false, isset($hidden['system_types']) && is_array($hidden['system_types']) && $hidden['system_types'] ? $hidden['system_types'] : array());
     // Field properties
     $properties = $this->fieldsdb_model->getFieldProperties();
     $properties['custom'] = $config;
     // Get total and max items
     if (input::post('do_save_field')) {
         //$totalItems = input::post('items') ? count(current(input::post('items'))) : 0;
         $lastItemID = input::post('items') ? max(array_keys(current(input::post('items')))) : 0;
     } else {
         //$totalItems = isset($field['items']) && $field['items'] ? count($field['items']) : 0;
         $lastItemID = isset($field['items']) && $field['items'] ? max(array_keys($field['items'])) : 0;
     }
     // Assign vars
     view::assign(array('fieldID' => $fieldID, 'categoryID' => $categoryID, 'field' => $field, 'hidden' => $hidden, 'types' => $types, 'properties' => $properties, 'lastItemID' => $lastItemID));
     // Process form values
     if (input::post('do_save_field')) {
         $this->_saveField($plugin, $table, $categoryID, $fieldID, $field, $properties, $hidden);
     }
     // Set trail
     view::setTrail('cp/system/fields/' . $plugin . '/edit/' . $categoryID . '/' . ($fieldID ? $fieldID : ''), $fieldID ? __('edit_field', 'system_fields') . ' - ' . text_helper::entities($field['name_' . session::item('language')]) : __('new_field', 'system_fields'));
     // Set actions
     if (count(config::item('languages', 'core', 'keywords')) > 1) {
         view::setAction('translate', '');
     }
     // Include sortable vendor files
     view::includeJavascript('externals/html5sortable/html5sortable.js');
     view::includeStylesheet('externals/html5sortable/style.css');
     // Load view
     view::load('cp/system/fields/edit');
 }
示例#24
0
 public function edit()
 {
     // Get URI vars
     $albumID = (int) uri::segment(6);
     // Get fields
     $fields = $this->fields_model->getFields('pictures', 1, 'edit');
     // Get album
     if (!$albumID || !($album = $this->pictures_albums_model->getAlbum($albumID, $fields, array('escape' => false, 'parse' => false)))) {
         view::setError(__('no_album', 'pictures'));
         router::redirect('cp/plugins/pictures/albums');
     }
     // Get user
     if (!($user = $this->users_model->getUser($album['user_id']))) {
         view::setError(__('no_user', 'users'));
         router::redirect('cp/plugins/pictures/albums');
     }
     // Privacy and general options
     $privacy = $options = array();
     // Do we need to add privacy field?
     if (config::item('album_privacy_view', 'pictures')) {
         $items = $this->users_model->getPrivacyOptions(isset($user['config']['privacy_profile']) ? $user['config']['privacy_profile'] : 1);
         $privacy[] = array('name' => __('privacy_album_view', 'pictures_privacy', array(), array(), false), 'keyword' => 'privacy', 'type' => 'select', 'items' => $items);
     }
     // 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(isset($user['config']['privacy_profile']) ? $user['config']['privacy_profile'] : 1, 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);
     }
     // 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, 'user' => $user, 'fields' => $fields, 'privacy' => $privacy, 'options' => $options));
     // Process form values
     if (input::post('do_save_album')) {
         $this->_saveAlbum($albumID, $album, $fields);
     }
     // Set title
     view::setTitle(__('album_edit', 'pictures'));
     // Set trail
     view::setTrail('cp/plugins/pictures/albums/edit/' . $albumID, __('album_edit', 'pictures') . ' - ' . text_helper::entities($album['data_title']));
     // Assign actions
     view::setAction('cp/plugins/pictures/browse/' . $albumID, __('pictures', 'system_navigation'), array('class' => 'icon-text icon-pictures'));
     // Load view
     view::load('cp/plugins/pictures/albums/edit');
 }
示例#25
0
 public function browse()
 {
     // Get gateways
     $gateways = array();
     foreach ($this->gateways_model->getGateways(false, false) as $gateway) {
         $gateways[$gateway['gateway_id']] = $gateway['name'];
     }
     // Parameters
     $params = array('join_columns' => array());
     // Process filters
     $params = $this->parseCounters($params, $gateways);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Create actions
     $actions = array(0 => __('select', 'system'), 'delete' => __('delete', 'system'));
     // Check form action
     if (input::post('do_action')) {
         // Delete selected transactions
         if (input::post('action') == 'delete') {
             if (input::post('transaction_id') && is_array(input::post('transaction_id'))) {
                 foreach (input::post('transaction_id') as $transactionID) {
                     $transactionID = (int) $transactionID;
                     if ($transactionID && $transactionID > 0) {
                         $this->delete($transactionID);
                     }
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get transaction
     $transactions = array();
     if ($params['total']) {
         $transactions = $this->transactions_model->getTransactions($params['join_columns'], $qstring['order'], $qstring['limit']);
     }
     // Create table grid
     $grid = array('uri' => 'cp/billing/transactions', 'keyword' => 'billing_transactions', 'header' => array('check' => array('html' => 'transaction_id', 'class' => 'check'), 'product' => array('html' => __('product', 'billing'), 'class' => 'product'), 'user' => array('html' => __('user', 'system'), 'class' => 'user'), 'gateway' => array('html' => __('payment_gateway', 'billing'), 'class' => 'gateway'), 'amount' => array('html' => __('price', 'billing'), 'class' => 'price', 'sortable' => true), 'post_date' => array('html' => __('payment_date', 'billing'), 'class' => 'date', 'sortable' => true), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($transactions as $transaction) {
         $grid['content'][] = array('check' => array('html' => $transaction['transaction_id']), 'product' => array('html' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], $transaction['name'])), 'user' => array('html' => users_helper::anchor($transaction['user'])), 'gateway' => array('html' => $gateways[$transaction['gateway_id']]), 'amount' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $transaction['amount']), 'post_date' => array('html' => date_helper::formatDate($transaction['post_date'])), 'actions' => array('html' => array('edit' => html_helper::anchor('cp/billing/transactions/view/' . $transaction['transaction_id'], __('details', 'system'), array('class' => 'details')), 'delete' => html_helper::anchor('cp/billing/transactions/delete/' . $transaction['transaction_id'] . '?' . $qstring['url'] . 'page=' . $qstring['page'], __('delete', 'system'), array('data-html' => __('transaction_delete?', 'billing_transactions'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/billing/transactions?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => $this->transactionPerPage, 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Filter hooks
     hook::filter('cp/billing/transactions/browse/grid', $grid);
     hook::filter('cp/billing/transactions/browse/actions', $actions);
     // Assign vars
     view::assign(array('grid' => $grid, 'actions' => $actions, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('billing_transactions_manage', 'system_navigation'));
     // Set trail
     if ($qstring['search_id']) {
         view::setTrail('cp/billing/transactions?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#transactions-search\').toggle();return false;'));
     // Load view
     view::load('cp/billing/transactions/browse');
 }
示例#26
0
 public function requests()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // 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_friends_i'], 'profiles' => true);
     // Process query string
     $qstring = $this->parseQuerystring($params['total']);
     // Get friends
     $friends = array();
     if ($params['total']) {
         $friends = $this->users_friends_model->getFriends(session::item('user_id'), 0, $qstring['order'], $qstring['limit'], $params);
     } else {
         view::setInfo(__('no_friend_requests', 'users_friends'));
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('users/friends/requests?' . $qstring['url']), 'total_items' => $params['total'], 'items_per_page' => config::item('friends_per_page', 'users'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'friends' => $friends, 'fields' => $fields, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('friends_requests', 'users_friends'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('users/friends/manage', __('users_friends', 'system_navigation'));
     // Assign actions
     if (session::item('total_friends_i')) {
         view::setAction('users/friends/requests', __('friends_requests_num' . (session::item('total_friends_i') == 1 ? '_one' : ''), 'system_info', array('%requests' => session::item('total_friends_i'))), array('class' => 'icon-text icon-users-friends-requests'));
     }
     //view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#friends-search\').toggle();return false;'));
     // Load view
     view::load('users/friends/manage');
 }
示例#27
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');
 }
示例#28
0
 public function manage()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     } elseif (!session::permission('blogs_post', 'blogs')) {
         view::noAccess(session::item('slug'));
     }
     // Assign user from session to variable
     $user = session::section('session');
     // Parameters
     $params = array('select_users' => false, 'join_columns' => array('`b`.`user_id`=' . session::item('user_id')), 'join_items' => array(), 'total' => $user['total_blogs'] + $user['total_blogs_i']);
     // Process filters
     $params = $this->parseCounters($params, 'manage');
     // Process query string
     $qstring = $this->parseQuerystring(config::item('user_blogs_per_page', 'blogs'), $params['max']);
     // Get blogs
     $blogs = array();
     if ($params['total']) {
         $blogs = $this->blogs_model->getBlogs('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit'], $params);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('blogs/manage?' . $qstring['url']), 'total_items' => $params['total'], 'max_items' => $params['max'], 'items_per_page' => config::item('user_blogs_per_page', 'blogs'), 'current_page' => $qstring['page'], 'uri_segment' => 'page');
     $pagination = loader::library('pagination', $config, null);
     // Assign vars
     view::assign(array('user' => $user, 'blogs' => $blogs, 'pagination' => $pagination));
     // Set title
     view::setTitle(__('my_blogs', 'system_navigation'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('blogs/manage', __('blogs', 'system_navigation'));
     if ($qstring['search_id']) {
         view::setTrail('blogs/manage?' . $qstring['url'] . 'page=' . $qstring['page'], __('search_results', 'system'));
     }
     // Assign actions
     view::setAction('blogs/edit', __('blog_new', 'blogs'), array('class' => 'icon-text icon-blogs-new'));
     if (session::permission('blogs_search', 'blogs') && ($params['total'] || input::post_get('do_search'))) {
         view::setAction('#', __('search', 'system'), array('class' => 'icon-text icon-system-search', 'onclick' => '$(\'#blogs-search\').toggle();return false;'));
     }
     // Load view
     view::load('blogs/manage');
 }
示例#29
0
 public function edit()
 {
     // Get URI vars
     $userID = (int) uri::segment(4);
     // Assign vars
     view::assign(array('userID' => $userID));
     // Get user
     $user = array();
     if ($userID && !($user = $this->users_model->getUser($userID))) {
         view::setError(__('no_user', 'users'));
         router::redirect('cp/users');
     }
     // Get user groups
     $groups = config::item('usergroups', 'core');
     unset($groups[config::item('group_guests_id', 'users')]);
     // Create privacy settings
     $settings = array();
     $settings['email'] = array('name' => __('email', 'users'), 'keyword' => 'email', 'type' => 'text', 'class' => 'input-xlarge', 'value' => $user ? input::demo(0) ? current(explode('@', $user['email'])) . '@hidden.com' : $user['email'] : '', 'rules' => array('required', 'max_length' => 255, 'valid_email', 'callback__is_unique_email' => $userID));
     if (config::item('user_username', 'users')) {
         $settings['username'] = array('name' => __('username', 'users'), 'keyword' => 'username', 'type' => 'text', 'class' => 'input-xlarge', 'value' => $user ? $user['username'] : '', 'rules' => array('required', 'min_length' => 3, 'max_length' => 128, 'callback__is_valid_username' => $userID));
     }
     $settings['password'] = array('name' => __('password', 'users'), 'keyword' => 'password', 'type' => 'password', 'maxlength' => 128, 'class' => 'input-xlarge', 'rules' => array(!$userID ? 'required' : '', 'max_length' => 128));
     $settings['password2'] = array('name' => __('password_confirm', 'users'), 'keyword' => 'password2', 'type' => 'password', 'maxlength' => 128, 'class' => 'input-xlarge', 'rules' => array('max_length' => 128, 'matches' => 'password'));
     $settings['type_id'] = array('name' => __('user_type', 'users'), 'keyword' => 'type_id', 'keyword' => 'type_id', 'type' => 'select', 'items' => $userID ? array($user['type_id'] => text_helper::entities(config::item('usertypes', 'core', 'names', $user['type_id']))) : config::item('usertypes', 'core', 'names'), 'value' => $user ? $user['type_id'] : config::item('type_default_id', 'users'), 'rules' => array('intval'));
     $settings['group_id'] = array('name' => __('user_group', 'users'), 'keyword' => 'group_id', 'type' => 'select', 'items' => $userID && $userID == session::item('user_id') ? array($user['group_id'] => config::item('usergroups', 'core', $user['group_id'])) : $groups, 'value' => $user ? $user['group_id'] : config::item('group_default_id', 'users'), 'rules' => array('intval'));
     if ($userID != session::item('user_id')) {
         $settings['verified'] = array('name' => __('verified', 'users'), 'keyword' => 'verified', 'type' => 'boolean', 'value' => $user ? $user['verified'] : '1', 'rules' => array('intval'));
         $settings['active'] = array('name' => __('active', 'system'), 'keyword' => 'active', 'type' => 'boolean', 'value' => $user ? $user['active'] : '1', 'rules' => array('intval'));
     }
     if ($userID) {
         $settings['join_date'] = array('name' => __('join_date', 'users'), 'keyword' => 'join_date', 'type' => 'static', 'value' => date_helper::formatDate($user['join_date'], 'date-time'));
         $settings['visit_date'] = array('name' => __('visit_date', 'users'), 'keyword' => 'visit_date', 'type' => 'static', 'value' => $user['visit_date'] ? date_helper::formatDate($user['visit_date'], 'date-time') : __('never', 'system'));
         $settings['ip_address'] = array('name' => __('ip_address', 'users'), 'keyword' => 'ip_address', 'type' => 'static', 'value' => input::demo(0) ? 'Hidden in this demo' : $user['ip_address']);
     }
     // Filter hook
     $settings = hook::filter('users/settings/account/options', $settings, $user);
     // Assign vars
     view::assign(array('user' => $user, 'settings' => $settings));
     // Process form values
     if (input::post('do_save_user')) {
         $this->_saveUser($userID, $settings, $user);
     }
     // Set title
     view::setTitle($userID ? __('user_edit', 'users') : __('user_new', 'users'));
     // Assign tabs
     if ($userID) {
         $this->_userActions($userID, 'account');
     }
     // Set trail
     view::setTrail('cp/users/edit/' . ($userID ? $userID : ''), $userID ? __('user_edit', 'users') . ' - ' . ($user['name1'] ? $user['name'] : $user['email']) : __('user_new', 'users'));
     // Assign actions
     if ($userID && $user['user_id'] != session::item('user_id') && $user['group_id'] != config::item('group_cancelled_id', 'users') && $user['active'] && $user['verified']) {
         view::setAction('cp/users/login/spy/' . $user['user_id'], __('login', 'system_navigation'), array('class' => 'icon-text icon-users-login'));
     }
     // Load view
     view::load('cp/users/edit');
 }
示例#30
0
 public function browse()
 {
     // Get URI vars
     $adID = (int) uri::segment(6);
     // Get ad
     if ($adID && !($ad = $this->classifieds_model->getAd($adID, 'in_view'))) {
         view::setError(__('no_ad', 'classifieds'));
         router::redirect('cp/plugins/classifieds');
     }
     // Get user
     if ($adID && !($user = $this->users_model->getUser($ad['user_id']))) {
         view::setError(__('no_user', 'users'));
         router::redirect('cp/plugins/classifieds');
     }
     // Parameters
     $params = array('join_columns' => $adID ? array('`p`.`ad_id`=' . $adID) : array(), 'join_items' => array());
     // Process filters
     $params = $this->parseCounters($adID, $params);
     // 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 ads
         if (input::post('action') && isset($actions[input::post('action')]) && input::post('picture_id') && is_array(input::post('picture_id'))) {
             foreach (input::post('picture_id') as $pictureID) {
                 $pictureID = (int) $pictureID;
                 if ($pictureID && $pictureID > 0) {
                     $this->action(input::post('action'), $pictureID);
                 }
             }
         }
         // Success
         view::setInfo(__('action_applied', 'system'));
         router::redirect('cp/plugins/classifieds/pictures/browse/' . $adID . '?' . $qstring['url'] . 'page=' . $qstring['page']);
     }
     // Get pictures
     $pictures = array();
     if ($params['total']) {
         $pictures = $this->classifieds_pictures_model->getPictures('in_list', $params['join_columns'], $params['join_items'], $qstring['order'], $qstring['limit']);
     }
     // Set pagination
     $config = array('base_url' => config::siteURL('cp/plugins/classifieds/pictures/browse/' . $adID . '?' . $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('adID' => $adID, 'ad' => $adID ? $ad : array(), 'user' => $adID ? $user : array(), 'pictures' => $pictures, 'pagination' => $pagination, 'actions' => $actions));
     // Set title
     view::setTitle(__('pictures', 'classifieds'));
     // Set trail
     if ($adID) {
         view::setTrail('cp/plugins/classifieds/edit/' . $adID, __('ad_edit', 'classifieds') . ' - ' . $ad['data_title']);
     }
     view::setTrail('cp/plugins/classifieds/pictures/browse/' . $adID, __('pictures', 'classifieds'));
     if ($qstring['search_id']) {
         view::setTrail('cp/plugins/classifieds/pictures/browse/' . $adID . '?' . $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/plugins/classifieds/pictures/browse');
 }