Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gulaandrij committed Aug 21, 2015
1 parent ee4455c commit 15cf373
Show file tree
Hide file tree
Showing 59 changed files with 2,137 additions and 647 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Open source php CMS based on CodeIgniter

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d1f4928d-7cce-4aad-937f-2aa5d91ebf14/mini.png)](https://insight.sensiolabs.com/projects/d1f4928d-7cce-4aad-937f-2aa5d91ebf14)
[![Code Climate](https://codeclimate.com/github/imagecms/ImageCMS/badges/gpa.svg)](https://codeclimate.com/github/imagecms/ImageCMS)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/imagecms/ImageCMS/badges/quality-score.png?b=development)](https://scrutinizer-ci.com/g/imagecms/ImageCMS/?branch=development)
[![Build Status](https://scrutinizer-ci.com/g/imagecms/ImageCMS/badges/build.png?b=development)](https://scrutinizer-ci.com/g/imagecms/ImageCMS/build-status/development)

##Installation
###Database
Expand Down
4 changes: 2 additions & 2 deletions application/core/MY_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class MY_Controller extends MX_Controller {

public static $currentLanguage = null;

public static $detect_load_admin = array();
public static $detect_load_admin = [];

public static $detect_load = array();
public static $detect_load = [];

public function __construct() {
parent::__construct();
Expand Down
8 changes: 4 additions & 4 deletions application/core/MY_Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function xss_clean($string) {
*/
public function _sanitize_globals() {
// It would be "wrong" to unset any of these GLOBALS.
$protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
$protected = ['_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
'_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
'system_folder', 'application_folder', 'BM', 'EXT',
'CFG', 'URI', 'RTR', 'OUT', 'IN');
'CFG', 'URI', 'RTR', 'OUT', 'IN'];

// Unset globals for securiy.
// This is effectively the same as register_globals = off
foreach (array($_GET, $_POST, $_COOKIE) as $global) {
foreach ([$_GET, $_POST, $_COOKIE] as $global) {
if (!is_array($global)) {
if (!in_array($global, $protected)) {
global $$global;
Expand All @@ -56,7 +56,7 @@ public function _sanitize_globals() {

// Is $_GET data allowed? If not we'll set the $_GET to an empty array
if ($this->_allow_get_array == FALSE) {
$_GET = array();
$_GET = [];
} else {
if (is_array($_GET) AND count($_GET) > 0) {
foreach ($_GET as $key => $val) {
Expand Down
11 changes: 7 additions & 4 deletions application/core/MY_Lang.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

if (!defined('BASEPATH'))
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}

/**
* MY_Lang
Expand All @@ -15,7 +16,9 @@
class MY_Lang extends MX_Lang {

public $gettext_language;

public $gettext_domain;

static $LANG;

/**
Expand All @@ -38,11 +41,11 @@ private function getFrontLangCode($language) {

foreach ($languages as $lang) {
if (in_array($language, $lang)) {
return array($lang['identif'], $lang['locale']);
return [$lang['identif'], $lang['locale']];
}
}

return array('ru', 'ru_RU');
return ['ru', 'ru_RU'];
}

private function _init() {
Expand Down Expand Up @@ -145,4 +148,4 @@ public static function setLang($lang) {
self::$LANG = $lang;
}

}
}
10 changes: 6 additions & 4 deletions application/core/MY_Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ class MY_Loader extends MX_Loader {

public function database($params = '', $return = FALSE, $active_record = NULL) {

if (class_exists('CI_DB', FALSE) AND $return == FALSE AND $active_record == NULL AND isset(CI::$APP->db) AND is_object(CI::$APP->db))
if (class_exists('CI_DB', FALSE) AND $return == FALSE AND $active_record == NULL AND isset(CI::$APP->db) AND is_object(CI::$APP->db)) {
return;
}

require_once APPPATH . '/core/database/DB' . EXT; // this is the only line that was changed - this file is overloaded
include_once APPPATH . '/core/database/DB' . EXT; // this is the only line that was changed - this file is overloaded

if ($return === TRUE)
if ($return === TRUE) {
return DB($params, $active_record);
}

CI::$APP->db = DB($params, $active_record);

return CI::$APP->db;
}

}
}
3 changes: 2 additions & 1 deletion application/core/MY_Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/* load the MX_Router class */
require APPPATH."third_party/MX/Router.php";

class MY_Router extends MX_Router {}
class MY_Router extends MX_Router {
}
15 changes: 9 additions & 6 deletions application/core/MY_URI.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php

if (!defined('BASEPATH'))
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}

class MY_URI extends CI_URI {

private $GET_params_arr = array();
private $GET_params_arr = [];

public function __construct() {
parent::__construct();
Expand All @@ -21,7 +22,8 @@ public function getAllParams() {
}

// Create from array string like: ?var1=value&var2=value
public function array_to_uri($arr = array()) {

public function array_to_uri($arr = []) {
$n = 0;
$str = '?';
$cnt = count($arr);
Expand All @@ -30,8 +32,9 @@ public function array_to_uri($arr = array()) {
foreach ($arr as $k => $v) {
$str .= $k . '=' . $v;
$n++;
if ($n < $cnt)
if ($n < $cnt) {
$str .= '&';
}
}
}

Expand All @@ -41,7 +44,7 @@ public function array_to_uri($arr = array()) {
/**
* Enable Russian charaters in url
*/
function _filter_uri($str) {
public function _filter_uri($str) {
if ($str != '' AND $this->config->item('permitted_uri_chars') != '') {
if (!preg_match("|^[" . ($this->config->item('permitted_uri_chars')) . "]+$|iu", rawurlencode($str))) {
exit('The URI you submitted has disallowed characters.');
Expand All @@ -53,4 +56,4 @@ function _filter_uri($str) {

}

/* End of file MY_URI.php */
/* End of file MY_URI.php */
13 changes: 6 additions & 7 deletions application/helpers/array_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

if (!function_exists('my_print_r')) {

function my_print_r($array = array()) {
function my_print_r($array = []) {
echo "<pre>";
print_r($array);
echo "</pre>";
Expand Down Expand Up @@ -40,7 +40,7 @@ function is_true_array($array) {
function result_column($result) {

if (count($result) == 0) {
return array();
return [];
}

$key = key($result[0]);
Expand Down Expand Up @@ -97,15 +97,14 @@ function array_to_file($file, $array) {

if (!function_exists('user_function_sort')) {

function user_function_sort($arr) {
function user_function_sort($arr, $key = 'value') {
usort(
$arr,
function($a, $b) {
return strnatcmp($a['value'], $b['value']);
function($a, $b) use ($key) {
return strnatcmp($a[$key], $b[$key]);
}
);
return $arr;
}

}
?>
}
Loading

0 comments on commit 15cf373

Please sign in to comment.