Completed
Push — 1.10.x ( c135db...ea3352 )
by Julito
26:21
created
main/inc/lib/export.lib.inc.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         DocumentManager::file_send_for_download($filePath, true, $filename.'.csv');
58 58
         exit;
59
-	}
59
+    }
60 60
 
61 61
     /**
62 62
      * Export tabular data to XLS-file
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         DocumentManager::file_send_for_download($filePath, true, $filename.'.xlsx');
81 81
         exit;
82
-	}
82
+    }
83 83
 
84 84
     /**
85 85
      * Export tabular data to XLS-file (as html table)
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     /**
115
-    * Export tabular data to XML-file
116
-    * @param array  Simple array of data to put in XML
117
-    * @param string Name of file to be given to the user
118
-    * @param string Name of common tag to place each line in
119
-    * @param string Name of the root element. A root element should always be given.
120
-    * @param string Encoding in which the data is provided
121
-    */
115
+     * Export tabular data to XML-file
116
+     * @param array  Simple array of data to put in XML
117
+     * @param string Name of file to be given to the user
118
+     * @param string Name of common tag to place each line in
119
+     * @param string Name of the root element. A root element should always be given.
120
+     * @param string Encoding in which the data is provided
121
+     */
122 122
     public static function arrayToXml(
123 123
         $data,
124 124
         $filename = 'export',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         fclose($handle);
149 149
         DocumentManager :: file_send_for_download($file, true, $filename.'.xml');
150 150
         exit;
151
-	}
151
+    }
152 152
 
153 153
     /**
154 154
      * Export hierarchical tabular data to XML-file
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         foreach ($data as $row) {
198 198
             $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
199 199
             if (is_array($row['value'])) {
200
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
200
+                $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
201 201
                 $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
202 202
             } else {
203 203
                 $string .= $row['value'];
Please login to merge, or discard this patch.
main/inc/lib/browser/Browser.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
     }
257 257
 
258 258
     /**
259
-    * Is the browser from facebook?
260
-    * @return boolean True if the browser is from facebook otherwise false
261
-    */
259
+     * Is the browser from facebook?
260
+     * @return boolean True if the browser is from facebook otherwise false
261
+     */
262 262
     public function isFacebook() 
263 263
     { 
264 264
         return $this->_is_facebook;
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
             }
592 592
             return true;
593 593
         } // Test for versions > IE 10
594
-		else if(stripos($this->_agent, 'trident') !== false) {
595
-			$this->setBrowser(self::BROWSER_IE);
596
-			$result = explode('rv:', $this->_agent);
597
-			$this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
598
-			$this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
599
-		} // Test for Pocket IE
594
+        else if(stripos($this->_agent, 'trident') !== false) {
595
+            $this->setBrowser(self::BROWSER_IE);
596
+            $result = explode('rv:', $this->_agent);
597
+            $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
598
+            $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
599
+        } // Test for Pocket IE
600 600
         else if (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) {
601 601
             $aresult = explode(' ', stristr($this->_agent, 'mspie'));
602 602
             $this->setPlatform(self::PLATFORM_WINDOWS_CE);
Please login to merge, or discard this patch.
main/inc/lib/certificate.lib.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
     /**
147
-    *  Generates an HTML Certificate and fills the path_certificate field in the DB
148
-    **/
147
+     *  Generates an HTML Certificate and fills the path_certificate field in the DB
148
+     **/
149 149
     public function generate($params = array())
150 150
     {
151 151
         // The user directory should be set
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
     }
262 262
 
263 263
     /**
264
-    * update user info about certificate
265
-    * @param int $cat_id category id
266
-    * @param int $user_id user id
267
-    * @param string $path_certificate the path name of the certificate
268
-    * @return void()
269
-    */
264
+     * update user info about certificate
265
+     * @param int $cat_id category id
266
+     * @param int $user_id user id
267
+     * @param string $path_certificate the path name of the certificate
268
+     * @return void()
269
+     */
270 270
     public function update_user_info_about_certificate(
271 271
         $cat_id,
272 272
         $user_id,
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
     }
369 369
 
370 370
     /**
371
-    * Shows the student's certificate (HTML file). If the global setting
372
-    * allow_public_certificates is set to 'false', no certificate can be printed.
373
-    * If the global allow_public_certificates is set to 'true' and the course
374
-    * setting allow_public_certificates is set to 0, no certificate *in this
375
-    * course* can be printed (for anonymous users). Connected users can always
376
-    * print them.
377
-    */
371
+     * Shows the student's certificate (HTML file). If the global setting
372
+     * allow_public_certificates is set to 'false', no certificate can be printed.
373
+     * If the global allow_public_certificates is set to 'true' and the course
374
+     * setting allow_public_certificates is set to 0, no certificate *in this
375
+     * course* can be printed (for anonymous users). Connected users can always
376
+     * print them.
377
+     */
378 378
     public function show()
379 379
     {
380 380
         // Special rules for anonymous users
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.smtp.php 1 patch
Indentation   +429 added lines, -429 removed lines patch added patch discarded remove patch
@@ -47,130 +47,130 @@  discard block
 block discarded – undo
47 47
  */
48 48
 
49 49
 class SMTP {
50
-  /**
51
-   *  SMTP server port
52
-   *  @var int
53
-   */
54
-  public $SMTP_PORT = 25;
55
-
56
-  /**
57
-   *  SMTP reply line ending
58
-   *  @var string
59
-   */
60
-  public $CRLF = "\r\n";
61
-
62
-  /**
63
-   *  Sets whether debugging is turned on
64
-   *  @var bool
65
-   */
66
-  public $do_debug;       // the level of debug to perform
67
-
68
-  /**
69
-   *  Sets VERP use on/off (default is off)
70
-   *  @var bool
71
-   */
72
-  public $do_verp = false;
73
-
74
-  /////////////////////////////////////////////////
75
-  // PROPERTIES, PRIVATE AND PROTECTED
76
-  /////////////////////////////////////////////////
77
-
78
-  private $smtp_conn; // the socket to the server
79
-  private $error;     // error if any on the last call
80
-  private $helo_rply; // the reply the server sent to us for HELO
81
-
82
-  /**
83
-   * Initialize the class so that the data is in a known state.
84
-   * @access public
85
-   * @return void
86
-   */
87
-  public function __construct() {
50
+    /**
51
+     *  SMTP server port
52
+     *  @var int
53
+     */
54
+    public $SMTP_PORT = 25;
55
+
56
+    /**
57
+     *  SMTP reply line ending
58
+     *  @var string
59
+     */
60
+    public $CRLF = "\r\n";
61
+
62
+    /**
63
+     *  Sets whether debugging is turned on
64
+     *  @var bool
65
+     */
66
+    public $do_debug;       // the level of debug to perform
67
+
68
+    /**
69
+     *  Sets VERP use on/off (default is off)
70
+     *  @var bool
71
+     */
72
+    public $do_verp = false;
73
+
74
+    /////////////////////////////////////////////////
75
+    // PROPERTIES, PRIVATE AND PROTECTED
76
+    /////////////////////////////////////////////////
77
+
78
+    private $smtp_conn; // the socket to the server
79
+    private $error;     // error if any on the last call
80
+    private $helo_rply; // the reply the server sent to us for HELO
81
+
82
+    /**
83
+     * Initialize the class so that the data is in a known state.
84
+     * @access public
85
+     * @return void
86
+     */
87
+    public function __construct() {
88 88
     $this->smtp_conn = 0;
89 89
     $this->error = null;
90 90
     $this->helo_rply = null;
91 91
 
92 92
     $this->do_debug = 0;
93
-  }
94
-
95
-  /////////////////////////////////////////////////
96
-  // CONNECTION FUNCTIONS
97
-  /////////////////////////////////////////////////
98
-
99
-  /**
100
-   * Connect to the server specified on the port specified.
101
-   * If the port is not specified use the default SMTP_PORT.
102
-   * If tval is specified then a connection will try and be
103
-   * established with the server for that number of seconds.
104
-   * If tval is not specified the default is 30 seconds to
105
-   * try on the connection.
106
-   *
107
-   * SMTP CODE SUCCESS: 220
108
-   * SMTP CODE FAILURE: 421
109
-   * @access public
110
-   * @return bool
111
-   */
112
-  public function Connect($host, $port = 0, $tval = 30) {
93
+    }
94
+
95
+    /////////////////////////////////////////////////
96
+    // CONNECTION FUNCTIONS
97
+    /////////////////////////////////////////////////
98
+
99
+    /**
100
+     * Connect to the server specified on the port specified.
101
+     * If the port is not specified use the default SMTP_PORT.
102
+     * If tval is specified then a connection will try and be
103
+     * established with the server for that number of seconds.
104
+     * If tval is not specified the default is 30 seconds to
105
+     * try on the connection.
106
+     *
107
+     * SMTP CODE SUCCESS: 220
108
+     * SMTP CODE FAILURE: 421
109
+     * @access public
110
+     * @return bool
111
+     */
112
+    public function Connect($host, $port = 0, $tval = 30) {
113 113
     // set the error val to null so there is no confusion
114 114
     $this->error = null;
115 115
 
116 116
     // make sure we are __not__ connected
117 117
     if($this->connected()) {
118
-      // already connected, generate error
119
-      $this->error = array("error" => "Already connected to a server");
120
-      return false;
118
+        // already connected, generate error
119
+        $this->error = array("error" => "Already connected to a server");
120
+        return false;
121 121
     }
122 122
 
123 123
     if(empty($port)) {
124
-      $port = $this->SMTP_PORT;
124
+        $port = $this->SMTP_PORT;
125 125
     }
126 126
 
127 127
     // connect to the smtp server
128 128
     $this->smtp_conn = @fsockopen($host,    // the host of the server
129
-                                 $port,    // the port to use
130
-                                 $errno,   // error number if any
131
-                                 $errstr,  // error message if any
132
-                                 $tval);   // give up after ? secs
129
+                                    $port,    // the port to use
130
+                                    $errno,   // error number if any
131
+                                    $errstr,  // error message if any
132
+                                    $tval);   // give up after ? secs
133 133
     // verify we connected properly
134 134
     if(empty($this->smtp_conn)) {
135
-      $this->error = array("error" => "Failed to connect to server",
136
-                           "errno" => $errno,
137
-                           "errstr" => $errstr);
138
-      if($this->do_debug >= 1) {
135
+        $this->error = array("error" => "Failed to connect to server",
136
+                            "errno" => $errno,
137
+                            "errstr" => $errstr);
138
+        if($this->do_debug >= 1) {
139 139
         echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
140
-      }
141
-      return false;
140
+        }
141
+        return false;
142 142
     }
143 143
 
144 144
     // SMTP server can take longer to respond, give longer timeout for first read
145 145
     // Windows does not have support for this timeout function
146 146
     if(substr(PHP_OS, 0, 3) != "WIN")
147
-     socket_set_timeout($this->smtp_conn, $tval, 0);
147
+        socket_set_timeout($this->smtp_conn, $tval, 0);
148 148
 
149 149
     // get any announcement
150 150
     $announce = $this->get_lines();
151 151
 
152 152
     if($this->do_debug >= 2) {
153
-      echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
153
+        echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
154 154
     }
155 155
 
156 156
     return true;
157
-  }
158
-
159
-  /**
160
-   * Initiate a TLS communication with the server.
161
-   *
162
-   * SMTP CODE 220 Ready to start TLS
163
-   * SMTP CODE 501 Syntax error (no parameters allowed)
164
-   * SMTP CODE 454 TLS not available due to temporary reason
165
-   * @access public
166
-   * @return bool success
167
-   */
168
-  public function StartTLS() {
157
+    }
158
+
159
+    /**
160
+     * Initiate a TLS communication with the server.
161
+     *
162
+     * SMTP CODE 220 Ready to start TLS
163
+     * SMTP CODE 501 Syntax error (no parameters allowed)
164
+     * SMTP CODE 454 TLS not available due to temporary reason
165
+     * @access public
166
+     * @return bool success
167
+     */
168
+    public function StartTLS() {
169 169
     $this->error = null; # to avoid confusion
170 170
 
171 171
     if(!$this->connected()) {
172
-      $this->error = array("error" => "Called StartTLS() without being connected");
173
-      return false;
172
+        $this->error = array("error" => "Called StartTLS() without being connected");
173
+        return false;
174 174
     }
175 175
 
176 176
     fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
@@ -179,35 +179,35 @@  discard block
 block discarded – undo
179 179
     $code = substr($rply,0,3);
180 180
 
181 181
     if($this->do_debug >= 2) {
182
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
182
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
183 183
     }
184 184
 
185 185
     if($code != 220) {
186
-      $this->error =
187
-         array("error"     => "STARTTLS not accepted from server",
188
-               "smtp_code" => $code,
189
-               "smtp_msg"  => substr($rply,4));
190
-      if($this->do_debug >= 1) {
186
+        $this->error =
187
+            array("error"     => "STARTTLS not accepted from server",
188
+                "smtp_code" => $code,
189
+                "smtp_msg"  => substr($rply,4));
190
+        if($this->do_debug >= 1) {
191 191
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
192
-      }
193
-      return false;
192
+        }
193
+        return false;
194 194
     }
195 195
 
196 196
     // Begin encrypted connection
197 197
     if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
198
-      return false;
198
+        return false;
199 199
     }
200 200
 
201 201
     return true;
202
-  }
203
-
204
-  /**
205
-   * Performs SMTP authentication.  Must be run after running the
206
-   * Hello() method.  Returns true if successfully authenticated.
207
-   * @access public
208
-   * @return bool
209
-   */
210
-  public function Authenticate($username, $password) {
202
+    }
203
+
204
+    /**
205
+     * Performs SMTP authentication.  Must be run after running the
206
+     * Hello() method.  Returns true if successfully authenticated.
207
+     * @access public
208
+     * @return bool
209
+     */
210
+    public function Authenticate($username, $password) {
211 211
     // Start authentication
212 212
     fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
213 213
 
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
     $code = substr($rply,0,3);
216 216
 
217 217
     if($code != 334) {
218
-      $this->error =
218
+        $this->error =
219 219
         array("error" => "AUTH not accepted from server",
220
-              "smtp_code" => $code,
221
-              "smtp_msg" => substr($rply,4));
222
-      if($this->do_debug >= 1) {
220
+                "smtp_code" => $code,
221
+                "smtp_msg" => substr($rply,4));
222
+        if($this->do_debug >= 1) {
223 223
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
224
-      }
225
-      return false;
224
+        }
225
+        return false;
226 226
     }
227 227
 
228 228
     // Send encoded username
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
     $code = substr($rply,0,3);
233 233
 
234 234
     if($code != 334) {
235
-      $this->error =
235
+        $this->error =
236 236
         array("error" => "Username not accepted from server",
237
-              "smtp_code" => $code,
238
-              "smtp_msg" => substr($rply,4));
239
-      if($this->do_debug >= 1) {
237
+                "smtp_code" => $code,
238
+                "smtp_msg" => substr($rply,4));
239
+        if($this->do_debug >= 1) {
240 240
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
241
-      }
242
-      return false;
241
+        }
242
+        return false;
243 243
     }
244 244
 
245 245
     // Send encoded password
@@ -249,87 +249,87 @@  discard block
 block discarded – undo
249 249
     $code = substr($rply,0,3);
250 250
 
251 251
     if($code != 235) {
252
-      $this->error =
252
+        $this->error =
253 253
         array("error" => "Password not accepted from server",
254
-              "smtp_code" => $code,
255
-              "smtp_msg" => substr($rply,4));
256
-      if($this->do_debug >= 1) {
254
+                "smtp_code" => $code,
255
+                "smtp_msg" => substr($rply,4));
256
+        if($this->do_debug >= 1) {
257 257
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
258
-      }
259
-      return false;
258
+        }
259
+        return false;
260 260
     }
