Changeset 26201 for extensions/pbase2piwigo/include
- Timestamp:
- Dec 26, 2013, 1:22:47 PM (10 years ago)
- Location:
- extensions/pbase2piwigo/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pbase2piwigo/include/functions.inc.php
r21291 r26201 1 1 <?php 2 if (!defined('PBASE_PATH'))die('Hacking attempt!');2 defined('PBASE_PATH') or die('Hacking attempt!'); 3 3 4 4 /** … … 306 306 307 307 /** 308 * count pictures and cats in the selected cat 309 * @param: &array tree 310 * @param: string $path 311 * @param: &int nb pictures 312 * @param: &int nb categories 313 * @param: bool recursive 314 * @return: void 315 */ 316 function count_pictures_cats(&$tree, $path, &$nb_pictures, &$nb_categories, $recursive=true) 317 { 318 $current = &get_current_cat($tree, $path); 319 $nb_pictures+= $current['nb_pictures']; 320 $nb_categories++; 321 322 if ( $recursive and !empty($current['categories']) ) 323 { 324 foreach ($current['categories'] as $cat) 325 { 326 count_pictures_cats($tree, $cat['path'], $nb_pictures, $nb_categories, $recursive); 327 } 328 } 329 } 330 331 /** 308 332 * test if a download method is available 309 333 * @return: bool … … 421 445 422 446 return false; 423 }424 }425 426 /**427 * count pictures and cats in the selected cat428 * @param: &array tree429 * @param: string $path430 * @param: &int nb pictures431 * @param: &int nb categories432 * @param: bool recursive433 * @return: void434 */435 function count_pictures_cats(&$tree, $path, &$nb_pictures, &$nb_categories, $recursive=true)436 {437 $current = &get_current_cat($tree, $path);438 $nb_pictures+= $current['nb_pictures'];439 $nb_categories++;440 441 if ( $recursive and !empty($current['categories']) )442 {443 foreach ($current['categories'] as $cat)444 {445 count_pictures_cats($tree, $cat['path'], $nb_pictures, $nb_categories, $recursive);446 }447 447 } 448 448 } … … 516 516 } 517 517 } 518 519 ?> -
extensions/pbase2piwigo/include/ws_functions.inc.php
r24661 r26201 1 1 <?php 2 if (!defined('PBASE_PATH'))die('Hacking attempt!');2 defined('PBASE_PATH') or die('Hacking attempt!'); 3 3 4 4 function pbase_add_ws_method($arr) … … 14 14 'fills' => array('default' => 'fill_name,fill_taken,fill_author,fill_comment,fill_tags'), 15 15 ), 16 'Used by PBase2Piwigo' 16 'Used by PBase2Piwigo', 17 null, 18 array('hidden'=>true) 17 19 ); 18 20 … … 25 27 'recursive' => array('default' => true), 26 28 ), 27 'Used by PBase2Piwigo' 29 'Used by PBase2Piwigo', 30 null, 31 array('hidden'=>true) 28 32 ); 29 33 … … 35 39 'path' => array(), 36 40 ), 37 'Used by PBase2Piwigo' 41 'Used by PBase2Piwigo', 42 null, 43 array('hidden'=>true) 38 44 ); 39 45 } … … 56 62 include_once(PBASE_PATH.'include/functions.inc.php'); 57 63 58 if ( test_remote_download() === false)64 if (!test_remote_download()) 59 65 { 60 66 return new PwgError(null, l10n('No download method available')); … … 127 133 else 128 134 { 129 $ category_id = ws_categories_add(array(135 $new_cat = $service->invoke('pwg.categories.add', array( 130 136 'name' => $category['title'].' <!--pbase-->', 131 137 'parent' => $params['parent_id'], 132 138 'comment' => pwg_db_real_escape_string($category['description']), 133 ) , $service);134 $category_id = $ category_id['id'];139 )); 140 $category_id = $new_cat['id']; 135 141 } 136 142 … … 140 146 'pictures' => array(), 141 147 'categories' => array(), 142 'message' => sprintf(l10n('Album "%s" created'), $category['title']),148 'message' => l10n('Album "%s" created', $category['title']), 143 149 ); 144 150 145 151 foreach ($category['pictures'] as &$pict) 146 152 { 147 array_push($output['pictures'], $pict['url']);153 $output['pictures'][] = $pict['url']; 148 154 } 149 155 if ($params['recursive']) … … 151 157 foreach ($category['categories'] as &$cat) 152 158 { 153 array_push($output['categories'], $cat['path']);159 $output['categories'][] = $cat['path']; 154 160 } 155 161 } … … 231 237 } 232 238 233 if ( !empty($photo['keywords']) and in_array('fill_tags', $params['fills']))239 if (!empty($photo['keywords']) and in_array('fill_tags', $params['fills'])) 234 240 { 235 241 $raw_tags = implode(',', $photo['keywords']); … … 239 245 } 240 246 241 return sprintf(l10n('Photo "%s" imported'), $photo['title']); 242 } 243 244 ?> 247 return l10n('Photo "%s" imported', $photo['title']); 248 }
Note: See TracChangeset
for help on using the changeset viewer.