Browse Source

Replaced $argv and $argc with the $_SERVER array

tags/3.3.3
Michael Vogel 4 years ago
parent
commit
cce561708a

+ 4
- 12
boot.php View File

@@ -435,7 +435,7 @@ if(! class_exists('App')) {
435 435
 
436 436
 		function __construct() {
437 437
 
438
-			global $default_timezone, $argv, $argc;
438
+			global $default_timezone;
439 439
 
440 440
 			$hostname = "";
441 441
 
@@ -504,9 +504,9 @@ if(! class_exists('App')) {
504 504
 			if ($hostname != "")
505 505
 				$this->hostname = $hostname;
506 506
 
507
-			if (is_array($argv) && $argc>1 && substr(end($argv), 0, 4)=="http" ) {
508
-				$this->set_baseurl(array_pop($argv) );
509
-				$argc --;
507
+			if (is_array($_SERVER["argv"]) && $_SERVER["argc"]>1 && substr(end($_SERVER["argv"]), 0, 4)=="http" ) {
508
+				$this->set_baseurl(array_pop($_SERVER["argv"]) );
509
+				$_SERVER["argc"] --;
510 510
 			}
511 511
 
512 512
 			#set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path());
@@ -2388,11 +2388,3 @@ if(!function_exists('exif_imagetype')) {
2388 2388
                 return($size[2]);
2389 2389
         }
2390 2390
 }
2391
-
2392
-// See https://github.com/friendica/friendica/issues/1218
2393
-// Try to get the values for $argv and $argc via the $_SERVER array
2394
-if (!isset($argv) && array_key_exists('argv', $_SERVER))
2395
-	$argv = $_SERVER['argv'];
2396
-
2397
-if (!isset($argc) && array_key_exists('argc', $_SERVER))
2398
-	$argc = $_SERVER['argc'];

+ 1
- 1
include/cronhooks.php View File

@@ -66,6 +66,6 @@ function cronhooks_run(&$argv, &$argc){
66 66
 }
67 67
 
68 68
 if (array_search(__file__,get_included_files())===0){
69
-  cronhooks_run($argv,$argc);
69
+  cronhooks_run($_SERVER["argv"],$_SERVER["argc"]);
70 70
   killme();
71 71
 }

+ 1
- 1
include/dbstructure.php View File

@@ -1339,6 +1339,6 @@ function dbstructure_run(&$argv, &$argc) {
1339 1339
 }
1340 1340
 
1341 1341
 if (array_search(__file__,get_included_files())===0){
1342
-	dbstructure_run($argv,$argc);
1342
+	dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);
1343 1343
 	killme();
1344 1344
 }

+ 1
- 1
include/dbupdate.php View File

@@ -23,6 +23,6 @@ function dbupdate_run(&$argv, &$argc) {
23 23
 }
24 24
 
25 25
 if (array_search(__file__,get_included_files())===0){
26
-  dbupdate_run($argv,$argc);
26
+  dbupdate_run($_SERVER["argv"],$_SERVER["argc"]);
27 27
   killme();
28 28
 }

+ 1
- 1
include/delivery.php View File

@@ -565,6 +565,6 @@ function delivery_run(&$argv, &$argc){
565 565
 }
566 566
 
567 567
 if (array_search(__file__,get_included_files())===0){
568
-  delivery_run($argv,$argc);
568
+  delivery_run($_SERVER["argv"],$_SERVER["argc"]);
569 569
   killme();
570 570
 }

+ 1
- 1
include/directory.php View File

@@ -46,6 +46,6 @@ function directory_run(&$argv, &$argc){
46 46
 }
47 47
 
48 48
 if (array_search(__file__,get_included_files())===0){
49
-  directory_run($argv,$argc);
49
+  directory_run($_SERVER["argv"],$_SERVER["argc"]);
50 50
   killme();
51 51
 }

+ 1
- 1
include/dsprphotoq.php View File

@@ -45,6 +45,6 @@ function dsprphotoq_run($argv, $argc){
45 45
 
46 46
 
47 47
 if (array_search(__file__,get_included_files())===0){
48
-  dsprphotoq_run($argv,$argc);
48
+  dsprphotoq_run($_SERVER["argv"],$_SERVER["argc"]);
49 49
   killme();
50 50
 }

+ 1
- 1
include/expire.php View File

@@ -55,6 +55,6 @@ function expire_run(&$argv, &$argc){
55 55
 }
56 56
 
57 57
 if (array_search(__file__,get_included_files())===0){
58
-  expire_run($argv,$argc);
58
+  expire_run($_SERVER["argv"],$_SERVER["argc"]);
59 59
   killme();
60 60
 }

+ 1
- 1
include/gprobe.php View File

@@ -63,6 +63,6 @@ function gprobe_run(&$argv, &$argc){
63 63
 }
64 64
 
65 65
 if (array_search(__file__,get_included_files())===0){
66
-  gprobe_run($argv,$argc);
66
+  gprobe_run($_SERVER["argv"],$_SERVER["argc"]);
67 67
   killme();
68 68
 }

+ 10
- 10
include/notifier.php View File

@@ -5,16 +5,16 @@ require_once('include/html2plain.php');
5 5
 
6 6
 /*
7 7
  * This file was at one time responsible for doing all deliveries, but this caused
8
- * big problems on shared hosting systems, where the process might get killed by the 
9
- * hosting provider and nothing would get delivered. 
8
+ * big problems on shared hosting systems, where the process might get killed by the
9
+ * hosting provider and nothing would get delivered.
10 10
  * It now only delivers one message under certain cases, and invokes a queued
11
- * delivery mechanism (include/deliver.php) to deliver individual contacts at 
11
+ * delivery mechanism (include/deliver.php) to deliver individual contacts at
12 12
  * controlled intervals.
13 13
  * This has a much better chance of surviving random processes getting killed
14
- * by the hosting provider. 
14
+ * by the hosting provider.
15 15
  * A lot of this code is duplicated in include/deliver.php until we have time to go back
16
- * and re-structure the delivery procedure based on the obstacles that have been thrown at 
17
- * us by hosting providers. 
16
+ * and re-structure the delivery procedure based on the obstacles that have been thrown at
17
+ * us by hosting providers.
18 18
  */
19 19
 
20 20
 /*
@@ -50,7 +50,7 @@ function notifier_run(&$argv, &$argc){
50 50
 	if(is_null($a)){
51 51
 		$a = new App;
52 52
 	}
53
-  
53
+
54 54
 	if(is_null($db)) {
55 55
 		@include(".htconfig.php");
56 56
 		require_once("include/dba.php");
@@ -946,7 +946,7 @@ function notifier_run(&$argv, &$argc){
946 946
 				}
947 947
 
948 948
 				if((! $mail) && (! $fsuggest) && (! $followup)) {
949
-					logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']); 
949
+					logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']);
950 950
 					proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
951 951
 					if($interval)
952 952
 						@time_sleep_until(microtime(true) + (float) $interval);
@@ -966,7 +966,7 @@ function notifier_run(&$argv, &$argc){
966 966
 					if ($h === '[internal]') {
967 967
 						// Set push flag for PuSH subscribers to this topic,
968 968
 						// they will be notified in queue.php
969
-						q("UPDATE `push_subscriber` SET `push` = 1 " . 
969
+						q("UPDATE `push_subscriber` SET `push` = 1 " .
970 970
 						  "WHERE `nickname` = '%s'", dbesc($owner['nickname']));
971 971
 					} else {
972 972
 
@@ -1001,6 +1001,6 @@ function notifier_run(&$argv, &$argc){
1001 1001
 
1002 1002
 
1003 1003
 if (array_search(__file__,get_included_files())===0){
1004
-  notifier_run($argv,$argc);
1004
+  notifier_run($_SERVER["argv"],$_SERVER["argc"]);
1005 1005
   killme();
1006 1006
 }

+ 3
- 3
include/onepoll.php View File

@@ -586,8 +586,8 @@ function onepoll_run(&$argv, &$argc){
586 586
 
587 587
 	// load current friends if possible.
588 588
 
589
-	if($contact['poco']) {	
590
-		$r = q("SELECT count(*) as total from glink 
589
+	if($contact['poco']) {
590
+		$r = q("SELECT count(*) as total from glink
591 591
 			where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
592 592
 			intval($contact['id'])
593 593
 		);
@@ -602,6 +602,6 @@ function onepoll_run(&$argv, &$argc){
602 602
 }
603 603
 
604 604
 if (array_search(__file__,get_included_files())===0){
605
-  onepoll_run($argv,$argc);
605
+  onepoll_run($_SERVER["argv"],$_SERVER["argc"]);
606 606
   killme();
607 607
 }

+ 1
- 1
include/poller.php View File

@@ -301,6 +301,6 @@ function poller_run(&$argv, &$argc){
301 301
 }
302 302
 
303 303
 if (array_search(__file__,get_included_files())===0){
304
-  poller_run($argv,$argc);
304
+  poller_run($_SERVER["argv"],$_SERVER["argc"]);
305 305
   killme();
306 306
 }

+ 1
- 1
include/queue.php View File

@@ -265,6 +265,6 @@ function queue_run(&$argv, &$argc){
265 265
 }
266 266
 
267 267
 if (array_search(__file__,get_included_files())===0){
268
-  queue_run($argv,$argc);
268
+  queue_run($_SERVER["argv"],$_SERVER["argc"]);
269 269
   killme();
270 270
 }

+ 1
- 3
testargs.php View File

@@ -15,9 +15,7 @@
15 15
  */
16 16
 
17 17
 
18
-if(($argc > 1) && isset($argv[1]))
19
-	echo $argv[1];
20
-elseif(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
18
+if(($_SERVER["argc"] > 1) && isset($_SERVER["argv"][1]))
21 19
 	echo $_SERVER["argv"][1];
22 20
 else
23 21
 	echo '';

+ 19
- 19
util/po2php.php View File

@@ -8,7 +8,7 @@ function po2php_run(&$argv, &$argc) {
8 8
 		print "Usage: ".$argv[0]." <file.po>\n\n";
9 9
 		return;
10 10
 	}
11
-	
11
+
12 12
 	$pofile = $argv[1];
13 13
 	$outfile = dirname($pofile)."/strings.php";
14 14
 
@@ -23,11 +23,11 @@ function po2php_run(&$argv, &$argc) {
23 23
 		print "Unable to find '$pofile'\n";
24 24
 		return;
25 25
 	}
26
-	
26
+
27 27
 	print "Out to '$outfile'\n";
28
-	
28
+
29 29
 	$out="<?php\n\n";
30
-	
30
+
31 31
 	$infile = file($pofile);
32 32
 	$k="";
33 33
 	$v="";
@@ -53,14 +53,14 @@ function po2php_run(&$argv, &$argc) {
53 53
 			$out .= '	return '.$cond.';'."\n";
54 54
 			$out .= '}}'."\n";
55 55
 		}
56
-		
56
+
57 57
 
58 58
 
59 59
 
60 60
 		if ($k!="" && substr($l,0,7)=="msgstr "){
61 61
 			if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
62 62
 			if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
63
-			
63
+
64 64
 			$v = substr($l,8,$len-10);
65 65
 			$v = preg_replace_callback($escape_s_exp,'escape_s',$v);
66 66
 			$inv = True;
@@ -69,28 +69,28 @@ function po2php_run(&$argv, &$argc) {
69 69
 		if ($k!="" && substr($l,0,7)=="msgstr["){
70 70
 			if ($ink) { $ink = False; $out .= '$a->strings["'.$k.'"] = '; }
71 71
 			if ($inv) {	$inv = False; $out .= '"'.$v.'"'; }
72
-						
72
+
73 73
 			if (!$arr) {
74 74
 				$arr=True;
75 75
 				$out .= "array(\n";
76 76
 			}
77 77
 			$match=Array();
78 78
 			preg_match("|\[([0-9]*)\] (.*)|", $l, $match);
79
-			$out .= "\t". 
79
+			$out .= "\t".
80 80
 				preg_replace_callback($escape_s_exp,'escape_s',$match[1])
81 81
 				." => "
82 82
 				.preg_replace_callback($escape_s_exp,'escape_s',$match[2]) .",\n";
83 83
 		}
84
-	
84
+
85 85
 		if (substr($l,0,6)=="msgid_") { $ink = False; $out .= '$a->strings["'.$k.'"] = '; };
86 86
 
87 87
 
88 88
 		if ($ink) {
89
-			$k .= trim($l,"\"\r\n"); 
89
+			$k .= trim($l,"\"\r\n");
90 90
 			$k = preg_replace_callback($escape_s_exp,'escape_s',$k);
91 91
 			//$out .= '$a->strings['.$k.'] = ';
92 92
 		}
93
-		
93
+
94 94
 		if (substr($l,0,6)=="msgid "){
95 95
 			if ($inv) {	$inv = False; $out .= '"'.$v.'"'; }
96 96
 			if ($k!="") $out .= $arr?");\n":";\n";
@@ -101,28 +101,28 @@ function po2php_run(&$argv, &$argc) {
101 101
 			} else {
102 102
 				$k = "";
103 103
 			}
104
-			
104
+
105 105
 			$k = preg_replace_callback($escape_s_exp,'escape_s',$k);
106 106
 			$ink = True;
107 107
 		}
108
-		
108
+
109 109
 		if ($inv && substr($l,0,6)!="msgstr") {
110
-			$v .= trim($l,"\"\r\n"); 
110
+			$v .= trim($l,"\"\r\n");
111 111
 			$v = preg_replace_callback($escape_s_exp,'escape_s',$v);
112 112
 			//$out .= '$a->strings['.$k.'] = ';
113 113
 		}
114
-	
115
-		
114
+
115
+
116 116
 	}
117 117
 
118 118
 	if ($inv) {	$inv = False; $out .= '"'.$v.'"'; }
119 119
 	if ($k!="") $out .= $arr?");\n":";\n";
120
-	
120
+
121 121
 	$out = str_replace(DQ_ESCAPE, '\"', $out);
122 122
 	file_put_contents($outfile, $out);
123
-	
123
+
124 124
 }
125 125
 
126 126
 if (array_search(__file__,get_included_files())===0){
127
-  po2php_run($argv,$argc);
127
+  po2php_run($_SERVER["argv"],$_SERVER["argc"]);
128 128
 }

Loading…
Cancel
Save