261 261
 
262 262
     return true;
263
-  }
264
-
265
-  /**
266
-   * Returns true if connected to a server otherwise false
267
-   * @access public
268
-   * @return bool
269
-   */
270
-  public function Connected() {
263
+    }
264
+
265
+    /**
266
+     * Returns true if connected to a server otherwise false
267
+     * @access public
268
+     * @return bool
269
+     */
270
+    public function Connected() {
271 271
     if(!empty($this->smtp_conn)) {
272
-      $sock_status = socket_get_status($this->smtp_conn);
273
-      if($sock_status["eof"]) {
272
+        $sock_status = socket_get_status($this->smtp_conn);
273
+        if($sock_status["eof"]) {
274 274
         // the socket is valid but we are not connected
275 275
         if($this->do_debug >= 1) {
276 276
             echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
277 277
         }
278 278
         $this->Close();
279 279
         return false;
280
-      }
281
-      return true; // everything looks good
280
+        }
281
+        return true; // everything looks good
282 282
     }
283 283
     return false;
284
-  }
285
-
286
-  /**
287
-   * Closes the socket and cleans up the state of the class.
288
-   * It is not considered good to use this function without
289
-   * first trying to use QUIT.
290
-   * @access public
291
-   * @return void
292
-   */
293
-  public function Close() {
284
+    }
285
+
286
+    /**
287
+     * Closes the socket and cleans up the state of the class.
288
+     * It is not considered good to use this function without
289
+     * first trying to use QUIT.
290
+     * @access public
291
+     * @return void
292
+     */
293
+    public function Close() {
294 294
     $this->error = null; // so there is no confusion
295 295
     $this->helo_rply = null;
296 296
     if(!empty($this->smtp_conn)) {
297
-      // close the connection and cleanup
298
-      fclose($this->smtp_conn);
299
-      $this->smtp_conn = 0;
300
-    }
301
-  }
302
-
303
-  /////////////////////////////////////////////////
304
-  // SMTP COMMANDS
305
-  /////////////////////////////////////////////////
306
-
307
-  /**
308
-   * Issues a data command and sends the msg_data to the server
309
-   * finializing the mail transaction. $msg_data is the message
310
-   * that is to be send with the headers. Each header needs to be
311
-   * on a single line followed by a <CRLF> with the message headers
312
-   * and the message body being seperated by and additional <CRLF>.
313
-   *
314
-   * Implements rfc 821: DATA <CRLF>
315
-   *
316
-   * SMTP CODE INTERMEDIATE: 354
317
-   *     [data]
318
-   *     <CRLF>.<CRLF>
319
-   *     SMTP CODE SUCCESS: 250
320
-   *     SMTP CODE FAILURE: 552,554,451,452
321
-   * SMTP CODE FAILURE: 451,554
322
-   * SMTP CODE ERROR  : 500,501,503,421
323
-   * @access public
324
-   * @return bool
325
-   */
326
-  public function Data($msg_data) {
297
+        // close the connection and cleanup
298
+        fclose($this->smtp_conn);
299
+        $this->smtp_conn = 0;
300
+    }
301
+    }
302
+
303
+    /////////////////////////////////////////////////
304
+    // SMTP COMMANDS
305
+    /////////////////////////////////////////////////
306
+
307
+    /**
308
+     * Issues a data command and sends the msg_data to the server
309
+     * finializing the mail transaction. $msg_data is the message
310
+     * that is to be send with the headers. Each header needs to be
311
+     * on a single line followed by a <CRLF> with the message headers
312
+     * and the message body being seperated by and additional <CRLF>.
313
+     *
314
+     * Implements rfc 821: DATA <CRLF>
315
+     *
316
+     * SMTP CODE INTERMEDIATE: 354
317
+     *     [data]
318
+     *     <CRLF>.<CRLF>
319
+     *     SMTP CODE SUCCESS: 250
320
+     *     SMTP CODE FAILURE: 552,554,451,452
321
+     * SMTP CODE FAILURE: 451,554
322
+     * SMTP CODE ERROR  : 500,501,503,421
323
+     * @access public
324
+     * @return bool
325
+     */
326
+    public function Data($msg_data) {
327 327
     $this->error = null; // so no confusion is caused
328 328
 
329 329
     if(!$this->connected()) {
330
-      $this->error = array(
331
-              "error" => "Called Data() without being connected");
332
-      return false;
330
+        $this->error = array(
331
+                "error" => "Called Data() without being connected");
332
+        return false;
333 333
     }
334 334
 
335 335
     fputs($this->smtp_conn,"DATA" . $this->CRLF);
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
     $code = substr($rply,0,3);
339 339
 
340 340
     if($this->do_debug >= 2) {
341
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
341
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
342 342
     }
343 343
 
344 344
     if($code != 354) {
345
-      $this->error =
345
+        $this->error =
346 346
         array("error" => "DATA command not accepted from server",
347
-              "smtp_code" => $code,
348
-              "smtp_msg" => substr($rply,4));
349
-      if($this->do_debug >= 1) {
347
+                "smtp_code" => $code,
348
+                "smtp_msg" => substr($rply,4));
349
+        if($this->do_debug >= 1) {
350 350
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
351
-      }
352
-      return false;
351
+        }
352
+        return false;
353 353
     }
