@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Step user through importing their file |
|
| 44 | - */ |
|
| 43 | + * Step user through importing their file |
|
| 44 | + */ |
|
| 45 | 45 | public function import_dialog($content = array()) { |
| 46 | 46 | $appname = $_GET['appname'] ? $_GET['appname'] : $content['appname']; |
| 47 | 47 | $definition = $_GET['definition'] ? $_GET['definition'] : $content['definition']; |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
| 226 | - * Get options for select boxes |
|
| 227 | - */ |
|
| 226 | + * Get options for select boxes |
|
| 227 | + */ |
|
| 228 | 228 | public static function get_select_options(Array $data) { |
| 229 | 229 | $options = array( |
| 230 | 230 | 'delimiter' => array( |
@@ -2033,7 +2033,7 @@ |
||
| 2033 | 2033 | * |
| 2034 | 2034 | * Reimplemented to add logging |
| 2035 | 2035 | * |
| 2036 | - * @param $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php |
|
| 2036 | + * @param $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php |
|
| 2037 | 2037 | */ |
| 2038 | 2038 | function ServeRequest($prefix=null) |
| 2039 | 2039 | { |
@@ -217,25 +217,25 @@ discard block |
||
| 217 | 217 | header("Pragma: no-cache"); // HTTP/1.0 |
| 218 | 218 | |
| 219 | 219 | function duration($ts) { |
| 220 | - global $time; |
|
| 221 | - $years = (int)((($time - $ts)/(7*86400))/52.177457); |
|
| 222 | - $rem = (int)(($time-$ts)-($years * 52.177457 * 7 * 86400)); |
|
| 223 | - $weeks = (int)(($rem)/(7*86400)); |
|
| 224 | - $days = (int)(($rem)/86400) - $weeks*7; |
|
| 225 | - $hours = (int)(($rem)/3600) - $days*24 - $weeks*7*24; |
|
| 226 | - $mins = (int)(($rem)/60) - $hours*60 - $days*24*60 - $weeks*7*24*60; |
|
| 227 | - $str = ''; |
|
| 228 | - if($years==1) $str .= "$years year, "; |
|
| 229 | - if($years>1) $str .= "$years years, "; |
|
| 230 | - if($weeks==1) $str .= "$weeks week, "; |
|
| 231 | - if($weeks>1) $str .= "$weeks weeks, "; |
|
| 232 | - if($days==1) $str .= "$days day,"; |
|
| 233 | - if($days>1) $str .= "$days days,"; |
|
| 234 | - if($hours == 1) $str .= " $hours hour and"; |
|
| 235 | - if($hours>1) $str .= " $hours hours and"; |
|
| 236 | - if($mins == 1) $str .= " 1 minute"; |
|
| 237 | - else $str .= " $mins minutes"; |
|
| 238 | - return $str; |
|
| 220 | + global $time; |
|
| 221 | + $years = (int)((($time - $ts)/(7*86400))/52.177457); |
|
| 222 | + $rem = (int)(($time-$ts)-($years * 52.177457 * 7 * 86400)); |
|
| 223 | + $weeks = (int)(($rem)/(7*86400)); |
|
| 224 | + $days = (int)(($rem)/86400) - $weeks*7; |
|
| 225 | + $hours = (int)(($rem)/3600) - $days*24 - $weeks*7*24; |
|
| 226 | + $mins = (int)(($rem)/60) - $hours*60 - $days*24*60 - $weeks*7*24*60; |
|
| 227 | + $str = ''; |
|
| 228 | + if($years==1) $str .= "$years year, "; |
|
| 229 | + if($years>1) $str .= "$years years, "; |
|
| 230 | + if($weeks==1) $str .= "$weeks week, "; |
|
| 231 | + if($weeks>1) $str .= "$weeks weeks, "; |
|
| 232 | + if($days==1) $str .= "$days day,"; |
|
| 233 | + if($days>1) $str .= "$days days,"; |
|
| 234 | + if($hours == 1) $str .= " $hours hour and"; |
|
| 235 | + if($hours>1) $str .= " $hours hours and"; |
|
| 236 | + if($mins == 1) $str .= " 1 minute"; |
|
| 237 | + else $str .= " $mins minutes"; |
|
| 238 | + return $str; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | // create graphics |
@@ -420,18 +420,18 @@ discard block |
||
| 420 | 420 | if($block['offset']!=$ptr) { // Used block |
| 421 | 421 | $h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s; |
| 422 | 422 | if ($h>0) { |
| 423 | - $j++; |
|
| 423 | + $j++; |
|
| 424 | 424 | if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j); |
| 425 | - else fill_box($image,$x,$y,50,$h,$col_black,$col_red); |
|
| 426 | - } |
|
| 425 | + else fill_box($image,$x,$y,50,$h,$col_black,$col_red); |
|
| 426 | + } |
|
| 427 | 427 | $y+=$h; |
| 428 | 428 | } |
| 429 | 429 | $h=(GRAPH_SIZE-5)*($block['size'])/$s; |
| 430 | 430 | if ($h>0) { |
| 431 | - $j++; |
|
| 431 | + $j++; |
|
| 432 | 432 | if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j); |
| 433 | 433 | else fill_box($image,$x,$y,50,$h,$col_black,$col_green); |
| 434 | - } |
|
| 434 | + } |
|
| 435 | 435 | $y+=$h; |
| 436 | 436 | $ptr = $block['offset']+$block['size']; |
| 437 | 437 | } |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | $apcversion = phpversion('apcu'); |
| 782 | 782 | $phpversion = phpversion(); |
| 783 | 783 | $number_vars = $cache['num_entries']; |
| 784 | - $size_vars = bsize($cache['mem_size']); |
|
| 784 | + $size_vars = bsize($cache['mem_size']); |
|
| 785 | 785 | $i=0; |
| 786 | 786 | echo <<< EOB |
| 787 | 787 | <div class="info div1"><h2>General Cache Information</h2> |
@@ -883,9 +883,9 @@ discard block |
||
| 883 | 883 | ++$nseg; |
| 884 | 884 | } |
| 885 | 885 | $ptr = $block['offset'] + $block['size']; |
| 886 | - /* Only consider blocks <5M for the fragmentation % */ |
|
| 887 | - if($block['size']<(5*1024*1024)) $fragsize+=$block['size']; |
|
| 888 | - $freetotal+=$block['size']; |
|
| 886 | + /* Only consider blocks <5M for the fragmentation % */ |
|
| 887 | + if($block['size']<(5*1024*1024)) $fragsize+=$block['size']; |
|
| 888 | + $freetotal+=$block['size']; |
|
| 889 | 889 | } |
| 890 | 890 | $freeseg += count($mem['block_lists'][$i]); |
| 891 | 891 | } |
@@ -907,15 +907,15 @@ discard block |
||
| 907 | 907 | </td> |
| 908 | 908 | </tr> |
| 909 | 909 | EOB; |
| 910 | - if(isset($mem['adist'])) { |
|
| 911 | - foreach($mem['adist'] as $i=>$v) { |
|
| 912 | - $cur = pow(2,$i); $nxt = pow(2,$i+1)-1; |
|
| 913 | - if($i==0) $range = "1"; |
|
| 914 | - else $range = "$cur - $nxt"; |
|
| 915 | - echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n"; |
|
| 916 | - } |
|
| 917 | - } |
|
| 918 | - echo <<<EOB |
|
| 910 | + if(isset($mem['adist'])) { |
|
| 911 | + foreach($mem['adist'] as $i=>$v) { |
|
| 912 | + $cur = pow(2,$i); $nxt = pow(2,$i+1)-1; |
|
| 913 | + if($i==0) $range = "1"; |
|
| 914 | + else $range = "$cur - $nxt"; |
|
| 915 | + echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n"; |
|
| 916 | + } |
|
| 917 | + } |
|
| 918 | + echo <<<EOB |
|
| 919 | 919 | </tbody></table> |
| 920 | 920 | </div> |
| 921 | 921 | EOB; |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | // ----------------------------------------------- |
| 929 | 929 | case OB_USER_CACHE: |
| 930 | 930 | if (!$AUTHENTICATED) { |
| 931 | - echo '<div class="error">You need to login to see the user values here!<br/> <br/>'; |
|
| 931 | + echo '<div class="error">You need to login to see the user values here!<br/> <br/>'; |
|
| 932 | 932 | put_login_link("Login now!"); |
| 933 | 933 | echo '</div>'; |
| 934 | 934 | break; |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | '<option value=500',$MYREQUEST['COUNT']=='500'? ' selected':'','>Top 500</option>', |
| 974 | 974 | '<option value=0 ',$MYREQUEST['COUNT']=='0' ? ' selected':'','>All</option>', |
| 975 | 975 | '</select>', |
| 976 | - ' Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>', |
|
| 976 | + ' Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>', |
|
| 977 | 977 | ' <input type=submit value="GO!">', |
| 978 | 978 | '</form></div>'; |
| 979 | 979 | |
@@ -982,8 +982,8 @@ discard block |
||
| 982 | 982 | // regular expression subpattern. |
| 983 | 983 | $MYREQUEST['SEARCH'] = '/'.str_replace('/', '\\/', $MYREQUEST['SEARCH']).'/i'; |
| 984 | 984 | if (preg_match($MYREQUEST['SEARCH'], 'test') === false) { |
| 985 | - echo '<div class="error">Error: enter a valid regular expression as a search query.</div>'; |
|
| 986 | - break; |
|
| 985 | + echo '<div class="error">Error: enter a valid regular expression as a search query.</div>'; |
|
| 986 | + break; |
|
| 987 | 987 | } |
| 988 | 988 | } |
| 989 | 989 | |
@@ -1037,45 +1037,45 @@ discard block |
||
| 1037 | 1037 | // output list |
| 1038 | 1038 | $i=0; |
| 1039 | 1039 | foreach($list as $k => $entry) { |
| 1040 | - if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) { |
|
| 1040 | + if(!$MYREQUEST['SEARCH'] || preg_match($MYREQUEST['SEARCH'], $entry[$fieldname]) != 0) { |
|
| 1041 | 1041 | $sh=md5($entry["info"]); |
| 1042 | - $field_value = htmlentities(strip_tags($entry[$fieldname],''), ENT_QUOTES, 'UTF-8'); |
|
| 1043 | - echo |
|
| 1044 | - '<tr id="key-'. $sh .'" class=tr-',$i%2,'>', |
|
| 1045 | - "<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",$sh,"#key-". $sh ."\">",$field_value,'</a></td>', |
|
| 1046 | - '<td class="td-n center">',$entry['num_hits'],'</td>', |
|
| 1047 | - '<td class="td-n right">',$entry['mem_size'],'</td>', |
|
| 1048 | - '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>', |
|
| 1049 | - '<td class="td-n center">',date(DATE_FORMAT,$entry['mtime']),'</td>', |
|
| 1050 | - '<td class="td-n center">',date(DATE_FORMAT,$entry['creation_time']),'</td>'; |
|
| 1051 | - |
|
| 1052 | - if($fieldname=='info') { |
|
| 1053 | - if($entry['ttl']) |
|
| 1054 | - echo '<td class="td-n center">'.$entry['ttl'].' seconds</td>'; |
|
| 1055 | - else |
|
| 1056 | - echo '<td class="td-n center">None</td>'; |
|
| 1057 | - } |
|
| 1058 | - if ($entry['deletion_time']) { |
|
| 1059 | - |
|
| 1060 | - echo '<td class="td-last center">', date(DATE_FORMAT,$entry['deletion_time']), '</td>'; |
|
| 1061 | - } else if ($MYREQUEST['OB'] == OB_USER_CACHE) { |
|
| 1062 | - |
|
| 1063 | - echo '<td class="td-last center">'; |
|
| 1064 | - echo '[<a href="', $MY_SELF, '&OB=', $MYREQUEST['OB'], '&DU=', urlencode($entry[$fieldkey]), '">Delete Now</a>]'; |
|
| 1065 | - echo '</td>'; |
|
| 1066 | - } else { |
|
| 1067 | - echo '<td class="td-last center"> </td>'; |
|
| 1068 | - } |
|
| 1069 | - echo '</tr>'; |
|
| 1042 | + $field_value = htmlentities(strip_tags($entry[$fieldname],''), ENT_QUOTES, 'UTF-8'); |
|
| 1043 | + echo |
|
| 1044 | + '<tr id="key-'. $sh .'" class=tr-',$i%2,'>', |
|
| 1045 | + "<td class=td-0><a href=\"$MY_SELF&OB=",$MYREQUEST['OB'],"&SH=",$sh,"#key-". $sh ."\">",$field_value,'</a></td>', |
|
| 1046 | + '<td class="td-n center">',$entry['num_hits'],'</td>', |
|
| 1047 | + '<td class="td-n right">',$entry['mem_size'],'</td>', |
|
| 1048 | + '<td class="td-n center">',date(DATE_FORMAT,$entry['access_time']),'</td>', |
|
| 1049 | + '<td class="td-n center">',date(DATE_FORMAT,$entry['mtime']),'</td>', |
|
| 1050 | + '<td class="td-n center">',date(DATE_FORMAT,$entry['creation_time']),'</td>'; |
|
| 1051 | + |
|
| 1052 | + if($fieldname=='info') { |
|
| 1053 | + if($entry['ttl']) |
|
| 1054 | + echo '<td class="td-n center">'.$entry['ttl'].' seconds</td>'; |
|
| 1055 | + else |
|
| 1056 | + echo '<td class="td-n center">None</td>'; |
|
| 1057 | + } |
|
| 1058 | + if ($entry['deletion_time']) { |
|
| 1059 | + |
|
| 1060 | + echo '<td class="td-last center">', date(DATE_FORMAT,$entry['deletion_time']), '</td>'; |
|
| 1061 | + } else if ($MYREQUEST['OB'] == OB_USER_CACHE) { |
|
| 1062 | + |
|
| 1063 | + echo '<td class="td-last center">'; |
|
| 1064 | + echo '[<a href="', $MY_SELF, '&OB=', $MYREQUEST['OB'], '&DU=', urlencode($entry[$fieldkey]), '">Delete Now</a>]'; |
|
| 1065 | + echo '</td>'; |
|
| 1066 | + } else { |
|
| 1067 | + echo '<td class="td-last center"> </td>'; |
|
| 1068 | + } |
|
| 1069 | + echo '</tr>'; |
|
| 1070 | 1070 | if ($sh == $MYREQUEST["SH"]) { |
| 1071 | 1071 | echo '<tr>'; |
| 1072 | 1072 | echo '<td colspan="7"><pre>'.htmlentities(print_r(apcu_fetch($entry['info']), 1)).'</pre></td>'; |
| 1073 | 1073 | echo '</tr>'; |
| 1074 | 1074 | } |
| 1075 | - $i++; |
|
| 1076 | - if ($i == $MYREQUEST['COUNT']) |
|
| 1077 | - break; |
|
| 1078 | - } |
|
| 1075 | + $i++; |
|
| 1076 | + if ($i == $MYREQUEST['COUNT']) |
|
| 1077 | + break; |
|
| 1078 | + } |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | } else { |
@@ -1106,10 +1106,10 @@ discard block |
||
| 1106 | 1106 | </tr> |
| 1107 | 1107 | EOB; |
| 1108 | 1108 | if (defined('PROXY')) { |
| 1109 | - $ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) ); |
|
| 1110 | - $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss", False, $ctxt); |
|
| 1109 | + $ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) ); |
|
| 1110 | + $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss", False, $ctxt); |
|
| 1111 | 1111 | } else { |
| 1112 | - $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss"); |
|
| 1112 | + $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss"); |
|
| 1113 | 1113 | } |
| 1114 | 1114 | if (!$rss) { |
| 1115 | 1115 | echo '<tr class="td-last center"><td>Unable to fetch version information.</td></tr>'; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | class calendar_wizard_import_csv extends importexport_wizard_basic_import_csv |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * constructor |
| 20 | 20 | */ |
| 21 | 21 | function __construct() |
@@ -807,11 +807,11 @@ discard block |
||
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | /** |
| 810 | - * Add seconds between 1601-01-01 and 1970-01-01 and multiply by 10000000 |
|
| 811 | - * |
|
| 812 | - * @param long $unixTime |
|
| 813 | - * @return long windowsTime |
|
| 814 | - */ |
|
| 810 | + * Add seconds between 1601-01-01 and 1970-01-01 and multiply by 10000000 |
|
| 811 | + * |
|
| 812 | + * @param long $unixTime |
|
| 813 | + * @return long windowsTime |
|
| 814 | + */ |
|
| 815 | 815 | public static function convertUnixTimeToWindowsTime($unixTime) |
| 816 | 816 | { |
| 817 | 817 | return ($unixTime + 11644477200) * 10000000; |
@@ -1263,10 +1263,10 @@ discard block |
||
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | /** |
| 1266 | - * Convert 8bit characters e.g. accented characters to UTF8 encoded characters |
|
| 1267 | - * |
|
| 1268 | - * Extended to use mbstring to convert from arbitrary charset to utf-8 |
|
| 1269 | - */ |
|
| 1266 | + * Convert 8bit characters e.g. accented characters to UTF8 encoded characters |
|
| 1267 | + * |
|
| 1268 | + * Extended to use mbstring to convert from arbitrary charset to utf-8 |
|
| 1269 | + */ |
|
| 1270 | 1270 | public function encode8Bit(&$item, $key) |
| 1271 | 1271 | { |
| 1272 | 1272 | if ($this->charset != 'utf-8' && $key != 'password') |
@@ -1294,29 +1294,29 @@ discard block |
||
| 1294 | 1294 | return $this->userClass; |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | - /** |
|
| 1298 | - * Get the group class interface |
|
| 1299 | - * |
|
| 1300 | - * @return adLDAPGroups |
|
| 1301 | - */ |
|
| 1302 | - public function group() { |
|
| 1303 | - if (!$this->groupClass) { |
|
| 1304 | - $this->groupClass = new adLDAPGroups($this); |
|
| 1305 | - } |
|
| 1306 | - return $this->groupClass; |
|
| 1307 | - } |
|
| 1308 | - |
|
| 1309 | - /** |
|
| 1310 | - * Get the utils class interface |
|
| 1311 | - * |
|
| 1312 | - * @return adLDAPUtils |
|
| 1313 | - */ |
|
| 1314 | - public function utilities() { |
|
| 1315 | - if (!$this->utilClass) { |
|
| 1316 | - $this->utilClass = new adLDAPUtils($this); |
|
| 1317 | - } |
|
| 1318 | - return $this->utilClass; |
|
| 1319 | - } |
|
| 1297 | + /** |
|
| 1298 | + * Get the group class interface |
|
| 1299 | + * |
|
| 1300 | + * @return adLDAPGroups |
|
| 1301 | + */ |
|
| 1302 | + public function group() { |
|
| 1303 | + if (!$this->groupClass) { |
|
| 1304 | + $this->groupClass = new adLDAPGroups($this); |
|
| 1305 | + } |
|
| 1306 | + return $this->groupClass; |
|
| 1307 | + } |
|
| 1308 | + |
|
| 1309 | + /** |
|
| 1310 | + * Get the utils class interface |
|
| 1311 | + * |
|
| 1312 | + * @return adLDAPUtils |
|
| 1313 | + */ |
|
| 1314 | + public function utilities() { |
|
| 1315 | + if (!$this->utilClass) { |
|
| 1316 | + $this->utilClass = new adLDAPUtils($this); |
|
| 1317 | + } |
|
| 1318 | + return $this->utilClass; |
|
| 1319 | + } |
|
| 1320 | 1320 | } |
| 1321 | 1321 | |
| 1322 | 1322 | /** |
@@ -1405,45 +1405,45 @@ discard block |
||
| 1405 | 1405 | return true; |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | - /** |
|
| 1409 | - * Encode a password for transmission over LDAP |
|
| 1410 | - * |
|
| 1411 | - * Extended to use mbstring to convert from arbitrary charset to UTF-16LE |
|
| 1412 | - * |
|
| 1413 | - * @param string $password The password to encode |
|
| 1414 | - * @return string |
|
| 1415 | - */ |
|
| 1416 | - public function encodePassword($password) |
|
| 1417 | - { |
|
| 1418 | - $password="\"".$password."\""; |
|
| 1419 | - if (function_exists('mb_convert_encoding') && !empty($this->adldap->charset)) |
|
| 1420 | - { |
|
| 1421 | - return mb_convert_encoding($password, 'UTF-16LE', $this->adldap->charset); |
|
| 1422 | - } |
|
| 1423 | - $encoded=""; |
|
| 1424 | - for ($i=0; $i <strlen($password); $i++){ $encoded.="{$password{$i}}\000"; } |
|
| 1425 | - return $encoded; |
|
| 1426 | - } |
|
| 1427 | - |
|
| 1428 | - /** |
|
| 1429 | - * Set a password |
|
| 1430 | - * |
|
| 1431 | - * Requires "Reset password" priviledges from bind user! |
|
| 1432 | - * |
|
| 1408 | + /** |
|
| 1409 | + * Encode a password for transmission over LDAP |
|
| 1410 | + * |
|
| 1411 | + * Extended to use mbstring to convert from arbitrary charset to UTF-16LE |
|
| 1412 | + * |
|
| 1413 | + * @param string $password The password to encode |
|
| 1414 | + * @return string |
|
| 1415 | + */ |
|
| 1416 | + public function encodePassword($password) |
|
| 1417 | + { |
|
| 1418 | + $password="\"".$password."\""; |
|
| 1419 | + if (function_exists('mb_convert_encoding') && !empty($this->adldap->charset)) |
|
| 1420 | + { |
|
| 1421 | + return mb_convert_encoding($password, 'UTF-16LE', $this->adldap->charset); |
|
| 1422 | + } |
|
| 1423 | + $encoded=""; |
|
| 1424 | + for ($i=0; $i <strlen($password); $i++){ $encoded.="{$password{$i}}\000"; } |
|
| 1425 | + return $encoded; |
|
| 1426 | + } |
|
| 1427 | + |
|
| 1428 | + /** |
|
| 1429 | + * Set a password |
|
| 1430 | + * |
|
| 1431 | + * Requires "Reset password" priviledges from bind user! |
|
| 1432 | + * |
|
| 1433 | 1433 | * We can NOT set password with ldap_add or ldap_modify, it needs ldap_mod_replace, at least under Win2008r2! |
| 1434 | 1434 | * |
| 1435 | - * @param string $dn |
|
| 1436 | - * @param string $password |
|
| 1437 | - * @return boolean |
|
| 1438 | - */ |
|
| 1439 | - public function setPassword($dn, $password) |
|
| 1440 | - { |
|
| 1441 | - $result = ldap_mod_replace($ds=$this->adldap->getLdapConnection(), $dn, array( |
|
| 1442 | - 'unicodePwd' => $this->encodePassword($password), |
|
| 1443 | - )); |
|
| 1444 | - if (!$result) error_log(__METHOD__."('$dn', '$password') ldap_mod_replace($ds, '$dn', \$password) returned FALSE: ".ldap_error($ds)); |
|
| 1445 | - return $result; |
|
| 1446 | - } |
|
| 1435 | + * @param string $dn |
|
| 1436 | + * @param string $password |
|
| 1437 | + * @return boolean |
|
| 1438 | + */ |
|
| 1439 | + public function setPassword($dn, $password) |
|
| 1440 | + { |
|
| 1441 | + $result = ldap_mod_replace($ds=$this->adldap->getLdapConnection(), $dn, array( |
|
| 1442 | + 'unicodePwd' => $this->encodePassword($password), |
|
| 1443 | + )); |
|
| 1444 | + if (!$result) error_log(__METHOD__."('$dn', '$password') ldap_mod_replace($ds, '$dn', \$password) returned FALSE: ".ldap_error($ds)); |
|
| 1445 | + return $result; |
|
| 1446 | + } |
|
| 1447 | 1447 | |
| 1448 | 1448 | /** |
| 1449 | 1449 | * Check if we can to a real password change, not just a password reset |
@@ -1457,30 +1457,30 @@ discard block |
||
| 1457 | 1457 | return function_exists('ldap_modify_batch'); |
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | - /** |
|
| 1461 | - * Set the password of a user - This must be performed over SSL |
|
| 1462 | - * |
|
| 1463 | - * @param string $username The username to modify |
|
| 1464 | - * @param string $password The new password |
|
| 1465 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
| 1466 | - * @param string $old_password old password for password change, if supported |
|
| 1467 | - * @return bool |
|
| 1468 | - */ |
|
| 1469 | - public function password($username, $password, $isGUID = false, $old_password=null) |
|
| 1470 | - { |
|
| 1471 | - if ($username === NULL) { return false; } |
|
| 1472 | - if ($password === NULL) { return false; } |
|
| 1473 | - if (!$this->adldap->getLdapBind()) { return false; } |
|
| 1474 | - if (!$this->adldap->getUseSSL() && !$this->adldap->getUseTLS()) { |
|
| 1475 | - throw new adLDAPException('SSL must be configured on your webserver and enabled in the class to set passwords.'); |
|
| 1476 | - } |
|
| 1477 | - |
|
| 1478 | - $userDn = $this->dn($username, $isGUID); |
|
| 1479 | - if ($userDn === false) { |
|
| 1480 | - return false; |
|
| 1481 | - } |
|
| 1482 | - |
|
| 1483 | - $add=array(); |
|
| 1460 | + /** |
|
| 1461 | + * Set the password of a user - This must be performed over SSL |
|
| 1462 | + * |
|
| 1463 | + * @param string $username The username to modify |
|
| 1464 | + * @param string $password The new password |
|
| 1465 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
| 1466 | + * @param string $old_password old password for password change, if supported |
|
| 1467 | + * @return bool |
|
| 1468 | + */ |
|
| 1469 | + public function password($username, $password, $isGUID = false, $old_password=null) |
|
| 1470 | + { |
|
| 1471 | + if ($username === NULL) { return false; } |
|
| 1472 | + if ($password === NULL) { return false; } |
|
| 1473 | + if (!$this->adldap->getLdapBind()) { return false; } |
|
| 1474 | + if (!$this->adldap->getUseSSL() && !$this->adldap->getUseTLS()) { |
|
| 1475 | + throw new adLDAPException('SSL must be configured on your webserver and enabled in the class to set passwords.'); |
|
| 1476 | + } |
|
| 1477 | + |
|
| 1478 | + $userDn = $this->dn($username, $isGUID); |
|
| 1479 | + if ($userDn === false) { |
|
| 1480 | + return false; |
|
| 1481 | + } |
|
| 1482 | + |
|
| 1483 | + $add=array(); |
|
| 1484 | 1484 | |
| 1485 | 1485 | if (empty($old_password) || !function_exists('ldap_modify_batch')) { |
| 1486 | 1486 | $add["unicodePwd"][0] = $this->encodePassword($password); |
@@ -1502,76 +1502,76 @@ discard block |
||
| 1502 | 1502 | ); |
| 1503 | 1503 | $result = ldap_modify_batch($this->adldap->getLdapConnection(), $userDn, $mods); |
| 1504 | 1504 | } |
| 1505 | - if ($result === false){ |
|
| 1506 | - $err = ldap_errno($this->adldap->getLdapConnection()); |
|
| 1507 | - if ($err) { |
|
| 1508 | - $msg = 'Error ' . $err . ': ' . ldap_err2str($err) . '.'; |
|
| 1509 | - if($err == 53) { |
|
| 1510 | - $msg .= ' Your password might not match the password policy.'; |
|
| 1511 | - } |
|
| 1512 | - throw new adLDAPException($msg); |
|
| 1513 | - } |
|
| 1514 | - else { |
|
| 1515 | - return false; |
|
| 1516 | - } |
|
| 1517 | - } |
|
| 1518 | - |
|
| 1519 | - return true; |
|
| 1520 | - } |
|
| 1521 | - |
|
| 1522 | - /** |
|
| 1523 | - * Modify a user |
|
| 1524 | - * |
|
| 1525 | - * @param string $username The username to query |
|
| 1526 | - * @param array $attributes The attributes to modify. Note if you set the enabled attribute you must not specify any other attributes |
|
| 1527 | - * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
| 1528 | - * @return bool |
|
| 1529 | - */ |
|
| 1530 | - public function modify($username, $attributes, $isGUID = false) |
|
| 1531 | - { |
|
| 1532 | - if ($username === NULL) { return "Missing compulsory field [username]"; } |
|
| 1533 | - if (array_key_exists("password", $attributes) && !$this->adldap->getUseSSL() && !$this->adldap->getUseTLS()) { |
|
| 1534 | - throw new adLDAPException('SSL/TLS must be configured on your webserver and enabled in the class to set passwords.'); |
|
| 1535 | - } |
|
| 1536 | - |
|
| 1537 | - // Find the dn of the user |
|
| 1538 | - $userDn = $this->dn($username, $isGUID); |
|
| 1539 | - if ($userDn === false) { |
|
| 1540 | - return false; |
|
| 1541 | - } |
|
| 1542 | - |
|
| 1543 | - // Translate the update to the LDAP schema |
|
| 1544 | - $mod = $this->adldap->adldap_schema($attributes); |
|
| 1545 | - |
|
| 1546 | - // Check to see if this is an enabled status update |
|
| 1547 | - if (!$mod && !array_key_exists("enabled", $attributes)){ |
|
| 1548 | - return false; |
|
| 1549 | - } |
|
| 1550 | - |
|
| 1551 | - // Set the account control attribute (only if specified) |
|
| 1552 | - if (array_key_exists("enabled", $attributes)){ |
|
| 1553 | - if ($attributes["enabled"]){ |
|
| 1554 | - $controlOptions = array("NORMAL_ACCOUNT"); |
|
| 1555 | - } |
|
| 1556 | - else { |
|
| 1557 | - $controlOptions = array("NORMAL_ACCOUNT", "ACCOUNTDISABLE"); |
|
| 1558 | - } |
|
| 1559 | - $mod["userAccountControl"][0] = $this->accountControl($controlOptions); |
|
| 1560 | - } |
|
| 1505 | + if ($result === false){ |
|
| 1506 | + $err = ldap_errno($this->adldap->getLdapConnection()); |
|
| 1507 | + if ($err) { |
|
| 1508 | + $msg = 'Error ' . $err . ': ' . ldap_err2str($err) . '.'; |
|
| 1509 | + if($err == 53) { |
|
| 1510 | + $msg .= ' Your password might not match the password policy.'; |
|
| 1511 | + } |
|
| 1512 | + throw new adLDAPException($msg); |
|
| 1513 | + } |
|
| 1514 | + else { |
|
| 1515 | + return false; |
|
| 1516 | + } |
|
| 1517 | + } |
|
| 1518 | + |
|
| 1519 | + return true; |
|
| 1520 | + } |
|
| 1521 | + |
|
| 1522 | + /** |
|
| 1523 | + * Modify a user |
|
| 1524 | + * |
|
| 1525 | + * @param string $username The username to query |
|
| 1526 | + * @param array $attributes The attributes to modify. Note if you set the enabled attribute you must not specify any other attributes |
|
| 1527 | + * @param bool $isGUID Is the username passed a GUID or a samAccountName |
|
| 1528 | + * @return bool |
|
| 1529 | + */ |
|
| 1530 | + public function modify($username, $attributes, $isGUID = false) |
|
| 1531 | + { |
|
| 1532 | + if ($username === NULL) { return "Missing compulsory field [username]"; } |
|
| 1533 | + if (array_key_exists("password", $attributes) && !$this->adldap->getUseSSL() && !$this->adldap->getUseTLS()) { |
|
| 1534 | + throw new adLDAPException('SSL/TLS must be configured on your webserver and enabled in the class to set passwords.'); |
|
| 1535 | + } |
|
| 1536 | + |
|
| 1537 | + // Find the dn of the user |
|
| 1538 | + $userDn = $this->dn($username, $isGUID); |
|
| 1539 | + if ($userDn === false) { |
|
| 1540 | + return false; |
|
| 1541 | + } |
|
| 1542 | + |
|
| 1543 | + // Translate the update to the LDAP schema |
|
| 1544 | + $mod = $this->adldap->adldap_schema($attributes); |
|
| 1545 | + |
|
| 1546 | + // Check to see if this is an enabled status update |
|
| 1547 | + if (!$mod && !array_key_exists("enabled", $attributes)){ |
|
| 1548 | + return false; |
|
| 1549 | + } |
|
| 1550 | + |
|
| 1551 | + // Set the account control attribute (only if specified) |
|
| 1552 | + if (array_key_exists("enabled", $attributes)){ |
|
| 1553 | + if ($attributes["enabled"]){ |
|
| 1554 | + $controlOptions = array("NORMAL_ACCOUNT"); |
|
| 1555 | + } |
|
| 1556 | + else { |
|
| 1557 | + $controlOptions = array("NORMAL_ACCOUNT", "ACCOUNTDISABLE"); |
|
| 1558 | + } |
|
| 1559 | + $mod["userAccountControl"][0] = $this->accountControl($controlOptions); |
|
| 1560 | + } |
|
| 1561 | 1561 | // we can NOT set password with ldap_add or ldap_modify, it needs ldap_mod_replace, at least under Win2008r2 |
| 1562 | 1562 | unset($mod['unicodePwd']); |
| 1563 | 1563 | |
| 1564 | 1564 | if ($mod) |
| 1565 | 1565 | { |
| 1566 | - // Do the update |
|
| 1567 | - $result = @ldap_modify($ds=$this->adldap->getLdapConnection(), $userDn, $mod); |
|
| 1568 | - if ($result == false) { |
|
| 1566 | + // Do the update |
|
| 1567 | + $result = @ldap_modify($ds=$this->adldap->getLdapConnection(), $userDn, $mod); |
|
| 1568 | + if ($result == false) { |
|
| 1569 | 1569 | if (isset($mod['unicodePwd'])) $mod['unicodePwd'] = '***'; |
| 1570 | 1570 | error_log(__METHOD__."(".array2string($attributes).") ldap_modify($ds, '$userDn', ".array2string($mod).") returned ".array2string($result)." ldap_error()=".ldap_error($ds)); |
| 1571 | - return false; |
|
| 1572 | - } |
|
| 1571 | + return false; |
|
| 1572 | + } |
|
| 1573 | 1573 | } |
| 1574 | - if (array_key_exists("password",$attributes) && !$this->setPassword($userDn, $attributes['password'])) |
|
| 1574 | + if (array_key_exists("password",$attributes) && !$this->setPassword($userDn, $attributes['password'])) |
|
| 1575 | 1575 | { |
| 1576 | 1576 | return false; |
| 1577 | 1577 | } |
@@ -1636,23 +1636,23 @@ discard block |
||
| 1636 | 1636 | return $this->adldap->encode8bit($item, $key); |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | - /** |
|
| 1640 | - * Escape strings for the use in LDAP filters |
|
| 1641 | - * |
|
| 1642 | - * DEVELOPERS SHOULD BE DOING PROPER FILTERING IF THEY'RE ACCEPTING USER INPUT |
|
| 1643 | - * Ported from Perl's Net::LDAP::Util escape_filter_value |
|
| 1644 | - * |
|
| 1645 | - * @param string $str The string the parse |
|
| 1646 | - * @author Port by Andreas Gohr <[email protected]> |
|
| 1647 | - * @return string |
|
| 1648 | - */ |
|
| 1649 | - public function ldapSlashes($str){ |
|
| 1650 | - return preg_replace_callback( |
|
| 1651 | - '/([\x00-\x1F\*\(\)\\\\])/', |
|
| 1652 | - function ($matches) { |
|
| 1653 | - return "\\".join("", unpack("H2", $matches[1])); |
|
| 1654 | - }, |
|
| 1655 | - $str |
|
| 1656 | - ); |
|
| 1657 | - } |
|
| 1639 | + /** |
|
| 1640 | + * Escape strings for the use in LDAP filters |
|
| 1641 | + * |
|
| 1642 | + * DEVELOPERS SHOULD BE DOING PROPER FILTERING IF THEY'RE ACCEPTING USER INPUT |
|
| 1643 | + * Ported from Perl's Net::LDAP::Util escape_filter_value |
|
| 1644 | + * |
|
| 1645 | + * @param string $str The string the parse |
|
| 1646 | + * @author Port by Andreas Gohr <[email protected]> |
|
| 1647 | + * @return string |
|
| 1648 | + */ |
|
| 1649 | + public function ldapSlashes($str){ |
|
| 1650 | + return preg_replace_callback( |
|
| 1651 | + '/([\x00-\x1F\*\(\)\\\\])/', |
|
| 1652 | + function ($matches) { |
|
| 1653 | + return "\\".join("", unpack("H2", $matches[1])); |
|
| 1654 | + }, |
|
| 1655 | + $str |
|
| 1656 | + ); |
|
| 1657 | + } |
|
| 1658 | 1658 | } |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * appname of app which want to add / edit its customfields |
|
| 36 | - * |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 35 | + * appname of app which want to add / edit its customfields |
|
| 36 | + * |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | var $appname; |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | protected $use_private = false; |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | - * userdefiened types e.g. type of infolog |
|
| 48 | - * |
|
| 49 | - * @var array |
|
| 50 | - */ |
|
| 47 | + * userdefiened types e.g. type of infolog |
|
| 48 | + * |
|
| 49 | + * @var array |
|
| 50 | + */ |
|
| 51 | 51 | var $types2 = array(); |
| 52 | 52 | var $content_types,$fields; |
| 53 | 53 | |
@@ -507,8 +507,8 @@ discard block |
||
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
| 510 | - * deletes custom field from customfield definitions |
|
| 511 | - */ |
|
| 510 | + * deletes custom field from customfield definitions |
|
| 511 | + */ |
|
| 512 | 512 | function delete_field(&$content) |
| 513 | 513 | { |
| 514 | 514 | unset($this->fields[key($content['fields']['delete'])]); |
@@ -525,8 +525,8 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | /** |
| 528 | - * create a new custom field |
|
| 529 | - */ |
|
| 528 | + * create a new custom field |
|
| 529 | + */ |
|
| 530 | 530 | function create_field(&$content) |
| 531 | 531 | { |
| 532 | 532 | $new_name = trim($content['fields'][count($content['fields'])-1]['name']); |
@@ -587,8 +587,8 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
| 590 | - * save changes to repository |
|
| 591 | - */ |
|
| 590 | + * save changes to repository |
|
| 591 | + */ |
|
| 592 | 592 | function save_repository() |
| 593 | 593 | { |
| 594 | 594 | //echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n"; |
@@ -601,25 +601,25 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | /** |
| 604 | - * get customfields of using application |
|
| 605 | - * |
|
| 606 | - * @deprecated use Api\Storage\Customfields::get() direct, no need to instanciate this UI class |
|
| 607 | - * @author Cornelius Weiss |
|
| 608 | - * @param boolean $all_private_too =false should all the private fields be returned too |
|
| 609 | - * @return array with customfields |
|
| 610 | - */ |
|
| 604 | + * get customfields of using application |
|
| 605 | + * |
|
| 606 | + * @deprecated use Api\Storage\Customfields::get() direct, no need to instanciate this UI class |
|
| 607 | + * @author Cornelius Weiss |
|
| 608 | + * @param boolean $all_private_too =false should all the private fields be returned too |
|
| 609 | + * @return array with customfields |
|
| 610 | + */ |
|
| 611 | 611 | function get_customfields($all_private_too=false) |
| 612 | 612 | { |
| 613 | 613 | return Api\Storage\Customfields::get($this->appname,$all_private_too); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | /** |
| 617 | - * get_content_types of using application |
|
| 618 | - * |
|
| 619 | - * @deprecated use Api\Config::get_content_types() direct, no need to instanciate this UI class |
|
| 620 | - * @author Cornelius Weiss |
|
| 621 | - * @return array with content-types |
|
| 622 | - */ |
|
| 617 | + * get_content_types of using application |
|
| 618 | + * |
|
| 619 | + * @deprecated use Api\Config::get_content_types() direct, no need to instanciate this UI class |
|
| 620 | + * @author Cornelius Weiss |
|
| 621 | + * @return array with content-types |
|
| 622 | + */ |
|
| 623 | 623 | function get_content_types() |
| 624 | 624 | { |
| 625 | 625 | return Api\Config::get_content_types($this->appname); |
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | $this->mapping_fields = array('ts_id' => lang('Timesheet ID')) + $bo->field2label; |
| 36 | 36 | |
| 37 | 37 | // These aren't in the list |
| 38 | - $this->mapping_fields += array( |
|
| 39 | - 'ts_modified' => lang('Modified'), |
|
| 40 | - ); |
|
| 38 | + $this->mapping_fields += array( |
|
| 39 | + 'ts_modified' => lang('Modified'), |
|
| 40 | + ); |
|
| 41 | 41 | |
| 42 | 42 | // List each custom field |
| 43 | 43 | unset($this->mapping_fields['customfields']); |
@@ -701,21 +701,21 @@ discard block |
||
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
| 704 | - * writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0 |
|
| 705 | - * |
|
| 706 | - * checks and asures ACL |
|
| 707 | - * |
|
| 708 | - * @param array &$values values to write |
|
| 709 | - * @param boolean $check_defaults = true check and set certain defaults |
|
| 710 | - * @param boolean|int $touch_modified = true touch the modification date and sets the modifier's user-id, 2: only modifier |
|
| 711 | - * @param boolean $user2server = true conversion between user- and server-time necessary |
|
| 712 | - * @param boolean $skip_notification = false true = do NOT send notification, false (default) = send notifications |
|
| 713 | - * @param boolean $throw_exception = false Throw an exception (if required fields are not set) |
|
| 714 | - * @param string $purge_cfs = null null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs |
|
| 715 | - * @param boolean $ignore_acl =true |
|
| 716 | - * |
|
| 717 | - * @return int|boolean info_id on a successfull write or false |
|
| 718 | - */ |
|
| 704 | + * writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0 |
|
| 705 | + * |
|
| 706 | + * checks and asures ACL |
|
| 707 | + * |
|
| 708 | + * @param array &$values values to write |
|
| 709 | + * @param boolean $check_defaults = true check and set certain defaults |
|
| 710 | + * @param boolean|int $touch_modified = true touch the modification date and sets the modifier's user-id, 2: only modifier |
|
| 711 | + * @param boolean $user2server = true conversion between user- and server-time necessary |
|
| 712 | + * @param boolean $skip_notification = false true = do NOT send notification, false (default) = send notifications |
|
| 713 | + * @param boolean $throw_exception = false Throw an exception (if required fields are not set) |
|
| 714 | + * @param string $purge_cfs = null null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs |
|
| 715 | + * @param boolean $ignore_acl =true |
|
| 716 | + * |
|
| 717 | + * @return int|boolean info_id on a successfull write or false |
|
| 718 | + */ |
|
| 719 | 719 | function write(&$values_in, $check_defaults=true, $touch_modified=true, $user2server=true, |
| 720 | 720 | $skip_notification=false, $throw_exception=false, $purge_cfs=null, $ignore_acl=false) |
| 721 | 721 | { |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | if (!$ignore_acl && ($values['info_id'] && !$this->check_access($values['info_id'],Acl::EDIT) && !$status_only || |
| 755 | - !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],Acl::ADD))) |
|
| 755 | + !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],Acl::ADD))) |
|
| 756 | 756 | { |
| 757 | 757 | return false; |
| 758 | 758 | } |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | break; case 'match': if(!preg_match($v, $tv)){$o = 0;} |
| 133 | 133 | break; case 'nomatch': if(preg_match($v, $tv)){$o = 0;} |
| 134 | 134 | break; case 'oneof': |
| 135 | - $m = 0; |
|
| 136 | - foreach(explode('|', $v) as $n){if($tv == $n){$m = 1; break;}} |
|
| 137 | - $o = $m; |
|
| 135 | + $m = 0; |
|
| 136 | + foreach(explode('|', $v) as $n){if($tv == $n){$m = 1; break;}} |
|
| 137 | + $o = $m; |
|
| 138 | 138 | break; case 'noneof': |
| 139 | - $m = 1; |
|
| 140 | - foreach(explode('|', $v) as $n){if($tv == $n){$m = 0; break;}} |
|
| 141 | - $o = $m; |
|
| 139 | + $m = 1; |
|
| 140 | + foreach(explode('|', $v) as $n){if($tv == $n){$m = 0; break;}} |
|
| 141 | + $o = $m; |
|
| 142 | 142 | break; default: |
| 143 | 143 | break; |
| 144 | 144 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | elseif($do < 3 or isset($ok['#pcdata'])){echo $x;} |
| 213 | 213 | elseif(strpos($x, "\x02\x04")){ |
| 214 | 214 | foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){ |
| 215 | - echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : '')); |
|
| 215 | + echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : '')); |
|
| 216 | 216 | } |
| 217 | 217 | }elseif($do > 4){echo preg_replace('`\S`', '', $x);} |
| 218 | 218 | } |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m); |
| 366 | 366 | $p = preg_replace('`(?<=/)\./`', '', $m[2]. $p); |
| 367 | 367 | while(preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $p)){ |
| 368 | - $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p); |
|
| 368 | + $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p); |
|
| 369 | 369 | } |
| 370 | 370 | $p = $m[1]. $p; |
| 371 | 371 | } |
@@ -478,20 +478,20 @@ discard block |
||
| 478 | 478 | switch($mode){ |
| 479 | 479 | case 0: // Name |
| 480 | 480 | if(preg_match('`^[a-zA-Z][\-a-zA-Z:]+`', $a, $m)){ |
| 481 | - $nm = strtolower($m[0]); |
|
| 482 | - $w = $mode = 1; $a = ltrim(substr_replace($a, '', 0, strlen($m[0]))); |
|
| 481 | + $nm = strtolower($m[0]); |
|
| 482 | + $w = $mode = 1; $a = ltrim(substr_replace($a, '', 0, strlen($m[0]))); |
|
| 483 | 483 | } |
| 484 | 484 | break; case 1: |
| 485 | 485 | if($a[0] == '='){ // = |
| 486 | - $w = 1; $mode = 2; $a = ltrim($a, '= '); |
|
| 486 | + $w = 1; $mode = 2; $a = ltrim($a, '= '); |
|
| 487 | 487 | }else{ // No val |
| 488 | - $w = 1; $mode = 0; $a = ltrim($a); |
|
| 489 | - $aA[$nm] = ''; |
|
| 488 | + $w = 1; $mode = 0; $a = ltrim($a); |
|
| 489 | + $aA[$nm] = ''; |
|
| 490 | 490 | } |
| 491 | 491 | break; case 2: // Val |
| 492 | 492 | if(preg_match('`^((?:"[^"]*")|(?:\'[^\']*\')|(?:\s*[^\s"\']+))(.*)`', $a, $m)){ |
| 493 | - $a = ltrim($m[2]); $m = $m[1]; $w = 1; $mode = 0; |
|
| 494 | - $aA[$nm] = trim(str_replace('<', '<', ($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m)); |
|
| 493 | + $a = ltrim($m[2]); $m = $m[1]; $w = 1; $mode = 0; |
|
| 494 | + $aA[$nm] = trim(str_replace('<', '<', ($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m)); |
|
| 495 | 495 | } |
| 496 | 496 | break; |
| 497 | 497 | } |
@@ -514,8 +514,8 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | if($k == 'style' && !$C['style_pass']){ |
| 516 | 516 | if(false !== strpos($v, '&#')){ |
| 517 | - static $sC = array(' '=>' ', ' '=>' ', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'e'=>'e', 'X'=>'x', 'X'=>'x', 'x'=>'x', 'x'=>'x', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'p'=>'p', 'S'=>'s', 'S'=>'s', 's'=>'s', 's'=>'s', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'i'=>'i', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'o'=>'o', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'n'=>'n', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'u'=>'u', 'R'=>'r', 'R'=>'r', 'r'=>'r', 'r'=>'r', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'l'=>'l', '('=>'(', '('=>'(', ')'=>')', ')'=>')', ' '=>':', ' '=>':', '"'=>'"', '"'=>'"', '''=>"'", '''=>"'", '/'=>'/', '/'=>'/', '*'=>'*', '*'=>'*', '\'=>'\\', '\'=>'\\'); |
|
| 518 | - $v = strtr($v, $sC); |
|
| 517 | + static $sC = array(' '=>' ', ' '=>' ', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'e'=>'e', 'X'=>'x', 'X'=>'x', 'x'=>'x', 'x'=>'x', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'p'=>'p', 'S'=>'s', 'S'=>'s', 's'=>'s', 's'=>'s', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'i'=>'i', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'o'=>'o', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'n'=>'n', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'u'=>'u', 'R'=>'r', 'R'=>'r', 'r'=>'r', 'r'=>'r', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'l'=>'l', '('=>'(', '('=>'(', ')'=>')', ')'=>')', ' '=>':', ' '=>':', '"'=>'"', '"'=>'"', '''=>"'", '''=>"'", '/'=>'/', '/'=>'/', '*'=>'*', '*'=>'*', '\'=>'\\', '\'=>'\\'); |
|
| 518 | + $v = strtr($v, $sC); |
|
| 519 | 519 | } |
| 520 | 520 | $v = preg_replace_callback('`(url(?:\()(?: )*(?:\'|"|&(?:quot|apos);)?)(.+?)((?:\'|"|&(?:quot|apos);)?(?: )*(?:\)))`iS', 'hl_prot', $v); |
| 521 | 521 | $v = !$C['css_expression'] ? preg_replace('`expression`i', ' ', preg_replace('`\\\\\S|(/|(%2f))(\*|(%2a))`i', ' ', $v)) : $v; |
@@ -523,20 +523,20 @@ discard block |
||
| 523 | 523 | $v = str_replace("", ' ', (strpos($v, '&') !== false ? str_replace(array('­', '­', '­'), ' ', $v) : $v)); # double-quoted char is soft-hyphen; appears here as "" or hyphen or something else depending on viewing software |
| 524 | 524 | $v = hl_prot($v, $k); |
| 525 | 525 | if($k == 'href'){ // X-spam |
| 526 | - if($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0){ |
|
| 527 | - $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v); |
|
| 528 | - }elseif($C['anti_link_spam']){ |
|
| 529 | - $r1 = $C['anti_link_spam'][1]; |
|
| 530 | - if(!empty($r1) && preg_match($r1, $v)){continue;} |
|
| 531 | - $r0 = $C['anti_link_spam'][0]; |
|
| 532 | - if(!empty($r0) && preg_match($r0, $v)){ |
|
| 533 | - if(isset($a['rel'])){ |
|
| 534 | - if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';} |
|
| 535 | - }elseif(isset($aA['rel'])){ |
|
| 536 | - if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;} |
|
| 537 | - }else{$a['rel'] = 'nofollow';} |
|
| 538 | - } |
|
| 539 | - } |
|
| 526 | + if($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0){ |
|
| 527 | + $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v); |
|
| 528 | + }elseif($C['anti_link_spam']){ |
|
| 529 | + $r1 = $C['anti_link_spam'][1]; |
|
| 530 | + if(!empty($r1) && preg_match($r1, $v)){continue;} |
|
| 531 | + $r0 = $C['anti_link_spam'][0]; |
|
| 532 | + if(!empty($r0) && preg_match($r0, $v)){ |
|
| 533 | + if(isset($a['rel'])){ |
|
| 534 | + if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';} |
|
| 535 | + }elseif(isset($aA['rel'])){ |
|
| 536 | + if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;} |
|
| 537 | + }else{$a['rel'] = 'nofollow';} |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | 540 | } |
| 541 | 541 | } |
| 542 | 542 | if(isset($rl[$k]) && is_array($rl[$k]) && ($v = hl_attrval($k, $v, $rl[$k])) === 0){continue;} |
@@ -685,8 +685,8 @@ discard block |
||
| 685 | 685 | $e = "<$e>"; |
| 686 | 686 | if(isset($d[$y])){ |
| 687 | 687 | if(!$x){ |
| 688 | - if($n){echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n);} |
|
| 689 | - else{++$N; ob_end_clean(); continue 2;} |
|
| 688 | + if($n){echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n);} |
|
| 689 | + else{++$N; ob_end_clean(); continue 2;} |
|
| 690 | 690 | } |
| 691 | 691 | else{echo "\n", str_repeat($s, $n), "$e\n", str_repeat($s, ($x != 1 ? ++$n : $n));} |
| 692 | 692 | echo $r; continue; |