Skip to content

Commit

Permalink
pre release
Browse files Browse the repository at this point in the history
  • Loading branch information
gulaandrij committed May 10, 2016
1 parent a150a5c commit f82eb68
Show file tree
Hide file tree
Showing 368 changed files with 6,915 additions and 26,022 deletions.
20 changes: 12 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/captcha
/uploads_backup
/uploads/*
/error.log
/uploads_backup/*
/uploads_backup
/gitpush
/application/backups
/application/config/database.php
Expand Down Expand Up @@ -41,11 +41,10 @@ Thumbs.db
/uploadsNewlevel/.tmb/
/uploads_cur
/templates/builds/
/templates/*/node_modules/
/templates/*/package.json
/templates/*/Gruntfile.js
/templates/**/node_modules/
/templates/**/.sass-cache/
/templates/**/bower_components/
/application/modules/novaposhta/
/application/modules/sendsms/
/application/modules/parce_opencart/
/application/modules/parceya/
/application/modules/yandex_maps/
Expand All @@ -56,10 +55,15 @@ Thumbs.db
!/application/third_party/php_error.php
!/application/third_party/hooks.php
!/application/third_party/MX
!/application/third_party/tinymce/
!/application/third_party/filemanager
/application/composer.lock
composer.lock
/uploads_backup_*
/assets
.vagrant
Vagrantfile
/application/nbproject/private/
/application/modules/parsingxml/okk.php
/templates/**/_css/final.css
/templates/**/_css/final.min.css
/templates/**/_js/final.min.js
/templates/**/_js/vendor.min.js

2 changes: 1 addition & 1 deletion .htaccess
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ExpiresByType text/html "access 1 year"
RewriteRule ^(.*)\.tpl$ [R=404]
RewriteRule ^(.*)backups(.*)\.zip$ [R=404]

RewriteCond $1 !^(index\.php|assets/.*|uploads/.*|application/third_party/(tinymce|filemanager).*|favicon\.ico|favicon\.png|captcha/.*|application/.*/templates|application/.*/assets/js|application/.*/assets/css|application/.*/assets/images|CHANGELOG.xml|templates|js)
RewriteCond $1 !^(index\.php|assets/.*|uploads/.*|application/third_party/(tinymce|filemanager).*|favicon\.ico|favicon\.png|captcha/.*|application/.*/templates|application/.*/assets/js|application/.*/assets/css|application/.*/assets/images|CHANGELOG.xml|templates|js|application/modules/update/UpdateService.wsdl)
RewriteRule ^(.*)$ /index.php/$1 [L]

####################################
Expand Down
7 changes: 2 additions & 5 deletions application/config/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
| module groups.
|
*/
$config['modules_locations'] = [
//'modules_shop',
'modules'
];
$config['modules_locations'] = ['modules'];


/*
Expand All @@ -64,7 +61,7 @@
|
*/
$config['tpl_compile_path'] = PUBPATH . 'system/cache/templates_c/';
$config['tpl_force_compile'] = FALSE;
$config['tpl_force_compile'] = TRUE;
$config['tpl_compiled_ttl'] = 84600;
$config['tpl_compress_output'] = TRUE;
$config['tpl_use_filemtime'] = TRUE;
Expand Down
59 changes: 57 additions & 2 deletions application/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
parameters:
# ...
memcached.host: localhost
memcached.port: 11211

cache.directory: system/cache/
cache.folder: doctrine

cache.provider.priority:
- cache.provider.memcache
- cache.provider.filesystem
- cache.provider.memcached
- cache.provider.apc

services:
dispatcher:
class: Symfony\Component\EventDispatcher\EventDispatcher
class: Symfony\Component\EventDispatcher\EventDispatcher

cache:
class: Doctrine\Common\Cache\Cache
factory: ["@cache.factory", createCacheProvider]


# Do not use this services as they are private.

# Doctrine Cache Providers

cache.provider.apc:
class: Doctrine\Common\Cache\ApcCache

cache.provider.memcache:
class: Doctrine\Common\Cache\MemcacheCache
calls:
- [setMemcache, ['@memcache']]

cache.provider.memcached:
class: Doctrine\Common\Cache\MemcachedCache
calls:
- [setMemcached, ['@memcached']]

cache.provider.filesystem:
class: Doctrine\Common\Cache\FilesystemCache
arguments: [%cache.directory%%cache.folder%]


