From d9aacba7eb06dfce23395c0163a52b7370d97fb7 Mon Sep 17 00:00:00 2001 From: MrSwed Date: Tue, 18 Nov 2014 18:06:50 +0300 Subject: [PATCH 1/9] [+] array version of #1 and #2 - in_array() used --- assets/snippets/ditto/classes/filter.class.inc.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/assets/snippets/ditto/classes/filter.class.inc.php b/assets/snippets/ditto/classes/filter.class.inc.php index 6f874f1a64..6d2056ac85 100644 --- a/assets/snippets/ditto/classes/filter.class.inc.php +++ b/assets/snippets/ditto/classes/filter.class.inc.php @@ -128,12 +128,20 @@ function basicFilter ($value) { if (trim($ii) == trim($iii)) $check++; } - - } + } } $unset = $check>0 ? 1 : 0; unset($val,$check); - break; + break; + // Cases 21-22 created by Sergey Davydov 08.11.2011 + case 21 : // array version of #1 - exlude records that do not in miltiple values such a "65||115" and have output delimeted list by comma + if (!isset ($value[$this->array_key]) || !in_array($this->filterValue,explode(',',$value[$this->array_key]))) + $unset = 0; + break; + case 22 : // array version of #2 - exlude records that in miltiple values such a "65||115" and have output delimeted list by comma + if (in_array($this->filterValue,explode(',',$value[$this->array_key]))) + $unset = 0; + break; } return $unset; } From 3db4296f506b718ff521912947ae8025a8a1016c Mon Sep 17 00:00:00 2001 From: MrSwed Date: Tue, 18 Nov 2014 18:15:12 +0300 Subject: [PATCH 2/9] [+] Ukrainian characters --- assets/plugins/transalias/transliterations/russian.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/plugins/transalias/transliterations/russian.php b/assets/plugins/transalias/transliterations/russian.php index af62f13dfa..a3f4b304d0 100755 --- a/assets/plugins/transalias/transliterations/russian.php +++ b/assets/plugins/transalias/transliterations/russian.php @@ -38,5 +38,6 @@ 'Я'=>'ya','а'=>'a','б'=>'b','в'=>'v','г'=>'g','д'=>'d','е'=>'e','ё'=>'yo','ж'=>'zh','з'=>'z', 'и'=>'i','й'=>'j','к'=>'k','л'=>'l','м'=>'m','н'=>'n','о'=>'o','п'=>'p','р'=>'r','с'=>'s', 'т'=>'t','у'=>'u','ф'=>'f','х'=>'h','ц'=>'c','ч'=>'ch','ш'=>'sh','щ'=>'shh','ъ'=>'','ы'=>'y', -'ь'=>'','э'=>'e','ю'=>'yu','я'=>'ya' +'ь'=>'','э'=>'e','є'=>'e','ю'=>'yu','я'=>'ya', +'Є'=>'e','є'=>'e','І'=>'i','і'=>'i','Ї'=>'i','ї'=>'i','Ґ'=>'g','ґ'=>'e', ); From bdf2d37d6534e1811f7eec1ca9f28fee2f3c7b5d Mon Sep 17 00:00:00 2001 From: MrSwed Date: Wed, 19 Nov 2014 18:39:05 +0300 Subject: [PATCH 3/9] [*] word boundary do NOT working with utf8 on some servers Php5.2.17, PCRE version 8.20 2011-10-21 Compiled with UTF-8 support Unicode properties support --- .../ajaxSearch/classes/ajaxSearchResults.class.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php b/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php index 782697a845..30af2bdd08 100644 --- a/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php +++ b/assets/snippets/ajaxSearch/classes/ajaxSearchResults.class.inc.php @@ -529,7 +529,7 @@ function _getExtract($text, $searchString, $advSearch, $highlightClass, &$nbExtr $wordLength = $mbStrlen($searchTerm); $wordLength2 = $wordLength / 2; // $pattern = '/' . preg_quote($searchTerm, '/') . $lookAhead . '/' . $pcreModifier; - if ($advSearch == EXACTPHRASE) $pattern = '/\b' . preg_quote($searchTerm, '/') . '\b/' . $pcreModifier; + if ($advSearch == EXACTPHRASE) $pattern = '/(\b|\W)' . preg_quote($searchTerm, '/') . '(\b|\W)/' . $pcreModifier; else $pattern = '/' . preg_quote($searchTerm, '/') . '/' . $pcreModifier; $matches = array(); $nbr = preg_match_all($pattern, $text, $matches, PREG_OFFSET_CAPTURE); @@ -592,7 +592,7 @@ function _getExtract($text, $searchString, $advSearch, $highlightClass, &$nbExtr if ($this->asCfg->cfg['highlightResult']) { $rank = $extracts[$i]['rank']; $searchTerm = $searchList[$rank - 1]; - if ($advSearch == EXACTPHRASE) $pattern = '/\b' . preg_quote($searchTerm, '/') . '\b/' . $pcreModifier; + if ($advSearch == EXACTPHRASE) $pattern = '/(\b|\W)' . preg_quote($searchTerm, '/') . '(\b|\W)/' . $pcreModifier; else $pattern = '/' . preg_quote($searchTerm, '/') . '/' . $pcreModifier; $subject = '\0'; $extract = preg_replace($pattern, $subject, $extract); @@ -881,7 +881,7 @@ function _doFilterTags($results, $searchString, $advSearch) { $searchList = $this->asCtrl->getSearchWords($searchString, $advSearch); $pcreModifier = $this->asCfg->pcreModifier; foreach ($searchList as $searchTerm) { - if ($advSearch == EXACTPHRASE) $pattern = '/\b' . preg_quote($searchTerm, '/') . '\b/' . $pcreModifier; + if ($advSearch == EXACTPHRASE) $pattern = '/(\b|\W)' . preg_quote($searchTerm, '/') . '(\b|\W)/' . $pcreModifier; else $pattern = '/' . preg_quote($searchTerm, '/') . '/' . $pcreModifier; $matches = array(); $found = preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE); From 0ca31ad12032d1b558e8fc0464d1b0689406c964 Mon Sep 17 00:00:00 2001 From: MrSwed Date: Fri, 21 Nov 2014 12:07:28 +0300 Subject: [PATCH 4/9] [+] phpthumb: determination of the original image file extension --- assets/snippets/phpthumb/snippet.phpthumb.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/snippets/phpthumb/snippet.phpthumb.php b/assets/snippets/phpthumb/snippet.phpthumb.php index 35e24c3af6..c5b507a652 100644 --- a/assets/snippets/phpthumb/snippet.phpthumb.php +++ b/assets/snippets/phpthumb/snippet.phpthumb.php @@ -15,8 +15,6 @@ file_put_contents(MODX_BASE_PATH . $cacheFolder . '/.htaccess', "order deny,allow\nallow from all\n"); } -$options = 'f=jpg&q=96&'.strtr($options, Array("," => "&", "_" => "=", '{' => '[', '}' => ']')); -parse_str($options, $params); if(!is_dir(MODX_BASE_PATH.$tmpFolder)) mkdir(MODX_BASE_PATH.$tmpFolder); @@ -24,7 +22,9 @@ $tmpImagesFolder=str_replace(MODX_BASE_PATH . "assets/images","",$path_parts['dirname']); $tmpImagesFolder=str_replace("assets/images","",$tmpImagesFolder); $tmpImagesFolder=explode("/",$tmpImagesFolder); - +$ext=strtolower($path_parts['extension']); +$options = 'f='.(in_array($ext,explode(",","jpg,png,gif"))?$ext:"jpg").'&q=96&'.strtr($options, Array("," => "&", "_" => "=", '{' => '[', '}' => ']')); +parse_str($options, $params); foreach ($tmpImagesFolder as $folder) { if (!empty($folder)) { $cacheFolder.="/".$folder; From 46e8457068325e63aaf4de4285c61286d4c99d88 Mon Sep 17 00:00:00 2001 From: MrSwed Date: Fri, 21 Nov 2014 15:05:31 +0300 Subject: [PATCH 5/9] [+] phpthumb encode decode cyr filenames --- assets/snippets/phpthumb/snippet.phpthumb.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/snippets/phpthumb/snippet.phpthumb.php b/assets/snippets/phpthumb/snippet.phpthumb.php index c5b507a652..8be5bea48f 100644 --- a/assets/snippets/phpthumb/snippet.phpthumb.php +++ b/assets/snippets/phpthumb/snippet.phpthumb.php @@ -5,6 +5,7 @@ $cacheFolder=isset($cacheFolder) ? $cacheFolder : "assets/cache/images"; $tmpFolder = 'assets/cache/tmp'; +if (!empty($input)) $input = rawurldecode($input); if(empty($input) || !file_exists(MODX_BASE_PATH . $input)){ $input = isset($noImage) ? $noImage : 'assets/snippets/phpthumb/noimage.png'; @@ -32,7 +33,7 @@ } } -$fname=$cacheFolder."/".$params['w']."x".$params['h'].'-'.$path_parts['filename'].".".substr(md5(serialize($params)),0,3).".".$params['f']; +$fname=$cacheFolder."/".$params['w']."x".$params['h'].'-'.rawurlencode($path_parts['filename']).".".substr(md5(serialize($params)),0,3).".".$params['f']; $outputFilename =MODX_BASE_PATH.$fname; if (!file_exists($outputFilename)) { require_once MODX_BASE_PATH.'assets/snippets/phpthumb/phpthumb.class.php'; From 70d0c8412dbe834c735b71feb3ba5843f221b6ed Mon Sep 17 00:00:00 2001 From: MrSwed Date: Fri, 21 Nov 2014 15:09:02 +0300 Subject: [PATCH 6/9] =?UTF-8?q?[*]=20&q=3D96=20makes=20no=20sense=20with?= =?UTF-8?q?=20png=20and=20gif=20(should=20be=20100=20there=20=E2=80=93=20o?= =?UTF-8?q?r=20better=20not=20provided)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/snippets/phpthumb/snippet.phpthumb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/snippets/phpthumb/snippet.phpthumb.php b/assets/snippets/phpthumb/snippet.phpthumb.php index 8be5bea48f..eef12d6462 100644 --- a/assets/snippets/phpthumb/snippet.phpthumb.php +++ b/assets/snippets/phpthumb/snippet.phpthumb.php @@ -24,7 +24,7 @@ $tmpImagesFolder=str_replace("assets/images","",$tmpImagesFolder); $tmpImagesFolder=explode("/",$tmpImagesFolder); $ext=strtolower($path_parts['extension']); -$options = 'f='.(in_array($ext,explode(",","jpg,png,gif"))?$ext:"jpg").'&q=96&'.strtr($options, Array("," => "&", "_" => "=", '{' => '[', '}' => ']')); +$options = 'f='.(in_array($ext,explode(",","png,gif"))?$ext:"jpg&q=96").'&'.strtr($options, Array("," => "&", "_" => "=", '{' => '[', '}' => ']')); parse_str($options, $params); foreach ($tmpImagesFolder as $folder) { if (!empty($folder)) { From dfb0ac40a29fa8e9dcb9984d77d42b107ca79ef7 Mon Sep 17 00:00:00 2001 From: MrSwed Date: Sun, 23 Nov 2014 15:55:01 +0300 Subject: [PATCH 7/9] [+] Display TV name during install --- install/action.options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/action.options.php b/install/action.options.php index 6a8f5b3393..3ab63b1772 100644 --- a/install/action.options.php +++ b/install/action.options.php @@ -119,7 +119,7 @@ for ($i = 0; $i < $limit; $i++) { $class = !in_array('sample', $moduleTVs[$i][12]) ? "toggle" : "toggle demo"; $chk = in_array($i, $tvs) || (!$options_selected) ? 'checked="checked"' : ""; - $tvOutput .= "" . $_lang['install_update'] . " " . $moduleTVs[$i][0] . " - " . $moduleTVs[$i][2] . "
\n"; + $tvOutput .= "" . $_lang['install_update'] . " " . $moduleTVs[$i][0] . " - {$moduleTVs[$i][1]} ({$moduleTVs[$i][2]})
\n"; } if($tvOutput != '') { echo "

