Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amelekesov/c73888efbbf9b543f70a to your computer and use it in GitHub Desktop.
Save amelekesov/c73888efbbf9b543f70a to your computer and use it in GitHub Desktop.

Revisions

  1. amelekesov created this gist Sep 28, 2015.
    13 changes: 13 additions & 0 deletions _tools-unit_tests-data-language_values.xml.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    diff --git a/_tools/unit_tests/data/language_values.xml b/_tools/unit_tests/data/language_values.xml
    index 17cb62f..ae00295 100644
    --- a/_tools/unit_tests/data/language_values.xml
    +++ b/_tools/unit_tests/data/language_values.xml
    @@ -16137,7 +16137,7 @@
    />
    <cscart_language_values
    lang_code = "en"
    - name = "warning_https_is_disabled"
    + name = "warning_https_disabled"
    value = "The secure connection check has failed. Please check HTTPS settings in the &quot;config.php&quot; file and make sure that SSL certificate is installed on your server."
    />
    <cscart_language_values
    28 changes: 28 additions & 0 deletions app-Tygh-Api.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    diff --git a/app/Tygh/Api.php b/app/Tygh/Api.php
    index 9457cdc..9ba6b97 100644
    --- a/app/Tygh/Api.php
    +++ b/app/Tygh/Api.php
    @@ -500,14 +500,18 @@ class Api
    */
    protected function getObjectByEntity($entity_properties)
    {
    - $version_namespace = '';
    - if ($this->called_version != self::CURRENT_VERSION) {
    - $version_namespace = 'v' . str_replace('.', '', $this->called_version) . '\\';
    - }
    - $class_name = "\\Tygh\\Api\\Entities\\" . $version_namespace . fn_camelize($entity_properties['name']);
    + $version = ($this->called_version == self::CURRENT_VERSION ? '' : 'v' . str_replace('.', '', $this->called_version) . '\\');
    + $class_name = "\\Tygh\\Api\\Entities\\" . $version . fn_camelize($entity_properties['name']);

    $entity = class_exists($class_name) ? new $class_name($this->auth, $this->area) : null;

    + if (!$entity) {
    + $class_name = "\\Tygh\\Api\\Entities\\" . fn_camelize($entity_properties['name']);
    + if (class_exists($class_name)) {
    + $entity = new $class_name($this->auth, $this->area);
    + }
    + }
    +
    return $entity;
    }

    191 changes: 191 additions & 0 deletions app-Tygh-BlockManager-RenderManager.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,191 @@
    diff --git a/app/Tygh/BlockManager/RenderManager.php b/app/Tygh/BlockManager/RenderManager.php
    index e94463f..6f902b1 100644
    --- a/app/Tygh/BlockManager/RenderManager.php
    +++ b/app/Tygh/BlockManager/RenderManager.php
    @@ -178,7 +178,7 @@ class RenderManager
    $grids = $this->sortGrids($grids);

    $this->_parent_grid = array();
    - $content = $this->renderGrids($grids);
    + $content = $this->_renderGrids($grids);

    $this->_view->assign('content', $content);

    @@ -197,93 +197,81 @@ class RenderManager

    }

    - protected function renderGrids($grids)
    + private function _renderGrids($grids)
    {
    - $grids_content = array();
    - foreach ($grids as $index => $grid) {
    - $grids_content[$index] = trim($this->_renderGrid($grid));
    - }
    + $_grids_content = array();

    - $next_grid_overrides = array(
    + $extra = array(
    'width' => 0,
    'alpha' => 0,
    + 'omega' => 0,
    );
    - foreach ($grids as $index => &$grid) {
    - if (!empty($grid['fluid_width'])) {
    - $grid['fluid_width'] += $next_grid_overrides['width'];
    - }
    - if (!empty($grid['width'])) {
    - $grid['width'] += $next_grid_overrides['width'];
    - }
    - if (!empty($next_grid_overrides['alpha'])) {
    - $grid['alpha'] = $next_grid_overrides['alpha'];
    +
    + foreach ($grids as $index => $grid) {
    + if (!empty($extra['width'])) {
    + if (!empty($grid['fluid_width'])) {
    + $grid['fluid_width'] += $extra['width'];
    + $grids[$index]['fluid_width'] = $grid['fluid_width'];
    + }
    + if (!empty($grid['width'])) {
    + $grid['width'] += $extra['width'];
    + $grids[$index]['width'] = $grid['width'];
    + }
    +
    + if (!empty($extra['alpha'])) {
    + $grid['alpha'] = $extra['alpha'];
    + }
    +
    + if (!empty($extra['omega'])) {
    + $grid['omega'] = $extra['omega'];
    + }
    }

    - $next_grid_overrides = array(
    + $_content = trim($this->_renderGrid($grid));
    +
    + $extra = array(
    'width' => 0,
    'alpha' => 0,
    + 'omega' => 0,
    );

    - // Found empty first-in-row (alpha only) or in-the-middle (non-alpha and non-omega) grid.
    - // Its width will be added to the next grid and its alpha status will be assigned to the next grid.
    - if (empty($grids_content[$index])
    - && (($grid['alpha'] && !$grid['omega']) || (!$grid['alpha'] && !$grid['omega']))
    - ) {
    - $next_grid_overrides['width'] = empty($grid['fluid_width']) ? $grid['width'] : $grid['fluid_width'];
    - $next_grid_overrides['alpha'] = $grid['alpha'];
    - }
    - }
    + if (empty($_content)) {
    + if ((!empty($grid['alpha']) && empty($grid['omega'])) || (empty($grid['alpha']) && empty($grid['omega']))) {
    + $extra['width'] = empty($grid['fluid_width']) ? $grid['width'] : $grid['fluid_width'];

    - // Reverse grids list and do the same for omega-only grids.
    - $grids = array_reverse($grids, true);
    -
    - $prev_grid_overrides = array(
    - 'width' => 0,
    - 'omega' => 0
    - );
    - foreach ($grids as $index => &$grid) {
    - if (!empty($grid['fluid_width'])) {
    - $grid['fluid_width'] += $prev_grid_overrides['width'];
    - }
    - if (!empty($grid['width'])) {
    - $grid['width'] += $prev_grid_overrides['width'];
    - }
    - if (!empty($prev_grid_overrides['omega'])) {
    - $grid['omega'] = $prev_grid_overrides['omega'];
    - }
    + if (!empty($grid['alpha'])) {
    + $extra['alpha'] = $grid['alpha'];
    + }

    - $prev_grid_overrides = array(
    - 'width' => 0,
    - 'omega' => 0
    - );
    + } elseif (empty($grid['alpha']) && !empty($grid['omega'])) {
    + $extra['width'] = empty($grid['fluid_width']) ? $grid['width'] : $grid['fluid_width'];
    + if (!empty($grids[$prev_index]['fluid_width'])) {
    + $grids[$prev_index]['fluid_width'] += $extra['width'];
    + }
    + if (!empty($grids[$prev_index]['width'])) {
    + $grids[$prev_index]['width'] += $extra['width'];
    + }

    - // Found empty last-in-row (omega only) grid.
    - // Its width will be added to previous grid and its omega status will be assigned to previous grid.
    - if (empty($grids_content[$index]) && ($grid['omega'] && !$grid['alpha'])) {
    - $prev_grid_overrides['width'] = empty($grid['fluid_width']) ? $grid['width'] : $grid['fluid_width'];
    - $prev_grid_overrides['omega'] = $grid['omega'];
    - }
    - }
    + $grids[$prev_index]['omega'] = $grid['omega'];

    - // Return the normal order of grids list
    - $grids = array_reverse($grids, true);
    + $_grids_content[$prev_index] = $this->_renderGrid($grids[$prev_index]);
    + }

    - foreach ($grids as $index => $grid) {
    - $this->_view->assign('content', $grids_content[$index]);
    - $this->_view->assign('parent_grid', $this->_parent_grid);
    - $this->_view->assign('grid', $grid);
    + } else {
    + $_grids_content[$index] = $_content;
    + }

    - $grids_content[$index] = $this->_view->fetch($this->_theme . 'grid.tpl');
    + $prev_index = $index;
    }

    - return implode('', $grids_content);
    + $content = implode('', $_grids_content);
    +
    + return $content;
    }

    /**
    * Renders grid
    - *
    - * @param array $grid Grid data to be rendered
    - *
    + * @param int $grid Grid data to be rendered
    * @return string HTML code of rendered grid
    */
    private function _renderGrid($grid)
    @@ -298,15 +286,19 @@ class RenderManager
    $parent_grid = $this->_parent_grid;
    $this->_parent_grid = $grid;

    - $content = $this->renderGrids($grid['children']);
    + $content = $this->_renderGrids($grid['children']);

    $this->_parent_grid = $parent_grid;
    } else {
    - $content = $this->renderBlocks($grid);
    + $content .= $this->renderBlocks($grid);
    }
    }

    - return $content;
    + $this->_view->assign('content', $content);
    + $this->_view->assign('parent_grid', $this->_parent_grid);
    + $this->_view->assign('grid', $grid);
    +
    + return $this->_view->fetch($this->_theme . 'grid.tpl');
    }

    /**
    @@ -884,7 +876,7 @@ class RenderManager
    )
    ) {
    if (is_callable($when_found)) {
    - call_user_func($when_found, $param_name, $value);
    + call_user_func($when_found, $param_name, $value);
    } else {
    return $when_found;
    }
    72 changes: 72 additions & 0 deletions app-Tygh-Bootstrap.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,72 @@
    diff --git a/app/Tygh/Bootstrap.php b/app/Tygh/Bootstrap.php
    index 10cfa22..7d84c94 100644
    --- a/app/Tygh/Bootstrap.php
    +++ b/app/Tygh/Bootstrap.php
    @@ -52,7 +52,7 @@ class Bootstrap
    ini_set('magic_quotes_sybase', 0);
    ini_set('pcre.backtrack_limit', '1000000'); // this value php versions < 5.3.7 10 times less, so set it as in newer versions.
    ini_set('arg_separator.output', '&');
    - ini_set('include_path', $dir_root . '/app/lib/pear/' . PATH_SEPARATOR . ini_get('include_path'));
    + ini_set('include_path', $dir_root . '/app/lib/pear/' . ini_get('include_path'));

    $session_id = session_id();
    if (empty($session_id)) {
    @@ -65,27 +65,24 @@ class Bootstrap
    }

    /**
    - * Detects HTTPS mode.
    - *
    - * @param array $server $_SERVER superglobal array
    - *
    - * @return boolean Whether current request is SSL-secured.
    + * Detects HTTPS mode
    + * @param array $server SERVER superglobal array
    */
    public static function detectHTTPS($server)
    {
    - if (
    - (isset($server['HTTPS']) && (strcasecmp($server['HTTPS'], 'on') === 0 || $server['HTTPS'] == '1')) ||
    - (isset($server['HTTP_X_FORWARDED_SERVER']) && (strcasecmp($server['HTTP_X_FORWARDED_SERVER'], 'secure') === 0 || $server['HTTP_X_FORWARDED_SERVER'] == 'ssl')) ||
    - (isset($server['SCRIPT_URI']) && (strpos($server['SCRIPT_URI'], 'https') === 0)) ||
    - (isset($server['HTTP_HOST']) && (strpos($server['HTTP_HOST'], ':443') !== false)) ||
    - (isset($server['HTTP_X_FORWARDED_HTTPS']) && (strcasecmp($server['HTTP_X_FORWARDED_PROTO'], 'on') || $server['HTTP_X_FORWARDED_PROTO'] == '1')) ||
    - (isset($server['HTTP_X_FORWARDED_PROTO']) && $server['HTTP_X_FORWARDED_PROTO'] == 'https') ||
    - (isset($server['HTTP_X_HTTPS']) && (strcasecmp($server['HTTP_X_HTTPS'], 'on') === 0 || $server['HTTP_X_HTTPS'] == '1'))
    - ) {
    - return true;
    - }
    -
    - return false;
    + if (isset($server['HTTPS']) && ($server['HTTPS'] == 'on' || $server['HTTPS'] == '1')) {
    + define('HTTPS', true);
    + } elseif (isset($server['HTTP_X_FORWARDED_SERVER']) && ($server['HTTP_X_FORWARDED_SERVER'] == 'secure' || $server['HTTP_X_FORWARDED_SERVER'] == 'ssl')) {
    + define('HTTPS', true);
    + } elseif (isset($server['SCRIPT_URI']) && (strpos($server['SCRIPT_URI'], 'https') === 0)) {
    + define('HTTPS', true);
    + } elseif (isset($server['HTTP_HOST']) && (strpos($server['HTTP_HOST'], ':443') !== false)) {
    + define('HTTPS', true);
    + } elseif (isset($server['HTTP_X_FORWARDED_PROTO']) && $server['HTTP_X_FORWARDED_PROTO'] == 'https') {
    + define('HTTPS', true);
    + } elseif (isset($server['HTTP_X_HTTPS']) && ($server['HTTP_X_HTTPS'] == 'on' || $server['HTTP_X_HTTPS'] == '1')) {
    + define('HTTPS', true);
    + }
    }

    /**
    @@ -216,7 +213,7 @@ class Bootstrap
    $server = self::fixServerVars($server);

    self::disableZipCompression();
    - self::detectHTTPS($server) && define('HTTPS', true);
    + self::detectHTTPS($server);
    self::setConstants($server, $dir_root);

    list($get, $post, $server) = self::initConsoleMode($get, $post, $server, $dir_root);
    @@ -445,4 +442,4 @@ class Bootstrap
    {
    return strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
    }
    -}
    \ No newline at end of file
    +}
    151 changes: 151 additions & 0 deletions app-Tygh-DataKeeper.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,151 @@
    diff --git a/app/Tygh/DataKeeper.php b/app/Tygh/DataKeeper.php
    index 98942c6..f2ccaab 100644
    --- a/app/Tygh/DataKeeper.php
    +++ b/app/Tygh/DataKeeper.php
    @@ -274,9 +274,7 @@ class DataKeeper
    fn_mkdir($extract_path);

    if ($type == self::BACKUP_TYPE_DATABASE) {
    - if (!fn_decompress_files($backup_path, $extract_path)) {
    - return false;
    - }
    + fn_decompress_files($backup_path, $extract_path);
    $list = fn_get_dir_contents($extract_path, false, true, 'sql');

    foreach ($list as $sql_file) {
    @@ -296,9 +294,7 @@ class DataKeeper
    }

    // All files can be overrided. Restore backupped files
    - if (!fn_decompress_files($backup_path, $extract_path)) {
    - return false;
    - }
    + fn_decompress_files($backup_path, $extract_path);
    $root_dir = Registry::get('config.dir.root') . '/';

    foreach ($files_list as $file) {
    @@ -500,72 +496,69 @@ class DataKeeper
    $files_list = array();
    $ext = fn_get_file_ext($file_path);

    - try {
    - switch ($ext) {
    - case 'zip':
    - $validators = new Validators();
    - if (!$validators->isZipArchiveAvailable()) {
    - return $files_list;
    - }
    + switch ($ext) {
    + case 'zip':
    + $validators = new Validators();
    + if (!$validators->isZipArchiveAvailable()) {
    + return $files_list;
    + }

    - $zip = new \ZipArchive;
    -
    - if ($zip->open($file_path)) {
    - $num_files = $zip->numFiles;
    -
    - $counter = 0;
    - for ($i = 0; $i < $num_files; $i++) {
    - $file_name = $zip->getNameIndex($i);
    - $parent_directories = fn_get_parent_directory_stack($file_name);
    - if ($only_root) {
    - if (empty($parent_directories)) {
    - $files_list[$file_name] = $counter++;
    - } else {
    - $files_list[end($parent_directories)] = $counter++;
    - }
    - } else {
    + $zip = new \ZipArchive;
    +
    + if ($zip->open($file_path)) {
    + $num_files = $zip->numFiles;
    +
    + $counter = 0;
    + for ($i = 0; $i < $num_files; $i++) {
    + $file_name = $zip->getNameIndex($i);
    + $parent_directories = fn_get_parent_directory_stack($file_name);
    + if ($only_root) {
    + if (empty($parent_directories)) {
    $files_list[$file_name] = $counter++;
    - foreach ($parent_directories as $parent_dir_path) {
    - $files_list[$parent_dir_path] = $counter++;
    - }
    + } else {
    + $files_list[end($parent_directories)] = $counter++;
    + }
    + } else {
    + $files_list[$file_name] = $counter++;
    + foreach ($parent_directories as $parent_dir_path) {
    + $files_list[$parent_dir_path] = $counter++;
    }
    }
    -
    - $files_list = array_flip($files_list);
    - $zip->close();
    }
    - $zip = null;

    - break;
    + $files_list = array_flip($files_list);
    + $zip->close();
    + }
    + $zip = null;

    - case 'tgz':
    - $tgz = new \PharData($file_path,
    - \FilesystemIterator::SKIP_DOTS |
    - \FilesystemIterator::CURRENT_AS_FILEINFO |
    - \FilesystemIterator::KEY_AS_PATHNAME
    - );
    - if ($only_root) {
    - $iterator = $tgz;
    - } else {
    - $iterator = new \RecursiveIteratorIterator($tgz, \RecursiveIteratorIterator::SELF_FIRST);
    - }
    + break;

    - foreach ($iterator as $path_name => $spl_file_info) {
    - /** @var \SplFileInfo $spl_file_info */
    - $files_list[] = $spl_file_info->isDir()
    - ? rtrim($iterator->getSubPathname(), '\\/') . DIRECTORY_SEPARATOR
    - : $iterator->getSubPathname();
    - }
    + case 'tgz':
    + $tgz = new \PharData($file_path,
    + \FilesystemIterator::SKIP_DOTS |
    + \FilesystemIterator::CURRENT_AS_FILEINFO |
    + \FilesystemIterator::KEY_AS_PATHNAME
    + );
    + if ($only_root) {
    + $iterator = $tgz;
    + } else {
    + $iterator = new \RecursiveIteratorIterator($tgz, \RecursiveIteratorIterator::SELF_FIRST);
    + }
    +
    + foreach ($iterator as $path_name => $spl_file_info) {
    + /** @var \SplFileInfo $spl_file_info */
    + $files_list[] = $spl_file_info->isDir()
    + ? rtrim($iterator->getSubPathname(), '\\/') . DIRECTORY_SEPARATOR
    + : $iterator->getSubPathname();
    + }

    - $tgz = null;
    - $iterator = null;
    + $tgz = null;
    + $iterator = null;

    - break;
    + break;

    - default:
    - break;
    - }
    - } catch (\Exception $e) {
    + default:
    + break;
    }

    sort($files_list);
    151 changes: 151 additions & 0 deletions app-Tygh-Database.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,151 @@
    diff --git a/app/Tygh/Database.php b/app/Tygh/Database.php
    index 410cfc0..186b836 100644
    --- a/app/Tygh/Database.php
    +++ b/app/Tygh/Database.php
    @@ -448,86 +448,56 @@ class Database
    }
    }

    - switch ($ph) {
    - // integer
    - case '?i':
    - $pattern = self::strReplace($ph, self::intVal($data[$k]), $pattern, $offset); // Trick to convert int's and longint's
    - break;
    -
    - // string
    - case '?s':
    - $pattern = self::strReplace($ph, "'" . self::$db->escape($data[$k]) . "'", $pattern, $offset);
    - break;
    -
    - // string for LIKE operator
    - case '?l':
    - $pattern = self::strReplace($ph, "'" . self::$db->escape(str_replace("\\", "\\\\", $data[$k])) . "'", $pattern, $offset);
    - break;
    -
    - // float
    - case '?d':
    - if ($data[$k] == INF || $data[$k] > PHP_INT_MAX) {
    - $data[$k] = PHP_INT_MAX;
    - }
    - $pattern = self::strReplace($ph, sprintf('%01.2f', $data[$k]), $pattern, $offset);
    - break;
    -
    - // array
    - // @FIXME: add trim
    - case '?a':
    - $data[$k] = is_array($data[$k]) ? $data[$k] : array($data[$k]);
    - if (!empty($data[$k])) {
    - $pattern = self::strReplace($ph, implode(', ', self::filterData($data[$k], true)), $pattern, $offset);
    - } else {
    - if (Debugger::isActive() || fn_is_development()) {
    - trigger_error('Empty array was passed into SQL statement IN()', E_USER_DEPRECATED);
    - }
    - $pattern = self::strReplace($ph, 'NULL', $pattern, $offset);
    - }
    - break;
    -
    - // array of integer
    - // FIXME: add trim
    - case '?n':
    - $data[$k] = is_array($data[$k]) ? $data[$k] : array($data[$k]);
    - $pattern = self::strReplace($ph, !empty($data[$k]) ? implode(', ', array_map(array('self', 'intVal'), $data[$k])) : "''", $pattern, $offset);
    - break;
    -
    - // update/condition with and
    - case '?u':
    - case '?w':
    - $clue = ($ph == '?u') ? ', ' : ' AND ';
    - $q = implode($clue, self::filterData($data[$k], false));
    - $pattern = self::strReplace($ph, $q, $pattern, $offset);
    - break;
    -
    - // insert
    - case '?e':
    - $filtered = self::filterData($data[$k], true);
    - $pattern = self::strReplace($ph,
    - "(" . implode(', ', array_keys($filtered)) . ") VALUES (" . implode(', ', array_values($filtered)) . ")", $pattern,
    - $offset);
    - break;
    -
    - // insert multi
    - case '?m':
    - $values = array();
    - foreach ($data[$k] as $value) {
    - $filtered = self::filterData($value, true);
    - $values[] = "(" . implode(', ', array_values($filtered)) . ")";
    + if ($ph == '?i') { // integer
    + $pattern = self::strReplace($ph, self::intVal($data[$k]), $pattern, $offset); // Trick to convert int's and longint's
    +
    + } elseif ($ph == '?s') { // string
    +
    + $pattern = self::strReplace($ph, "'" . self::$db->escape($data[$k]) . "'", $pattern, $offset);
    +
    + } elseif ($ph == '?l') { // string for LIKE operator
    + $pattern = self::strReplace($ph, "'" . self::$db->escape(str_replace("\\", "\\\\", $data[$k])) . "'", $pattern, $offset);
    +
    + } elseif ($ph == '?d') { // float
    + $pattern = self::strReplace($ph, sprintf('%01.2f', $data[$k]), $pattern, $offset);
    +
    + } elseif ($ph == '?a') { // array FIXME: add trim
    + $data[$k] = !is_array($data[$k]) ? array($data[$k]) : $data[$k];
    + if (!empty($data[$k])) {
    + $pattern = self::strReplace($ph, implode(', ', self::filterData($data[$k], true)), $pattern, $offset);
    + } else {
    + if (Debugger::isActive() || fn_is_development()) {
    + trigger_error('Empty array was passed into SQL statement IN()', E_USER_DEPRECATED);
    }
    - $pattern = self::strReplace($ph, "(" . implode(', ', array_keys($filtered)) . ") VALUES " . implode(', ', $values), $pattern, $offset);
    - break;
    -
    - // field/table/database name
    - case '?f':
    - $pattern = self::strReplace($ph, self::field($data[$k]), $pattern, $offset);
    - break;
    -
    - // prepared statement
    - case '?p':
    - $pattern = self::strReplace($ph, self::tablePrefixReplace('?:', self::$table_prefix, $data[$k]), $pattern, $offset);
    - break;
    + $pattern = self::strReplace($ph, 'NULL', $pattern, $offset);
    + }
    +
    + } elseif ($ph == '?n') { // array of integer FIXME: add trim
    + $data[$k] = !is_array($data[$k]) ? array($data[$k]) : $data[$k];
    + $pattern = self::strReplace($ph, !empty($data[$k]) ? implode(', ', array_map(array('self', 'intVal'), $data[$k])) : "''", $pattern, $offset);
    +
    + } elseif ($ph == '?u' || $ph == '?w') { // update/condition with and
    + $clue = ($ph == '?u') ? ', ' : ' AND ';
    + $q = implode($clue, self::filterData($data[$k], false));
    + $pattern = self::strReplace($ph, $q, $pattern, $offset);
    +
    + } elseif ($ph == '?e') { // insert
    + $filtered = self::filterData($data[$k], true);
    + $pattern = self::strReplace($ph, "(" . implode(', ', array_keys($filtered)) . ") VALUES (" . implode(', ', array_values($filtered)) . ")", $pattern, $offset);
    +
    + } elseif ($ph == '?m') { // insert multi
    + $values = array();
    + foreach ($data[$k] as $value) {
    + $filtered = self::filterData($value, true);
    + $values[] = "(" . implode(', ', array_values($filtered)) . ")";
    + }
    + $pattern = self::strReplace($ph, "(" . implode(', ', array_keys($filtered)) . ") VALUES " . implode(', ', $values), $pattern, $offset);
    +
    + } elseif ($ph == '?f') { // field/table/database name
    + $pattern = self::strReplace($ph, self::field($data[$k]), $pattern, $offset);
    +
    + } elseif ($ph == '?p') { // prepared statement
    + $pattern = self::strReplace($ph, self::tablePrefixReplace('?:', self::$table_prefix, $data[$k]), $pattern, $offset);
    }
    }
    }
    @@ -695,10 +665,6 @@ class Database
    */
    protected static function intVal($int)
    {
    - if ($int == INF || $int > PHP_INT_MAX) {
    - $int = PHP_INT_MAX;
    - }
    -
    return $int + 0;
    }

    92 changes: 92 additions & 0 deletions app-Tygh-Http.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,92 @@
    diff --git a/app/Tygh/Http.php b/app/Tygh/Http.php
    index aabebab..59804ef 100644
    --- a/app/Tygh/Http.php
    +++ b/app/Tygh/Http.php
    @@ -455,7 +455,7 @@ class Http
    * @param string $url request URL
    * @param string $data request data (URL-encoded)
    * @param array $extra extra parameters
    - * @return mixed string response/true if output is written to file or false if request failed
    + * @return mixed string response or false if request failed
    */
    private static function _socketRequest($method, $url, $data, $extra)
    {
    @@ -491,7 +491,7 @@ class Http
    $post_url = $components['path'] . (!empty($components['query']) ? '?' . $components['query'] : '');
    }

    - fputs($sh, "$method $post_url HTTP/1.0\r\n");
    + fputs($sh, "$method $post_url HTTP/1.1\r\n");
    fputs($sh, "Host: $components[host]\r\n");

    if (!empty($req_settings['proxy_user'])) {
    @@ -528,36 +528,15 @@ class Http
    fputs($sh, "\r\n");
    }

    - if (!empty($extra['write_to_file'])) {
    - $f = fopen($extra['write_to_file'], 'w');
    - }
    -
    $content = '';
    - $headers_parsed = false;
    while (!feof($sh)) {
    $content .= fread($sh, 65536);
    -
    - if (!empty($extra['write_to_file'])) {
    - if (!$headers_parsed) {
    - $headers_parsed = true;
    - $content = self::_parseContent($content);
    - }
    -
    - fwrite($f, $content);
    - $content = '';
    - }
    }
    -
    fclose($sh);

    if (!empty($content)) {
    $content = self::_parseContent($content);
    }
    -
    - if (!empty($extra['write_to_file'])) {
    - $content = true;
    - fclose($f);
    - }
    } else {
    self::_setError('socket', $error, $errno);
    $content = false;
    @@ -572,7 +551,7 @@ class Http
    * @param string $url request URL
    * @param string $data request data (URL-encoded)
    * @param array $extra extra parameters
    - * @return mixed string response/true if output is written to file or false if request failed
    + * @return mixed string response or false if request failed
    */
    private static function _curlRequest($method, $url, $data, $extra)
    {
    @@ -627,12 +606,6 @@ class Http
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    - if (!empty($extra['write_to_file'])) {
    - $f = fopen($extra['write_to_file'], 'w');
    - curl_setopt($ch, CURLOPT_HEADER, 0);
    - curl_setopt($ch, CURLOPT_FILE, $f);
    - }
    -
    $req_settings = self::_getSettings();
    if (!empty($req_settings['proxy_host'])) {
    curl_setopt($ch, CURLOPT_PROXY, $req_settings['proxy_host'] . ':' . (empty($req_settings['proxy_port']) ? 3128 : $req_settings['proxy_port']));
    @@ -660,10 +633,6 @@ class Http
    self::_setError('curl', $error, $errno);
    }

    - if (!empty($extra['write_to_file'])) {
    - fclose($f);
    - }
    -
    return $content;
    }

    136 changes: 136 additions & 0 deletions app-Tygh-Languages-Languages.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,136 @@
    diff --git a/app/Tygh/Languages/Languages.php b/app/Tygh/Languages/Languages.php
    index 5b622a4..1370d48 100644
    --- a/app/Tygh/Languages/Languages.php
    +++ b/app/Tygh/Languages/Languages.php
    @@ -516,7 +516,7 @@ class Languages

    if (!self::isValidMeta($lang_meta)) {
    // Failed to read meta data of new language
    - fn_set_notification('E', __('error'), __('po_file_is_incorrect', array('[file]' => fn_get_rel_dir($pack_path))));
    + fn_set_notification('E', __('error'), __('check_po_file'));

    return false;
    }
    @@ -711,6 +711,7 @@ class Languages
    }
    }

    +
    if (!empty($original_values_query)) {
    self::executeLangQueries('original_values', array('msgctxt', 'msgid'), $original_values_query);
    }
    @@ -876,22 +877,21 @@ class Languages

    Po::createHeader($core_pack_path, $lang);

    + $addons_lang_vars = array();
    + list($addons) = fn_get_addons(array('type' => 'installed'), 0, $lang_code);
    + foreach ($addons as $addon_id => $addon) {
    + $addons_lang_vars = array_merge($addons_lang_vars, self::exportAddonsPo($addon_id, $pack_path . 'addons/' . $addon_id . '.po', $lang_code));
    + }
    +
    // Export Language values
    list($values) = LanguageValues::getVariables(array(), 0, $lang_code);
    + $original_values = self::getOriginalValues('Languages');

    foreach ($values as $_id => $value) {
    $values[$_id]['msgctxt'] = 'Languages' . \I18n_Pofile::DELIMITER . $value['name'];
    }

    $values = fn_array_value_to_key($values, 'msgctxt');
    -
    - $addons_lang_vars = array();
    - list($addons) = fn_get_addons(array('type' => 'installed'), 0, $lang_code);
    - foreach ($addons as $addon_id => $addon) {
    - $addons_lang_vars = array_merge($addons_lang_vars, self::exportAddonsPo($addon_id, $pack_path . 'addons/' . $addon_id . '.po', $lang_code, $values));
    - }
    -
    - $original_values = self::getOriginalValues('Languages');
    $values = array_diff_key($values, $addons_lang_vars);

    foreach ($values as $_id => $value) {
    @@ -1050,13 +1050,12 @@ class Languages
    /**
    * Exports only specified add-on language data
    *
    - * @param string $addon_id Addon ID (like: gift_certificates, buy_together)
    - * @param string $pack_path Path to exported PO-file
    - * @param string $lang_code 2-letters language code
    - * @param array $current_values Current lang values from DB
    + * @param string $addon_id Addon ID (like: gift_certificates, buy_together)
    + * @param string $pack_path Path to exported PO-file
    + * @param string $lang_code 2-letters language code
    * @return array Exported data
    */
    - private static function exportAddonsPo($addon_id, $pack_path, $lang_code, $current_values = array())
    + private static function exportAddonsPo($addon_id, $pack_path, $lang_code)
    {
    // Translation packs should not include "Not translated" language data
    $allow_overlap = $lang_code == 'en' ? true : false;
    @@ -1110,12 +1109,10 @@ class Languages
    continue;
    }

    - $key = 'Languages' . \I18n_Pofile::DELIMITER . $variable['name'];
    -
    $_values[] = array(
    'name' => $variable['name'],
    - 'value' => isset($current_values[$key]) ? $current_values[$key]['value'] : $variable['value'],
    - 'original_value' => isset($original_variables[$key]) ? $original_variables[$key]['msgid'] : '',
    + 'value' => $variable['value'],
    + 'original_value' => isset($original_variables['Languages' . \I18n_Pofile::DELIMITER . $variable['name']]) ? $original_variables['Languages' . \I18n_Pofile::DELIMITER . $variable['name']]['msgid'] : '',
    );
    }

    @@ -1222,28 +1219,15 @@ class Languages
    return true;
    }

    +
    /**
    - * This method installs language values stored at so-named "Crowdin-pack directory".
    - * The directory should have the following structure:
    - *
    - * /
    - * /core.po - Core language values. Required.
    - * /editions - Stores edition-specific *.po files. Optional.
    - * /mve.po - Multivendor-specific file.
    - * /addons - Stores add-ons' *.po files. Optional.
    - * /banners.po
    - * /bestsellers.po
    - * /{addon name}.po
    - *
    - * This methods collects relevant *.po files from given directory and executes {@see Tygh\Languages\Languages::installLanguagePack()} method for each one.
    - * "Relevant" means that only installed addons' po-files would be installed as well as mve.po will be installed only for Multivendor edition.
    - *
    - * @see Tygh\Languages\Languages::installLanguagePack()
    + * Installs PO-pack.
    *
    * @param string $path Path to directory that contains .po files (i.e. PO-pack directory)
    - * @param array $params Parameters passed to {@see Tygh\Languages\Languages::installLanguagePack()} function.
    + * @param array $params Parameters passed to {self::installLanguagePack()} function.
    *
    - * @return bool|int (bool) false on failure, (bool) true on success or (int) ID of newly created language (if it was created successfully).
    + * @return bool|int (bool) false on failure, (bool) true on success
    + * or (int) ID of newly created language (if it was created successfully).
    */
    public static function installCrowdinPack($path, $params)
    {
    @@ -1254,7 +1238,7 @@ class Languages

    if (empty($lang_meta['lang_code'])) {
    $result = false;
    - fn_set_notification('E', __('error'), __('incorrect_po_pack_structure', array('[pack_path]' => fn_get_rel_dir($path))));
    + fn_set_notification('E', __('error'), __('broken_po_pack'));

    } else {
    fn_copy($path, Registry::get('config.dir.lang_packs') . $lang_meta['lang_code'] . '/');
    @@ -1291,7 +1275,7 @@ class Languages

    return $result;
    } else {
    - fn_set_notification('E', __('error'), __('incorrect_po_pack_structure', array('[pack_path]' => fn_get_rel_dir($path))));
    + fn_set_notification('E', __('error'), __('broken_po_pack'));

    return false;
    }
    15 changes: 15 additions & 0 deletions app-Tygh-Languages-Po.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    diff --git a/app/Tygh/Languages/Po.php b/app/Tygh/Languages/Po.php
    index f4e6bae..391742d 100644
    --- a/app/Tygh/Languages/Po.php
    +++ b/app/Tygh/Languages/Po.php
    @@ -42,8 +42,8 @@ class Po
    }

    $_d = $poparser->read($filename, false, 'LanguageName');
    - if (!empty($_d['LanguageName']['msgstr']) && is_array($_d['LanguageName']['msgstr'])) {
    - $meta['name'] = reset($_d['LanguageName']['msgstr']);
    + if (!empty($_d) && is_array($_d)) {
    + $meta['name'] = $_d['LanguageName']['msgstr'][0];
    }
    }
    } else {
    68 changes: 68 additions & 0 deletions app-Tygh-Mailer.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    diff --git a/app/Tygh/Mailer.php b/app/Tygh/Mailer.php
    index 92f5a32..eeb4ace 100644
    --- a/app/Tygh/Mailer.php
    +++ b/app/Tygh/Mailer.php
    @@ -13,7 +13,6 @@
    ****************************************************************************/

    namespace Tygh;
    -use Tygh\Tools\Url;

    class Mailer extends \PHPMailer
    {
    @@ -50,10 +49,15 @@ class Mailer extends \PHPMailer

    foreach (array('reply_to', 'to', 'cc') as $way) {
    if (!empty($params[$way])) {
    - foreach ((array) $params[$way] as $way_ar) {
    - ${$way}[] = !empty($company_data[$way_ar]) ? $company_data[$way_ar] : $way_ar;
    + if (!is_array($params[$way])) {
    + ${$way}[] = !empty($company_data[$params[$way]]) ? $company_data[$params[$way]] : $params[$way];
    + } else {
    + foreach ($params[$way] as $way_ar) {
    + ${$way}[] = !empty($company_data[$way_ar]) ? $company_data[$way_ar] : $way_ar;
    + }
    }
    }
    +
    }

    if (!empty($reply_to)) {
    @@ -95,7 +99,6 @@ class Mailer extends \PHPMailer
    if (empty($to) || empty($from['email'])) {
    return false;
    }
    - $from['email'] = Url::normalizeEmail($from['email']);

    $mailer->SetFrom($from['email'], $from['name']);
    $mailer->IsHTML(isset($params['is_html']) ? $params['is_html'] : true);
    @@ -244,7 +247,10 @@ class Mailer extends \PHPMailer
    public function formatEmails($emails)
    {
    $result = array();
    - foreach ((array) $emails as $email) {
    + if (!is_array($emails)) {
    + $emails = array($emails);
    + }
    + foreach ($emails as $email) {
    $email = str_replace(';', ',', $email);
    $res = explode(',', $email);
    foreach ($res as &$v) {
    @@ -253,16 +259,7 @@ class Mailer extends \PHPMailer
    $result = array_merge($result, $res);
    }

    - $result = array_unique($result);
    -
    - foreach ($result as $k => $email) {
    - $result[$k] = Url::normalizeEmail($email);
    - if (!$result[$k]) {
    - unset($result[$k]);
    - }
    - }
    -
    - return $result;
    + return array_unique($result);
    }

    public static function ValidateAddress($email, $method = 'auto')
    172 changes: 172 additions & 0 deletions app-Tygh-Pdf.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,172 @@
    diff --git a/app/Tygh/Pdf.php b/app/Tygh/Pdf.php
    index 7bd9c9b..271fea6 100644
    --- a/app/Tygh/Pdf.php
    +++ b/app/Tygh/Pdf.php
    @@ -18,8 +18,8 @@ use Tygh\Http;

    class Pdf
    {
    - protected static $transaction_id;
    - protected static $url = 'http://converter.cart-services.com';
    + private static $_transaction_id;
    + private static $_url = 'http://converter.cart-services.com';

    /**
    * Pushes HTML code to batch to render PDF later
    @@ -28,10 +28,10 @@ class Pdf
    */
    public static function batchAdd($html)
    {
    - $transaction_id = Http::post(self::action('/pdf/batch/add'),
    + $transaction_id = Http::post(self::_action('/pdf/batch/add'),
    json_encode(array(
    - 'transaction_id' => !empty(self::$transaction_id) ? self::$transaction_id : '',
    - 'content' => self::convertImages($html)
    + 'transaction_id' => !empty(self::$_transaction_id) ? self::$_transaction_id : '',
    + 'content' => self::_convertImages($html)
    )), array(
    'headers' => array(
    'Content-type: application/json',
    @@ -40,8 +40,8 @@ class Pdf
    'binary_transfer' => true
    ));

    - if (!empty($transaction_id) && empty(self::$transaction_id)) {
    - self::$transaction_id = json_decode($transaction_id);
    + if (!empty($transaction_id) && empty(self::$_transaction_id)) {
    + self::$_transaction_id = json_decode($transaction_id);
    }

    return !empty($transaction_id);
    @@ -58,27 +58,24 @@ class Pdf
    public static function batchRender($filename = '', $save = false, $params = array())
    {
    $default_params = array(
    - 'transaction_id' => self::$transaction_id,
    + 'transaction_id' => self::$_transaction_id,
    'page_size' => 'A4'
    );

    $params = array_merge($default_params, $params);

    - $file = fn_create_temp_file();
    -
    - $response = Http::post(self::action('/pdf/batch/render'), json_encode($params), array(
    + $content = Http::post(self::_action('/pdf/batch/render'), json_encode($params), array(
    'headers' => array(
    'Content-type: application/json',
    'Accept: application/pdf'
    ),
    - 'binary_transfer' => true,
    - 'write_to_file' => $file
    + 'binary_transfer' => true
    ));

    - self::$transaction_id = null;
    + self::$_transaction_id = null;

    - if (!empty($response)) {
    - return self::output($file, $filename, $save);
    + if (!empty($content)) {
    + return self::_output($content, $filename, $save);
    }

    return false;
    @@ -98,8 +95,8 @@ class Pdf
    $html = implode("<div style='page-break-before: always;'>&nbsp;</div>", $html);
    }

    - if (self::isLocalIP(gethostbyname($_SERVER['HTTP_HOST']))) {
    - $html = self::convertImages($html);
    + if (self::_isLocalIP(gethostbyname($_SERVER['HTTP_HOST']))) {
    + $html = self::_convertImages($html);
    }

    $default_params = array(
    @@ -107,21 +104,18 @@ class Pdf
    'page_size' => 'A4'
    );

    - $params = array_merge($default_params, $params);
    -
    - $file = fn_create_temp_file();
    + $params = array_merge($default_params, $params);

    - $response = Http::post(self::action('/pdf/render'), json_encode($params), array(
    + $content = Http::post(self::_action('/pdf/render'), json_encode($params), array(
    'headers' => array(
    'Content-type: application/json',
    'Accept: application/pdf'
    ),
    - 'binary_transfer' => true,
    - 'write_to_file' => $file
    + 'binary_transfer' => true
    ));

    - if (!empty($response)) {
    - return self::output($file, $filename, $save);
    + if (!empty($content)) {
    + return self::_output($content, $filename, $save);
    }

    return false;
    @@ -132,26 +126,26 @@ class Pdf
    * @param string $action action
    * @return string formed URL
    */
    - protected static function action($action)
    + private static function _action($action)
    {
    - return self::$url . $action;
    + return self::$_url . $action;
    }

    /**
    * Saves PDF document or outputs it
    - * @param string $file file with PDF document
    + * @param string $content PDF document
    * @param string $filename filename to save PDF or name of attachment to download
    * @param boolean $save saves to file if true, outputs if not
    * @return mixed true if document saved, false on failure or outputs document
    */
    - protected static function output($file, $filename = '', $save = false)
    + private static function _output($content, $filename = '', $save = false)
    {
    if (!empty($filename) && strpos($filename, '.pdf') === false) {
    $filename .= '.pdf';
    }

    if (!empty($filename) && $save == true) {
    - return fn_rename($file, $filename);
    + return fn_put_contents($filename, $content);

    } else {
    if (!empty($filename)) {
    @@ -160,8 +154,7 @@ class Pdf
    }

    header('Content-type: application/pdf');
    - readfile($file);
    - fn_rm($file);
    + fn_echo($content);
    exit;
    }

    @@ -173,7 +166,7 @@ class Pdf
    * @param string $html html code
    * @return string html code with converted links
    */
    - protected static function convertImages($html)
    + private static function _convertImages($html)
    {
    $http_location = Registry::get('config.http_location');
    $https_location = Registry::get('config.https_location');
    @@ -232,7 +225,7 @@ class Pdf
    * @param string $ip IP address
    * @return boolean true if IP is local, false - if public
    */
    - protected static function isLocalIP($ip)
    + private static function _isLocalIP($ip)
    {
    $ranges = array(
    '10' => array(
    74 changes: 74 additions & 0 deletions app-Tygh-Tools-Url.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,74 @@
    diff --git a/app/Tygh/Tools/Url.php b/app/Tygh/Tools/Url.php
    index 3e95212..7bf94c4 100644
    --- a/app/Tygh/Tools/Url.php
    +++ b/app/Tygh/Tools/Url.php
    @@ -132,7 +132,7 @@ class Url
    * Creates string representation of URL from current state of the object.
    *
    * @param bool $encode Whether to encode ampersands
    - * @param bool $puny - encode URL host to punycode
    + * @param bool $puny - encode URL host to punycode
    *
    * @return string Result URL
    */
    @@ -179,7 +179,7 @@ class Url
    /**
    * Normalize URL to pass it to parse_url function
    *
    - * @param string $url URL
    + * @param string $url URL
    *
    * @return string normalized URL
    */
    @@ -198,7 +198,7 @@ class Url
    /**
    * Cleans up URL, leaving domain and path only
    *
    - * @param string $url URL
    + * @param string $url URL
    *
    * @return string cleaned up URL
    */
    @@ -218,9 +218,9 @@ class Url
    /**
    * Normalizes domain name and punycode's it
    *
    - * @param string $url URL
    + * @param string $url URL
    *
    - * @return mixed string with normalized domain on success, boolean false otherwise
    + * @return mixed string with normalized domain on success, boolean false otherwise
    */
    public static function normalizeDomain($url)
    {
    @@ -243,28 +243,11 @@ class Url
    }

    /**
    - * Normalizes email name and punycode's it
    - *
    - * @param string $email E-mail
    - * @return mixed string with normalized email on success, boolean false otherwise
    - */
    - public static function normalizeEmail($email)
    - {
    - list($name, $domain) = explode('@', $email, 2);
    - $domain = self::normalizeDomain($domain);
    - if ($domain) {
    - return $name . '@' . $domain;
    - }
    -
    - return false;
    - }
    -
    - /**
    * Decodes punycoded'd URL
    *
    - * @param string $url URL
    + * @param string $url URL
    *
    - * @return mixed string with decoded URL on success, boolean false otherwise
    + * @return mixed string with decoded URL on success, boolean false otherwise
    */
    public static function decode($url)
    {
    200 changes: 200 additions & 0 deletions app-Tygh-UpgradeCenter-App.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,200 @@
    diff --git a/app/Tygh/UpgradeCenter/App.php b/app/Tygh/UpgradeCenter/App.php
    index 2e1f78e..049f72f 100644
    --- a/app/Tygh/UpgradeCenter/App.php
    +++ b/app/Tygh/UpgradeCenter/App.php
    @@ -638,7 +638,7 @@ class App
    $this->applyPackageFiles($content_path . 'package', $this->config['dir']['root']);

    $logger->add('Deleting files removed at new version');
    - $this->cleanupOldFiles($schema);
    + $this->cleanupOldFiles($schema, $this->config['dir']['root']);

    // Copy files from themes_repository to design folder
    $logger->add('Processing themes files');
    @@ -701,12 +701,93 @@ class App
    }
    }

    + // Install languages
    Output::display(__('uc_install_languages'), '', true);
    - list ($lang_codes_to_install, $failed_lang_codes) = $this->installLanguages($schema, $logger, $content_path);

    - if (!empty($lang_codes_to_install) && !empty($failed_lang_codes)) {
    - $result = self::PACKAGE_INSTALL_RESULT_WITH_ERRORS;
    - $logger->add('Failed to install languages: %s', implode(', ', $failed_lang_codes));
    + // Install langs that are provided by package
    + if (!empty($schema['languages'])) {
    + $logger->add('Installing languages provided by package');
    + $logger->add(sprintf('Package languages: %s', implode(', ', $schema['languages'])));
    +
    + $avail_languages = Languages::getAvailable('A', true);
    +
    + $logger->add(sprintf('Already installed languages: %s', implode(', ', array_keys($avail_languages))));
    +
    + foreach ($avail_languages as $lang_code => $language) {
    + if (in_array($lang_code, $schema['languages'])) {
    + $logger->add(sprintf('Installing "%s" language', $lang_code));
    + Output::display(__('install') . ': ' . $lang_code, '', false);
    +
    + Languages::installCrowdinPack($content_path . 'languages/' . $lang_code, array(
    + 'install_newly_added' => true,
    + 'validate_lang_code' => true,
    + 'reinstall' => true,
    + ));
    + } else {
    + $pack_code = '';
    + if (in_array(CART_LANGUAGE, $schema['languages'])) {
    + $pack_code = CART_LANGUAGE;
    + } elseif (in_array('en', $schema['languages'])) {
    + $pack_code = 'en';
    + }
    +
    + if (!empty($pack_code) && file_exists($content_path . 'languages/' . $pack_code)) {
    + // Fill the unknown language by the Default/EN language variables
    + Languages::installCrowdinPack($content_path . 'languages/' . $pack_code, array(
    + 'reinstall' => true,
    + 'force_lang_code' => $lang_code,
    + 'install_newly_added' => true
    + ));
    + }
    + }
    + }
    + } else {
    + // Install languages using upgraded /var/langs/*/*.po files
    + $logger->add('Installing languages using upgraded *.po files');
    +
    + $langs_meta = Languages::getLangPacksMeta('', '', true);
    + $lang_packs = array();
    +
    + foreach ($langs_meta as $value) {
    + $lang_packs[$value['lang_code']] = $value;
    + }
    +
    + $logger->add(sprintf('Found language packs: %s', implode(', ', array_keys($lang_packs))));
    +
    + $avail_languages = Languages::getAvailable('A', true);
    + $logger->add(sprintf('Already installed languages: %s', implode(', ', array_keys($avail_languages))));
    +
    + foreach ($avail_languages as $lang_code => $language) {
    + if (isset($lang_packs[$lang_code])) {
    + $logger->add(sprintf('Installing "%s" language', $lang_code));
    + Output::display(__('install') . ': ' . $lang_code, '', false);
    +
    + $pack_path = $this->config['dir']['lang_packs'] . $lang_code;
    + Languages::installCrowdinPack($pack_path, array(
    + 'install_newly_added' => true,
    + 'validate_lang_code' => true,
    + 'reinstall' => true,
    + ));
    + } else {
    + $pack_code = '';
    + if (isset($lang_packs[CART_LANGUAGE])) {
    + $pack_code = CART_LANGUAGE;
    + } elseif (isset($lang_packs['en'])) {
    + $pack_code = 'en';
    + }
    +
    + $pack_path = $this->config['dir']['lang_packs'] . $pack_code;
    +
    + if (!empty($pack_code) && file_exists($pack_path)) {
    + // Fill the unknown language by the Default/EN language variables
    + Languages::installCrowdinPack($pack_path, array(
    + 'reinstall' => true,
    + 'force_lang_code' => $lang_code,
    + 'install_newly_added' => true
    + ));
    + }
    + }
    + }
    }
    }

    @@ -962,9 +1043,9 @@ class App
    {
    $logger->add(str_repeat('-', 10));
    $logger->add(sprintf('Changing permissions of "%s" to %o', $path, $permissions));
    - $logger->lineStart('Using chmod()... ');
    + $logger->add('Using chmod()... ', true, true, false);
    $result = @chmod($path, $permissions);
    - $logger->lineEnd($result ? 'OK' : 'FAILED');
    + $logger->add($result ? 'OK' : 'FAILED', true, false, true);

    if (!$result) {
    $logger->add('Using FTP...');
    @@ -1424,74 +1505,4 @@ class App
    $this->params = $params;
    $this->settings = Settings::instance()->getValues('Upgrade_center');
    }
    -
    - /**
    - * @param array $package_content_schema Package content schema
    - * @param Log $logger Logger instance
    - * @param string $package_content_path Package content path
    - *
    - * @return array First element is a list of languages to be installed, second element is a list languages failed to install
    - */
    - public function installLanguages($package_content_schema, Log $logger, $package_content_path)
    - {
    - $failed_to_install = array();
    - $installed_languages = array_keys(Languages::getAvailable('A', true));
    -
    - if (empty($package_content_schema['languages'])) {
    - $logger->add('Installing languages using upgraded *.po files');
    - $po_pack_basepath = $this->config['dir']['lang_packs'];
    - $lang_codes_to_install = array();
    - foreach (Languages::getLangPacksMeta('', '', true) as $value) {
    - $lang_codes_to_install[] = $value['lang_code'];
    - }
    - } else {
    - $logger->add('Installing languages provided by package');
    - $po_pack_basepath = $package_content_path . 'languages/';
    - $lang_codes_to_install = (array) $package_content_schema['languages'];
    - }
    - $logger->add(sprintf('Already installed languages: %s', implode(', ', $installed_languages)));
    - $logger->add(sprintf('Languages to be installed: %s', implode(', ', $lang_codes_to_install)));
    -
    - if (in_array(CART_LANGUAGE, $lang_codes_to_install)) {
    - $fallback_lang_code = CART_LANGUAGE;
    - } elseif (in_array('en', $lang_codes_to_install)) {
    - $fallback_lang_code = 'en';
    - } else {
    - $fallback_lang_code = null;
    - }
    -
    - foreach ($installed_languages as $lang_code) {
    - $logger->lineStart(sprintf('Installing "%s" language... ', $lang_code));
    -
    - if (in_array($lang_code, $lang_codes_to_install)) {
    - Output::display(__('install') . ': ' . $lang_code, '', false);
    -
    - if (false === Languages::installCrowdinPack($po_pack_basepath . $lang_code, array(
    - 'install_newly_added' => true,
    - 'validate_lang_code' => true,
    - 'reinstall' => true,
    - ))) {
    - $logger->lineEnd('FAILED');
    - $failed_to_install[] = $lang_code;
    - } else {
    - $logger->lineEnd('OK');
    - }
    - } elseif ($fallback_lang_code !== null) {
    - if (false === Languages::installCrowdinPack($po_pack_basepath . $fallback_lang_code, array(
    - 'reinstall' => true,
    - 'force_lang_code' => $lang_code,
    - 'install_newly_added' => true,
    - ))) {
    - $logger->lineEnd('FAILED');
    - $failed_to_install[] = $lang_code;
    - } else {
    - $logger->lineEnd('OK');
    - }
    - } else {
    - $logger->lineEnd('SKIPPED');
    - }
    - }
    -
    - return array($lang_codes_to_install, $failed_to_install);
    - }
    -}
    \ No newline at end of file
    +}
    21 changes: 21 additions & 0 deletions app-Tygh-UpgradeCenter-Log.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    diff --git a/app/Tygh/UpgradeCenter/Log.php b/app/Tygh/UpgradeCenter/Log.php
    index cced989..52c0955 100644
    --- a/app/Tygh/UpgradeCenter/Log.php
    +++ b/app/Tygh/UpgradeCenter/Log.php
    @@ -81,16 +81,6 @@ class Log
    return $this;
    }

    - public function lineStart($message)
    - {
    - return $this->add($message, true, true, false);
    - }
    -
    - public function lineEnd($message)
    - {
    - return $this->add($message, true, false, true);
    - }
    -
    private function getLogFilePath()
    {
    return $this->config['dir']['root'] . '/var/upgrade/' . $this->package_id . '_log.txt';
    21 changes: 21 additions & 0 deletions app-controllers-backend-datakeeper.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    diff --git a/app/controllers/backend/datakeeper.php b/app/controllers/backend/datakeeper.php
    index c7da3ce..1a72e27 100644
    --- a/app/controllers/backend/datakeeper.php
    +++ b/app/controllers/backend/datakeeper.php
    @@ -87,7 +87,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $restore_result = DataKeeper::restore($_REQUEST['backup_file']);
    if ($restore_result === true) {
    fn_set_notification('N', __('notice'), __('done'));
    - } elseif ($restore_result === false) {
    } else {
    fn_set_notification('E', __('error'), $restore_result);
    }
    @@ -196,7 +195,7 @@ if ($mode == 'getfile' && !empty($_REQUEST['file'])) {
    $backup_files[$file]['can_be_restored'] = false;
    $required_phardata = true;
    }
    - if ($ext == 'zip' && !$validators->isZipArchiveAvailable()) {
    + if ($ext == 'zip' && $validators->isZipArchiveAvailable()) {
    $backup_files[$file]['can_be_restored'] = false;
    }
    }
    14 changes: 14 additions & 0 deletions app-controllers-frontend-orders.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    diff --git a/app/controllers/frontend/orders.php b/app/controllers/frontend/orders.php
    index 2beabed..7d7f10a 100644
    --- a/app/controllers/frontend/orders.php
    +++ b/app/controllers/frontend/orders.php
    @@ -486,9 +486,6 @@ function fn_reorder($order_id, &$cart, &$auth)
    $order_info['products'][$k]['company_id'] = $company_id;

    unset($order_info['products'][$k]['extra']['ekey_info']);
    - unset($order_info['products'][$k]['extra']['promotions']);
    - unset($order_info['products'][$k]['promotions']);
    -
    $order_info['products'][$k]['product_options'] = empty($order_info['products'][$k]['extra']['product_options']) ? array() : $order_info['products'][$k]['extra']['product_options'];
    $order_info['products'][$k]['main_pair'] = fn_get_cart_product_icon($item['product_id'], $order_info['products'][$k]);
    }
    40 changes: 40 additions & 0 deletions app-functions-fn.cart.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    diff --git a/app/functions/fn.cart.php b/app/functions/fn.cart.php
    index d82a53d..01a8f53 100644
    --- a/app/functions/fn.cart.php
    +++ b/app/functions/fn.cart.php
    @@ -1433,6 +1433,8 @@ function fn_finish_payment($order_id, $pp_response, $force_notification = array(
    $valid_id = db_get_field("SELECT order_id FROM ?:order_data WHERE order_id = ?i AND type = 'S'", $order_id);

    if (!empty($valid_id)) {
    + db_query("DELETE FROM ?:order_data WHERE order_id = ?i AND type = 'S'", $order_id);
    +
    fn_update_order_payment_info($order_id, $pp_response);

    if ($pp_response['order_status'] == 'N' && !empty($_SESSION['cart']['placement_action']) && $_SESSION['cart']['placement_action'] == 'repay') {
    @@ -1442,8 +1444,6 @@ function fn_finish_payment($order_id, $pp_response, $force_notification = array(
    fn_set_hook('finish_payment', $order_id, $pp_response, $force_notification);

    fn_change_order_status($order_id, $pp_response['order_status'], '', $force_notification);
    -
    - db_query("DELETE FROM ?:order_data WHERE order_id = ?i AND type = 'S'", $order_id);
    }
    }

    @@ -7434,17 +7434,6 @@ EOT;
    }

    echo <<<EOT
    - <noscript><p>
    -EOT;
    - echo(__('text_cc_javascript_disabled'));
    -
    - echo <<<EOT
    - </p><p><input type="submit" name="btn" value="
    -EOT;
    - echo(__('cc_button_submit'));
    - echo <<<EOT
    -"></p>
    - </noscript>
    </form>
    <script type="text/javascript">
    window.onload = function(){
    19 changes: 19 additions & 0 deletions app-functions-fn.fs.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    diff --git a/app/functions/fn.fs.php b/app/functions/fn.fs.php
    index d1aeec1..50a6e4a 100644
    --- a/app/functions/fn.fs.php
    +++ b/app/functions/fn.fs.php
    @@ -1420,11 +1420,9 @@ function fn_get_public_files_path()
    */
    function fn_get_rel_dir($dir)
    {
    - return str_replace(
    - rtrim(Registry::get('config.dir.root'), '\\/') . '/',
    - '',
    - $dir
    - );
    + $dir = str_replace(Registry::get('config.dir.root') . '/', '', $dir);
    +
    + return $dir;
    }

    /**
    94 changes: 94 additions & 0 deletions app-functions-fn.promotions.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,94 @@
    diff --git a/app/functions/fn.promotions.php b/app/functions/fn.promotions.php
    index f1d63d6..6f06298 100644
    --- a/app/functions/fn.promotions.php
    +++ b/app/functions/fn.promotions.php
    @@ -482,7 +482,7 @@ function fn_promotion_apply_cart_rule($bonus, &$cart, &$auth, &$cart_products)

    } elseif ($bonus['bonus'] == 'give_coupon') {
    $cart['promotions'][$bonus['promotion_id']]['bonuses'][$bonus_id]['pending'] = true;
    - $cart['promotions'][$bonus['promotion_id']]['bonuses'][$bonus_id]['coupon_code'] = fn_promotion_generate_bonus_coupon($bonus, $bonus_id, $cart);
    + $cart['promotions'][$bonus['promotion_id']]['bonuses'][$bonus_id]['coupon_code'] = fn_generate_code('', COUPON_CODE_LENGTH);

    } elseif ($bonus['bonus'] == 'free_shipping') {

    @@ -1693,6 +1693,8 @@ function fn_promotions_calculate_order_discount($bonus, $bonus_id, $cart)
    $price = $cart['subtotal'];
    $value = $bonus['discount_value'];

    + static $parent_orders = array();
    +
    // this calculations are actual only for the fixed (absolute) amount
    if ($type == 'to_fixed' || $type == 'by_fixed') {

    @@ -1708,12 +1710,20 @@ function fn_promotions_calculate_order_discount($bonus, $bonus_id, $cart)
    $session_orders_discount['parent_order_discount'] = $discount;
    $session_orders_discount['suborders_discount'] = 0;

    - } else { // this is sub order
    - $parent_order = fn_promotion_get_order($cart['parent_order_id']);
    + } else {
    + // this is sub order
    +
    + $parent_order_id = $cart['parent_order_id'];

    - if (!empty($parent_order['subtotal'])) {
    + // get parent order subtotal info
    + if (!isset($parent_orders[$parent_order_id]['subtotal'])) {
    + $parent_order_info = fn_get_order_info($parent_order_id);
    + $parent_orders[$parent_order_id]['subtotal'] = $parent_order_info['subtotal'];
    + }
    +
    + if (!empty($parent_orders[$parent_order_id]['subtotal'])) {
    // calculate the share of the full discount
    - $value = $value * $price / $parent_order['subtotal'];
    + $value = $value * $price / $parent_orders[$parent_order_id]['subtotal'];
    }

    $discount = fn_promotions_calculate_discount($type, $price, $value);
    @@ -1896,46 +1906,3 @@ function fn_promotion_shippings($this, $cart)

    return $result;
    }
    -
    -
    -/**
    - * Return order data. Result saved in internal cache.
    - *
    - * @param int $order_id
    - * @return array|bool
    - */
    -function fn_promotion_get_order($order_id)
    -{
    - static $orders = array();
    -
    - if (empty($order_id)) {
    - return false;
    - }
    -
    - if (!isset($orders[$order_id])) {
    - $orders[$order_id] = fn_get_order_info($order_id);
    - }
    -
    - return !empty($orders[$order_id]) ? $orders[$order_id] : false;
    -}
    -
    -/**
    - * Generate bonus coupon for order
    - *
    - * @param array $bonus Array with promotion data
    - * @param int $bonus_id Bonus ID
    - * @param array $cart Array with cart data
    - * @return string Coupon code
    - */
    -function fn_promotion_generate_bonus_coupon($bonus, $bonus_id, $cart)
    -{
    - if (!empty($cart['parent_order_id'])) {
    - $parent_order = fn_promotion_get_order($cart['parent_order_id']);
    -
    - if (!empty($parent_order['promotions'][$bonus['promotion_id']]['bonuses'][$bonus_id]['coupon_code'])) {
    - return $parent_order['promotions'][$bonus['promotion_id']]['bonuses'][$bonus_id]['coupon_code'];
    - }
    - }
    -
    - return fn_generate_code('', COUPON_CODE_LENGTH);
    -}
    15 changes: 15 additions & 0 deletions app-functions-smarty_plugins-block.scripts.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    diff --git a/app/functions/smarty_plugins/block.scripts.php b/app/functions/smarty_plugins/block.scripts.php
    index 5c1d771..e3e8e11 100644
    --- a/app/functions/smarty_plugins/block.scripts.php
    +++ b/app/functions/smarty_plugins/block.scripts.php
    @@ -90,8 +90,9 @@ function smarty_block_scripts($params, $content, &$smarty, &$repeat)
    $return .= '<script type="text/javascript">' . $sc . '</script>' . "\n";
    }
    }
    +
    + $return .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);
    }
    - $return .= smarty_helper_inline_scripts($params, $content, $smarty, $repeat);

    return $return;
    }
    40 changes: 40 additions & 0 deletions app-payments-dibs.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    diff --git a/app/payments/dibs.php b/app/payments/dibs.php
    index 0113ad0..6daba43 100644
    --- a/app/payments/dibs.php
    +++ b/app/payments/dibs.php
    @@ -88,6 +88,10 @@ if (defined('PAYMENT_NOTIFICATION')) {

    $post_address = "https://payment.architrade.com/paymentweb/start.action";

    + $msg = __('text_cc_processor_connection', array(
    + '[processor]' => 'DIBS'
    + ));
    +
    $lang_code = Registry::get('settings.Appearance.backend_default_language');

    $post = array();
    @@ -107,13 +111,14 @@ if (defined('PAYMENT_NOTIFICATION')) {
    'uniqueoid' =>'yes',
    'ip' => $order_info['ip_address'],
    'paytype' => 'ACCEPT,ACK,AMEX,AMEX(DK),BHBC,CCK,CKN,COBK,DIN,DIN(DK),DK,ELEC,VISA,EWORLD,FCC,FCK,FFK,FSC,FSBK,FSSBK,GSC,GRA,HBSBK,HMK,ICASBK,IBC,IKEA,JPSBK,JCB,LIC(DK),LIC(SE),MC,MC(DK),MC(SE),MTRO,MTRO(DK),MTRO(UK),MTRO(SOLO),MEDM,MERLIN(DK),MOCA,NSBK,OESBK,PGSBK,Q8SK,Q8LIC,RK,SLV,SBSBK,S/T,SBC,SBK,SEBSBK,TKTD,TUBC,TLK,VSC,V-DK,VEKO,VISA,VISA(DK),VISA(SE),ELEC,WOCO,AAK',
    + 'calcfee' => 'no',
    'skiplastpage' => $processor_data['processor_params']['skiplastpage'],
    'lang' => in_array(CART_LANGUAGE, $languages) ? CART_LANGUAGE : $processor_data['processor_params']['lang'],
    'color' => $processor_data['processor_params']['color'],
    'decorator' => $processor_data['processor_params']['decorator'],
    'md5key' => $md5key
    );
    -
    +
    if ($processor_data['processor_params']['test'] == 'test') {
    $post_data['test'] = 'yes';
    }
    @@ -168,7 +173,7 @@ if (defined('PAYMENT_NOTIFICATION')) {
    }
    }

    - fn_create_payment_form($post_address, $post_data, 'DIBS', false);
    + fn_create_payment_form($post_address, $post_data, 'Dibs', false);
    }

    exit;
    22 changes: 22 additions & 0 deletions app-schemas-settings-actions.functions.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    diff --git a/app/schemas/settings/actions.functions.php b/app/schemas/settings/actions.functions.php
    index 8d747bd..52cdf4d 100644
    --- a/app/schemas/settings/actions.functions.php
    +++ b/app/schemas/settings/actions.functions.php
    @@ -40,7 +40,7 @@ function fn_settings_actions_security_secure_storefront(&$new_value, $old_value)
    Settings::instance()->updateValue('secure_storefront', 'none', 'Security');
    $new_value = 'none';

    - fn_set_notification('W', __('warning'), __('warning_https_is_disabled'));
    + fn_set_notification('W', __('warning'), __('warning_https_disabled'));
    }
    }
    }
    @@ -66,7 +66,7 @@ function fn_settings_actions_security_secure_admin(&$new_value, $old_value)
    Settings::instance()->updateValue('secure_admin', 'N', 'Security');
    $new_value = 'N';

    - fn_set_notification('W', __('warning'), __('warning_https_is_disabled'));
    + fn_set_notification('W', __('warning'), __('warning_https_disabled'));
    }
    }
    }
    13 changes: 13 additions & 0 deletions design-backend-mail-templates-profiles-usergroup_request.tpl.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    diff --git a/design/backend/mail/templates/profiles/usergroup_request.tpl b/design/backend/mail/templates/profiles/usergroup_request.tpl
    index b0d5cd8..23241d3 100644
    --- a/design/backend/mail/templates/profiles/usergroup_request.tpl
    +++ b/design/backend/mail/templates/profiles/usergroup_request.tpl
    @@ -5,7 +5,7 @@
    <table>
    <tr>
    <td>{__("usergroup")}:</td>
    - <td><b>{$usergroup}</b></td>
    + <td><b>{$usergroups.$usergroup_id.usergroup}</b></td>
    </tr>
    <tr>
    <td>{__("person_name")}:</td>
    16 changes: 16 additions & 0 deletions design-backend-templates-views-datakeeper-manage.tpl.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    diff --git a/design/backend/templates/views/datakeeper/manage.tpl b/design/backend/templates/views/datakeeper/manage.tpl
    index f4a4f90..6972156 100644
    --- a/design/backend/templates/views/datakeeper/manage.tpl
    +++ b/design/backend/templates/views/datakeeper/manage.tpl
    @@ -52,8 +52,10 @@
    <p class="no-items">{__("no_items")}</p>
    {/if}
    {/hook}
    +
    </form>
    - <!--backup_management--></div>
    + <!--backup_management-->
    + </div>
    {capture name="upload_backup"}
    {** UPLOAD BACKUP **}
    <div class="install-addon" id="content_upload_backup">
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    diff --git a/design/backend/templates/views/payments/components/cc_processors/dibs.tpl b/design/backend/templates/views/payments/components/cc_processors/dibs.tpl
    index 450fa43..e165788 100644
    --- a/design/backend/templates/views/payments/components/cc_processors/dibs.tpl
    +++ b/design/backend/templates/views/payments/components/cc_processors/dibs.tpl
    @@ -88,7 +88,6 @@
    <option value="default"{if $processor_params.decorator == 'default'} selected="selected"{/if}>Default</option>
    <option value="basal"{if $processor_params.decorator == 'basal'} selected="selected"{/if}>Basal</option>
    <option value="rich"{if $processor_params.decorator == 'rich'} selected="selected"{/if}>Rich</option>
    - <option value="responsive"{if $processor_params.decorator == 'responsive'} selected="selected"{/if}>Responsive</option>
    </select>
    </div>
    </div>
    @@ -97,8 +96,8 @@
    <label class="control-label" for="skiplastpage">{__("skiplastpage")}:</label>
    <div class="controls">
    <select name="payment_data[processor_params][skiplastpage]" id="skiplastpage">
    - <option value="yes"{if $processor_params.skiplastpage == 'yes'} selected="selected"{/if}>{__("yes")}</option>
    - <option value="no"{if $processor_params.skiplastpage == 'no'} selected="selected"{/if}>{__("no")}</option>
    + <option value="yes"{if $processor_params.skiplastpage == 'yes'} selected="selected"{/if}>Yes</option>
    + <option value="no"{if $processor_params.skiplastpage == 'no'} selected="selected"{/if}>No</option>
    </select>
    </div>
    </div>
    @@ -108,4 +107,4 @@
    <div class="controls">
    <input type="text" name="payment_data[processor_params][order_prefix]" id="order_prefix" value="{$processor_params.order_prefix}" size="60">
    </div>
    -</div>
    +</div>
    \ No newline at end of file
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    diff --git a/design/backend/templates/views/settings_wizard/components/ssl_checking.tpl b/design/backend/templates/views/settings_wizard/components/ssl_checking.tpl
    index dcd9d02..e5e2b8b 100644
    --- a/design/backend/templates/views/settings_wizard/components/ssl_checking.tpl
    +++ b/design/backend/templates/views/settings_wizard/components/ssl_checking.tpl
    @@ -3,7 +3,7 @@
    <br>
    <div class="alert alert-block alert-error fade in">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
    - <p>{__("warning_https_is_disabled")}</p>
    + <p>{__("warning_https_disabled")}</p>
    </div>
    {/if}
    <br>
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    diff --git a/design/themes/responsive/templates/addons/form_builder/hooks/pages/page_content.override.tpl b/design/themes/responsive/templates/addons/form_builder/hooks/pages/page_content.override.tpl
    index 8d2f6e3..49ba2e7 100644
    --- a/design/themes/responsive/templates/addons/form_builder/hooks/pages/page_content.override.tpl
    +++ b/design/themes/responsive/templates/addons/form_builder/hooks/pages/page_content.override.tpl
    @@ -128,7 +128,9 @@

    </form>

    + {/if}
    +
    + {hook name="pages:page_content"}{/hook}
    +
    </div>
    -{/if}
    - {hook name="pages:page_content"}{/hook}
    {/if}
    \ No newline at end of file
    12 changes: 12 additions & 0 deletions install-app-Installer-App.php.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    diff --git a/install/app/Installer/App.php b/install/app/Installer/App.php
    index ad817f8..4773d15 100644
    --- a/install/app/Installer/App.php
    +++ b/install/app/Installer/App.php
    @@ -137,7 +137,6 @@ class App
    'fn.fs.php',
    'fn.cms.php',
    'fn.cart.php',
    - 'fn.catalog.php',
    'fn.common.php',
    'fn.control.php',
    'fn.init.php',
    20 changes: 20 additions & 0 deletions js-tygh-core.js.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    diff --git a/js/tygh/core.js b/js/tygh/core.js
    index a367116..0baa01f 100644
    --- a/js/tygh/core.js
    +++ b/js/tygh/core.js
    @@ -1045,13 +1045,13 @@ var Tygh = {
    });

    // Check if cookie is enabled.
    - if(typeof Modernizr !== 'undefined' && Modernizr.cookies == false) {
    + if(Modernizr.cookies == false) {
    $.ceNotification('show', {
    title: _.tr('warning'),
    message: _.tr('cookie_is_disabled')
    });
    }
    -
    +
    return true;
    },

    13 changes: 13 additions & 0 deletions js-tygh-theme_editor.js.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    diff --git a/js/tygh/theme_editor.js b/js/tygh/theme_editor.js
    index e56995f..13caa2b 100644
    --- a/js/tygh/theme_editor.js
    +++ b/js/tygh/theme_editor.js
    @@ -168,7 +168,7 @@
    }
    }

    - if (typeof _.te_custom_fonts !== 'undefined' && _.te_custom_fonts.length) {
    + if (_.te_custom_fonts.length) {
    lis['custom'] = '';
    for (i = 0; i < _.te_custom_fonts.length; i++) {
    lis['custom'] += '<li style="font-family: ' + _.te_custom_fonts[i] + '" data-ca-select-box-value="' + _.te_custom_fonts[i] + '">' + _.te_custom_fonts[i] + '</li>';
    53 changes: 53 additions & 0 deletions var-langs-en-core.po.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    diff --git a/var/langs/en/core.po b/var/langs/en/core.po
    index 067561f..991f7d9 100644
    --- a/var/langs/en/core.po
    +++ b/var/langs/en/core.po
    @@ -1364,10 +1364,6 @@ msgctxt "Languages::broken_po_pack"
    msgid "Incorrect PO-pack structure. The uploaded pack cannot be installed."
    msgstr "Incorrect PO-pack structure. The uploaded pack cannot be installed."

    -msgctxt "Languages::incorrect_po_pack_structure"
    -msgid "The structure of package that contains \".po\" translation files located at <b>\"[pack_path]\"</b> is incorrect."
    -msgstr "The structure of package that contains \".po\" translation files located at <b>\"[pack_path]\"</b> is incorrect."
    -
    msgctxt "Languages::browse"
    msgid "Browse..."
    msgstr "Browse..."
    @@ -13032,9 +13028,9 @@ msgctxt "Languages::default_currency_status"
    msgid "Status of the Primary currency cannot be changed"
    msgstr "Status of the Primary currency cannot be changed"

    -msgctxt "Languages::warning_https_is_disabled"
    -msgid "The secure connection check has failed. Please ensure that SSL certificate is installed on your server."
    -msgstr "The secure connection check has failed. Please ensure that SSL certificate is installed on your server."
    +msgctxt "Languages::warning_https_disabled"
    +msgid "The secure connection check has failed. Please check HTTPS settings in the \"config.php\" file and make sure that SSL certificate is installed on your server."
    +msgstr "The secure connection check has failed. Please check HTTPS settings in the \"config.php\" file and make sure that SSL certificate is installed on your server."

    msgctxt "Languages::warning_insecure_admin_script"
    msgid "It is strongly recommended that you rename the default <b>admin.php</b> script (check the <a href=\"[href]\" target=\"_blank\">Knowledge base</a>) for security reasons."
    @@ -13360,9 +13356,9 @@ msgctxt "Languages::development"
    msgid "Development"
    msgstr "Development"

    -msgctxt "Languages::po_file_is_incorrect"
    -msgid "PO-file <b>\"[file]\"</b> contains syntax errors or incorrect structure."
    -msgstr "PO-file <b>\"[file]\"</b> contains syntax errors or incorrect structure."
    +msgctxt "Languages::check_po_file"
    +msgid "PO-file contains syntax errors or incorrect structure. Please re-check it and upload again."
    +msgstr "PO-file contains syntax errors or incorrect structure. Please re-check it and upload again."

    msgctxt "Languages::product_option_delimiter"
    msgid "Option delimiter"
    @@ -15812,11 +15808,3 @@ msgstr "I agree and continue"
    msgctxt "Languages::upgrade_center.error_unable_to_prepare_restore"
    msgid "Unable to prepare restore script."
    msgstr "Unable to prepare restore script."
    -
    -msgctxt "Languages::text_cc_javascript_disabled"
    -msgid "Note! Your browser has the <b>JavaScript</b> disabled. To pay for your order click"
    -msgstr "Note! Your browser has the <b>JavaScript</b> disabled. To pay for your order click"
    -
    -msgctxt "Languages::cc_button_submit"
    -msgid "Proceed to checkout"
    -msgstr "Proceed to checkout"