Beispiel #1
0
 public function edit()
 {
     // Get URI vars
     $newsletterID = (int) uri::segment(5);
     // Get newsletter
     $newsletter = array();
     if ($newsletterID && !($newsletter = $this->newsletters_model->getNewsletter($newsletterID, false))) {
         view::setError(__('no_newsletter', 'newsletters'));
         router::redirect('cp/content/newsletters');
     }
     // Assign vars
     view::assign(array('newsletterID' => $newsletterID, 'newsletter' => $newsletter));
     // Process form values
     if (input::post('do_save_newsletter')) {
         $this->_saveNewsletter($newsletterID);
     }
     // Set title
     view::setTitle($newsletterID ? __('newsletter_edit', 'newsletters') : __('newsletter_new', 'newsletters'));
     // Set trail
     view::setTrail('cp/content/newsletters/edit/' . ($newsletterID ? $newsletterID : '') . (uri::segment(6) == 'review' ? '/review' : ''), $newsletterID ? __('newsletter_edit', 'newsletters') . ' - ' . text_helper::entities($newsletter['subject']) : __('newsletter_new', 'newsletters'));
     // Load ckeditor
     view::includeJavascript('externals/ckeditor/ckeditor.js');
     // Load view
     view::load('cp/content/newsletters/edit');
 }
Beispiel #2
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');
 }
Beispiel #3
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');
     }
 }
Beispiel #4
0
 public function browse()
 {
     // Did we submit the form?
     if (input::post('action') == 'reorder' && input::post('ids')) {
         $this->_reorderPlans();
     }
     // Get plans
     if (!($plans = $this->plans_model->getPlans(false))) {
         view::setInfo(__('no_plans', 'billing_plans'));
     }
     // Set cycles
     $cycles = array_map('strtolower', array(1 => __('day', 'date'), 2 => __('week', 'date'), 3 => __('month', 'date'), 4 => __('year', 'date')));
     $cyclesMulti = array_map('strtolower', array(1 => __('days', 'date'), 2 => __('weeks', 'date'), 3 => __('months', 'date'), 4 => __('years', 'date')));
     // Create table grid
     $grid = array('uri' => 'cp/billing/plans/browse', 'keyword' => 'billing_plans', 'header' => array('name' => array('html' => __('name', 'system'), 'class' => 'name'), 'group' => array('html' => __('plan_group', 'billing_plans'), 'class' => 'group'), 'cycle' => array('html' => __('plan_cycle', 'billing_plans'), 'class' => 'cycle'), 'price' => array('html' => __('price', 'billing'), 'class' => 'price'), 'signup' => array('html' => __('plan_signup', 'billing_plans'), 'class' => 'signup'), 'status' => array('html' => __('active', 'system'), 'class' => 'status'), 'actions' => array('html' => __('actions', 'system'), 'class' => 'actions')), 'content' => array());
     // Create grid content
     foreach ($plans as $plan) {
         $grid['content'][] = array('name' => array('html' => html_helper::anchor('cp/billing/plans/edit/' . $plan['plan_id'], $plan['name'])), 'group' => array('html' => config::item('usergroups', 'core', $plan['group_id'])), 'cycle' => array('html' => $plan['duration'] . ' ' . ($plan['duration'] == 1 ? $cycles[$plan['cycle']] : $cyclesMulti[$plan['cycle']])), 'price' => array('html' => money_helper::symbol(config::item('currency', 'billing')) . $plan['price']), 'signup' => array('html' => $plan['signup'] ? '<span class="label success small">' . __('yes', 'system') . '</span>' : '<span class="label important small">' . __('no', 'system') . '</span>'), 'status' => array('html' => $plan['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/plans/edit/' . $plan['plan_id'], __('edit', 'system'), array('class' => 'edit')), 'delete' => html_helper::anchor('cp/billing/plans/delete/' . $plan['plan_id'], __('delete', 'system'), array('data-html' => __('plan_delete?', 'billing_plans'), 'data-role' => 'confirm', 'class' => 'delete')))));
     }
     // Filter hooks
     hook::filter('cp/billing/plans/browse/grid', $grid);
     // Assign vars
     view::assign(array('grid' => $grid, 'plans' => $plans));
     // Set title
     view::setTitle(__('billing_plans_manage', 'system_navigation'));
     // Assign actions
     view::setAction('cp/billing/plans/edit', __('plan_new', 'billing_plans'), array('class' => 'icon-text icon-billing-plans-new'));
     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/billing/plans/browse_' . (input::post('view') == 'list' ? 'list' : 'grid'));
     } else {
         view::load('cp/billing/plans/browse');
     }
 }
Beispiel #5
0
<?php

view::load('cp/system/elements/template/header');
?>

