echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
-if($build != DB_UPDATE_VERSION) {
+if ($build != DB_UPDATE_VERSION) {
echo "Updating database...";
check_db($a);
echo "Done\n";
*/
function namesList($fileset) {
$fsparam="";
- foreach($fileset as $file) {
+ foreach ($fileset as $file) {
$fsparam=$fsparam.",".$file;
}
return $fsparam;
function runs($fileset) {
$fsParam=namesList($fileset);
exec('docblox -t phpdoc_out -f '.$fsParam);
- if(file_exists("phpdoc_out/index.html")) {
+ if (file_exists("phpdoc_out/index.html")) {
echo "\n Subset ".$fsParam." is okay. \n";
exec('rm -r phpdoc_out');
return true;
//filter working subsets...
$parts=array_filter($parts, "runs");
//melt remaining parts together
- if(is_array($parts)) {
+ if (is_array($parts)) {
return array_reduce($parts, "array_merge", array());
}
return array();
$filelist=array();
//loop over all files in $dir
-while($dh=opendir($dir)) {
- while($file=readdir($dh)) {
- if(is_dir($dir."/".$file)) {
+while ($dh=opendir($dir)) {
+ while ($file=readdir($dh)) {
+ if (is_dir($dir."/".$file)) {
//add to directory stack
- if($file!=".." && $file!=".") {
+ if ($file!=".." && $file!=".") {
array_push($dirstack, $dir."/".$file);
echo "dir ".$dir."/".$file."\n";
}
} else {
//test if it is a source file and add to filelist
- if(substr($file, strlen($file)-4)==".php") {
+ if (substr($file, strlen($file)-4)==".php") {
array_push($filelist, $dir."/".$file);
echo $dir."/".$file."\n";
}
}
//check the entire set
-if(runs($filelist)) {
+if (runs($filelist)) {
echo "I can not detect a problem. \n";
exit;
}
echo $i."/".count($fileset)." elements remaining. \n";
$res=reduce($res, count($res)/2);
shuffle($res);
-} while(count($res)<$i);
+} while (count($res)<$i);
//check one file after another
$needed=array();
-while(count($res)!=0) {
+while (count($res)!=0) {
$file=array_pop($res);
- if(runs(array_merge($res, $needed))) {
+ if (runs(array_merge($res, $needed))) {
echo "needs: ".$file." and file count ".count($needed);
array_push($needed, $file);
}
$files = array_merge($files,glob('mod/*'),glob('include/*'),glob('addon/*/*'));
- foreach($files as $file) {
+ foreach ($files as $file) {
$str = file_get_contents($file);
$pat = '| t\(([^\)]*)\)|';
preg_match_all($patt, $str, $matchestt);
- if(count($matches)){
- foreach($matches[1] as $match) {
- if(! in_array($match,$arr))
+ if (count($matches)){
+ foreach ($matches[1] as $match) {
+ if (! in_array($match,$arr))
$arr[] = $match;
}
}
- if(count($matchestt)){
- foreach($matchestt[1] as $match) {
+ if (count($matchestt)){
+ foreach ($matchestt[1] as $match) {
$matchtkns = preg_split("|[ \t\r\n]*,[ \t\r\n]*|",$match);
if (count($matchtkns)==3 && !in_array($matchtkns,$arr)){
$arr[] = $matchtkns;
';
- foreach($arr as $a) {
+ foreach ($arr as $a) {
if (is_array($a)){
- if(substr($a[1],0,1) == '$')
+ if (substr($a[1],0,1) == '$') {
continue;
+ }
$s .= '$a->strings[' . $a[0] . "] = array(\n";
$s .= "\t0 => ". $a[0]. ",\n";
$s .= "\t1 => ". $a[1]. ",\n";
$s .= ");\n";
} else {
- if(substr($a,0,1) == '$')
- continue;
+ if (substr($a,0,1) == '$') {
+ continue;
+ }
$s .= '$a->strings[' . $a . '] = '. $a . ';' . "\n";
}
}
$zones = timezone_identifiers_list();
- foreach($zones as $zone)
+ foreach ($zones as $zone) {
$s .= '$a->strings[\'' . $zone . '\'] = \'' . $zone . '\';' . "\n";
-
+ }
+
echo $s;
\ No newline at end of file
Config::load();
$maint_mode = 1;
-if($argc > 1)
+if ($argc > 1) {
$maint_mode = intval($argv[1]);
+}
set_config('system', 'maintenance', $maint_mode);
-if($maint_mode)
+if ($maint_mode) {
$mode_str = "maintenance mode";
-else
+} else {
$mode_str = "normal mode";
+}
echo "\n\tSystem set in $mode_str\n\n";
echo "Usage:\n\n";
DEFINE("NORM_REGEXP", "|[\\\]|");
- if(! class_exists('App')) {
+ if (! class_exists('App')) {
class TmpA {
public $strings = Array();
}
}
$infile = file($phpfile);
- foreach($infile as $l) {
+ foreach ($infile as $l) {
$l = trim($l);
if (startsWith($l, 'function string_plural_select_')) {
$lang = str_replace( 'function string_plural_select_' , '', str_replace( '($n){','', $l) );
$norm_base_msgids = array();
$base_f = file("util/messages.po") or die("No base messages.po\n");
$_f = 0; $_mid = ""; $_mids = array();
- foreach( $base_f as $l) {
+ foreach ( $base_f as $l) {
$l = trim($l);
//~ print $l."\n";
}
$warnings = "";
- foreach($a->strings as $key=>$str) {
+ foreach ($a->strings as $key=>$str) {
$msgid = massage_string($key);
if (preg_match("|%[sd0-9](\$[sn])*|", $msgid)) {
foreach ($infile as $l) {
$l = str_replace('\"', DQ_ESCAPE, $l);
$len = strlen($l);
- if ($l[0]=="#") $l="";
- if (substr($l,0,15)=='"Plural-Forms: '){
+ if ($l[0]=="#") {
+ $l="";
+ }
+ if (substr($l,0,15) == '"Plural-Forms: '){
$match=Array();
preg_match("|nplurals=([0-9]*); *plural=(.*)[;\\\\]|", $l, $match);
$cond = str_replace('n','$n',$match[2]);
// define plural select function if not already defined
$fnname = 'string_plural_select_' . $lang;
- $out .= 'if(! function_exists("'.$fnname.'")) {'."\n";
+ $out .= 'if (! function_exists("'.$fnname.'")) {'."\n";
$out .= 'function '. $fnname . '($n){'."\n";
$out .= ' return '.$cond.';'."\n";
$out .= '}}'."\n";
}
-
-
-
- if ($k!="" && substr($l,0,7)=="msgstr "){
- if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
- if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
+ if ($k!="" && substr($l,0,7) == "msgstr "){
+ if ($ink) {
+ $ink = False;
+ $out .= '$a->strings["'.$k.'"] = ';
+ }
+ if ($inv) {
+ $inv = False;
+ $out .= '"'.$v.'"';
+ }
$v = substr($l,8,$len-10);
$v = preg_replace_callback($escape_s_exp,'escape_s',$v);
$inv = True;
//$out .= $v;
}
- if ($k!="" && substr($l,0,7)=="msgstr["){
- if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
- if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
+ if ($k!="" && substr($l,0,7) == "msgstr["){
+ if ($ink) {
+ $ink = False;
+ $out .= '$a->strings["'.$k.'"] = ';
+ }
+ if ($inv) {
+ $inv = False;
+ $out .= '"'.$v.'"';
+ }
if (!$arr) {
$arr=True;
if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; };
-
if ($ink) {
$k .= trim($l,"\"\r\n");
$k = preg_replace_callback($escape_s_exp,'escape_s',$k);
}
if (substr($l,0,6)=="msgid "){
- if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
- if ($k!="") $out .= $arr?");\n":";\n";
- $arr=False;
+ if ($inv) {
+ $inv = False;
+ $out .= '"'.$v.'"';
+ }
+ if ($k != "") {
+ $out .= $arr?");\n":";\n";
+ }
+ $arr = False;
$k = str_replace("msgid ","",$l);
if ($k != '""' ) {
$k = trim($k,"\"\r\n");
}
- if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
- if ($k!="") $out .= $arr?");\n":";\n";
+ if ($inv) {
+ $inv = False;
+ $out .= '"'.$v.'"';
+ }
+ if ($k!="") {
+ $out .= $arr?");\n":";\n";
+ }
$out = str_replace(DQ_ESCAPE, '\"', $out);
file_put_contents($outfile, $out);
<?php
- // Tired of chasing typos and finding them after a commit.
- // Run this from cmdline in basedir and quickly see if we've
- // got any parse errors in our application files.
-
-
- error_reporting(E_ERROR | E_WARNING | E_PARSE );
- ini_set('display_errors', '1');
- ini_set('log_errors','0');
-
- include 'boot.php';
-
- $a = new App();
-
- if(x($a->config,'php_path'))
- $phpath = $a->config['php_path'];
- else
- $phpath = 'php';
-
-
- echo "Directory: mod\n";
- $files = glob('mod/*.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
-
- echo "Directory: include\n";
- $files = glob('include/*.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
-
- echo "Directory: object\n";
- $files = glob('object/*.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
-
- echo "Directory: addon\n";
- $dirs = glob('addon/*');
-
- foreach($dirs as $dir) {
- $addon = basename($dir);
- $files = glob($dir . '/' . $addon . '.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+// Tired of chasing typos and finding them after a commit.
+// Run this from cmdline in basedir and quickly see if we've
+// got any parse errors in our application files.
+
+
+error_reporting(E_ERROR | E_WARNING | E_PARSE );
+ini_set('display_errors', '1');
+ini_set('log_errors','0');
+
+include 'boot.php';
+
+$a = new App();
+
+if (x($a->config,'php_path')) {
+ $phpath = $a->config['php_path'];
+} else {
+ $phpath = 'php';
+}
+
+echo "Directory: mod\n";
+$files = glob('mod/*.php');
+foreach ($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
+
+echo "Directory: include\n";
+$files = glob('include/*.php');
+foreach ($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
+
+echo "Directory: object\n";
+$files = glob('object/*.php');
+foreach ($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}
+
+echo "Directory: addon\n";
+$dirs = glob('addon/*');
+
+foreach ($dirs as $dir) {
+ $addon = basename($dir);
+ $files = glob($dir . '/' . $addon . '.php');
+ foreach ($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
}
+}
+echo "String files\n";
- echo "String files\n";
+echo 'util/strings.php' . "\n";
+passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
- echo 'util/strings.php' . "\n";
- passthru("$phpath -l util/strings.php", $ret); $ret===0 or die();
-
- $files = glob('view/lang/*/strings.php');
- foreach($files as $file) {
- passthru("$phpath -l $file", $ret); $ret===0 or die();
- }
+$files = glob('view/lang/*/strings.php');
+foreach ($files as $file) {
+ passthru("$phpath -l $file", $ret); $ret===0 or die();
+}