354 354
 
355 355
     /* the server is ready to accept data!
@@ -380,49 +380,49 @@  discard block
 block discarded – undo
380 380
     $field = substr($lines[0],0,strpos($lines[0],":"));
381 381
     $in_headers = false;
382 382
     if(!empty($field) && !strstr($field," ")) {
383
-      $in_headers = true;
383
+        $in_headers = true;
384 384
     }
385 385
 
386 386
     $max_line_length = 998; // used below; set here for ease in change
387 387
 
388 388
     while(list(,$line) = @each($lines)) {
389
-      $lines_out = null;
390
-      if($line == "" && $in_headers) {
389
+        $lines_out = null;
390
+        if($line == "" && $in_headers) {
391 391
         $in_headers = false;
392
-      }
393
-      // ok we need to break this line up into several smaller lines
394
-      while(strlen($line) > $max_line_length) {
392
+        }
393
+        // ok we need to break this line up into several smaller lines
394
+        while(strlen($line) > $max_line_length) {
395 395
         $pos = strrpos(substr($line,0,$max_line_length)," ");
396 396
 
397 397
         // Patch to fix DOS attack
398 398
         if(!$pos) {
399
-          $pos = $max_line_length - 1;
400
-          $lines_out[] = substr($line,0,$pos);
401
-          $line = substr($line,$pos);
399
+            $pos = $max_line_length - 1;
400
+            $lines_out[] = substr($line,0,$pos);
401
+            $line = substr($line,$pos);
402 402
         } else {
403
-          $lines_out[] = substr($line,0,$pos);
404
-          $line = substr($line,$pos + 1);
403
+            $lines_out[] = substr($line,0,$pos);
404
+            $line = substr($line,$pos + 1);
405 405
         }
406 406
 
407 407
         /* if processing headers add a LWSP-char to the front of new line
408 408
          * rfc 822 on long msg headers
409 409
          */
410 410
         if($in_headers) {
411
-          $line = "\t" . $line;
411
+            $line = "\t" . $line;
412 412
         }
413
-      }
414
-      $lines_out[] = $line;
413
+        }
414
+        $lines_out[] = $line;
415 415
 
416
-      // send the lines to the server
417
-      while(list(,$line_out) = @each($lines_out)) {
416
+        // send the lines to the server
417
+        while(list(,$line_out) = @each($lines_out)) {
418 418
         if(strlen($line_out) > 0)
419 419
         {
420
-          if(substr($line_out, 0, 1) == ".") {
420
+            if(substr($line_out, 0, 1) == ".") {
421 421
             $line_out = "." . $line_out;
422
-          }
422
+            }
423 423
         }
424 424
         fputs($this->smtp_conn,$line_out . $this->CRLF);
425
-      }
425
+        }
426 426
     }
427 427
 
428 428
     // message data has been sent
@@ -432,111 +432,111 @@  discard block
 block discarded – undo
432 432
     $code = substr($rply,0,3);
433 433
 
434 434
     if($this->do_debug >= 2) {
435
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
435
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
436 436
     }
437 437
 
438 438
     if($code != 250) {
439
-      $this->error =
439
+        $this->error =
440 440
         array("error" => "DATA not accepted from server",
441
-              "smtp_code" => $code,
442
-              "smtp_msg" => substr($rply,4));
443
-      if($this->do_debug >= 1) {
441
+                "smtp_code" => $code,
442
+                "smtp_msg" => substr($rply,4));
443
+        if($this->do_debug >= 1) {
444 444
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
445
-      }
446
-      return false;
445
+        }
446
+        return false;
447 447
     }
448 448
     return true;
449
-  }
450
-
451
-  /**
452
-   * Sends the HELO command to the smtp server.
453
-   * This makes sure that we and the server are in
454
-   * the same known state.
455
-   *
456
-   * Implements from rfc 821: HELO <SP> <domain> <CRLF>
457
-   *
458
-   * SMTP CODE SUCCESS: 250
459
-   * SMTP CODE ERROR  : 500, 501, 504, 421
460
-   * @access public
461
-   * @return bool
462
-   */
463
-  public function Hello($host = '') {
449
+    }
450
+
451
+    /**
452
+     * Sends the HELO command to the smtp server.
453
+     * This makes sure that we and the server are in
454
+     * the same known state.
455
+     *
456
+     * Implements from rfc 821: HELO <SP> <domain> <CRLF>
457
+     *
458
+     * SMTP CODE SUCCESS: 250
459
+     * SMTP CODE ERROR  : 500, 501, 504, 421
460
+     * @access public
461
+     * @return bool
462
+     */
463
+    public function Hello($host = '') {
464 464
     $this->error = null; // so no confusion is caused
465 465
 
466 466
     if(!$this->connected()) {
467
-      $this->error = array(
467
+        $this->error = array(
468 468
             "error" => "Called Hello() without being connected");
469
-      return false;
469
+        return false;
470 470
     }
471 471
 
472 472
     // if hostname for HELO was not specified send default
473 473
     if(empty($host)) {
474
-      // determine appropriate default to send to server
475
-      $host = "localhost";
474
+        // determine appropriate default to send to server
475
+        $host = "localhost";
476 476
     }
477 477
 
478 478
     // Send extended hello first (RFC 2821)
479 479
     if(!$this->SendHello("EHLO", $host)) {
480
-      if(!$this->SendHello("HELO", $host)) {
480
+        if(!$this->SendHello("HELO", $host)) {
481 481
         return false;
482
-      }
482
+        }
483 483
     }
484 484
 
485 485
     return true;
486
-  }
487
-
488
-  /**
489
-   * Sends a HELO/EHLO command.
490
-   * @access private
491
-   * @return bool
492
-   */
493
-  private function SendHello($hello, $host) {
486
+    }
487
+
488
+    /**
489
+     * Sends a HELO/EHLO command.
490
+     * @access private
491
+     * @return bool
492
+     */
493
+    private function SendHello($hello, $host) {
494 494
     fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
495 495
 
496 496
     $rply = $this->get_lines();
497 497
     $code = substr($rply,0,3);
498 498
 
499 499
     if($this->do_debug >= 2) {
500
-      echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
500
+        echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
501 501
     }
502 502
 
503 503
     if($code != 250) {
504
-      $this->error =
504
+        $this->error =
505 505
         array("error" => $hello . " not accepted from server",
506
-              "smtp_code" => $code,
507
-              "smtp_msg" => substr($rply,4));
508
-      if($this->do_debug >= 1) {
506
+                "smtp_code" => $code,
507
+                "smtp_msg" => substr($rply,4));
508
+        if($this->do_debug >= 1) {
509 509
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
510
-      }
511
-      return false;
510
+        }
511
+        return false;
512 512
     }
513 513
 
514 514
     $this->helo_rply = $rply;
515 515
 
516 516
     return true;
517
-  }
518
-
519
-  /**
520
-   * Starts a mail transaction from the email address specified in
521
-   * $from. Returns true if successful or false otherwise. If True
522
-   * the mail transaction is started and then one or more Recipient
523
-   * commands may be called followed by a Data command.
524
-   *
525
-   * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
526
-   *
527
-   * SMTP CODE SUCCESS: 250
528
-   * SMTP CODE SUCCESS: 552,451,452
529
-   * SMTP CODE SUCCESS: 500,501,421
530
-   * @access public
531
-   * @return bool
532
-   */
533
-  public function Mail($from) {
517
+    }
518
+
519
+    /**
520
+     * Starts a mail transaction from the email address specified in
521
+     * $from. Returns true if successful or false otherwise. If True
522
+     * the mail transaction is started and then one or more Recipient
523
+     * commands may be called followed by a Data command.
524
+     *
525
+     * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
526
+     *
527
+     * SMTP CODE SUCCESS: 250
528
+     * SMTP CODE SUCCESS: 552,451,452
529
+     * SMTP CODE SUCCESS: 500,501,421
530
+     * @access public
531
+     * @return bool
532
+     */
533
+    public function Mail($from) {
534 534
     $this->error = null; // so no confusion is caused
535 535
 
536 536
     if(!$this->connected()) {
537
-      $this->error = array(
538
-              "error" => "Called Mail() without being connected");
539
-      return false;
537
+        $this->error = array(
538
+                "error" => "Called Mail() without being connected");
539
+        return false;
540 540
     }
541 541
 
542 542
     $useVerp = ($this->do_verp ? "XVERP" : "");
@@ -546,40 +546,40 @@  discard block
 block discarded – undo
546 546
     $code = substr($rply,0,3);
547 547
 
548 548
     if($this->do_debug >= 2) {
549
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
549
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
550 550
     }
551 551
 
552 552
     if($code != 250) {
553
-      $this->error =
553
+        $this->error =
554 554
         array("error" => "MAIL not accepted from server",
555
-              "smtp_code" => $code,
556
-              "smtp_msg" => substr($rply,4));
557
-      if($this->do_debug >= 1) {
555
+                "smtp_code" => $code,
556
+                "smtp_msg" => substr($rply,4));
557
+        if($this->do_debug >= 1) {
558 558
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
559
-      }
560
-      return false;
559
+        }
560
+        return false;
561 561
     }
