[Fusionforge-commits] FusionForge branch master updated. f9382ee1587733dbeeef9da610f82fe26a0b19f7

Alain Peyrat aljeux at fusionforge.org
Fri Aug 30 18:07:02 CEST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  f9382ee1587733dbeeef9da610f82fe26a0b19f7 (commit)
      from  67092f0e4252abc0ed562affd4ad46e93059b6a5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f9382ee1587733dbeeef9da610f82fe26a0b19f7
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date:   Fri Aug 30 18:06:51 2013 +0200

    Indent

diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 5a48791..16ddb95 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -32,32 +32,36 @@
  * From http://www.php.net/manual/en/function.crypt.php#73619
  */
 function htpasswd_apr1_md5($plainpasswd) {
-    $salt = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 8);
-    $len = strlen($plainpasswd);
-    $text = $plainpasswd.'$apr1$'.$salt;
-    $bin = pack("H32", md5($plainpasswd.$salt.$plainpasswd));
-    $tmp = '';
-    for($i = $len; $i > 0; $i -= 16) { $text .= substr($bin, 0, min(16, $i)); }
-    for($i = $len; $i > 0; $i >>= 1) { $text .= ($i & 1) ? chr(0) : $plainpasswd{0}; }
-    $bin = pack("H32", md5($text));
-    for($i = 0; $i < 1000; $i++) {
-        $new = ($i & 1) ? $plainpasswd : $bin;
-        if ($i % 3) $new .= $salt;
-        if ($i % 7) $new .= $plainpasswd;
-        $new .= ($i & 1) ? $bin : $plainpasswd;
-        $bin = pack("H32", md5($new));
-    }
-    for ($i = 0; $i < 5; $i++) {
-        $k = $i + 6;
-        $j = $i + 12;
-        if ($j == 16) $j = 5;
-        $tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
-    }
-    $tmp = chr(0).chr(0).$bin[11].$tmp;
-    $tmp = strtr(strrev(substr(base64_encode($tmp), 2)),
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
-    "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
-    return "$"."apr1"."$".$salt."$".$tmp;
+	$salt = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 8);
+	$len = strlen($plainpasswd);
+	$text = $plainpasswd.'$apr1$'.$salt;
+	$bin = pack("H32", md5($plainpasswd.$salt.$plainpasswd));
+	$tmp = '';
+	for ($i = $len; $i > 0; $i -= 16) {
+		$text .= substr($bin, 0, min(16, $i));
+	}
+	for ($i = $len; $i > 0; $i >>= 1) {
+		$text .= ($i & 1)? chr(0) : $plainpasswd{0};
+	}
+	$bin = pack("H32", md5($text));
+	for ($i = 0; $i < 1000; $i++) {
+		$new = ($i & 1)? $plainpasswd : $bin;
+		if ($i % 3) $new .= $salt;
+		if ($i % 7) $new .= $plainpasswd;
+		$new .= ($i & 1)? $bin : $plainpasswd;
+		$bin = pack("H32", md5($new));
+	}
+	for ($i = 0; $i < 5; $i++) {
+		$k = $i + 6;
+		$j = $i + 12;
+		if ($j == 16) $j = 5;
+		$tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
+	}
+	$tmp = chr(0).chr(0).$bin[11].$tmp;
+	$tmp = strtr(strrev(substr(base64_encode($tmp), 2)),
+		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
+		"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+	return "$"."apr1"."$".$salt."$".$tmp;
 }
 
 /**
@@ -66,29 +70,29 @@ function htpasswd_apr1_md5($plainpasswd) {
  * From http://www.php.net/manual/en/function.mb-detect-encoding.php#85294
  */
 function is_utf8($str) {
-    $c=0; $b=0;
-    $bits=0;
-    $len=strlen($str);
-    for($i=0; $i<$len; $i++){
-        $c=ord($str[$i]);
-        if($c > 128){
-            if(($c >= 254)) return false;
-            elseif($c >= 252) $bits=6;
-            elseif($c >= 248) $bits=5;
-            elseif($c >= 240) $bits=4;
-            elseif($c >= 224) $bits=3;
-            elseif($c >= 192) $bits=2;
-            else return false;
-            if(($i+$bits) > $len) return false;
-            while($bits > 1){
-                $i++;
-                $b=ord($str[$i]);
-                if($b < 128 || $b > 191) return false;
-                $bits--;
-            }
-        }
-    }
-    return true;
+	$c=0; $b=0;
+	$bits=0;
+	$len=strlen($str);
+	for($i=0; $i<$len; $i++){
+		$c=ord($str[$i]);
+		if($c > 128){
+			if(($c >= 254)) return false;
+			elseif($c >= 252) $bits=6;
+			elseif($c >= 248) $bits=5;
+			elseif($c >= 240) $bits=4;
+			elseif($c >= 224) $bits=3;
+			elseif($c >= 192) $bits=2;
+			else return false;
+			if(($i+$bits) > $len) return false;
+			while($bits > 1){
+				$i++;
+				$b=ord($str[$i]);
+				if($b < 128 || $b > 191) return false;
+				$bits--;
+			}
+		}
+	}
+	return true;
 }
 
 function util_strip_unprintable(&$data) {
@@ -96,8 +100,7 @@ function util_strip_unprintable(&$data) {
 		foreach ($data as $key => &$value) {
 			util_strip_unprintable($value);
 		}
-	}
-	else {
+	} else {
 		$data = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/', '', $data);
 	}
 	return $data;
@@ -145,7 +148,7 @@ function util_check_fileupload($filename) {
 		return false;
 	}
 	if ((dirname($filename) != '/tmp') &&
-            (dirname($filename) != "/var/tmp")) {
+		(dirname($filename) != "/var/tmp")) {
 		return false;
 	}
 	return true;
@@ -187,7 +190,6 @@ function util_send_message($to,$subject,$body,$from='',$BCC='',$sendername='',$e
 		$from='noreply@'.forge_get_config('web_host');
 	}
 
-
 	$charset = _('UTF-8');
 	if (!$charset) {
 		$charset = 'UTF-8';

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/utils.php |  108 +++++++++++++++++++++---------------------
 1 file changed, 55 insertions(+), 53 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list