packages: phorum/phorum.spec, phorum/enable-mbstring.patch (NEW), phorum/no...

glen glen at pld-linux.org
Wed Feb 10 16:57:38 CET 2010


Author: glen                         Date: Wed Feb 10 15:57:38 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- drop pear copy of json, avoid using substr on utf8 data by forcing mbstring in

---- Files affected:
packages/phorum:
   phorum.spec (1.43 -> 1.44) , enable-mbstring.patch (NONE -> 1.1)  (NEW), no-pear-json.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/phorum/phorum.spec
diff -u packages/phorum/phorum.spec:1.43 packages/phorum/phorum.spec:1.44
--- packages/phorum/phorum.spec:1.43	Wed Feb 10 16:45:05 2010
+++ packages/phorum/phorum.spec	Wed Feb 10 16:57:32 2010
@@ -8,7 +8,7 @@
 Summary(pl.UTF-8):	Phorum - implementacja forum WWW w PHP
 Name:		phorum
 Version:	%{mainver}.14
-Release:	0.53
+Release:	0.57
 License:	Apache-like
 Group:		Applications/WWW
 Source0:	http://www.phorum.org/downloads/%{name}-%{version}.tar.bz2
@@ -23,18 +23,21 @@
 Patch2:		docsurl.patch
 Patch3:		sys-phpmailer.patch
 Patch4:		sys-recaptcha.patch
+Patch5:		enable-mbstring.patch
+Patch6:		no-pear-json.patch
 URL:		http://www.phorum.org/
 BuildRequires:	glibc-misc
 BuildRequires:	rpmbuild(macros) >= 1.268
 Requires:	%{name}(DB_Provider)
 Requires:	php-date
 Requires:	php-gd
+Requires:	php-json
+Requires:	php-mbstring
 Requires:	php-pcre
 Requires:	webapps
 Requires:	webserver(access)
 Requires:	webserver(alias)
 Requires:	webserver(php) >= %{php_min_version}
-Suggests:	php-mbstring
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -42,7 +45,7 @@
 %define		_noautopear	pear
 
 # exclude optional php dependencies
-%define		_noautophp	php-mbstring
+%define		_noautophp	%{nil}
 
 # put it together for rpmbuild
 %define		_noautoreq	%{?_noautophp} %{?_noautopear}
@@ -259,6 +262,9 @@
 rm -rf mods/spamhurdles/captcha/recaptcha-php-1.9
 rm -f mods/spamhurdles/MANIFEST
 
+# php-json
+rm -f include/api/json-pear.php
+
 mv include/db/config.php.sample .
 mv include/api/examples examples/api
 mv docs/example_mods examples/mods
@@ -319,6 +325,8 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 # cleanup backups after patching
 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
@@ -594,6 +602,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.44  2010/02/10 15:57:32  glen
+- drop pear copy of json, avoid using substr on utf8 data by forcing mbstring in
+
 Revision 1.43  2010/02/10 15:45:05  glen
 - subpackages for mysql and mysqli db drivers
 - update deps and generate them

================================================================
Index: packages/phorum/enable-mbstring.patch
diff -u /dev/null packages/phorum/enable-mbstring.patch:1.1
--- /dev/null	Wed Feb 10 16:57:38 2010
+++ packages/phorum/enable-mbstring.patch	Wed Feb 10 16:57:32 2010
@@ -0,0 +1,31 @@
+--- phorum/common.php~	2010-02-10 17:40:57.000000000 +0200
++++ phorum/common.php	2010-02-10 17:45:45.039565976 +0200
+@@ -2153,28 +2153,3 @@
+ 
+     exit();
+ }
+-
+-// For safely doing substr() operations on strings that contain
+-// multi-byte characters (which can happen when using UTF-8), we
+-// need mb_substr(). Unfortunately, this function is part of a
+-// PHP extension and we can therefore not be sure that it is
+-// available in the PHP installation.
+-//
+-// Here we implement mb_substr() ourselves in case it is not
+-// available, so we can safely use it in our code.
+-if (!function_exists('mb_substr'))
+-{
+-    // For now, we implement mb_substr simply as substr().
+-    // We need to think about adding a check for broken multi-byte
+-    // characters at the end of the resulting substring.
+-    function mb_substr($str, $start, $length = NULL, $encoding = NULL)
+-    {
+-        if ($length) {
+-            return substr($str, $start, $length);
+-        } else {
+-            return substr($str, $start);
+-        }
+-    }
+-}
+-
+-?>

================================================================
Index: packages/phorum/no-pear-json.patch
diff -u /dev/null packages/phorum/no-pear-json.patch:1.1
--- /dev/null	Wed Feb 10 16:57:38 2010
+++ packages/phorum/no-pear-json.patch	Wed Feb 10 16:57:32 2010
@@ -0,0 +1,48 @@
+--- phorum/include/api/json.php~	2010-02-10 17:40:56.000000000 +0200
++++ phorum/include/api/json.php	2010-02-10 17:47:36.549956833 +0200
+@@ -33,45 +33,6 @@
+ 
+ if (!defined('PHORUM')) return;
+ 
+-if (!function_exists('json_decode'))
+-{
+-    function json_decode($content, $assoc=false)
+-    {
+-        require_once PHORUM_INCLUDES_DIR.'/api/json-pear.php';
+-
+-        static $json_a;
+-        static $json_b;
+-
+-        if ($assoc) {
+-            if (!$json_a) {
+-                $json_a = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
+-            }
+-            $json = $json_a;
+-        } else {
+-            if (!$json_b) {
+-                $json_b = new Services_JSON;
+-            }
+-            $json = $json_b;
+-        }
+-
+-        return $json->decode($content);
+-    }
+-}
+- 
+-if (!function_exists('json_encode'))
+-{
+-    function json_encode($content)
+-    {
+-        require_once PHORUM_INCLUDES_DIR.'/api/json-pear.php';
+-
+-        static $json;
+-        if (!$json) {
+-            $json = new Services_JSON;
+-        }
+-        return $json->encode($content);
+-    }
+-}
+-
+ // {{{ Function: phorum_api_json_encode()
+ function phorum_api_json_encode($var)
+ {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/phorum/phorum.spec?r1=1.43&r2=1.44&f=u



More information about the pld-cvs-commit mailing list