@@ -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,17 +15,17 @@ |
||
15 | 15 | class calendar_wizard_import_ical |
16 | 16 | { |
17 | 17 | /** |
18 | - * List of steps. Key is the function, value is the translated title. |
|
19 | - */ |
|
18 | + * List of steps. Key is the function, value is the translated title. |
|
19 | + */ |
|
20 | 20 | public $steps; |
21 | 21 | |
22 | 22 | /** |
23 | - * List of eTemplates to use for each step. You can override this with your own etemplates steps. |
|
24 | - */ |
|
23 | + * List of eTemplates to use for each step. You can override this with your own etemplates steps. |
|
24 | + */ |
|
25 | 25 | protected $step_templates = array( |
26 | 26 | 'wizard_step55' => 'calendar.import.conditions' |
27 | 27 | ); |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * constructor |
30 | 30 | */ |
31 | 31 | function __construct() |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | private $bo; |
65 | 65 | |
66 | 66 | /** |
67 | - * For figuring out if an entry has changed |
|
68 | - */ |
|
67 | + * For figuring out if an entry has changed |
|
68 | + */ |
|
69 | 69 | protected $tracking; |
70 | 70 | |
71 | 71 | /** |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | protected $errors = array(); |
95 | 95 | |
96 | 96 | /** |
97 | - * List of actions, and how many times that action was taken |
|
98 | - */ |
|
97 | + * List of actions, and how many times that action was taken |
|
98 | + */ |
|
99 | 99 | protected $results = array(); |
100 | 100 | |
101 | 101 | /** |
@@ -228,38 +228,38 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
231 | - * Returns warnings that were encountered during importing |
|
232 | - * Maximum of one warning message per record, but you can append if you need to |
|
233 | - * |
|
234 | - * @return Array ( |
|
235 | - * record_# => warning message |
|
236 | - * ) |
|
237 | - */ |
|
238 | - public function get_warnings() { |
|
231 | + * Returns warnings that were encountered during importing |
|
232 | + * Maximum of one warning message per record, but you can append if you need to |
|
233 | + * |
|
234 | + * @return Array ( |
|
235 | + * record_# => warning message |
|
236 | + * ) |
|
237 | + */ |
|
238 | + public function get_warnings() { |
|
239 | 239 | return $this->warnings; |
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | - * Returns errors that were encountered during importing |
|
244 | - * Maximum of one error message per record, but you can append if you need to |
|
245 | - * |
|
246 | - * @return Array ( |
|
247 | - * record_# => error message |
|
248 | - * ) |
|
249 | - */ |
|
250 | - public function get_errors() { |
|
243 | + * Returns errors that were encountered during importing |
|
244 | + * Maximum of one error message per record, but you can append if you need to |
|
245 | + * |
|
246 | + * @return Array ( |
|
247 | + * record_# => error message |
|
248 | + * ) |
|
249 | + */ |
|
250 | + public function get_errors() { |
|
251 | 251 | return $this->errors; |
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * Returns a list of actions taken, and the number of records for that action. |
|
256 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
257 | - * |
|
258 | - * @return Array ( |
|
259 | - * action => record count |
|
260 | - * ) |
|
261 | - */ |
|
262 | - public function get_results() { |
|
263 | - return $this->results; |
|
264 | - } |
|
255 | + * Returns a list of actions taken, and the number of records for that action. |
|
256 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
257 | + * |
|
258 | + * @return Array ( |
|
259 | + * action => record count |
|
260 | + * ) |
|
261 | + */ |
|
262 | + public function get_results() { |
|
263 | + return $this->results; |
|
264 | + } |
|
265 | 265 | } |
266 | 266 | \ No newline at end of file |
@@ -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() |
@@ -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); |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | var $debug = 0; |
53 | 53 | |
54 | 54 | /** |
55 | - * Serve a webdav request |
|
56 | - * |
|
57 | - * Reimplemented to not check our vfs base path with realpath and connect to mysql DB |
|
58 | - * |
|
59 | - * @access public |
|
60 | - * @param $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php |
|
61 | - */ |
|
55 | + * Serve a webdav request |
|
56 | + * |
|
57 | + * Reimplemented to not check our vfs base path with realpath and connect to mysql DB |
|
58 | + * |
|
59 | + * @access public |
|
60 | + * @param $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php |
|
61 | + */ |
|
62 | 62 | function ServeRequest($prefix=null) |
63 | 63 | { |
64 | 64 | // special treatment for litmus compliance test |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | - * DELETE method handler |
|
77 | - * |
|
78 | - * @param array general parameter passing array |
|
79 | - * @return bool true on success |
|
80 | - */ |
|
76 | + * DELETE method handler |
|
77 | + * |
|
78 | + * @param array general parameter passing array |
|
79 | + * @return bool true on success |
|
80 | + */ |
|
81 | 81 | function DELETE($options) |
82 | 82 | { |
83 | 83 | $path = $this->base . $options['path']; |
@@ -110,117 +110,117 @@ discard block |
||
110 | 110 | return '204 No Content'; |
111 | 111 | } |
112 | 112 | |
113 | - /** |
|
114 | - * MKCOL method handler |
|
115 | - * |
|
116 | - * Reimplemented to NOT use dirname/basename, which has problems with utf-8 chars |
|
117 | - * |
|
118 | - * @param array general parameter passing array |
|
119 | - * @return bool true on success |
|
120 | - */ |
|
121 | - function MKCOL($options) |
|
122 | - { |
|
123 | - $path = $this->_unslashify($this->base .$options["path"]); |
|
124 | - $parent = Vfs::dirname($path); |
|
125 | - |
|
126 | - if (!file_exists($parent)) { |
|
127 | - return "409 Conflict"; |
|
128 | - } |
|
129 | - |
|
130 | - if (!is_dir($parent)) { |
|
131 | - return "403 Forbidden"; |
|
132 | - } |
|
133 | - |
|
134 | - if ( file_exists($path) ) { |
|
135 | - return "405 Method not allowed"; |
|
136 | - } |
|
137 | - |
|
138 | - if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet |
|
139 | - return "415 Unsupported media type"; |
|
140 | - } |
|
141 | - |
|
142 | - $stat = mkdir($path, 0777); |
|
143 | - if (!$stat) { |
|
144 | - return "403 Forbidden"; |
|
145 | - } |
|
146 | - |
|
147 | - return ("201 Created"); |
|
148 | - } |
|
113 | + /** |
|
114 | + * MKCOL method handler |
|
115 | + * |
|
116 | + * Reimplemented to NOT use dirname/basename, which has problems with utf-8 chars |
|
117 | + * |
|
118 | + * @param array general parameter passing array |
|
119 | + * @return bool true on success |
|
120 | + */ |
|
121 | + function MKCOL($options) |
|
122 | + { |
|
123 | + $path = $this->_unslashify($this->base .$options["path"]); |
|
124 | + $parent = Vfs::dirname($path); |
|
125 | + |
|
126 | + if (!file_exists($parent)) { |
|
127 | + return "409 Conflict"; |
|
128 | + } |
|
129 | + |
|
130 | + if (!is_dir($parent)) { |
|
131 | + return "403 Forbidden"; |
|
132 | + } |
|
133 | + |
|
134 | + if ( file_exists($path) ) { |
|
135 | + return "405 Method not allowed"; |
|
136 | + } |
|
137 | + |
|
138 | + if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet |
|
139 | + return "415 Unsupported media type"; |
|
140 | + } |
|
141 | + |
|
142 | + $stat = mkdir($path, 0777); |
|
143 | + if (!$stat) { |
|
144 | + return "403 Forbidden"; |
|
145 | + } |
|
146 | + |
|
147 | + return ("201 Created"); |
|
148 | + } |
|
149 | 149 | |
150 | 150 | /** |
151 | - * COPY method handler |
|
152 | - * |
|
153 | - * @param array general parameter passing array |
|
154 | - * @return bool true on success |
|
155 | - */ |
|
156 | - function COPY($options, $del=false) |
|
157 | - { |
|
158 | - // TODO Property updates still broken (Litmus should detect this?) |
|
159 | - |
|
160 | - if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet |
|
161 | - return "415 Unsupported media type"; |
|
162 | - } |
|
163 | - |
|
164 | - // no copying to different WebDAV Servers yet |
|
165 | - if (isset($options["dest_url"])) { |
|
166 | - return "502 bad gateway"; |
|
167 | - } |
|
168 | - |
|
169 | - $source = $this->base .$options["path"]; |
|
170 | - if (!file_exists($source)) return "404 Not found"; |
|
171 | - |
|
172 | - if (is_dir($source)) { // resource is a collection |
|
173 | - switch ($options["depth"]) { |
|
174 | - case "infinity": // valid |
|
175 | - break; |
|
176 | - case "0": // valid for COPY only |
|
177 | - if ($del) { // MOVE? |
|
178 | - return "400 Bad request"; |
|
179 | - } |
|
180 | - break; |
|
181 | - case "1": // invalid for both COPY and MOVE |
|
182 | - default: |
|
183 | - return "400 Bad request"; |
|
184 | - } |
|
185 | - } |
|
186 | - |
|
187 | - $dest = $this->base . $options["dest"]; |
|
188 | - $destdir = dirname($dest); |
|
189 | - |
|
190 | - if (!file_exists($destdir) || !is_dir($destdir)) { |
|
191 | - return "409 Conflict"; |
|
192 | - } |
|
193 | - |
|
194 | - $new = !file_exists($dest); |
|
195 | - $existing_col = false; |
|
196 | - |
|
197 | - if (!$new) { |
|
198 | - if ($del && is_dir($dest)) { |
|
199 | - if (!$options["overwrite"]) { |
|
200 | - return "412 precondition failed"; |
|
201 | - } |
|
202 | - $dest .= basename($source); |
|
203 | - if (file_exists($dest)) { |
|
204 | - $options["dest"] .= basename($source); |
|
205 | - } else { |
|
206 | - $new = true; |
|
207 | - $existing_col = true; |
|
208 | - } |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - if (!$new) { |
|
213 | - if ($options["overwrite"]) { |
|
214 | - $stat = $this->DELETE(array("path" => $options["dest"])); |
|
215 | - if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) { |
|
216 | - return $stat; |
|
217 | - } |
|
218 | - } else { |
|
219 | - return "412 precondition failed"; |
|
220 | - } |
|
221 | - } |
|
222 | - |
|
223 | - if ($del) { |
|
151 | + * COPY method handler |
|
152 | + * |
|
153 | + * @param array general parameter passing array |
|
154 | + * @return bool true on success |
|
155 | + */ |
|
156 | + function COPY($options, $del=false) |
|
157 | + { |
|
158 | + // TODO Property updates still broken (Litmus should detect this?) |
|
159 | + |
|
160 | + if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet |
|
161 | + return "415 Unsupported media type"; |
|
162 | + } |
|
163 | + |
|
164 | + // no copying to different WebDAV Servers yet |
|
165 | + if (isset($options["dest_url"])) { |
|
166 | + return "502 bad gateway"; |
|
167 | + } |
|
168 | + |
|
169 | + $source = $this->base .$options["path"]; |
|
170 | + if (!file_exists($source)) return "404 Not found"; |
|
171 | + |
|
172 | + if (is_dir($source)) { // resource is a collection |
|
173 | + switch ($options["depth"]) { |
|
174 | + case "infinity": // valid |
|
175 | + break; |
|
176 | + case "0": // valid for COPY only |
|
177 | + if ($del) { // MOVE? |
|
178 | + return "400 Bad request"; |
|
179 | + } |
|
180 | + break; |
|
181 | + case "1": // invalid for both COPY and MOVE |
|
182 | + default: |
|
183 | + return "400 Bad request"; |
|
184 | + } |
|
185 | + } |
|
186 | + |
|
187 | + $dest = $this->base . $options["dest"]; |
|
188 | + $destdir = dirname($dest); |
|
189 | + |
|
190 | + if (!file_exists($destdir) || !is_dir($destdir)) { |
|
191 | + return "409 Conflict"; |
|
192 | + } |
|
193 | + |
|
194 | + $new = !file_exists($dest); |
|
195 | + $existing_col = false; |
|
196 | + |
|
197 | + if (!$new) { |
|
198 | + if ($del && is_dir($dest)) { |
|
199 | + if (!$options["overwrite"]) { |
|
200 | + return "412 precondition failed"; |
|
201 | + } |
|
202 | + $dest .= basename($source); |
|
203 | + if (file_exists($dest)) { |
|
204 | + $options["dest"] .= basename($source); |
|
205 | + } else { |
|
206 | + $new = true; |
|
207 | + $existing_col = true; |
|
208 | + } |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + if (!$new) { |
|
213 | + if ($options["overwrite"]) { |
|
214 | + $stat = $this->DELETE(array("path" => $options["dest"])); |
|
215 | + if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) { |
|
216 | + return $stat; |
|
217 | + } |
|
218 | + } else { |
|
219 | + return "412 precondition failed"; |
|
220 | + } |
|
221 | + } |
|
222 | + |
|
223 | + if ($del) { |
|
224 | 224 | try { |
225 | 225 | if (!rename($source, $dest)) { |
226 | 226 | return "500 Internal server error"; |
@@ -229,51 +229,51 @@ discard block |
||
229 | 229 | catch (Exception\ProtectedDirectory $e) { |
230 | 230 | return "403 Forbidden: ".$e->getMessage(); |
231 | 231 | } |
232 | - } else { |
|
233 | - if (is_dir($source) && $options['depth'] == 'infinity') { |
|
234 | - $files = Vfs::find($source,array('depth' => true,'url' => true)); // depth=true: return dirs first, url=true: allow urls! |
|
235 | - } else { |
|
236 | - $files = array($source); |
|
237 | - } |
|
238 | - |
|
239 | - if (!is_array($files) || empty($files)) { |
|
240 | - return "500 Internal server error"; |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - foreach ($files as $file) { |
|
245 | - if (is_dir($file)) { |
|
246 | - $file = $this->_slashify($file); |
|
247 | - } |
|
248 | - |
|
249 | - $destfile = str_replace($source, $dest, $file); |
|
250 | - |
|
251 | - if (is_dir($file)) { |
|
252 | - if (!is_dir($destfile)) { |
|
253 | - // TODO "mkdir -p" here? (only natively supported by PHP 5) |
|
254 | - if (!@mkdir($destfile)) { |
|
255 | - return "409 Conflict"; |
|
256 | - } |
|
257 | - } |
|
258 | - } else { |
|
259 | - if (!@copy($file, $destfile)) { |
|
260 | - return "409 Conflict"; |
|
261 | - } |
|
262 | - } |
|
263 | - } |
|
264 | - } |
|
265 | - // adding Location header as shown in example in rfc2518 section 8.9.5 |
|
232 | + } else { |
|
233 | + if (is_dir($source) && $options['depth'] == 'infinity') { |
|
234 | + $files = Vfs::find($source,array('depth' => true,'url' => true)); // depth=true: return dirs first, url=true: allow urls! |
|
235 | + } else { |
|
236 | + $files = array($source); |
|
237 | + } |
|
238 | + |
|
239 | + if (!is_array($files) || empty($files)) { |
|
240 | + return "500 Internal server error"; |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + foreach ($files as $file) { |
|
245 | + if (is_dir($file)) { |
|
246 | + $file = $this->_slashify($file); |
|
247 | + } |
|
248 | + |
|
249 | + $destfile = str_replace($source, $dest, $file); |
|
250 | + |
|
251 | + if (is_dir($file)) { |
|
252 | + if (!is_dir($destfile)) { |
|
253 | + // TODO "mkdir -p" here? (only natively supported by PHP 5) |
|
254 | + if (!@mkdir($destfile)) { |
|
255 | + return "409 Conflict"; |
|
256 | + } |
|
257 | + } |
|
258 | + } else { |
|
259 | + if (!@copy($file, $destfile)) { |
|
260 | + return "409 Conflict"; |
|
261 | + } |
|
262 | + } |
|
263 | + } |
|
264 | + } |
|
265 | + // adding Location header as shown in example in rfc2518 section 8.9.5 |
|
266 | 266 | header('Location: '.$this->base_uri.$options['dest']); |
267 | 267 | |
268 | - return ($new && !$existing_col) ? "201 Created" : "204 No Content"; |
|
269 | - } |
|
268 | + return ($new && !$existing_col) ? "201 Created" : "204 No Content"; |
|
269 | + } |
|
270 | 270 | |
271 | - /** |
|
272 | - * Get properties for a single file/resource |
|
273 | - * |
|
274 | - * @param string $_path resource path |
|
275 | - * @return array resource properties |
|
276 | - */ |
|
271 | + /** |
|
272 | + * Get properties for a single file/resource |
|
273 | + * |
|
274 | + * @param string $_path resource path |
|
275 | + * @return array resource properties |
|
276 | + */ |
|
277 | 277 | function fileinfo($_path) |
278 | 278 | { |
279 | 279 | // internally we require some url-encoding, as vfs_stream_wrapper uses URL's internally |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | $info['props'][] = self::mkprop ('creationdate', filectime($fspath)); |
302 | 302 | $info['props'][] = self::mkprop ('getlastmodified', filemtime($fspath)); |
303 | 303 | |
304 | - // Microsoft extensions: last access time and 'hidden' status |
|
305 | - $info["props"][] = self::mkprop("lastaccessed", fileatime($fspath)); |
|
306 | - $info["props"][] = self::mkprop("ishidden", Vfs::is_hidden($fspath)); |
|
304 | + // Microsoft extensions: last access time and 'hidden' status |
|
305 | + $info["props"][] = self::mkprop("lastaccessed", fileatime($fspath)); |
|
306 | + $info["props"][] = self::mkprop("ishidden", Vfs::is_hidden($fspath)); |
|
307 | 307 | |
308 | 308 | // type and size (caller already made sure that path exists) |
309 | 309 | if (is_dir($fspath)) { |
@@ -441,38 +441,38 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
444 | - * Used eg. by get |
|
445 | - * |
|
446 | - * @todo replace all calls to _mimetype with Vfs::mime_content_type() |
|
447 | - * @param string $path |
|
448 | - * @return string |
|
449 | - */ |
|
444 | + * Used eg. by get |
|
445 | + * |
|
446 | + * @todo replace all calls to _mimetype with Vfs::mime_content_type() |
|
447 | + * @param string $path |
|
448 | + * @return string |
|
449 | + */ |
|
450 | 450 | function _mimetype($path) |
451 | 451 | { |
452 | 452 | return Vfs::mime_content_type($path); |
453 | 453 | } |
454 | 454 | |
455 | - /** |
|
456 | - * Check if path is readable by current user |
|
457 | - * |
|
458 | - * @param string $fspath |
|
459 | - * @return boolean |
|
460 | - */ |
|
461 | - function _is_readable($fspath) |
|
462 | - { |
|
463 | - return Vfs::is_readable($fspath); |
|
464 | - } |
|
465 | - |
|
466 | - /** |
|
467 | - * Check if path is writable by current user |
|
468 | - * |
|
469 | - * @param string $fspath |
|
470 | - * @return boolean |
|
471 | - */ |
|
472 | - function _is_writable($fspath) |
|
473 | - { |
|
474 | - return Vfs::is_writable($fspath); |
|
475 | - } |
|
455 | + /** |
|
456 | + * Check if path is readable by current user |
|
457 | + * |
|
458 | + * @param string $fspath |
|
459 | + * @return boolean |
|
460 | + */ |
|
461 | + function _is_readable($fspath) |
|
462 | + { |
|
463 | + return Vfs::is_readable($fspath); |
|
464 | + } |
|
465 | + |
|
466 | + /** |
|
467 | + * Check if path is writable by current user |
|
468 | + * |
|
469 | + * @param string $fspath |
|
470 | + * @return boolean |
|
471 | + */ |
|
472 | + function _is_writable($fspath) |
|
473 | + { |
|
474 | + return Vfs::is_writable($fspath); |
|
475 | + } |
|
476 | 476 | |
477 | 477 | /** |
478 | 478 | * PROPPATCH method handler |
@@ -615,13 +615,13 @@ discard block |
||
615 | 615 | * @param string directory path |
616 | 616 | * @return void function has to handle HTTP response itself |
617 | 617 | */ |
618 | - function GetDir($fspath, &$options) |
|
619 | - { |
|
618 | + function GetDir($fspath, &$options) |
|
619 | + { |
|
620 | 620 | // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) |
621 | 621 | header('Content-type: text/html; charset='.Api\Translation::charset()); |
622 | 622 | |
623 | 623 | parent::GetDir($fspath, $options); |
624 | - } |
|
624 | + } |
|
625 | 625 | |
626 | 626 | private $force_download = false; |
627 | 627 |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | private $bo; |
73 | 73 | |
74 | 74 | /** |
75 | - * For figuring out if a record has changed |
|
76 | - */ |
|
75 | + * For figuring out if a record has changed |
|
76 | + */ |
|
77 | 77 | protected $tracking; |
78 | 78 | |
79 | 79 | /** |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | protected $errors = array(); |
98 | 98 | |
99 | 99 | /** |
100 | - * List of actions, and how many times that action was taken |
|
101 | - */ |
|
100 | + * List of actions, and how many times that action was taken |
|
101 | + */ |
|
102 | 102 | protected $results = array(); |
103 | 103 | |
104 | 104 | /** |
@@ -526,39 +526,39 @@ discard block |
||
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
529 | - * Returns warnings that were encountered during importing |
|
530 | - * Maximum of one warning message per record, but you can append if you need to |
|
531 | - * |
|
532 | - * @return Array ( |
|
533 | - * record_# => warning message |
|
534 | - * ) |
|
535 | - */ |
|
529 | + * Returns warnings that were encountered during importing |
|
530 | + * Maximum of one warning message per record, but you can append if you need to |
|
531 | + * |
|
532 | + * @return Array ( |
|
533 | + * record_# => warning message |
|
534 | + * ) |
|
535 | + */ |
|
536 | 536 | public function get_warnings() |
537 | 537 | { |
538 | 538 | return $this->warnings; |
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
542 | - * Returns errors that were encountered during importing |
|
543 | - * Maximum of one error message per record, but you can append if you need to |
|
544 | - * |
|
545 | - * @return Array ( |
|
546 | - * record_# => error message |
|
547 | - * ) |
|
548 | - */ |
|
542 | + * Returns errors that were encountered during importing |
|
543 | + * Maximum of one error message per record, but you can append if you need to |
|
544 | + * |
|
545 | + * @return Array ( |
|
546 | + * record_# => error message |
|
547 | + * ) |
|
548 | + */ |
|
549 | 549 | public function get_errors() |
550 | 550 | { |
551 | 551 | return $this->errors; |
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
555 | - * Returns a list of actions taken, and the number of records for that action. |
|
556 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
557 | - * |
|
558 | - * @return Array ( |
|
559 | - * action => record count |
|
560 | - * ) |
|
561 | - */ |
|
555 | + * Returns a list of actions taken, and the number of records for that action. |
|
556 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
557 | + * |
|
558 | + * @return Array ( |
|
559 | + * action => record count |
|
560 | + * ) |
|
561 | + */ |
|
562 | 562 | public function get_results() |
563 | 563 | { |
564 | 564 | return $this->results; |