@@ -76,6 +76,10 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $sCode |
|
| 81 | + * @param integer $nStartSearch |
|
| 82 | + */ |
|
| 79 | 83 | public function findEndOfPHPString($sCode, $nStartSearch) |
| 80 | 84 | { |
| 81 | 85 | $nEnd = 0; |
@@ -116,6 +120,10 @@ discard block |
||
| 116 | 120 | } |
| 117 | 121 | |
| 118 | 122 | // TODO: performance ... scan once at __construct and store line positions |
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @param integer $nPos |
|
| 126 | + */ |
|
| 119 | 127 | public function findLineOfPos($nPos) |
| 120 | 128 | { |
| 121 | 129 | $nLine = 1; |
@@ -246,11 +246,21 @@ discard block |
||
| 246 | 246 | return $ret; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | +/** |
|
| 250 | + * @param string $name |
|
| 251 | + * @param string $default |
|
| 252 | + * |
|
| 253 | + * @return string |
|
| 254 | + */ |
|
| 249 | 255 | function getSysConfig($name, $default) |
| 250 | 256 | { |
| 251 | 257 | return sql_value("SELECT `value` FROM `sysconfig` WHERE `name`='&1'", $default, $name); |
| 252 | 258 | } |
| 253 | 259 | |
| 260 | +/** |
|
| 261 | + * @param string $name |
|
| 262 | + * @param string $value |
|
| 263 | + */ |
|
| 254 | 264 | function setSysConfig($name, $value) |
| 255 | 265 | { |
| 256 | 266 | sql( |
@@ -333,6 +343,9 @@ discard block |
||
| 333 | 343 | } |
| 334 | 344 | |
| 335 | 345 | |
| 346 | +/** |
|
| 347 | + * @return string |
|
| 348 | + */ |
|
| 336 | 349 | function escape_javascript($text) |
| 337 | 350 | { |
| 338 | 351 | return str_replace('\'', '\\\'', str_replace('"', '"', $text)); |
@@ -128,6 +128,9 @@ |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
| 131 | +/** |
|
| 132 | + * @param boolean $include_editor |
|
| 133 | + */ |
|
| 131 | 134 | function assignFromDB($userid, $include_editor) |
| 132 | 135 | { |
| 133 | 136 | global $tpl, $opt, $smilies, $_REQUEST; |
@@ -182,6 +182,9 @@ |
||
| 182 | 182 | $tpl->display(); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | +/** |
|
| 186 | + * @param user $user |
|
| 187 | + */ |
|
| 185 | 188 | function assignFromUser($user) |
| 186 | 189 | { |
| 187 | 190 | global $tpl; |
@@ -188,6 +188,9 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | + /** |
|
| 192 | + * @return string |
|
| 193 | + */ |
|
| 191 | 194 | public static function removeSensitiveData($message) |
| 192 | 195 | { |
| 193 | 196 | return str_replace( |
@@ -553,6 +556,10 @@ discard block |
||
| 553 | 556 | return mysql_affected_rows(); |
| 554 | 557 | } |
| 555 | 558 | |
| 559 | + /** |
|
| 560 | + * @param string $table |
|
| 561 | + * @param string $field |
|
| 562 | + */ |
|
| 556 | 563 | public static function field_exists($table, $field) |
| 557 | 564 | { |
| 558 | 565 | if (!preg_match("/[a-z0-9_]+/", $table.$field)) |
@@ -679,6 +686,9 @@ discard block |
||
| 679 | 686 | public $consumer_key; |
| 680 | 687 | public $token_type; |
| 681 | 688 | |
| 689 | + /** |
|
| 690 | + * @param string $token_type |
|
| 691 | + */ |
|
| 682 | 692 | public function __construct($key, $secret, $consumer_key, $token_type) |
| 683 | 693 | { |
| 684 | 694 | parent::__construct($key, $secret); |
@@ -755,6 +765,7 @@ discard block |
||
| 755 | 765 | * options. If $token_required == false, it doesn't throw an exception when |
| 756 | 766 | * there is no token specified. You may also change the token_type required |
| 757 | 767 | * for this request. |
| 768 | + * @param OAuthRequest $request |
|
| 758 | 769 | */ |
| 759 | 770 | public function verify_request2(&$request, $token_type = 'access', $token_required = true) |
| 760 | 771 | { |
@@ -1052,6 +1063,7 @@ discard block |
||
| 1052 | 1063 | * Save a variable to okapi_vars. WARNING: The entire content of okapi_vars table |
| 1053 | 1064 | * is loaded on EVERY execution. Do not store data in this table, unless it's |
| 1054 | 1065 | * frequently needed. |
| 1066 | + * @param string $varname |
|
| 1055 | 1067 | */ |
| 1056 | 1068 | public static function set_var($varname, $value) |
| 1057 | 1069 | { |
@@ -1330,6 +1342,7 @@ discard block |
||
| 1330 | 1342 | |
| 1331 | 1343 | /** |
| 1332 | 1344 | * Split the array into groups of max. $size items. |
| 1345 | + * @param integer $size |
|
| 1333 | 1346 | */ |
| 1334 | 1347 | public static function make_groups($array, $size) |
| 1335 | 1348 | { |
@@ -1476,6 +1489,7 @@ discard block |
||
| 1476 | 1489 | * Generate a string of random characters, suitable for keys as passwords. |
| 1477 | 1490 | * Troublesome characters like '0', 'O', '1', 'l' will not be used. |
| 1478 | 1491 | * If $user_friendly=true, then it will consist from numbers only. |
| 1492 | + * @param integer $length |
|
| 1479 | 1493 | */ |
| 1480 | 1494 | public static function generate_key($length, $user_friendly = false) |
| 1481 | 1495 | { |
@@ -1496,6 +1510,7 @@ discard block |
||
| 1496 | 1510 | * Register new OKAPI Consumer, send him an email with his key-pair, etc. |
| 1497 | 1511 | * This method does not verify parameter values, check if they are in |
| 1498 | 1512 | * a correct format prior the execution. |
| 1513 | + * @param string $appname |
|
| 1499 | 1514 | */ |
| 1500 | 1515 | public static function register_new_consumer($appname, $appurl, $email) |
| 1501 | 1516 | { |
@@ -1565,6 +1580,8 @@ discard block |
||
| 1565 | 1580 | /** |
| 1566 | 1581 | * Return an SQL formula for calculating distance between two geopoints. |
| 1567 | 1582 | * Parameters should be either numberals or strings (SQL field references). |
| 1583 | + * @param null|string $lat2 |
|
| 1584 | + * @param null|string $lon2 |
|
| 1568 | 1585 | */ |
| 1569 | 1586 | public static function get_distance_sql($lat1, $lon1, $lat2, $lon2) |
| 1570 | 1587 | { |
@@ -2044,6 +2061,9 @@ discard block |
||
| 2044 | 2061 | return $html; |
| 2045 | 2062 | } |
| 2046 | 2063 | |
| 2064 | + /** |
|
| 2065 | + * @param string $variable |
|
| 2066 | + */ |
|
| 2047 | 2067 | function php_ini_get_bytes($variable) |
| 2048 | 2068 | { |
| 2049 | 2069 | $value = trim(ini_get($variable)); |
@@ -2077,6 +2097,7 @@ discard block |
||
| 2077 | 2097 | * |
| 2078 | 2098 | * If $timeout is null, then the object will be treated as persistent |
| 2079 | 2099 | * (the Cache will do its best to NEVER remove it). |
| 2100 | + * @param string $key |
|
| 2080 | 2101 | */ |
| 2081 | 2102 | public static function set($key, $value, $timeout) |
| 2082 | 2103 | { |
@@ -2099,6 +2120,8 @@ discard block |
||
| 2099 | 2120 | /** |
| 2100 | 2121 | * Scored version of set. Elements set up this way will expire when they're |
| 2101 | 2122 | * not used. |
| 2123 | + * @param string $key |
|
| 2124 | + * @param string $value |
|
| 2102 | 2125 | */ |
| 2103 | 2126 | public static function set_scored($key, $value) |
| 2104 | 2127 | { |
@@ -2201,6 +2224,7 @@ discard block |
||
| 2201 | 2224 | |
| 2202 | 2225 | /** |
| 2203 | 2226 | * Delete key $key from the cache. |
| 2227 | + * @param string $key |
|
| 2204 | 2228 | */ |
| 2205 | 2229 | public static function delete($key) |
| 2206 | 2230 | { |
@@ -2226,6 +2250,9 @@ discard block |
||
| 2226 | 2250 | */ |
| 2227 | 2251 | class FileCache |
| 2228 | 2252 | { |
| 2253 | + /** |
|
| 2254 | + * @param string $key |
|
| 2255 | + */ |
|
| 2229 | 2256 | public static function get_file_path($key) |
| 2230 | 2257 | { |
| 2231 | 2258 | $filename = Okapi::get_var_dir()."/okapi_filecache_".md5($key); |
@@ -2238,6 +2265,8 @@ discard block |
||
| 2238 | 2265 | * Note, there is no $timeout (time to live) parameter. Currently, |
| 2239 | 2266 | * OKAPI will delete every old file after certain amount of time. |
| 2240 | 2267 | * See CacheCleanupCronJob for details. |
| 2268 | + * @param string $key |
|
| 2269 | + * @param string $value |
|
| 2241 | 2270 | */ |
| 2242 | 2271 | public static function set($key, $value) |
| 2243 | 2272 | { |
@@ -2274,6 +2303,7 @@ discard block |
||
| 2274 | 2303 | /** |
| 2275 | 2304 | * Return request parameter, or NULL when not found. Use this instead of |
| 2276 | 2305 | * $_GET or $_POST or $_REQUEST. |
| 2306 | + * @param string $name |
|
| 2277 | 2307 | */ |
| 2278 | 2308 | public abstract function get_parameter($name); |
| 2279 | 2309 | |
@@ -2310,6 +2340,7 @@ discard block |
||
| 2310 | 2340 | /** |
| 2311 | 2341 | * You may use "null" values in parameters if you want them skipped |
| 2312 | 2342 | * (null-ized keys will be removed from parameters). |
| 2343 | + * @param OkapiConsumer|null $consumer |
|
| 2313 | 2344 | */ |
| 2314 | 2345 | public function __construct($consumer, $token, $parameters) |
| 2315 | 2346 | { |
@@ -2526,6 +2557,7 @@ discard block |
||
| 2526 | 2557 | /** |
| 2527 | 2558 | * Return request parameter, or NULL when not found. Use this instead of |
| 2528 | 2559 | * $_GET or $_POST or $_REQUEST. |
| 2560 | + * @param string $name |
|
| 2529 | 2561 | */ |
| 2530 | 2562 | public function get_parameter($name) |
| 2531 | 2563 | { |
@@ -64,6 +64,7 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * Execute all scheduled cronjobs of given type, reschedule, and return |
| 66 | 66 | * UNIX timestamp of the nearest scheduled event. |
| 67 | + * @param string $type |
|
| 67 | 68 | */ |
| 68 | 69 | public static function run_jobs($type) |
| 69 | 70 | { |
@@ -127,6 +128,7 @@ discard block |
||
| 127 | 128 | /** |
| 128 | 129 | * Force a specified cronjob to run. Throw an exception if cronjob not found. |
| 129 | 130 | * $job_name mast equal one of the names returned by ->get_name() method. |
| 131 | + * @param string $job_name |
|
| 130 | 132 | */ |
| 131 | 133 | public static function force_run($job_name) |
| 132 | 134 | { |
@@ -146,6 +148,7 @@ discard block |
||
| 146 | 148 | /** |
| 147 | 149 | * Reset the schedule of a specified cronjob. This will force the job to |
| 148 | 150 | * run on nearest occasion (but not NOW). |
| 151 | + * @param string $job_name |
|
| 149 | 152 | */ |
| 150 | 153 | public static function reset_job_schedule($job_name) |
| 151 | 154 | { |
@@ -77,6 +77,9 @@ discard block |
||
| 77 | 77 | $this->AddInfo = array(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | + /** |
|
| 81 | + * @param string $Name |
|
| 82 | + */ |
|
| 80 | 83 | function FileAdd($Name, $Data, $DataType=self::TBSZIP_STRING, $Compress=true) { |
| 81 | 84 | |
| 82 | 85 | if ($Data===false) return $this->FileCancelModif($Name, false); // Cancel a previously added file |
@@ -127,6 +130,9 @@ discard block |
||
| 127 | 130 | return true; |
| 128 | 131 | } |
| 129 | 132 | |
| 133 | + /** |
|
| 134 | + * @param string $cd_info |
|
| 135 | + */ |
|
| 130 | 136 | function CentralDirRead_End($cd_info) { |
| 131 | 137 | $b = $cd_info.$this->_ReadData(18); |
| 132 | 138 | $x = array(); |
@@ -142,6 +148,9 @@ discard block |
||
| 142 | 148 | return $x; |
| 143 | 149 | } |
| 144 | 150 | |
| 151 | + /** |
|
| 152 | + * @param integer $idx |
|
| 153 | + */ |
|
| 145 | 154 | function CentralDirRead_File($idx) { |
| 146 | 155 | |
| 147 | 156 | $b = $this->_ReadData(46); |
@@ -175,6 +184,9 @@ discard block |
||
| 175 | 184 | return $x; |
| 176 | 185 | } |
| 177 | 186 | |
| 187 | + /** |
|
| 188 | + * @param string $Msg |
|
| 189 | + */ |
|
| 178 | 190 | function RaiseError($Msg) { |
| 179 | 191 | if ($this->DisplayError) { |
| 180 | 192 | if (PHP_SAPI==='cli') { |
@@ -310,6 +322,9 @@ discard block |
||
| 310 | 322 | |
| 311 | 323 | } |
| 312 | 324 | |
| 325 | + /** |
|
| 326 | + * @param boolean $ReadData |
|
| 327 | + */ |
|
| 313 | 328 | function _ReadFile($idx, $ReadData) { |
| 314 | 329 | // read the file header (and maybe the data ) in the archive, assuming the cursor in at a new file position |
| 315 | 330 | |
@@ -625,6 +640,10 @@ discard block |
||
| 625 | 640 | // output functions |
| 626 | 641 | // ---------------- |
| 627 | 642 | |
| 643 | + /** |
|
| 644 | + * @param integer $Render |
|
| 645 | + * @param string $ContentType |
|
| 646 | + */ |
|
| 628 | 647 | function OutputOpen($Render, $File, $ContentType) { |
| 629 | 648 | |
| 630 | 649 | if (($Render & self::TBSZIP_FILE)==self::TBSZIP_FILE) { |
@@ -697,6 +716,9 @@ discard block |
||
| 697 | 716 | // Reading functions |
| 698 | 717 | // ---------------- |
| 699 | 718 | |
| 719 | + /** |
|
| 720 | + * @param integer $relative |
|
| 721 | + */ |
|
| 700 | 722 | function _MoveTo($pos, $relative = SEEK_SET) { |
| 701 | 723 | fseek($this->ArchHnd, $pos, $relative); |
| 702 | 724 | } |
@@ -714,6 +736,10 @@ discard block |
||
| 714 | 736 | // Take info from binary data |
| 715 | 737 | // ---------------- |
| 716 | 738 | |
| 739 | + /** |
|
| 740 | + * @param integer $pos |
|
| 741 | + * @param integer $len |
|
| 742 | + */ |
|
| 717 | 743 | function _GetDec($txt, $pos, $len) { |
| 718 | 744 | $x = substr($txt, $pos, $len); |
| 719 | 745 | $z = 0; |
@@ -724,11 +750,21 @@ discard block |
||
| 724 | 750 | return $z; |
| 725 | 751 | } |
| 726 | 752 | |
| 753 | + /** |
|
| 754 | + * @param string $txt |
|
| 755 | + * @param integer $pos |
|
| 756 | + * @param integer $len |
|
| 757 | + */ |
|
| 727 | 758 | function _GetHex($txt, $pos, $len) { |
| 728 | 759 | $x = substr($txt, $pos, $len); |
| 729 | 760 | return 'h:'.bin2hex(strrev($x)); |
| 730 | 761 | } |
| 731 | 762 | |
| 763 | + /** |
|
| 764 | + * @param string $txt |
|
| 765 | + * @param integer $pos |
|
| 766 | + * @param integer $len |
|
| 767 | + */ |
|
| 732 | 768 | function _GetBin($txt, $pos, $len) { |
| 733 | 769 | $x = substr($txt, $pos, $len); |
| 734 | 770 | $z = ''; |
@@ -749,6 +785,10 @@ discard block |
||
| 749 | 785 | // Put info into binary data |
| 750 | 786 | // ---------------- |
| 751 | 787 | |
| 788 | + /** |
|
| 789 | + * @param integer $pos |
|
| 790 | + * @param integer $len |
|
| 791 | + */ |
|
| 752 | 792 | function _PutDec(&$txt, $val, $pos, $len) { |
| 753 | 793 | $x = ''; |
| 754 | 794 | for ($i=0;$i<$len;$i++) { |
@@ -802,6 +842,7 @@ discard block |
||
| 802 | 842 | * Return the position of the record in the file. |
| 803 | 843 | * Return false if the record is not found. The comment cannot exceed 65335 bytes (=FFFF). |
| 804 | 844 | * The method is read backwards a block of 256 bytes and search the key in this block. |
| 845 | + * @param string $cd_info |
|
| 805 | 846 | */ |
| 806 | 847 | function _FindCDEnd($cd_info) { |
| 807 | 848 | $nbr = 1; |
@@ -825,6 +866,9 @@ discard block |
||
| 825 | 866 | return false; |
| 826 | 867 | } |
| 827 | 868 | |
| 869 | + /** |
|
| 870 | + * @param integer $PosLoc |
|
| 871 | + */ |
|
| 828 | 872 | function _DataOuputAddedFile($Idx, $PosLoc) { |
| 829 | 873 | |
| 830 | 874 | $Ref =& $this->AddInfo[$Idx]; |
@@ -885,6 +929,10 @@ discard block |
||
| 885 | 929 | |
| 886 | 930 | } |
| 887 | 931 | |
| 932 | + /** |
|
| 933 | + * @param integer $DataType |
|
| 934 | + * @param boolean $Compress |
|
| 935 | + */ |
|
| 888 | 936 | function _DataCreateNewRef($Data, $DataType, $Compress, $Diff, $NameOrIdx) { |
| 889 | 937 | |
| 890 | 938 | $file_time = false; |
@@ -104,6 +104,10 @@ discard block |
||
| 104 | 104 | $extras['reason_stack'][] = 'missing_parameter'; |
| 105 | 105 | $extras['parameter'] = $this->param_name; |
| 106 | 106 | } |
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @param string $param_name |
|
| 110 | + */ |
|
| 107 | 111 | public function __construct($param_name) { |
| 108 | 112 | parent::__construct("Missing '$param_name' parameter. This parameter is required."); |
| 109 | 113 | $this->param_name = $param_name; |
@@ -151,6 +155,12 @@ discard block |
||
| 151 | 155 | $extras['difference'] = $this->ourTimestamp - $this->usersTimestamp; |
| 152 | 156 | $extras['threshold'] = $this->threshold; |
| 153 | 157 | } |
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * @param integer $users |
|
| 161 | + * @param integer $ours |
|
| 162 | + * @param integer $threshold |
|
| 163 | + */ |
|
| 154 | 164 | public function __construct($users, $ours, $threshold) { |
| 155 | 165 | $this->usersTimestamp = $users; |
| 156 | 166 | $this->ourTimestamp = $ours; |
@@ -352,6 +362,12 @@ discard block |
||
| 352 | 362 | // (1) do a lookup in a table of trusted certs keyed off of consumer |
| 353 | 363 | // |
| 354 | 364 | // Either way should return a string representation of the certificate |
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * @param OAuthRequest $request |
|
| 368 | + * |
|
| 369 | + * @return string |
|
| 370 | + */ |
|
| 355 | 371 | protected abstract function fetch_private_cert(&$request); |
| 356 | 372 | |
| 357 | 373 | public function build_signature($request, $consumer, $token) { |
@@ -481,6 +497,9 @@ discard block |
||
| 481 | 497 | return new OAuthRequest($http_method, $http_url, $parameters); |
| 482 | 498 | } |
| 483 | 499 | |
| 500 | + /** |
|
| 501 | + * @param string $name |
|
| 502 | + */ |
|
| 484 | 503 | public function set_parameter($name, $value, $allow_duplicates = true) { |
| 485 | 504 | if ($allow_duplicates && isset($this->parameters[$name])) { |
| 486 | 505 | // We have already added parameter(s) with this name, so add to the list |
@@ -665,6 +684,9 @@ discard block |
||
| 665 | 684 | $this->data_store = $data_store; |
| 666 | 685 | } |
| 667 | 686 | |
| 687 | + /** |
|
| 688 | + * @param OAuthSignatureMethod_HMAC_SHA1 $signature_method |
|
| 689 | + */ |
|
| 668 | 690 | public function add_signature_method($signature_method) { |
| 669 | 691 | $this->signature_methods[$signature_method->get_name()] = |
| 670 | 692 | $signature_method; |
@@ -55,6 +55,10 @@ |
||
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param OkapiRequest $request |
|
| 60 | + * @param string $name |
|
| 61 | + */ |
|
| 58 | 62 | private static function require_uint($request, $name, $min_value = 0) |
| 59 | 63 | { |
| 60 | 64 | $val = $request->get_parameter($name); |