Skip to content

Commit

Permalink
4.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gulaandrij committed Mar 23, 2017
1 parent cfd391b commit deed4d6
Show file tree
Hide file tree
Showing 93 changed files with 10,593 additions and 8,495 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<spotlight>
<current>
<name>ImageCMS Corporate</name>
<export_version>4.12.1</export_version>
<edition>Corporate</edition>
<timestamp>1490272826</timestamp>
</current>
<item>
<name>ImageCMS Corporate</name>
<export_version>4.12</export_version>
<edition>Corporate</edition>
<timestamp>1469022432</timestamp>
</current>
</item>
<item>
<name>ImageCMS Corporate</name>
<export_version>4.11</export_version>
Expand Down
2 changes: 1 addition & 1 deletion application/config/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
|
*/
$config['tpl_compile_path'] = PUBPATH . 'system/cache/templates_c/';
$config['tpl_force_compile'] = FALSE;
$config['tpl_force_compile'] = false;
$config['tpl_compiled_ttl'] = 84600;
$config['tpl_compress_output'] = TRUE;
$config['tpl_use_filemtime'] = TRUE;
Expand Down
11 changes: 6 additions & 5 deletions application/config/config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php if (! defined('BASEPATH')) { exit('No direct script access allowed');
}

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -265,9 +266,9 @@
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;

