- Timestamp:
- Feb 3, 2010, 10:26:32 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r4731 r4833 949 949 $query = ' 950 950 UPDATE '.IMAGES_TABLE.' 951 SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file)951 SET path = '.pwg_db_concat(array($fulldirs[$cat_id],'\'/\'','file')).' 952 952 WHERE storage_category_id = '.$cat_id.' 953 953 ;'; -
trunk/admin/include/functions_permalinks.php
r4325 r4833 193 193 UPDATE '.CATEGORIES_TABLE.' 194 194 SET permalink="'.$permalink.'" 195 WHERE id='.$cat_id .'196 LIMIT 1';195 WHERE id='.$cat_id; 196 // LIMIT 1'; 197 197 pwg_query($query); 198 198 -
trunk/admin/permalinks.php
r4325 r4833 110 110 SELECT 111 111 id, 112 CONCAT(id, " - ", name, IF(permalink IS NULL, "", " √") )AS name,112 '.pwg_db_concat(array('id', '\' - \'', 'name', 'IF(permalink IS NULL, \'\', \' √\')')).' AS name, 113 113 uppercats, global_rank 114 114 FROM '.CATEGORIES_TABLE; -
trunk/include/calendar_base.class.php
r4781 r4833 221 221 222 222 $level_items = simple_hash_from_query($query, 'period', 'nb_images'); 223 $level_items = array_to_int($level_items); 223 224 224 225 if ( count($level_items)==1 and … … 292 293 $current = implode('-', $page['chronology_date'] ); 293 294 $upper_items = array_from_query( $query, 'period'); 294 295 usort($upper_items, 'date_compare'); 295 $upper_items = array_to_int($upper_items); 296 297 usort($upper_items, 'version_compare'); 296 298 $upper_items_rank = array_flip($upper_items); 297 299 if ( !isset($upper_items_rank[$current]) ) 298 300 { 299 301 array_push($upper_items, $current);// just in case (external link) 300 usort($upper_items, ' date_compare');302 usort($upper_items, 'version_compare'); 301 303 $upper_items_rank = array_flip($upper_items); 302 304 } -
trunk/include/dblayer/functions_mysql.inc.php
r4781 r4833 459 459 } 460 460 461 function pwg_db_concat($array) 462 { 463 $string = implode($array, ','); 464 return 'CONCAT('. $string.')'; 465 } 466 461 467 function pwg_db_concat_ws($array, $separator) 462 468 { -
trunk/include/dblayer/functions_pgsql.inc.php
r4781 r4833 393 393 } 394 394 395 function pwg_db_concat($array) 396 { 397 $string = implode($array, ','); 398 return 'ARRAY_TO_STRING(ARRAY['.$string.'])'; 399 } 400 395 401 function pwg_db_concat_ws($array, $separator) 396 402 { -
trunk/include/dblayer/functions_sqlite.inc.php
r4791 r4833 55 55 56 56 $link->createFunction('now', 'pwg_now', 0); 57 $link->createFunction('unix_timestamp', 'pwg_unix_timestamp', 0); 57 58 $link->createFunction('md5', 'md5', 1); 59 $link->createFunction('if', 'pwg_if', 3); 58 60 59 61 $link->createAggregate('std', 'pwg_std_step', 'pwg_std_finalize'); … … 402 404 } 403 405 406 function pwg_db_concat($array) 407 { 408 return implode($array, ' || '); 409 } 410 404 411 function pwg_db_concat_ws($array, $separator) 405 412 { … … 469 476 } 470 477 471 return 'date('.$date.',\''. $period.' DAY\')';478 return 'date('.$date.',\''.-$period.' DAY\')'; 472 479 } 473 480 … … 512 519 function pwg_db_get_dayofweek($date) 513 520 { 514 return 'strftime(\'%w\','.$date.') +1';521 return 'strftime(\'%w\','.$date.')'; 515 522 } 516 523 517 524 function pwg_db_get_weekday($date) 518 525 { 519 return 'strftime(\'%w\', '.$date.')';526 return 'strftime(\'%w\',date('.$date.',\'-1 DAY\'))'; 520 527 } 521 528 … … 548 555 return date('Y-m-d H:i:s'); 549 556 } 557 558 function pwg_unix_timestamp() 559 { 560 return time(); 561 } 562 563 function pwg_if($expression, $value1, $value2) 564 { 565 if ($expression) 566 { 567 return $value1; 568 } 569 else 570 { 571 return $value2; 572 } 573 } 550 574 551 575 function pwg_regexp($pattern, $string) -
trunk/include/functions_calendar.inc.php
r4781 r4833 291 291 } 292 292 293 /* 294 * callback to sort array with date comparaison 295 * 296 **/ 297 function date_compare(&$a, &$b) 293 function array_to_int($array) 298 294 { 299 $parts = explode('-', $a); 300 foreach ($parts as &$p) { 301 $p = (int)$p; 302 } 303 $a = implode('-', $parts); 304 $parts = explode('-', $b); 305 foreach ($parts as &$p) { 306 $p = (int)$p; 307 } 308 $b = implode('-', $parts); 309 310 return strcmp($a, $b); 295 foreach ($array as $k => $v) 296 { 297 if ((int)$k==$k) 298 { 299 $key = (int) $k; 300 } 301 else 302 { 303 $key = $k; 304 } 305 if (is_array($v)) 306 { 307 $result[$key] = array_to_int($v); 308 } 309 else 310 { 311 if (is_int($v)) 312 { 313 $value = (int) $v; 314 } 315 else 316 { 317 $value = $v; 318 } 319 $result[$key] = $value; 320 } 321 } 322 return $result; 311 323 } 312 324 ?>
Note: See TracChangeset
for help on using the changeset viewer.