562 562
     return true;
563
-  }
564
-
565
-  /**
566
-   * Sends the quit command to the server and then closes the socket
567
-   * if there is no error or the $close_on_error argument is true.
568
-   *
569
-   * Implements from rfc 821: QUIT <CRLF>
570
-   *
571
-   * SMTP CODE SUCCESS: 221
572
-   * SMTP CODE ERROR  : 500
573
-   * @access public
574
-   * @return bool
575
-   */
576
-  public function Quit($close_on_error = true) {
563
+    }
564
+
565
+    /**
566
+     * Sends the quit command to the server and then closes the socket
567
+     * if there is no error or the $close_on_error argument is true.
568
+     *
569
+     * Implements from rfc 821: QUIT <CRLF>
570
+     *
571
+     * SMTP CODE SUCCESS: 221
572
+     * SMTP CODE ERROR  : 500
573
+     * @access public
574
+     * @return bool
575
+     */
576
+    public function Quit($close_on_error = true) {
577 577
     $this->error = null; // so there is no confusion
578 578
 
579 579
     if(!$this->connected()) {
580
-      $this->error = array(
581
-              "error" => "Called Quit() without being connected");
582
-      return false;
580
+        $this->error = array(
581
+                "error" => "Called Quit() without being connected");
582
+        return false;
583 583
     }
584 584
 
585 585
     // send the quit command to the server
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     $byemsg = $this->get_lines();
590 590
 
591 591
     if($this->do_debug >= 2) {
592
-      echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
592
+        echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
593 593
     }
594 594
 
595 595
     $rval = true;
@@ -597,42 +597,42 @@  discard block
 block discarded – undo
597 597
 
598 598
     $code = substr($byemsg,0,3);
599 599
     if($code != 221) {
600
-      // use e as a tmp var cause Close will overwrite $this->error
601
-      $e = array("error" => "SMTP server rejected quit command",
602
-                 "smtp_code" => $code,
603
-                 "smtp_rply" => substr($byemsg,4));
604
-      $rval = false;
605
-      if($this->do_debug >= 1) {
600
+        // use e as a tmp var cause Close will overwrite $this->error
601
+        $e = array("error" => "SMTP server rejected quit command",
602
+                    "smtp_code" => $code,
603
+                    "smtp_rply" => substr($byemsg,4));
604
+        $rval = false;
605
+        if($this->do_debug >= 1) {
606 606
         echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
607
-      }
607
+        }
608 608
     }
609 609
 
610 610
     if(empty($e) || $close_on_error) {
611
-      $this->Close();
611
+        $this->Close();
612 612
     }
613 613
 
614 614
     return $rval;
615
-  }
616
-
617
-  /**
618
-   * Sends the command RCPT to the SMTP server with the TO: argument of $to.
619
-   * Returns true if the recipient was accepted false if it was rejected.
620
-   *
621
-   * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
622
-   *
623
-   * SMTP CODE SUCCESS: 250,251
624
-   * SMTP CODE FAILURE: 550,551,552,553,450,451,452
625
-   * SMTP CODE ERROR  : 500,501,503,421
626
-   * @access public
627
-   * @return bool
628
-   */
629
-  public function Recipient($to) {
615
+    }
616
+
617
+    /**
618
+     * Sends the command RCPT to the SMTP server with the TO: argument of $to.
619
+     * Returns true if the recipient was accepted false if it was rejected.
620
+     *
621
+     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
622
+     *
623
+     * SMTP CODE SUCCESS: 250,251
624
+     * SMTP CODE FAILURE: 550,551,552,553,450,451,452
625
+     * SMTP CODE ERROR  : 500,501,503,421
626
+     * @access public
627
+     * @return bool
628
+     */
629
+    public function Recipient($to) {
630 630
     $this->error = null; // so no confusion is caused
631 631
 
632 632
     if(!$this->connected()) {
633
-      $this->error = array(
634
-              "error" => "Called Recipient() without being connected");
635
-      return false;
633
+        $this->error = array(
634
+                "error" => "Called Recipient() without being connected");
635
+        return false;
636 636
     }
637 637
 
638 638
     fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
@@ -641,41 +641,41 @@  discard block
 block discarded – undo
641 641
     $code = substr($rply,0,3);
642 642
 
643 643
     if($this->do_debug >= 2) {
644
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
644
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
645 645
     }
646 646
 
647 647
     if($code != 250 && $code != 251) {
648
-      $this->error =
648
+        $this->error =
649 649
         array("error" => "RCPT not accepted from server",
650
-              "smtp_code" => $code,
651
-              "smtp_msg" => substr($rply,4));
652
-      if($this->do_debug >= 1) {
650
+                "smtp_code" => $code,
651
+                "smtp_msg" => substr($rply,4));
652
+        if($this->do_debug >= 1) {
653 653
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
654
-      }
655
-      return false;
654
+        }
655
+        return false;
656 656
     }
657 657
     return true;
658
-  }
659
-
660
-  /**
661
-   * Sends the RSET command to abort and transaction that is
662
-   * currently in progress. Returns true if successful false
663
-   * otherwise.
664
-   *
665
-   * Implements rfc 821: RSET <CRLF>
666
-   *
667
-   * SMTP CODE SUCCESS: 250
668
-   * SMTP CODE ERROR  : 500,501,504,421
669
-   * @access public
670
-   * @return bool
671
-   */
672
-  public function Reset() {
658
+    }
659
+
660
+    /**
661
+     * Sends the RSET command to abort and transaction that is
662
+     * currently in progress. Returns true if successful false
663
+     * otherwise.
664
+     *
665
+     * Implements rfc 821: RSET <CRLF>
666
+     *
667
+     * SMTP CODE SUCCESS: 250
668
+     * SMTP CODE ERROR  : 500,501,504,421
669
+     * @access public
670
+     * @return bool
671
+     */
672
+    public function Reset() {
673 673
     $this->error = null; // so no confusion is caused
674 674
 
675 675
     if(!$this->connected()) {
676
-      $this->error = array(
677
-              "error" => "Called Reset() without being connected");
678
-      return false;
676
+        $this->error = array(
677
+                "error" => "Called Reset() without being connected");
678
+        return false;
679 679
     }
680 680
 
681 681
     fputs($this->smtp_conn,"RSET" . $this->CRLF);
@@ -684,46 +684,46 @@  discard block
 block discarded – undo
684 684
     $code = substr($rply,0,3);
685 685
 
686 686
     if($this->do_debug >= 2) {
687
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
687
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
688 688
     }
689 689
 
690 690
     if($code != 250) {
691
-      $this->error =
691
+        $this->error =
692 692
         array("error" => "RSET failed",
693
-              "smtp_code" => $code,
694
-              "smtp_msg" => substr($rply,4));
695
-      if($this->do_debug >= 1) {
693
+                "smtp_code" => $code,
694
+                "smtp_msg" => substr($rply,4));
695
+        if($this->do_debug >= 1) {
696 696
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
697
-      }
698
-      return false;
697
+        }
698
+        return false;
699 699
     }
700 700
 
701 701
     return true;
702
-  }
703
-
704
-  /**
705
-   * Starts a mail transaction from the email address specified in
706
-   * $from. Returns true if successful or false otherwise. If True
707
-   * the mail transaction is started and then one or more Recipient
708
-   * commands may be called followed by a Data command. This command
709
-   * will send the message to the users terminal if they are logged
710
-   * in and send them an email.
711
-   *
712
-   * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
713
-   *
714
-   * SMTP CODE SUCCESS: 250
715
-   * SMTP CODE SUCCESS: 552,451,452
716
-   * SMTP CODE SUCCESS: 500,501,502,421
717
-   * @access public
718
-   * @return bool
719
-   */
720
-  public function SendAndMail($from) {
702
+    }
703
+
704
+    /**
705
+     * Starts a mail transaction from the email address specified in
706
+     * $from. Returns true if successful or false otherwise. If True
707
+     * the mail transaction is started and then one or more Recipient
708
+     * commands may be called followed by a Data command. This command
709
+     * will send the message to the users terminal if they are logged
710
+     * in and send them an email.
711
+     *
712
+     * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
713
+     *
714
+     * SMTP CODE SUCCESS: 250
715
+     * SMTP CODE SUCCESS: 552,451,452
716
+     * SMTP CODE SUCCESS: 500,501,502,421
717
+     * @access public
718
+     * @return bool
719
+     */
720
+    public function SendAndMail($from) {
721 721
     $this->error = null; // so no confusion is caused
722 722
 
723 723
     if(!$this->connected()) {
724
-      $this->error = array(
725
-          "error" => "Called SendAndMail() without being connected");
726
-      return false;
724
+        $this->error = array(
725
+            "error" => "Called SendAndMail() without being connected");
726
+        return false;
727 727
     }
728 728
 
729 729
     fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
@@ -732,82 +732,82 @@  discard block
 block discarded – undo
732 732
     $code = substr($rply,0,3);
733 733
 
734 734
     if($this->do_debug >= 2) {
735
-      echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
735
+        echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
736 736
     }
737 737
 
738 738
     if($code != 250) {
739
-      $this->error =
739
+        $this->error =
740 740
         array("error" => "SAML not accepted from server",
741
-              "smtp_code" => $code,
742
-              "smtp_msg" => substr($rply,4));
743
-      if($this->do_debug >= 1) {
741
+                "smtp_code" => $code,
742
+                "smtp_msg" => substr($rply,4));
743
+        if($this->do_debug >= 1) {
744 744
         echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
745
-      }
746
-      return false;
745
+        }
746
+        return false;
747 747
     }
748 748
     return true;