/*
Expand Down Expand Up @@ -359,4 +360,4 @@


/* End of file config.php */
/* Location: ./application/config/config.php */
/* Location: ./application/config/config.php */
2 changes: 1 addition & 1 deletion application/helpers/admin_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
function create_language_select($languages, $locale, $url, $pjax = FALSE) {

if (count($languages) > 1) {
if (count($languages) > 1 && \MY_Controller::isPremiumCMS()) {
$html = "<div class='dropdown d-i_b'>";
foreach ($languages as $language) {
if ($language['identif'] == $locale) {
Expand Down
55 changes: 53 additions & 2 deletions application/helpers/category_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function category_list($exclude_cats = '') {
if (!in_array($row['id'], $exclude_cats)) {
$row['fetch_pages'] = unserialize($row['fetch_pages']);

$total_pages = $ci->core->_get_category_pages($row, 0, 0, TRUE);
$total_pages = _get_category_pages($row, 0, 0, TRUE);
$result[] = '<a href="' . site_url($row['path_url']) . '">' . $row['name'] . ' (' . $total_pages . ')</a>';
}
}
Expand Down Expand Up @@ -77,7 +77,7 @@ function sub_category_list($category_id = 0) {
foreach ($categories as $row) {
$row['fetch_pages'] = unserialize($row['fetch_pages']);

$total_pages = $ci->core->_get_category_pages($row, 0, 0, TRUE);
$total_pages = _get_category_pages($row, 0, 0, TRUE);
$result[] = '<a href="' . site_url($row['path_url']) . '">' . $row['name'] . ' (' . $total_pages . ')</a>';
}

Expand Down Expand Up @@ -111,4 +111,55 @@ function get_category_name($id) {

}

if (!function_exists('_get_category_pages')) {

/**
* Select or count pages in category
* @param array $category
* @param int $row_count
* @param int $offset
* @param bool|FALSE $count
* @return array|string
*/
function _get_category_pages(array $category = [], $row_count = 0, $offset = 0, $count = FALSE) {
$ci = & get_instance();

$ci->db->where('post_status', 'publish');
$ci->db->where('publish_date <=', time());
$ci->db->where('lang', $ci->config->item('cur_lang'));
if (count($category['fetch_pages']) > 0) {
$category['fetch_pages'][] = $category['id'];
$ci->db->where_in('category', $category['fetch_pages']);
} else {
$ci->db->where('category', $category['id']);
}
$ci->db->select('content.*');
$ci->db->select('IF(route.parent_url <> \'\', concat(route.parent_url, \'/\', route.url), route.url) as full_url', FALSE);
$ci->db->order_by($category['order_by'], $category['sort_order']);
$ci->db->join('route', 'route.id=content.route_id');

if ($count === FALSE) {
if ($row_count > 0) {
$query = $ci->db->get('content', (int) $row_count, (int) $offset);
} else {
$query = $ci->db->get('content');
}
} else {
$ci->db->from('content');
return $ci->db->count_all_results();
}
$pages = $query->result_array();

if (count($pages) > 0 AND is_array($pages)) {
$n = 0;
foreach ($pages as $p) {
$pages[$n] = $ci->cfcm->connect_fields($p, 'page');
$n++;
}
}
return $pages;
}

}

/* End of file category_helper.php */
9 changes: 6 additions & 3 deletions application/helpers/page_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ function get_page($id) {
$ci = &get_instance();

$ci->db->limit(1);
$ci->db->select('CONCAT_WS("", content.cat_url, content.url) as full_url, category, content.id, content.title, full_text, prev_text, publish_date, showed, comments_count, author', FALSE);
$ci->db->select('IF(route.parent_url <> \'\', concat(route.parent_url, \'/\', route.url), route.url) as full_url, category, content.id, content.title, full_text, prev_text, publish_date, showed, comments_count, author', FALSE);
$ci->db->join('route', 'route.id=content.route_id');

if ($lang_identif == $ci->uri->segment(1)) {
$ci->db->where('lang_alias', $id);
$ci->db->where('lang', $lang_id);
} else {
$ci->db->where('id', $id);
$ci->db->where('content.id', $id);
}
$query = $ci->db->get('content');

Expand Down Expand Up @@ -65,7 +66,9 @@ function category_pages($categoryId, $limit = 0) {
}

$ci->db->select('content.*');
$ci->db->select('CONCAT_WS("", content.cat_url, content.url) as full_url', FALSE);
$ci->db->select('IF(route.parent_url <> \'\', concat(route.parent_url, \'/\', route.url), route.url) as full_url', FALSE);
$ci->db->join('route', 'route.id=content.route_id');

$ci->db->order_by($category['order_by'], $category['sort_order']);

if ($limit > 0) {
Expand Down
38 changes: 1 addition & 37 deletions application/libraries/BaseAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,7 @@ public function __construct() {

$this->load->library('lib_admin');
$this->lib_admin->init_settings();
$this->autoloadModules();
}

/**
* Run ImageCMS modules autoload method for admin-page
* @access private
* @copyright ImageCMS (c) 2013, Kaero <[email protected]>
*/
private function autoloadModules() {
if (!self::$adminAutoLoaded) {
/** Search module with autoload */
$query = $this->db
->select('name')
->where('autoload', 1)
->get('components');

if ($query) {
$moduleName = null;
/** Run all Admin autoload method */
$modules = $query->result_array();
$modules = array_column($modules, 'name');
array_unshift($modules, 'core');
$modules = array_unique($modules);

foreach ($modules as $moduleName) {
Modules::load_file($moduleName, APPPATH . 'modules' . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR);
$moduleName = ucfirst($moduleName);
if (class_exists($moduleName)) {
if (method_exists($moduleName, 'adminAutoload')) {
$moduleName::adminAutoload();
}
}
}
}

self::$adminAutoLoaded = true;
}
\CMSFactory\AdminLoader::getInstance()->adminAutoload();
}

}
53 changes: 34 additions & 19 deletions application/libraries/Permitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,18 +631,22 @@ public function translateRole($id, $lang) {
* @return void
*/
public function roleEdit($roleId) {
$sqlModel = 'SELECT SRR.id, SRR.name, SRR.importance, SRRI.alt_name, SRRI.description
FROM shop_rbac_roles SRR
LEFT JOIN shop_rbac_roles_i18n SRRI ON SRRI.id = SRR.id AND SRRI.locale = "' . MY_Controller::getCurrentLocale() . '" WHERE SRR.id = "' . $roleId . '" ORDER BY SRR.name ASC';

$queryModel = $this->db->query($sqlModel);
$queryModel->row();
$locale = MY_Controller::getCurrentLocale();

$queryModel = $this->db->select('shop_rbac_roles.id, shop_rbac_roles.name , shop_rbac_roles.importance, shop_rbac_roles_i18n.alt_name, shop_rbac_roles_i18n.description ')
->from('shop_rbac_roles')
->join('shop_rbac_roles_i18n', 'shop_rbac_roles_i18n.id = shop_rbac_roles.id', 'left')
->where('shop_rbac_roles.id', $roleId)
->where('shop_rbac_roles_i18n.locale', $locale)
->get();

if ($queryModel === null) {
$this->error404(lang('Role not found'));
}

if ($this->input->post()) {

$this->form_validation->set_rules('alt_name', lang('Title'), 'required');

if ($this->form_validation->run($this) == FALSE) {
Expand All @@ -662,12 +666,12 @@ public function roleEdit($roleId) {
//$this->db->where('id',$roleId)->update('shop_rbac_roles',array('name', $this->input->post('Name')));

$privileges = $this->input->post('Privileges') ?: [];

if (MY_Controller::isProCMS()) {
$privilegesPOSTIds = $this->filterShopPrivileges();
} else {
//
// if (MY_Controller::isProCMS()) {
// $privilegesPOSTIds = $this->filterShopPrivileges();
// } else {
$privilegesPOSTIds = $privileges;
}
// }

$idForDelete = implode(', ', $privilegesPOSTIds);

Expand All @@ -691,23 +695,29 @@ public function roleEdit($roleId) {
}
}
} else {
//preparing array of privileges ids which belong to currenc role
$sql = 'SELECT `privilege_id`
FROM `shop_rbac_roles_privileges` WHERE `role_id` = ' . $roleId;
$queryPrivilegeR = $this->db->query($sql)->result_array();

$queryPrivilegeR = $this->db->select('privilege_id')
->from('shop_rbac_roles_privileges')
->where('role_id', $roleId)
->get()->result_array();

$role_privileges = [];
foreach ($queryPrivilegeR as $item) {
$role_privileges[] = (int) $item['privilege_id'];
}

//preparing array of controller types
$types = $this->db->query('SELECT DISTINCT `type` FROM ' . self::$rbac_group_table)->result_array();
$types = $this->db->select('type')
->distinct()
->from(self::$rbac_group_table)
->get()->result_array();

$controller_types = [];

foreach ($types as $item) {
$controller_types[] = $item['type'];
}

//preparing groups

$locale = MY_Controller::defaultLocale();
$res = $this->db->select('id')->get_where(self::$rbac_group_table . '_i18n', ['locale' => $locale])->result_array();
if (count($res) < 1) {
Expand All @@ -716,8 +726,13 @@ public function roleEdit($roleId) {

$result = self::makeRolesArray($controller_types, $locale);

$sqlLangSel = 'SELECT lang_sel FROM settings';
$Lang = $this->db->query($sqlLangSel)->row();
$Lang = $this->db->select('lang_sel')
->from('settings')
->get()
->row();

// dd($result);

$this->template->add_array(
[
'model' => $queryModel->row(),
Expand Down
Loading

0 comments on commit deed4d6

Please sign in to comment.