# Dependencies
memcache:
class: Memcache
calls:
- [connect, ['%memcached.host%', '%memcached.port%']]

memcached:
class: Memcached
calls:
- [addServer, ['%memcached.host%', '%memcached.port%']]

# Factory
cache.factory:
public: false
class: CMSFactory\Services\Cache\CacheFactory
calls:
- [setContainer, ['@service_container']]
25 changes: 24 additions & 1 deletion application/core/MY_Controller.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

use CMSFactory\DependencyInjection\DependencyInjectionProvider;
use Doctrine\Common\Cache\Cache;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;

(defined('BASEPATH')) OR exit('No direct script access allowed');

Expand Down Expand Up @@ -162,7 +167,7 @@ public static function getCurrentLocale() {
*/
public static function getAdminInterfaceLocale() {

$locale = CI::$APP->config->item('language') ? CI::$APP->config->item('language') : 'ru_RU';
$locale = CI::$APP->config->item('language') ?: 'ru_RU';
return array_shift(explode('_', $locale));
}

Expand Down Expand Up @@ -289,10 +294,28 @@ private static function checkCMSVersion($version) {
return strstr(strtolower(IMAGECMS_NUMBER), $version) ? true : false;
}

/**
* @return ContainerBuilder
*/
public function getContainer() {

return DependencyInjectionProvider::getContainer();
}

/**
* @return Cache
* @throws ServiceNotFoundException
* @throws ServiceCircularReferenceException
* @throws InvalidArgumentException
* @throws Exception
*/
public function getCache() {

return $this->getContainer()->get('cache');
}

public function get($id) {
return $this->getContainer()->get($id);
}

}
Expand Down
20 changes: 10 additions & 10 deletions application/helpers/admin_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ function create_language_select($languages, $locale, $url, $pjax = FALSE) {
$locale = $language['identif'];
$html .= "<input type='hidden' name='Locale' value='" . $language['identif'] . "'/>";
$html .= "<span class='caret'></span>";
$html .= "</a>";
$html .= '</a>';
}
}
$html .= "<ul class='dropdown-menu pull-right'>";
foreach ($languages as $language) {
if ($language['identif'] != $locale) {
$html .= "<li>";
$html .= "<a href='" . $url . "/" . $language['identif'] . "' class='" . ($pjax ? 'pjax' : '') . "'>" . $language['lang_name'] . "</a>";
$html .= "</li>";
$html .= '<li>';
$html .= "<a href='" . $url . '/' . $language['identif'] . "' class='" . ($pjax ? 'pjax' : '') . "'>" . $language['lang_name'] . '</a>';
$html .= '</li>';
}
}
if (count($languages) > 1) {
$html .= "</ul></div>";
$html .= '</ul></div>';
}
}
return $html ?: '';
Expand Down Expand Up @@ -85,7 +85,7 @@ function build_cats_tree($cats, $selected_cats = []) {

if (is_array($cats)) {
foreach ($cats as $cat) {
echo "<option";
echo '<option';
if (is_array($selected_cats)) {
foreach ($selected_cats as $k) {
if ($k == $cat['id']) {
Expand All @@ -97,7 +97,7 @@ function build_cats_tree($cats, $selected_cats = []) {
for ($i = 0; $i < $cat['level']; $i++) {
echo '-';
}
echo $cat['name'] . "</option>";
echo $cat['name'] . '</option>';
if ($cat['subtree']) {
build_cats_tree($cat['subtree'], $selected_cats);
}
Expand All @@ -120,12 +120,12 @@ function build_cats_tree_ul_li($cats, $item_id = NULL, $level = 0) {
}

foreach ($cats as $cat) {
echo "<li>";
echo '<li>';
if ($cat['id'] == $item_id) {
echo "<b><a class='category_item' data-title='" . $cat['name'] . "' data-id='" . $cat['id'] . "' href='#'>" . $subst . $cat['name'] . "</a></b>";
echo "<b><a class='category_item' data-title='" . $cat['name'] . "' data-id='" . $cat['id'] . "' href='#'>" . $subst . $cat['name'] . '</a></b>';
} else {

echo "<a class='category_item' data-title='" . $cat['name'] . "' data-id='" . $cat['id'] . "' href='#'>" . $subst . $cat['name'] . "</a>";
echo "<a class='category_item' data-title='" . $cat['name'] . "' data-id='" . $cat['id'] . "' href='#'>" . $subst . $cat['name'] . '</a>';
}
if ($cat['subtree']) {
build_cats_tree_ul_li($cat['subtree'], $item_id, ++$level);
Expand Down
6 changes: 5 additions & 1 deletion application/helpers/array_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ function ($a, $b) use ($key) {
function pluralize($count = 0, array $words = []) {

if (empty($words)) {
$words = [' ', ' ', ' '];
$words = [
' ',
' ',
' ',
];
}

$numeric = (int) abs($count);
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/category_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function get_category_name($id) {
$c = $ci->lib_category->get_category($id);

if ($c['name'] == '') {
$c['name'] = lang("No category");
$c['name'] = lang('No category');
}

return $c['name'];
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/cli_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
function _readLine($message = '') {
file_put_contents('php://stdout', $message);
$handle = fopen("php://stdin", "r");
$handle = fopen('php://stdin', 'r');
return trim(fgets($handle), PHP_EOL);
}

Expand All @@ -33,8 +33,8 @@ function _readLine($message = '') {
function _confirm($question, $defaultApprove = true) {
$question = rtrim($question);

file_put_contents('php://stdout', sprintf("%s? [%s]: ", $question, $defaultApprove ? 'Y/n' : 'y/N'));
$handle = fopen("php://stdin", "r");
file_put_contents('php://stdout', sprintf('%s? [%s]: ', $question, $defaultApprove ? 'Y/n' : 'y/N'));
$handle = fopen('php://stdin', 'r');
$input = trim(fgets($handle), PHP_EOL);

if (empty($input) && $defaultApprove) {
Expand Down
42 changes: 33 additions & 9 deletions application/helpers/dx_captcha_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path =

function color($type) {
switch ($type) {
case "bg":
case 'bg':
//$color = rand(224,255);
$color = 255;
break;
case "text":
case 'text':
$color = rand(0, 127);
break;
case "grid":
case 'grid':
$color = rand(200, 224);
break;
default:
Expand All @@ -185,7 +185,19 @@ function color($type) {

}

$defaults = ['word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_size' => '', 'font_path' => '', 'show_grid' => true, 'skew' => true, 'expiration' => 7200, 'alt' => 'captcha'];
$defaults = [
'word' => '',
'img_path' => '',
'img_url' => '',
'img_width' => '150',
'img_height' => '30',
'font_size' => '',
'font_path' => '',
'show_grid' => true,
'skew' => true,
'expiration' => 7200,
'alt' => 'captcha',
];

foreach ($defaults as $key => $val) {
if (!is_array($data)) {
Expand Down Expand Up @@ -236,14 +248,14 @@ function color($type) {
// Remove old images
// -----------------------------------

list($usec, $sec) = explode(" ", microtime());
list($usec, $sec) = explode(' ', microtime());
$now = ((float) $usec + (float) $sec);

$current_dir = @opendir($img_path);

while ($filename = @readdir($current_dir)) {
if ($filename != "." and $filename != ".." and $filename != "index.html") {
$name = str_replace(".png", "", $filename);
if ($filename != '.' and $filename != '..' and $filename != 'index.html') {
$name = str_replace('.png', '', $filename);

if (($name + $expiration) < $now) {
@unlink($img_path . $filename);
Expand Down Expand Up @@ -339,7 +351,15 @@ function color($type) {
$x += ($font_size * 2);
} else {
$letter = substr($word, $i, 1);
$less_rotate = ['c', 'N', 'U', 'Z', '7', '6', '9']; //letters that we don't want rotated too much...
$less_rotate = [
'c',
'N',
'U',
'Z',
'7',
'6',
'9',
]; //letters that we don't want rotated too much...

$angle = $skew == TRUE ? (in_array($letter, $less_rotate)) ? rand(-5, 5) : rand(-15, 15) : 0;
$y = $img_height / 2 + ($font_size >> 1) + ($skew == TRUE ? rand(-9, 9) : 0);
Expand Down Expand Up @@ -367,7 +387,11 @@ function color($type) {

imagedestroy($im);

return ['word' => $word, 'time' => $now, 'image' => $img];
return [
'word' => $word,
'time' => $now,
'image' => $img,
];
}

}
Loading

0 comments on commit f82eb68

Please sign in to comment.