<?php 
if (isset($autoclose) && $autoclose) {
    ?>
	<?php 
    view::includeJavascript('setTimeout(function(){ parent.$.colorbox.close(); }, 1000);', 'footer');
}
?>

<?php 
view::load('cp/system/elements/template/footer');
Beispiel #6
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');
 }
Beispiel #7
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');
 }
Beispiel #8
0
            ?>
						<div class="clearfix"></div>
					<?php 
        }
        ?>
    				<div class="copyright <?php 
        echo config::item('social_facebook', 'template') || config::item('social_linkedin', 'template') || config::item('social_skype', 'template') || config::item('social_twitter', 'template') || config::item('social_youtube', 'template') || config::item('social_rss', 'template') ? 'social' : 'single';
        ?>
">
						<?php 
        echo config::item('branding_text', 'system');
        ?>
					</div>
				<?php 
    }
    ?>
			</div>
		</footer>
	<?php 
}
?>
	<?php 
if (input::get('modal')) {
    view::includeJavascript('parent.$.colorbox.resize({innerHeight:$("body").height()});', 'footer');
}
?>
	<?php 
echo view::getJavascripts('footer');
?>
</body>
</html>
Beispiel #9
0
 public function getFields($plugin, $categoryID = 0, $type = 'view', $config = '', $search = false)
 {
     if (!($fields = $this->cache->item('db_fields_' . $plugin . '_' . session::item('language') . '_' . $categoryID . '_' . $type . '_' . $config . '_' . ($search ? 1 : 0))) && !is_array($fields)) {
         $fields = $fieldIDs = array();
         // Get fields
         $qfields = $this->db->query("SELECT * FROM `:prefix:core_fields` WHERE `plugin`=? AND `category_id`=? ORDER BY `order_id` ASC", array($plugin, $categoryID))->result();
         foreach ($qfields as $field) {
             // Set index
             $index = $field['field_id'];
             // Decode configuration array
             $field['config'] = $field['config'] ? @json_decode($field['config'], true) : array();
             if (!is_array($field['config'])) {
                 $field['config'] = array();
             }
             // Is configuration item present?
             if ($config == '' || $config == 'all' || isset($field['config'][$config]) && $field['config'][$config]) {
                 $fields[$index] = array();
                 $fields[$index]['keyword'] = $field['keyword'];
                 $fields[$index]['multilang'] = $field['multilang'];
                 $fields[$index]['class'] = $field['class'];
                 $fields[$index]['style'] = $field['style'];
                 if (isset($field['config']['html']) && $field['config']['html']) {
                     $fields[$index]['html'] = 1;
                 }
                 // Basic field data
                 if ($type == 'query') {
                     if ($this->isMultiValue($field['type'])) {
                         $fields[$index]['items'] = array();
                     }
                 } else {
                     if ($search && $field['sname_' . session::item('language')] != '') {
                         $fields[$index]['name'] = $field['sname_' . session::item('language')];
                     } else {
                         $fields[$index]['name'] = $type == 'view' && $field['vname_' . session::item('language')] ? $field['vname_' . session::item('language')] : $field['name_' . session::item('language')];
                     }
                     $fields[$index]['type'] = $field['type'];
                 }
                 // Data for edit and grid/browse type of pages
                 if ($type == 'full' || $type == 'edit' || $type == 'grid') {
                     $fields[$index]['field_id'] = $field['field_id'];
                     $fields[$index]['plugin'] = $field['plugin'];
                     $fields[$index]['category_id'] = $field['category_id'];
                     $fields[$index]['required'] = $field['required'];
                     $fields[$index]['system'] = $field['system'];
                     $fields[$index]['order_id'] = $field['order_id'];
                 }
                 // Data for edit type of pages
                 if ($type == 'full' || $type == 'edit') {
                     $fields[$index]['validate'] = $field['validate'];
                     $fields[$index]['validate_error'] = $field['validate_error_' . session::item('language')];
                     $fields[$index]['config'] = $field['config'];
                     // Check field's type
                     if ($this->isMultiValue($field['type'])) {
                         $fields[$index]['items'] = array();
                     }
                 }
                 // Check field's type
                 if ($this->isMultiValue($field['type'])) {
                     // Store field ID
                     $fieldIDs[$field['field_id']] = $this->getValueFormat($field['type']);
                 }
             }
         }
         // Do we have any field IDs
         if ($fieldIDs) {
             // Get items
             $items = $this->db->query("SELECT * FROM `:prefix:core_fields_items` WHERE `field_id` IN (" . implode(',', array_keys($fieldIDs)) . ") ORDER BY `order_id` ASC")->result();
             // Assign items to the field
             foreach ($items as $item) {
                 $id = $fieldIDs[$item['field_id']] == 'multiple' ? $item['item_id'] : $item['order_id'];
                 if ($search && $item['sname_' . session::item('language')] != '') {
                     $fields[$item['field_id']]['items'][$id] = $item['sname_' . session::item('language')];
                 } else {
                     $fields[$item['field_id']]['items'][$id] = $item['name_' . session::item('language')];
                 }
             }
         }
         $this->cache->set('db_fields_' . $plugin . '_' . session::item('language') . '_' . $categoryID . '_' . $type . '_' . $config . '_' . ($search ? 1 : 0), $fields, 60 * 60 * 24 * 30);
     }
     if ($type == 'edit' && !$search && input::isCP()) {
         foreach ($fields as $field) {
             if ($field['type'] == 'textarea' && isset($field['config']['html']) && $field['config']['html']) {
                 view::includeJavascript('externals/ckeditor/ckeditor.js');
             }
         }
     } elseif ($config == 'in_view') {
         $names = array();
         foreach ($fields as $field) {
             $names[$field['keyword']] = $field['name'];
         }
         config::set('fields_' . $plugin, $names, 'core');
     }
     return $fields;
 }