" . $_lang['tvs'] . "


\n"; From 3c0b38d006497ca1290777633f4e4aaa05481ab2 Mon Sep 17 00:00:00 2001 From: MrSwed Date: Sun, 23 Nov 2014 15:55:51 +0300 Subject: [PATCH 8/9] [+] Install: styles for component names and description --- install/style.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install/style.css b/install/style.css index 65c2efac5c..2373ed9b9a 100755 --- a/install/style.css +++ b/install/style.css @@ -383,6 +383,12 @@ font-size:1.3em; #rtl #installChoices input { margin: 0 0 10px 10px; } +#installChoices .comname { + font-weight: bold; +} +#installChoices .description { + font-size: 0.9em; +} p.labelHolder { clear: left; From 9b0a873ee09d0f909223e01891105cdc3f91d22e Mon Sep 17 00:00:00 2001 From: MrSwed Date: Thu, 27 Nov 2014 23:59:41 +0300 Subject: [PATCH 9/9] [+] phpthumb: encode only returned filenames --- assets/snippets/phpthumb/snippet.phpthumb.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/snippets/phpthumb/snippet.phpthumb.php b/assets/snippets/phpthumb/snippet.phpthumb.php index eef12d6462..ecee972a61 100644 --- a/assets/snippets/phpthumb/snippet.phpthumb.php +++ b/assets/snippets/phpthumb/snippet.phpthumb.php @@ -33,8 +33,9 @@ } } -$fname=$cacheFolder."/".$params['w']."x".$params['h'].'-'.rawurlencode($path_parts['filename']).".".substr(md5(serialize($params)),0,3).".".$params['f']; -$outputFilename =MODX_BASE_PATH.$fname; +$fname_preffix=$cacheFolder."/".$params['w']."x".$params['h'].'-'; +$fname = $path_parts['filename'].".".substr(md5(serialize($params)),0,3).".".$params['f']; +$outputFilename =MODX_BASE_PATH.$fname_preffix.$fname; if (!file_exists($outputFilename)) { require_once MODX_BASE_PATH.'assets/snippets/phpthumb/phpthumb.class.php'; $phpThumb = new phpthumb(); @@ -49,5 +50,5 @@ $modx->logEvent(0, 3, implode('
', $phpThumb->debugmessages), 'phpthumb'); } } -return $fname; +return $fname_preffix.rawurlencode($fname); ?> \ No newline at end of file