749
-  }
750
-
751
-  /**
752
-   * This is an optional command for SMTP that this class does not
753
-   * support. This method is here to make the RFC821 Definition
754
-   * complete for this class and __may__ be implimented in the future
755
-   *
756
-   * Implements from rfc 821: TURN <CRLF>
757
-   *
758
-   * SMTP CODE SUCCESS: 250
759
-   * SMTP CODE FAILURE: 502
760
-   * SMTP CODE ERROR  : 500, 503
761
-   * @access public
762
-   * @return bool
763
-   */
764
-  public function Turn() {
749
+    }
750
+
751
+    /**
752
+     * This is an optional command for SMTP that this class does not
753
+     * support. This method is here to make the RFC821 Definition
754
+     * complete for this class and __may__ be implimented in the future
755
+     *
756
+     * Implements from rfc 821: TURN <CRLF>
757
+     *
758
+     * SMTP CODE SUCCESS: 250
759
+     * SMTP CODE FAILURE: 502
760
+     * SMTP CODE ERROR  : 500, 503
761
+     * @access public
762
+     * @return bool
763
+     */
764
+    public function Turn() {
765 765
     $this->error = array("error" => "This method, TURN, of the SMTP ".
766 766
                                     "is not implemented");
767 767
     if($this->do_debug >= 1) {
768
-      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
768
+        echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
769 769
     }
770 770
     return false;
771
-  }
772
-
773
-  /**
774
-  * Get the current error
775
-  * @access public
776
-  * @return array
777
-  */
778
-  public function getError() {
771
+    }
772
+
773
+    /**
774
+     * Get the current error
775
+     * @access public
776
+     * @return array
777
+     */
778
+    public function getError() {
779 779
     return $this->error;
780
-  }
781
-
782
-  /////////////////////////////////////////////////
783
-  // INTERNAL FUNCTIONS
784
-  /////////////////////////////////////////////////
785
-
786
-  /**
787
-   * Read in as many lines as possible
788
-   * either before eof or socket timeout occurs on the operation.
789
-   * With SMTP we can tell if we have more lines to read if the
790
-   * 4th character is '-' symbol. If it is a space then we don't
791
-   * need to read anything else.
792
-   * @access private
793
-   * @return string
794
-   */
795
-  private function get_lines() {
780
+    }
781
+
782
+    /////////////////////////////////////////////////
783
+    // INTERNAL FUNCTIONS
784
+    /////////////////////////////////////////////////
785
+
786
+    /**
787
+     * Read in as many lines as possible
788
+     * either before eof or socket timeout occurs on the operation.
789
+     * With SMTP we can tell if we have more lines to read if the
790
+     * 4th character is '-' symbol. If it is a space then we don't
791
+     * need to read anything else.
792
+     * @access private
793
+     * @return string
794
+     */
795
+    private function get_lines() {
796 796
     $data = "";
797 797
     while($str = @fgets($this->smtp_conn,515)) {
798
-      if($this->do_debug >= 4) {
798
+        if($this->do_debug >= 4) {
799 799
         echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
800 800
         echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
801
-      }
802
-      $data .= $str;
803
-      if($this->do_debug >= 4) {
801
+        }
802
+        $data .= $str;
803
+        if($this->do_debug >= 4) {
804 804
         echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
805
-      }
806
-      // if 4th character is a space, we are done reading, break the loop
807
-      if(substr($str,3,1) == " ") { break; }
805
+        }
806
+        // if 4th character is a space, we are done reading, break the loop
807
+        if(substr($str,3,1) == " ") { break; }
808 808
     }
809 809
     return $data;
810
-  }
810
+    }
811 811
 
812 812
 }
813 813
 
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/class.pop3.php 1 patch
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -60,103 +60,103 @@  discard block
 block discarded – undo
60 60
  */
61 61
 