Beispiel #10
0
 public function thumbnail()
 {
     // Is user loggedin ?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Resize picture?
     if (input::post('do_save_thumbnail')) {
         $this->_saveThumbnail();
     }
     // Set title
     view::setTitle(__('picture_thumbnail_edit', 'system_files'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     // Include jcron files
     view::includeJavascript('externals/jcrop/jcrop.min.js');
     view::includeStylesheet('externals/jcrop/style.css');
     // Load view
     view::load('users/profile/thumbnail');
 }
Beispiel #11
0
 public function thumbnail()
 {
     // Is user logged in?
     if (!users_helper::isLoggedin()) {
         router::redirect('users/login');
     }
     // Get URI vars
     $adID = (int) uri::segment(4);
     $pictureID = (int) uri::segment(5);
     // Get album
     if (!$adID || !($ad = $this->classifieds_model->getAd($adID, 'in_view')) || $ad['user_id'] != session::item('user_id')) {
         view::setError(__('no_ad', 'classifieds'));
         router::redirect('classifieds');
     }
     // Get picture
     if (!$pictureID || !($picture = $this->classifieds_pictures_model->getPicture($pictureID, 'in_view')) || $picture['user_id'] != session::item('user_id')) {
         view::setError(__('no_picture', 'classifieds'));
         router::redirect('classifieds/pictures/index/' . $adID . '/' . text_helper::slug($ad['data_title'], 100));
     }
     // Assign vars
     view::assign(array('adID' => $adID, 'pictureID' => $pictureID, 'picture' => $picture, 'ad' => $ad));
     // Resize picture?
     if (input::post('do_save_thumbnail')) {
         $this->_saveThumbnail($pictureID, $picture, $ad);
     }
     // Set title
     view::setTitle(__('picture_thumbnail_edit', 'system_files'));
     // Set trail
     view::setTrail(session::item('slug'), __('my_profile', 'system_navigation'));
     view::setTrail('classifieds/manage', __('classifieds', 'system_navigation'));
     view::setTrail('classifieds/view/' . $ad['ad_id'] . '/' . text_helper::slug($ad['data_title'], 100), __('ad_view', 'classifieds'), array('side' => true));
     // Include jcron files
     view::includeJavascript('externals/jcrop/jcrop.min.js');
     view::includeStylesheet('externals/jcrop/style.css');
     // Load view
     view::load('classifieds/pictures/thumbnail');
 }
Beispiel #12
0
 public function thumbnail()
 {
     // Is user logged in?
     if (users_helper::isLoggedin()) {
         router::redirect(session::item('slug'));
     } elseif (!config::item('signup_enable', 'users')) {
         // Success
         view::setError(__('signup_disabled', 'users_signup'));
         router::redirect('users/login');
     } elseif (!session::item('account', 'signup') || config::item('signup_steps', 'users', 'profile') !== false && !session::item('profile', 'signup')) {
         router::redirect('users/signup');
     } elseif (!session::item('picture', 'signup', 'file_id')) {
         router::redirect('users/signup/picture');
     }
     // Reset steps
     $this->_resetSteps('picture');
     // Process form values
     if (input::post('do_save_thumbnail')) {
         $this->_saveThumbnail();
     }
     // Add storage includes
     $this->storage_model->includeExternals();
     // Set title
     view::setTitle(__('picture_thumbnail_edit', 'system_files'));
     // Include jcron files
     view::includeJavascript('externals/jcrop/jcrop.min.js');
     view::includeStylesheet('externals/jcrop/style.css');
     // Load view
     view::load('users/signup/thumbnail');
 }