Changeset 2543
- Timestamp:
- Sep 17, 2008, 3:48:31 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/history.php
r2530 r2543 117 117 $search['fields']['display_thumbnail'] = $_POST['display_thumbnail']; 118 118 // Display choise are also save to one cookie 119 pwg_set_cookie_var('history_display_thumbnail', $_POST['display_thumbnail']); 119 $cookie_val = ($_POST['display_thumbnail']!=$display_thumbnails[2] and in_array($_POST['display_thumbnail'], $display_thumbnails)) ? $_POST['display_thumbnail']:null; 120 pwg_set_cookie_var('history_display_thumbnail', $cookie_val, strtotime('+1 month') ); 120 121 121 122 // TODO manage inconsistency of having $_POST['image_id'] and -
trunk/include/common.inc.php
r2502 r2543 224 224 echo l10n('gallery_locked_message') 225 225 .'<a href="'.get_absolute_root_url(false).'identification.php">.</a>'; 226 echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size 226 227 exit(); 227 228 } -
trunk/include/functions_cookie.inc.php
r2339 r2543 37 37 // mod_rewrite is activated for upper level directories. we must set the 38 38 // cookie to the path shown in the browser otherwise it will be discarded. 39 if 40 ( 39 if 40 ( 41 41 isset($_SERVER['PATH_INFO']) and !empty($_SERVER['PATH_INFO']) and 42 42 ($_SERVER['REDIRECT_URL'] !== $_SERVER['PATH_INFO']) and … … 45 45 ) 46 46 { 47 $scr = substr($_SERVER['REDIRECT_URL'], 0, 47 $scr = substr($_SERVER['REDIRECT_URL'], 0, 48 48 strlen($_SERVER['REDIRECT_URL'])-strlen($_SERVER['PATH_INFO'])); 49 49 } … … 65 65 $scr .= '/'; 66 66 } 67 67 68 68 if ( substr(PHPWG_ROOT_PATH,0,3)=='../') 69 69 { // this is maybe a plugin inside pwg directory … … 88 88 * @see pwg_get_cookie_var 89 89 */ 90 function pwg_set_cookie_var($var, $value )90 function pwg_set_cookie_var($var, $value, $expire=null) 91 91 { 92 $_COOKIE['pwg_'.$var] = $value; 93 return 94 setcookie('pwg_'.$var, $value, 95 strtotime('+10 years'), cookie_path()); 92 if ($value==null or $expire===0) 93 { 94 unset($_COOKIE['pwg_'.$var]); 95 return setcookie('pwg_'.$var, false, 0, cookie_path()); 96 97 } 98 else 99 { 100 $_COOKIE['pwg_'.$var] = $value; 101 $expire = is_numeric($expire) ? $expire : strtotime('+10 years'); 102 return setcookie('pwg_'.$var, $value, $expire, cookie_path()); 103 } 96 104 } 97 105 -
trunk/include/functions_html.inc.php
r2502 r2543 586 586 .urlencode(urlencode($_SERVER['REQUEST_URI'])); 587 587 588 set_status_header(401); 588 589 if ( isset($user) and !is_a_guest() ) 589 590 { … … 591 592 echo '<a href="'.get_root_url().'identification.php">'.l10n('identification').'</a> '; 592 593 echo '<a href="'.make_index_url().'">'.l10n('home').'</a></div>'; 594 echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size 593 595 exit(); 594 596 } 595 597 else 596 598 { 597 set_status_header(401);598 599 redirect_html($login_url); 599 600 } … … 678 679 679 680 @set_status_header(500); 680 echo $display.str_repeat( ' ', 300); //IE doesn't error output if below a size681 echo $display.str_repeat( ' ', 300); //IE6 doesn't error output if below a size 681 682 682 683 if ( function_exists('ini_set') ) … … 755 756 case 404: $text='Not found';break; 756 757 case 500: $text='Server error';break; 758 case 501: $text='Not implemented';break; 757 759 case 503: $text='Service unavailable';break; 758 760 } -
trunk/include/functions_notification.inc.php
r2335 r2543 36 36 * @return string sql where 37 37 */ 38 function get_std_sql_where_restrict_filter($prefix_condition, $ force_one_condition = false)38 function get_std_sql_where_restrict_filter($prefix_condition, $img_field='ic.image_id', $force_one_condition = false) 39 39 { 40 40 return get_sql_condition_FandF … … 44 44 'forbidden_categories' => 'ic.category_id', 45 45 'visible_categories' => 'ic.category_id', 46 'visible_images' => 'ic.image_id'46 'visible_images' => $img_field 47 47 ), 48 48 $prefix_condition, … … 90 90 WHERE date_available > \''.$start.'\' 91 91 AND date_available <= \''.$end.'\' 92 '.get_std_sql_where_restrict_filter('AND' ).'92 '.get_std_sql_where_restrict_filter('AND', 'id').' 93 93 ;'; 94 94 break; … … 98 98 WHERE date_available > \''.$start.'\' 99 99 AND date_available <= \''.$end.'\' 100 '.get_std_sql_where_restrict_filter('AND' ).'100 '.get_std_sql_where_restrict_filter('AND', 'id').' 101 101 ;'; 102 102 break; … … 435 435 global $conf, $user; 436 436 437 $where_sql = get_std_sql_where_restrict_filter('WHERE', true);437 $where_sql = get_std_sql_where_restrict_filter('WHERE', 'i.id', true); 438 438 439 439 $query = ' … … 441 441 COUNT(DISTINCT id) nb_elements, 442 442 COUNT(DISTINCT category_id) nb_cats 443 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id443 FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id 444 444 '.$where_sql.' 445 445 GROUP BY date_available … … 460 460 $query = ' 461 461 SELECT DISTINCT id, path, name, tn_ext, file 462 FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id462 FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id 463 463 '.$where_sql.' 464 464 AND date_available="'.$dates[$i]['date_available'].'" -
trunk/include/ws_core.inc.php
r2521 r2543 36 36 define( 'WS_PARAM_OPTIONAL', 0x040000 ); 37 37 38 define( 'WS_ERR_INVALID_METHOD', 1001 );38 define( 'WS_ERR_INVALID_METHOD', 501 ); 39 39 define( 'WS_ERR_MISSING_PARAM', 1002 ); 40 40 define( 'WS_ERR_INVALID_PARAM', 1003 ); … … 48 48 class PwgError 49 49 { 50 var$_code;51 var$_codeText;50 private $_code; 51 private $_codeText; 52 52 53 53 function PwgError($code, $codeText) 54 54 { 55 set_status_header($code, $codeText); 55 if ($code>=400 and $code<600) 56 { 57 set_status_header($code, $codeText); 58 } 56 59 57 60 $this->_code = $code; … … 81 84 * xml attributes instead of xml child elements 82 85 */ 83 function PwgNamedArray( &$arr, $itemName, $xmlAttributes=array() )86 function PwgNamedArray($arr, $itemName, $xmlAttributes=array() ) 84 87 { 85 88 $this->_content = $arr; … … 135 138 136 139 /** 137 * Replace array_walk_recursive()138 *139 * @category PHP140 * @package PHP_Compat141 * @link http://php.net/function.array_walk_recursive142 * @author Tom Buskens <ortega@php.net>143 * @author Aidan Lister <aidan@php.net>144 * @version $Revision$145 * @since PHP 5146 * @require PHP 4.0.6 (is_callable)147 */148 if (!function_exists('array_walk_recursive')) {149 function array_walk_recursive(&$input, $funcname)150 {151 if (!is_callable($funcname)) {152 if (is_array($funcname)) {153 $funcname = $funcname[0] . '::' . $funcname[1];154 }155 user_error('array_walk_recursive() Not a valid callback ' . $user_func,156 E_USER_WARNING);157 return;158 }159 160 if (!is_array($input)) {161 user_error('array_walk_recursive() The argument should be an array',162 E_USER_WARNING);163 return;164 }165 166 $args = func_get_args();167 168 foreach ($input as $key => $item) {169 if (is_array($item)) {170 array_walk_recursive($item, $funcname, $args);171 $input[$key] = $item;172 } else {173 $args[0] = &$item;174 $args[1] = &$key;175 call_user_func_array($funcname, $args);176 $input[$key] = $item;177 }178 }179 }180 }181 182 /**183 140 * Abstract base class for request handlers. 184 141 */ … … 210 167 * NOT consecutive integers starting with 0) 211 168 */ 212 function is_struct(&$data)169 static function is_struct(&$data) 213 170 { 214 171 if (is_array($data) ) … … 226 183 * usually called by every response encoder, except rest xml. 227 184 */ 228 function flattenResponse(&$response)185 static function flattenResponse(&$response) 229 186 { 230 187 PwgResponseEncoder::_mergeAttributesAndContent($response); … … 240 197 } 241 198 242 /*private*/function _remove_named_callback(&$value, $key)199 private static function _remove_named_callback(&$value, $key) 243 200 { 244 201 do … … 252 209 } 253 210 254 /*private*/function _mergeAttributesAndContent(&$value)211 private static function _mergeAttributesAndContent(&$value) 255 212 { 256 213 if ( !is_array($value) ) … … 311 268 } 312 269 313 /*private*/function _removeNamedArray(&$value)270 private static function _removeNamedArray(&$value) 314 271 { 315 272 if ( strtolower( get_class($value) ) =='pwgnamedarray') … … 321 278 } 322 279 323 /*private*/function _removeNamedStruct(&$value)280 private static function _removeNamedStruct(&$value) 324 281 { 325 282 if ( strtolower( get_class($value) ) =='pwgnamedstruct') … … 389 346 if ( is_null($this->_requestHandler) ) 390 347 { 391 $this->sendResponse( 392 new PwgError(400, 'Unknown request format') 393 ); 348 $this->sendResponse( new PwgError(400, 'Unknown request format') ); 394 349 return; 395 350 } … … 584 539 * WS reflection method implementation: lists all available methods 585 540 */ 586 /*static*/function ws_getMethodList($params, &$service)541 static function ws_getMethodList($params, &$service) 587 542 { 588 543 return array('methods' => new PwgNamedArray( array_keys($service->_methods),'method' ) ); … … 592 547 * WS reflection method implementation: gets information about a given method 593 548 */ 594 /*static*/function ws_getMethodDetails($params, &$service)549 static function ws_getMethodDetails($params, &$service) 595 550 { 596 551 $methodName = $params['methodName'];
Note: See TracChangeset
for help on using the changeset viewer.