62 62
 class POP3 {
63
-  /**
64
-   * Default POP3 port
65
-   * @var int
66
-   */
67
-  public $POP3_PORT = 110;
68
-
69
-  /**
70
-   * Default Timeout
71
-   * @var int
72
-   */
73
-  public $POP3_TIMEOUT = 30;
74
-
75
-  /**
76
-   * POP3 Carriage Return + Line Feed
77
-   * @var string
78
-   */
79
-  public $CRLF = "\r\n";
80
-
81
-  /**
82
-   * Displaying Debug warnings? (0 = now, 1+ = yes)
83
-   * @var int
84
-   */
85
-  public $do_debug = 2;
86
-
87
-  /**
88
-   * POP3 Mail Server
89
-   * @var string
90
-   */
91
-  public $host;
92
-
93
-  /**
94
-   * POP3 Port
95
-   * @var int
96
-   */
97
-  public $port;
98
-
99
-  /**
100
-   * POP3 Timeout Value
101
-   * @var int
102
-   */
103
-  public $tval;
104
-
105
-  /**
106
-   * POP3 Username
107
-   * @var string
108
-   */
109
-  public $username;
110
-
111
-  /**
112
-   * POP3 Password
113
-   * @var string
114
-   */
115
-  public $password;
116
-
117
-  /////////////////////////////////////////////////
118
-  // PROPERTIES, PRIVATE AND PROTECTED
119
-  /////////////////////////////////////////////////
120
-
121
-  private $pop_conn;
122
-  private $connected;
123
-  private $error;     //  Error log array
124
-
125
-  /**
126
-   * Constructor, sets the initial values
127
-   * @access public
128
-   * @return POP3
129
-   */
130
-  public function __construct() {
63
+    /**
64
+     * Default POP3 port
65
+     * @var int
66
+     */
67
+    public $POP3_PORT = 110;
68
+
69
+    /**
70
+     * Default Timeout
71
+     * @var int
72
+     */
73
+    public $POP3_TIMEOUT = 30;
74
+
75
+    /**
76
+     * POP3 Carriage Return + Line Feed
77
+     * @var string
78
+     */
79
+    public $CRLF = "\r\n";
80
+
81
+    /**
82
+     * Displaying Debug warnings? (0 = now, 1+ = yes)
83
+     * @var int
84
+     */
85
+    public $do_debug = 2;
86
+
87
+    /**
88
+     * POP3 Mail Server
89
+     * @var string
90
+     */
91
+    public $host;
92
+
93
+    /**
94
+     * POP3 Port
95
+     * @var int
96
+     */
97
+    public $port;
98
+
99
+    /**
100
+     * POP3 Timeout Value
101
+     * @var int
102
+     */
103
+    public $tval;
104
+
105
+    /**
106
+     * POP3 Username
107
+     * @var string
108
+     */
109
+    public $username;
110
+
111
+    /**
112
+     * POP3 Password
113
+     * @var string
114
+     */
115
+    public $password;
116
+
117
+    /////////////////////////////////////////////////
118
+    // PROPERTIES, PRIVATE AND PROTECTED
119
+    /////////////////////////////////////////////////
120
+
121
+    private $pop_conn;
122
+    private $connected;
123
+    private $error;     //  Error log array
124
+
125
+    /**
126
+     * Constructor, sets the initial values
127
+     * @access public
128
+     * @return POP3
129
+     */
130
+    public function __construct() {
131 131
     $this->pop_conn  = 0;
132 132
     $this->connected = false;
133 133
     $this->error     = null;
134
-  }
135
-
136
-  /**
137
-   * Combination of public events - connect, login, disconnect
138
-   * @access public
139
-   * @param string $host
140
-   * @param integer $port
141
-   * @param integer $tval
142
-   * @param string $username
143
-   * @param string $password
144
-   */
145
-  public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
134
+    }
135
+
136
+    /**
137
+     * Combination of public events - connect, login, disconnect
138
+     * @access public
139
+     * @param string $host
140
+     * @param integer $port
141
+     * @param integer $tval
142
+     * @param string $username
143
+     * @param string $password
144
+     */
145
+    public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
146 146
     $this->host = $host;
147 147
 
148 148
     //  If no port value is passed, retrieve it
149 149
     if ($port == false) {
150
-      $this->port = $this->POP3_PORT;
150
+        $this->port = $this->POP3_PORT;
151 151
     } else {
152
-      $this->port = $port;
152
+        $this->port = $port;
153 153
     }
154 154
 
155 155
     //  If no port value is passed, retrieve it
156 156
     if ($tval == false) {
157
-      $this->tval = $this->POP3_TIMEOUT;
157
+        $this->tval = $this->POP3_TIMEOUT;
158 158
     } else {
159
-      $this->tval = $tval;
159
+        $this->tval = $tval;
160 160
     }
161 161
 
162 162
     $this->do_debug = $debug_level;
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
     $result = $this->Connect($this->host, $this->port, $this->tval);
171 171
 
172 172
     if ($result) {
173
-      $login_result = $this->Login($this->username, $this->password);
173
+        $login_result = $this->Login($this->username, $this->password);
174 174
 
175
-      if ($login_result) {
175
+        if ($login_result) {
176 176
         $this->Disconnect();
177 177
 
178 178
         return true;
179
-      }
179
+        }
180 180
 
181 181
     }
182 182
 
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
     $this->Disconnect();
185 185
 
186 186
     return false;
187
-  }
188
-
189
-  /**
190
-   * Connect to the POP3 server
191
-   * @access public
192
-   * @param string $host
193
-   * @param integer $port
194
-   * @param integer $tval
195
-   * @return boolean
196
-   */
197
-  public function Connect ($host, $port = false, $tval = 30) {
187
+    }
188
+
189
+    /**
190
+     * Connect to the POP3 server
191
+     * @access public
192
+     * @param string $host
193
+     * @param integer $port
194
+     * @param integer $tval
195
+     * @return boolean
196
+     */
197
+    public function Connect ($host, $port = false, $tval = 30) {
198 198
     //  Are we already connected?
199 199
     if ($this->connected) {
200
-      return true;
200
+        return true;
201 201
     }
202 202
 
203 203
     /*
@@ -209,45 +209,45 @@  discard block
 block discarded – undo
209 209
 
210 210
     //  Connect to the POP3 server
211 211
     $this->pop_conn = fsockopen($host,    //  POP3 Host
212
-                  $port,    //  Port #
213
-                  $errno,   //  Error Number
214
-                  $errstr,  //  Error Message
215
-                  $tval);   //  Timeout (seconds)
212
+                    $port,    //  Port #
213
+                    $errno,   //  Error Number
214
+                    $errstr,  //  Error Message
215
+                    $tval);   //  Timeout (seconds)
216 216
 
217 217
     //  Restore the error handler
218 218
     restore_error_handler();
219 219
 
220 220
     //  Does the Error Log now contain anything?
221 221
     if ($this->error && $this->do_debug >= 1) {
222
-      $this->displayErrors();
222
+        $this->displayErrors();
223 223
     }
224 224
 
225 225
     //  Did we connect?
226 226
     if ($this->pop_conn == false) {
227
-      //  It would appear not...
228
-      $this->error = array(
227
+        //  It would appear not...
228
+        $this->error = array(
229 229
         'error' => "Failed to connect to server $host on port $port",
230 230
         'errno' => $errno,
231 231
         'errstr' => $errstr
232
-      );
232
+        );
233 233
 
234
-      if ($this->do_debug >= 1) {
234
+        if ($this->do_debug >= 1) {
235 235
         $this->displayErrors();
236
-      }
236
+        }
237 237
 
238
-      return false;
238
+        return false;
239 239
     }
240 240
 
241 241
     //  Increase the stream time-out
242 242
 
243 243
     //  Check for PHP 4.3.0 or later
244 244
     if (version_compare(phpversion(), '5.0.0', 'ge')) {
245
-      stream_set_timeout($this->pop_conn, $tval, 0);
245
+        stream_set_timeout($this->pop_conn, $tval, 0);
246 246
     } else {
247
-      //  Does not work on Windows
248
-      if (substr(PHP_OS, 0, 3) !== 'WIN') {
247
+        //  Does not work on Windows
248
+        if (substr(PHP_OS, 0, 3) !== 'WIN') {
249 249
         socket_set_timeout($this->pop_conn, $tval, 0);
250
-      }
250
+        }
251 251
     }
252 252
 
253 253
     //  Get the POP3 server response
@@ -257,33 +257,33 @@  discard block
 block discarded – undo
257 257
     if ($this->checkResponse($pop3_response)) {
258 258
     //  The connection is established and the POP3 server is talking
259 259
     $this->connected = true;
260
-      return true;
260
+        return true;
261 261
     }
262 262
 
263
-  }
263
+    }
264 264
 
265
-  /**
266
-   * Login to the POP3 server (does not support APOP yet)
267
-   * @access public
268
-   * @param string $username
269
-   * @param string $password
270
-   * @return boolean
271
-   */
272
-  public function Login ($username = '', $password = '') {
265
+    /**
266
+     * Login to the POP3 server (does not support APOP yet)
267
+     * @access public
268
+     * @param string $username
269
+     * @param string $password
270
+     * @return boolean
271
+     */
272
+    public function Login ($username = '', $password = '') {
273 273
     if ($this->connected == false) {
274
-      $this->error = 'Not connected to POP3 server';
274
+        $this->error = 'Not connected to POP3 server';
275 275
 
276
-      if ($this->do_debug >= 1) {
276
+        if ($this->do_debug >= 1) {
277 277
         $this->displayErrors();
278
-      }
278
+        }
279 279
     }
280 280
 
281 281
     if (empty($username)) {
282
-      $username = $this->username;
282
+        $username = $this->username;
283 283
     }
284 284
 
285 285
     if (empty($password)) {
286
-      $password = $this->password;
286
+        $password = $this->password;
287 287
     }
288 288
 
289 289
     $pop_username = "USER $username" . $this->CRLF;
@@ -294,114 +294,114 @@  discard block
 block discarded – undo
294 294
     $pop3_response = $this->getResponse();
295 295
 
296 296
     if ($this->checkResponse($pop3_response)) {
297
-      //  Send the Password
298
-      $this->sendString($pop_password);
299
-      $pop3_response = $this->getResponse();
297
+        //  Send the Password
298
+        $this->sendString($pop_password);
299
+        $pop3_response = $this->getResponse();
300 300
 
301
-      if ($this->checkResponse($pop3_response)) {
301
+        if ($this->checkResponse($pop3_response)) {
302 302
         return true;
303
-      } else {
303
+        } else {
304 304
         return false;
305
-      }
305
+        }
306 306
     } else {
307
-      return false;
307
+        return false;
308
+    }
308 309
     }
309
-  }
310 310
 
311
-  /**
312
-   * Disconnect from the POP3 server
313
-   * @access public
314
-   */
315
-  public function Disconnect () {
311
+    /**
312
+     * Disconnect from the POP3 server
313
+     * @access public
314
+     */
315
+    public function Disconnect () {
316 316
     $this->sendString('QUIT');
317 317
 
318 318
     fclose($this->pop_conn);
319
-  }
320
-
321
-  /////////////////////////////////////////////////
322
-  //  Private Methods
323
-  /////////////////////////////////////////////////
324
-
325
-  /**
326
-   * Get the socket response back.
327
-   * $size is the maximum number of bytes to retrieve
328
-   * @access private
329
-   * @param integer $size
330
-   * @return string
331
-   */
332
-  private function getResponse ($size = 128) {
319
+    }
320
+
321
+    /////////////////////////////////////////////////
322
+    //  Private Methods
323
+    /////////////////////////////////////////////////
324
+
325
+    /**
326
+     * Get the socket response back.
327
+     * $size is the maximum number of bytes to retrieve
328
+     * @access private
329
+     * @param integer $size
330
+     * @return string
331
+     */
332
+    private function getResponse ($size = 128) {
333 333
     $pop3_response = fgets($this->pop_conn, $size);
334 334
 
335 335
     return $pop3_response;
336
-  }
337
-
338
-  /**
339
-   * Send a string down the open socket connection to the POP3 server
340
-   * @access private
341
-   * @param string $string
342
-   * @return integer
343
-   */
344
-  private function sendString ($string) {
336
+    }
337
+
338
+    /**
339
+     * Send a string down the open socket connection to the POP3 server
340
+     * @access private
341
+     * @param string $string
342
+     * @return integer
343
+     */
344
+    private function sendString ($string) {
345 345
     $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
346 346
 
347 347
     return $bytes_sent;
348
-  }
349
-
350
-  /**
351
-   * Checks the POP3 server response for +OK or -ERR
352
-   * @access private
353
-   * @param string $string
354
-   * @return boolean
355
-   */
356
-  private function checkResponse ($string) {
348
+    }
349
+
350
+    /**
351
+     * Checks the POP3 server response for +OK or -ERR
352
+     * @access private
353
+     * @param string $string
354
+     * @return boolean
355
+     */
356
+    private function checkResponse ($string) {
357 357
     if (substr($string, 0, 3) !== '+OK') {
358
-      $this->error = array(
358
+        $this->error = array(
359 359
         'error' => "Server reported an error: $string",
360 360
         'errno' => 0,
361 361
         'errstr' => ''
362
-      );
362
+        );
363 363
 
364
-      if ($this->do_debug >= 1) {
364
+        if ($this->do_debug >= 1) {
365 365
         $this->displayErrors();
366
-      }
366
+        }
367 367
 
368
-      return false;
368
+        return false;
369 369
     } else {
370
-      return true;
370
+        return true;
371 371
     }
372 372
 
373
-  }
373
+    }
374 374
 
375
-  /**
376
-   * If debug is enabled, display the error message array
377
-   * @access private
378
-   */
379
-  private function displayErrors () {
375
+    /**
376
+     * If debug is enabled, display the error message array
377
+     * @access private
378
+     */
379
+    private function displayErrors () {
380 380
     echo '<pre>';
381 381
 
382 382
     foreach ($this->error as $single_error) {
383
-      print_r($single_error);
383
+        print_r($single_error);
384 384
     }
385 385
 
386 386
     echo '</pre>';
387
-  }
388
-
389
-  /**
390
-   * Takes over from PHP for the socket warning handler
391
-   * @access private
392
-   * @param integer $errno
393
-   * @param string $errstr
394
-   * @param string $errfile
395
-   * @param integer $errline
396
-   */
397
-  private function catchWarning ($errno, $errstr, $errfile, $errline) {
387
+    }
388
+
389
+    /**
390
+     * Takes over from PHP for the socket warning handler
391
+     * @access private
392
+     * @param integer $errno
393
+     * @param string $errstr
394
+     * @param string $errfile
395
+     * @param integer $errline
396
+     */
397
+    private function catchWarning ($errno, $errstr, $errfile, $errline) {
398 398
     $this->error[] = array(
399
-      'error' => "Connecting to the POP3 server raised a PHP warning: ",
400
-      'errno' => $errno,
401
-      'errstr' => $errstr
399
+        'error' => "Connecting to the POP3 server raised a PHP warning: ",
400
+        'errno' => $errno,
401
+        'errstr' => $errstr
402 402
     );
403
-  }
403
+    }
404 404
 
405
-  //  End of class
405
+    //  End of class
406 406
 }
407 407
 ?>
408 408
\ No newline at end of file
Please login to merge, or discard this patch.
main/inc/lib/phpmailer/language/phpmailer.lang-ar.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.';
20 20
 //$PHPMAILER_LANG['provide_address']      = 'You must provide at least one recipient email address.';
21 21
 $PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: الأخطاء التالية ' .
22
-                                          'فشل في الارسال لكل من : ';
22
+                                            'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 //$PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() failed.';
25 25
 //$PHPMAILER_LANG['smtp_error']           = 'SMTP server error: ';
Please login to merge, or discard this patch.
main/inc/lib/array.lib.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -108,24 +108,24 @@
 block discarded – undo
108 108
  */
109 109
 function utf8_sort($array)
110 110
 {
111
-	$old_locale = setlocale(LC_ALL, null);
112
-	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
-	$try_sort = false;
111
+    $old_locale = setlocale(LC_ALL, null);
112
+    $code = api_get_language_isocode();
113
+    $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
+    $try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
117
-		$my_local = setlocale(LC_COLLATE, $locale);
118
-		if ($my_local) {
119
-			$try_sort = true;
120
-			break;
121
-		}
122
-	}
116
+    foreach($locale_list as $locale) {
117
+        $my_local = setlocale(LC_COLLATE, $locale);
118
+        if ($my_local) {
119
+            $try_sort = true;
120
+            break;
121
+        }
122
+    }
123 123
 
124
-	if ($try_sort) {
125
-		uasort($array, 'strcoll');
126
-	}
127
-	setlocale(LC_COLLATE, $old_locale);
128
-	return $array;
124
+    if ($try_sort) {
125
+        uasort($array, 'strcoll');
126
+    }
127
+    setlocale(LC_COLLATE, $old_locale);
128
+    return $array;
129 129
 }
130 130
 
131 131
 /**
Please login to merge, or discard this patch.
main/inc/lib/legal.lib.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
     {
16 16
     }
17 17
 
18
-	/**
19
-	 * Add a new Term and Condition
20
-	 * @param int $language language id
21
-	 * @param string $content content
22
-	 * @param int $type term and condition type (0 or 1)
23
-	 * @param string $changes explain changes
24
-	 * @return boolean success
25
-	 */
26
-	public static function add($language, $content, $type, $changes)
18
+    /**
19
+     * Add a new Term and Condition
20
+     * @param int $language language id
21
+     * @param string $content content
22
+     * @param int $type term and condition type (0 or 1)
23
+     * @param string $changes explain changes
24
+     * @return boolean success
25
+     */
26
+    public static function add($language, $content, $type, $changes)
27 27
     {
28 28
         $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
29 29
         $last = self::get_last_condition($language);
@@ -60,62 +60,62 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
 
63
-	public static function delete($id)
63
+    public static function delete($id)
64 64
     {
65
-		/*
65
+        /*
66 66
 		$legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
67 67
 		$id = intval($id);
68 68
 		$sql = "DELETE FROM $legal_table WHERE legal_id = '".$id."'";
69 69
 		*/
70
-	}
71
-
72
-	/**
73
-	 * Gets the last version of a Term and condition by language
74
-	 * @param int $language language id
75
-	 * @return array all the info of a Term and condition
76
-	 */
77
-	public static function get_last_condition_version($language)
70
+    }
71
+
72
+    /**
73
+     * Gets the last version of a Term and condition by language
74
+     * @param int $language language id
75
+     * @return array all the info of a Term and condition
76
+     */
77
+    public static function get_last_condition_version($language)
78 78
     {
79
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
-		$language= Database::escape_string($language);
81
-		$sql = "SELECT version FROM $legal_conditions_table
79
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
+        $language= Database::escape_string($language);
81
+        $sql = "SELECT version FROM $legal_conditions_table
82 82
 		        WHERE language_id = '".$language."'
83 83
 		        ORDER BY legal_id DESC LIMIT 1 ";
84
-		$result = Database::query($sql);
85
-		$row = Database::fetch_array($result);
84
+        $result = Database::query($sql);
85
+        $row = Database::fetch_array($result);
86 86
         if (Database::num_rows($result) > 0) {
87 87
 
88
-			return $row['version'];
89
-		} else {
88
+            return $row['version'];
89
+        } else {
90 90
 
91
-			return 0;
92
-		}
93
-	}
91
+            return 0;
92
+        }
93
+    }
94 94
 
95
-	/**
96
-	 * Gets the data of a Term and condition by language
97
-	 * @param int $language language id
98
-	 * @return array all the info of a Term and condition
99
-	 */
100
-	public static function get_last_condition ($language)
95
+    /**
96
+     * Gets the data of a Term and condition by language
97
+     * @param int $language language id
98
+     * @return array all the info of a Term and condition
99
+     */
100
+    public static function get_last_condition ($language)
101 101
     {
102
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
-		$language= Database::escape_string($language);
104
-		$sql = "SELECT * FROM $legal_conditions_table
102
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
+        $language= Database::escape_string($language);
104
+        $sql = "SELECT * FROM $legal_conditions_table
105 105
                 WHERE language_id = '".$language."'
106 106
                 ORDER BY version DESC
107 107
                 LIMIT 1 ";
108
-		$result = Database::query($sql);
108
+        $result = Database::query($sql);
109 109
 
110
-		return Database::fetch_array($result);
111
-	}
110
+        return Database::fetch_array($result);
111
+    }
112 112
 
113
-	/**
114
-	 * Gets the last version of a Term and condition by language
115
-	 * @param int $language language id
116
-	 * @return boolean | int the version or false if does not exist
117
-	 */
118
-	public static function get_last_version($language)
113
+    /**
114
+     * Gets the last version of a Term and condition by language
115
+     * @param int $language language id
116
+     * @return boolean | int the version or false if does not exist
117
+     */
118
+    public static function get_last_version($language)
119 119
     {
120 120
         $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
121 121
         $language = intval($language);
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 
134 134
             return false;
135 135
         }
136
-	}
136
+    }
137 137
 
138
-	/**
139
-	 * Show the last condition
140
-	 * @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
138
+    /**
139
+     * Show the last condition
140
+     * @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
141 141
      *
142
-	 * @return string html preview
143
-	 */
144
-	public static function show_last_condition($term_preview)
142
+     * @return string html preview
143
+     */
144
+    public static function show_last_condition($term_preview)
145 145
     {
146 146
         $preview = '';
147 147
         switch ($term_preview['type']) {
@@ -167,80 +167,80 @@  discard block
 block discarded – undo
167 167
             default:
168 168
                 break;
169 169
         }
170
-		return 	$preview;
171
-	}
172
-
173
-	/**
174
-	 * Get the terms and condition table (only for maintenance)
175
-	 * @param int offset
176
-	 * @param int number of items
177
-	 * @param int column
178
-	 * @return array
179
-	 */
180
-	public static function get_legal_data($from, $number_of_items, $column)
170
+        return 	$preview;
171
+    }
172
+
173
+    /**
174
+     * Get the terms and condition table (only for maintenance)
175
+     * @param int offset
176
+     * @param int number of items
177
+     * @param int column
178
+     * @return array
179
+     */
180
+    public static function get_legal_data($from, $number_of_items, $column)
181 181
     {
182
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
183
-		$lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
184
-		$from = intval($from);
185
-		$number_of_items = intval($number_of_items);
186
-		$column = intval($column);
182
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
183
+        $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
184
+        $from = intval($from);
185
+        $number_of_items = intval($number_of_items);
186
+        $column = intval($column);
187 187
 
188
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
188
+            $sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
189 189
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
190
-		$sql .= "ORDER BY language, version ASC ";
191
-		$sql .= "LIMIT $from, $number_of_items ";
192
-
193
-		$result = Database::query($sql);
194
-		$legals = array ();
195
-		$versions = array ();
196
-		while ($legal = Database::fetch_array($result)) {
197
-			// max 2000 chars
198
-			//echo strlen($legal[1]); echo '<br>';
199
-			$versions[]=$legal[0];
200
-			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
207
-			$legals[] = $legal;
208
-		}
209
-		return $legals;
210
-	}
211
-
212
-	/**
213
-	 * Gets the number of terms and conditions available
214
-	 * @return int
215
-	 */
216
-	public static function count()
190
+        $sql .= "ORDER BY language, version ASC ";
191
+        $sql .= "LIMIT $from, $number_of_items ";
192
+
193
+        $result = Database::query($sql);
194
+        $legals = array ();
195
+        $versions = array ();
196
+        while ($legal = Database::fetch_array($result)) {
197
+            // max 2000 chars
198
+            //echo strlen($legal[1]); echo '<br>';
199
+            $versions[]=$legal[0];
200
+            $languages[]=$legal[1];
201
+            if (strlen($legal[2])>2000)
202
+                $legal[2]= substr($legal[2],0,2000).' ... ';
203
+            if ($legal[4]==0)
204
+                $legal[4]= get_lang('HTMLText');
205
+            elseif($legal[4]==1)
206
+                $legal[4]=get_lang('PageLink');
207
+            $legals[] = $legal;
208
+        }
209
+        return $legals;
210
+    }
211
+
212
+    /**
213
+     * Gets the number of terms and conditions available
214
+     * @return int
215
+     */
216
+    public static function count()
217 217
     {
218
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
-		$sql = "SELECT count(*) as count_result
218
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
+        $sql = "SELECT count(*) as count_result
220 220
 		        FROM $legal_conditions_table
221 221
 		        ORDER BY legal_id DESC ";
222
-		$result = Database::query($sql);
223
-		$url = Database::fetch_array($result,'ASSOC');
224
-		$result = $url['count_result'];
225
-
226
-		return $result;
227
-	}
228
-
229
-	/**
230
-	 * Get type of terms and conditions
231
-	 * @param int The legal id
232
-	 * @param int The language id
233
-	 * @return int The current type of terms and conditions
234
-	 */
235
-	public static function get_type_of_terms_and_conditions($legal_id, $language_id)
222
+        $result = Database::query($sql);
223
+        $url = Database::fetch_array($result,'ASSOC');
224
+        $result = $url['count_result'];
225
+
226
+        return $result;
227
+    }
228
+
229
+    /**
230
+     * Get type of terms and conditions
231
+     * @param int The legal id
232
+     * @param int The language id
233
+     * @return int The current type of terms and conditions
234
+     */
235
+    public static function get_type_of_terms_and_conditions($legal_id, $language_id)
236 236
     {
237
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
-		$legal_id = intval($legal_id);
239
-		$language_id = intval($language_id);
240
-		$sql = 'SELECT type FROM '.$legal_conditions_table.'
237
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
+        $legal_id = intval($legal_id);
239
+        $language_id = intval($language_id);
240
+        $sql = 'SELECT type FROM '.$legal_conditions_table.'
241 241
 		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242
-		$rs = Database::query($sql);
242
+        $rs = Database::query($sql);
243 243
 
244
-		return Database::result($rs,0,'type');
245
-	}
244
+        return Database::result($rs,0,'type');
245
+    }
246 246
 }
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
         );
50 50
     }
51 51
 
52
-     /**
53
-     * Displays the page header
54
-     * @param string The name of the page (will be showed in the page title)
55
-     * @param string Optional help file name
56
-     * @param string $page_header
57
-     */
52
+        /**
53
+         * Displays the page header
54
+         * @param string The name of the page (will be showed in the page title)
55
+         * @param string Optional help file name
56
+         * @param string $page_header
57
+         */
58 58
     public static function display_header($tool_name ='', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     public static function display_normal_message($message, $filter = true, $returnValue = false)
450 450
     {
451
-    	$message = self::return_message($message, 'normal', $filter);
451
+        $message = self::return_message($message, 'normal', $filter);
452 452
         if ($returnValue) {
453 453
             return $message;
454 454
         } else {
@@ -524,22 +524,22 @@  discard block
 block discarded – undo
524 524
     public static function return_message($message, $type = 'normal', $filter = true)
525 525
     {
526 526
         if ($filter) {
527
-        	$message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
527
+            $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
528 528
         }
529 529
 
530 530
         $class = "";
531 531
         switch($type) {
532 532
             case 'warning':
533 533
                $class .= 'alert alert-warning';
534
-               break;
534
+                break;
535 535
             case 'error':
536 536
                $class .= 'alert alert-danger';
537
-               break;
537
+                break;
538 538
             case 'confirmation':
539 539
             case 'confirm':
540 540
             case 'success':
541 541
                 $class .= 'alert alert-success';
542
-               break;
542
+                break;
543 543
             case 'normal':
544 544
             default:
545 545
                 $class .= 'alert alert-info';
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
      * @param array    additional attributes (for instance height, width, onclick, ...)
683 683
      * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
684 684
      * @return void
685
-    */
685
+     */
686 686
     public static function display_icon(
687 687
         $image,
688 688
         $alt_text = '',
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
      * @author Julio Montoya 2010 Function improved, adding image constants
706 706
      * @author Yannick Warnier 2011 Added size handler
707 707
      * @version Feb 2011
708
-    */
708
+     */
709 709
     public static function return_icon(
710 710
         $image,
711 711
         $alt_text = '',
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
      */
885 885
     public static function input($type, $name, $value, $attributes = array())
886 886
     {
887
-         if (isset($type)) {
888
-             $attributes['type']= $type;
889
-         }
890
-         if (isset($name)) {
891
-             $attributes['name']= $name;
892
-         }
893
-         if (isset($value)) {
894
-             $attributes['value']= $value;
887
+            if (isset($type)) {
888
+                $attributes['type']= $type;
889
+            }
890
+            if (isset($name)) {
891
+                $attributes['name']= $name;
892
+            }
893
+            if (isset($value)) {
894
+                $attributes['value']= $value;
895 895
         }
896 896
         return self::tag('input', '', $attributes);
897 897
     }
@@ -904,10 +904,10 @@  discard block
 block discarded – undo
904 904
      */
905 905
     public static function button($name, $value, $attributes = array())
906 906
     {
907
-    	if (!empty($name)) {
907
+        if (!empty($name)) {
908 908
             $attributes['name'] = $name;
909
-    	}
910
-    	return self::tag('button', $value, $attributes);
909
+        }
910
+        return self::tag('button', $value, $attributes);
911 911
     }
912 912
 
913 913
     /**
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
      * in the $htmlHeadXtra variable before the display_header
975 975
      * Add this script
976 976
      * @example
977
-             * <script>
977
+     * <script>
978 978
                     $(function() {
979 979
                         $( "#tabs" ).tabs();
980 980
                     });
@@ -1035,20 +1035,20 @@  discard block
 block discarded – undo
1035 1035
      */
1036 1036
     public static function tabsOnlyLink($headers, $selected = null)
1037 1037
     {
1038
-         $id = uniqid();
1039
-         $i = 1;
1040
-         $lis = null;
1041
-         foreach ($headers as $item) {
1038
+            $id = uniqid();
1039
+            $i = 1;
1040
+            $lis = null;
1041
+            foreach ($headers as $item) {
1042 1042
             $class = null;
1043 1043
             if ($i == $selected) {
1044 1044
                 $class = 'active';
1045 1045
             }
1046
-             $item = self::tag(
1047
-                 'a',
1048
-                 $item['content'],
1049
-                 array('id' => $id.'-'.$i, 'href' => $item['url'])
1050
-             );
1051
-             $lis .= self::tag('li', $item, array('class' => $class));
1046
+                $item = self::tag(
1047
+                    'a',
1048
+                    $item['content'],
1049
+                    array('id' => $id.'-'.$i, 'href' => $item['url'])
1050
+                );
1051
+                $lis .= self::tag('li', $item, array('class' => $class));
1052 1052
             $i++;
1053 1053
         }
1054 1054
         return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin'));
@@ -1260,8 +1260,8 @@  discard block
 block discarded – undo
1260 1260
      */
1261 1261
     public static function table($headers, $rows, $attributes = array())
1262 1262
     {
1263
-    	if (empty($attributes)) {
1264
-    		$attributes['class'] = 'data_table';
1263
+        if (empty($attributes)) {
1264
+            $attributes['class'] = 'data_table';
1265 1265
         }
1266 1266
         $table = new HTML_Table($attributes);
1267 1267
         $row = 0;
@@ -1269,17 +1269,17 @@  discard block
 block discarded – undo
1269 1269
 
1270 1270
         // Course headers
1271 1271
         if (!empty($headers)) {
1272
-	        foreach ($headers as $item) {
1273
-	            $table->setHeaderContents($row, $column, $item);
1274
-	            $column++;
1275
-	        }
1276
-	        $row = 1;
1277
-	        $column = 0;
1272
+            foreach ($headers as $item) {
1273
+                $table->setHeaderContents($row, $column, $item);
1274
+                $column++;
1275
+            }
1276
+            $row = 1;
1277
+            $column = 0;
1278 1278
         }
1279 1279
 
1280 1280
         if (!empty($rows)) {
1281
-	        foreach($rows as $content) {
1282
-	            $table->setCellContents($row, $column, $content);
1281
+            foreach($rows as $content) {
1282
+                $table->setCellContents($row, $column, $content);
1283 1283
                 $row++;
1284 1284
             }
1285 1285
         }
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
                         //$item_property['tool'] != TOOL_DROPBOX &&
1386 1386
                         $item_property['tool'] != TOOL_NOTEBOOK &&
1387 1387
                         $item_property['tool'] != TOOL_CHAT)
1388
-                   )
1388
+                    )
1389 1389
                 )
1390 1390
                 // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset.
1391 1391
                 && ($item_property['visibility'] == '1'
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
                         ($item_property['to_user_id'] != $user_id) &&
1402 1402
                         (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids)))
1403 1403
                 ) {
1404
-                   continue;
1404
+                    continue;
1405 1405
                 }
1406 1406
 
1407 1407
                 // If it's a survey, make sure the user's invited. Otherwise drop it.
@@ -1620,21 +1620,21 @@  discard block
 block discarded – undo
1620 1620
      *
1621 1621
      * @param  string  id of the rating ul element
1622 1622
      * @param  string  url that will be added (for jquery see hot_courses.tpl)
1623
-	 * @param	string	point info array see function CourseManager::get_course_ranking()
1624
-	 * @param	bool	add a div wrapper
1625
-	 * @todo	use     templates
1623
+     * @param	string	point info array see function CourseManager::get_course_ranking()
1624
+     * @param	bool	add a div wrapper
1625
+     * @todo	use     templates
1626 1626
      **/
1627 1627
     public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true)
1628 1628
     {
1629
-		$number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null;
1630
-		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1629
+        $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null;
1630
+        $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1631 1631
 
1632
-		if (!empty($percentage)) {
1632
+        if (!empty($percentage)) {
1633 1633
             $percentage = $percentage*125/100;
1634 1634
         }
1635
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1635
+        $accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1636 1636
 
1637
-		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1637
+        $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1638 1638
 
1639 1639
         $html = '<ul id="'.$id.'" class="star-rating">
1640 1640
 					<li class="current-rating" style="width:'.$percentage.'px;"></li>
@@ -1645,26 +1645,26 @@  discard block
 block discarded – undo
1645 1645
 					<li><a href="javascript:void(0);" data-link="'.$url.'&amp;star=5" title="'.$star_label.'" class="five-stars">5</a></li>
1646 1646
 				</ul>';
1647 1647
 
1648
-		$labels = array();
1648
+        $labels = array();
1649 1649
 
1650
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1651
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1652
-		if (!empty($number_of_users_who_voted)) {
1653
-			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1654
-		}
1650
+        $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1651
+        $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1652
+        if (!empty($number_of_users_who_voted)) {
1653
+            $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1654
+        }
1655 1655
 
1656
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1656
+        $labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1657 1657
 
1658
-		if (!$add_div_wrapper && api_is_anonymous()) {
1659
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1660
-		}
1658
+        if (!$add_div_wrapper && api_is_anonymous()) {
1659
+            $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1660
+        }
1661 1661
 
1662 1662
         $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1663 1663
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1664 1664
 
1665 1665
         if ($add_div_wrapper) {
1666
-			$html = Display::div($html, array('id' => 'rating_wrapper_'.$id));
1667
-		}
1666
+            $html = Display::div($html, array('id' => 'rating_wrapper_'.$id));
1667
+        }
1668 1668
 
1669 1669
         return $html;
1670 1670
     }
@@ -1702,8 +1702,8 @@  discard block
 block discarded – undo
1702 1702
         return self::page_header($title, $second_title);
1703 1703
     }
1704 1704
 
1705
-     public static function page_subheader_and_translate($title, $second_title = null)
1706
-     {
1705
+        public static function page_subheader_and_translate($title, $second_title = null)
1706
+        {
1707 1707
         $title = get_lang($title);
1708 1708
         return self::page_subheader($title, $second_title);
1709 1709
     }
Please login to merge, or discard this patch.