Changeset 2516
- Timestamp:
- Sep 11, 2008, 3:20:25 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r2488 r2516 97 97 ) 98 98 ); 99 if ($conf['ws_access_control']) // Do we need to display ws_checker100 {101 $template->assign('U_WS_CHECKER', $link_start.'ws_checker' );102 }103 99 104 100 //---------------------------------------------------------------- plugin menus -
trunk/admin/include/functions_upgrade.php
r2339 r2516 72 72 define('IMAGE_TAG_TABLE', $prefixeTable.'image_tag'); 73 73 define('PLUGINS_TABLE', $prefixeTable.'plugins'); 74 define('WEB_SERVICES_ACCESS_TABLE', $prefixeTable.'ws_access');75 74 define('OLD_PERMALINKS_TABLE', $prefixeTable.'old_permalinks'); 76 75 } 77 76 78 77 // Create empty local files to avoid log errors 79 function create_empty_local_files() 78 function create_empty_local_files() 80 79 { 81 $files = 80 $files = 82 81 array ( 83 82 PHPWG_ROOT_PATH . 'template-common/local-layout.css', -
trunk/admin/template/yoga/admin.tpl
r2513 r2516 85 85 <li><a href="{$U_MAINTENANCE}">{'Maintenance'|@translate}</a></li> 86 86 <li><a href="{$U_ADVANCED_FEATURE}">{'Advanced_features'|@translate}</a></li> 87 {if isset($U_WS_CHECKER) }88 <li><a href="{$U_WS_CHECKER}">{'web_services'|@translate}</a></li>89 {/if}90 87 <li> 91 88 {'Plugins'|@translate} -
trunk/admin/template/yoga/theme/admin/themeconf.inc.php
r2513 r2516 40 40 case 'maintenance': 41 41 case 'advanced_feature': 42 case 'ws_checker':43 42 case 'plugins_list': 44 43 case 'plugin': -
trunk/include/config_default.inc.php
r2451 r2516 618 618 // Maximum number of images to be returned foreach call to the web service 619 619 $conf['ws_max_images_per_page'] = 500; 620 621 // On Access control false / Admim Web Service need Php cURL extension622 // Controls are done on public basis or623 // if connected on member authorization basis624 $conf['ws_access_control'] = false;625 626 // Additionnal controls are made based on Web Service Access Table627 // Max returned rows number ( > 0 )628 $conf['ws_allowed_limit'] = array(1,2,3,5,10,25);629 630 // By default can be delayed by 0, 1, 2, 3, 5, 7, 14 or 30 days631 // 0 it's Now(), don't remove that one632 $conf['ws_postponed_start'] = array(0,1,2,3,5,7,14,30); /* In days */633 634 // By default 10, 5, 2, 1 year(s) or 6, 3, 1 month(s)635 // or 15, 10, 7, 5, 1, 0 day(s)636 // 0 it's temporary closed (Useful for one access)637 $conf['ws_durations'] = array(3650,1825,730,365,182,91,30,15,10,7,5,1,0);638 620 639 621 // +-----------------------------------------------------------------------+ -
trunk/include/constants.php
r2343 r2516 105 105 if (!defined('PLUGINS_TABLE')) 106 106 define('PLUGINS_TABLE', $prefixeTable.'plugins'); 107 if (!defined('WEB_SERVICES_ACCESS_TABLE'))108 define('WEB_SERVICES_ACCESS_TABLE', $prefixeTable.'ws_access');109 107 if (!defined('OLD_PERMALINKS_TABLE')) 110 108 define('OLD_PERMALINKS_TABLE', $prefixeTable.'old_permalinks'); -
trunk/include/ws_functions.inc.php
r2511 r2516 43 43 } 44 44 45 if ( !$conf['ws_access_control'] )46 {47 return $res; // No controls are requested48 }49 $query = '50 SELECT * FROM '.WEB_SERVICES_ACCESS_TABLE."51 WHERE `name` = '$calling_partner_id'52 AND NOW() <= end; ";53 $result = pwg_query($query);54 $row = mysql_fetch_assoc($result);55 if ( empty($row) )56 {57 return new PwgError(403, 'Partner id does not exist or is expired');58 }59 if ( !empty($row['request'])60 and strpos($methodName, $row['request'])==false61 and strpos($methodName, 'session')==false62 and strpos($methodName, 'getVersion')==false )63 { // session and getVersion are allowed to diagnose any failure reason64 return new PwgError(403, 'Method not allowed');65 }66 67 45 return $res; 68 }69 70 /**71 * ws_addControls72 * returns additionnal controls if requested73 * usable for 99% of Web Service methods74 *75 * - Args76 * $methodName: is the requested method77 * $partner: is the key78 * $tbl_name: is the alias_name in the query (sometimes called correlation name)79 * null if !getting picture informations80 * - Logic81 * Access_control is not active: Return82 * Key is incorrect: Return 0 = 1 (False condition for MySQL)83 * One of Params doesn't match with type of request: return 0 = 1 again84 * Access list(id/cat/tag) is converted in expended image-id list85 * image-id list: converted to an in-where-clause86 *87 * The additionnal in-where-clause is return88 */89 function ws_addControls( $methodName, &$params, $tbl_name )90 {91 global $conf, $calling_partner_id;92 if ( !$conf['ws_access_control'] or !isset($calling_partner_id) )93 {94 return '1=1'; // No controls are requested95 }96 97 // Is it an active Partner?98 $query = '99 SELECT * FROM '.WEB_SERVICES_ACCESS_TABLE."100 WHERE `name` = '$calling_partner_id'101 AND NOW() <= end; ";102 $result = pwg_query($query);103 if ( mysql_num_rows( $result ) == 0 )104 {105 return '0=1'; // Unknown partner or Obsolate agreement106 }107 108 $row = mysql_fetch_array($result);109 110 // Overide general object limit111 $params['per_page'] = $row['limit'];112 113 // Target restrict114 // 3 cases: list, cat or tag115 // Behind / we could found img-ids, cat-ids or tag-ids116 $target = $row['access'];117 if ( $target == '')118 {119 return '1=1'; // No controls are requested120 }121 list($type, $str_ids) = explode('/',$target); // Find type list122 123 // (array) 1,2,21,3,22,4,5,9-12,6,11,12,13,2,4,6,124 $arr_ids = expand_id_list( explode( ',',$str_ids ) );125 $addings = implode(',', $arr_ids);126 // (string) 1,2,3,4,5,6,9,10,11,12,13,21,22,127 if ( $type == 'list')128 {129 return $tbl_name . 'id IN ( ' . $addings . ' ) ';130 }131 132 if ( $type == 'cat' )133 {134 $addings = implode(',', get_image_ids_for_cats($arr_ids));135 return $tbl_name . 'id IN ( ' . $addings . ' ) ';136 }137 138 if ( $type == 'tag' )139 {140 $addings = implode(',', get_image_ids_for_tags($arr_ids, 'OR'));141 return $tbl_name . 'id IN ( ' . $addings . ' ) ';142 }143 // Unmanaged new type?144 return ' 0 = 1 '; // ???145 46 } 146 47 … … 372 273 ), null, true 373 274 ); 374 $where_clauses[] = ws_addControls( 'categories.getImages', $params, 'i.' );375 275 376 276 $order_by = ws_std_image_sql_order($params, 'i.'); … … 610 510 array('visible_images' => 'id'), 611 511 ' AND' 612 ).' AND '. 613 ws_addControls( 'images.getInfo', $params, '' ).' 614 LIMIT 1;'; 512 ).' 513 LIMIT 1'; 615 514 616 515 $image_row = mysql_fetch_assoc(pwg_query($query)); … … 1184 1083 ); 1185 1084 $where_clauses[] = 'id IN ('.implode(',',$image_ids).')'; 1186 $where_clauses[] = ws_addControls( 'tags.getImages', $params, 'i.' );1187 1085 1188 1086 $order_by = ws_std_image_sql_order($params); … … 1267 1165 } 1268 1166 1269 1270 /**1271 * expand_id_list($ids) convert a human list expression to a full ordered list1272 * example : expand_id_list( array(5,2-3,2) ) returns array( 2, 3, 5)1273 * */1274 function expand_id_list($ids)1275 {1276 $tid = array();1277 foreach ( $ids as $id )1278 {1279 if ( is_numeric($id) )1280 {1281 $tid[] = (int) $id;1282 }1283 else1284 {1285 $range = explode( '-', $id );1286 if ( is_numeric($range[0]) and is_numeric($range[1]) )1287 {1288 $from = min($range[0],$range[1]);1289 $to = max($range[0],$range[1]);1290 for ($i = $from; $i <= $to; $i++)1291 {1292 $tid[] = (int) $i;1293 }1294 }1295 }1296 }1297 $result = array_unique ($tid); // remove duplicates...1298 sort ($result);1299 return $result;1300 }1301 1302 1303 /**1304 * converts a cat-ids array in image-ids array1305 * FIXME Function which should already exist somewhere else1306 * */1307 function get_image_ids_for_cats($cat_ids)1308 {1309 $cat_list = implode(',', $cat_ids);1310 $ret_ids = array();1311 $query = '1312 SELECT DISTINCT image_id1313 FROM '.IMAGE_CATEGORY_TABLE.'1314 WHERE category_id in ('.$cat_list.')1315 ;';1316 return array_from_query($query, 'image_id');1317 }1318 1319 1167 ?> -
trunk/install/upgrade_1.6.2.php
r2299 r2516 170 170 ;", 171 171 172 /* TABLE DROPPED BEFORE Butterfly/Piwigo release - see later DROP IF EXISTS 172 173 " 173 174 CREATE TABLE `".PREFIX_TABLE."ws_access` ( … … 183 184 UNIQUE KEY `ws_access_ui1` (`name`) 184 185 ) TYPE=MyISAM COMMENT='Access for Web Services' 185 ;", 186 ;",*/ 186 187 187 188 " -
trunk/language/en_UK/admin.lang.php
r2491 r2516 466 466 $lang['Advanced_features'] = 'Advanced features'; 467 467 $lang['Elements_not_linked'] = 'Not linked elements'; 468 $lang['web_services'] = 'Web services ';469 $lang['title_wscheck'] = ' Access management ';470 $lang['ws_failed_upd'] = ' -> <strong>Uncompleted demand</strong> ';471 $lang['ws_success_upd'] = ' -> Successfully completed ';472 $lang['ws_adding_legend'] = ' Add a new partner access to Web Services ';473 $lang['ws_update_legend'] = ' Revoke / Update selected partner access ';474 $lang['ws_delete_legend'] = ' Revoke selected partner access ';475 $lang['ws_Methods'] = ' Methods ';476 $lang['ws_KeyName'] = ' Partner ';477 $lang['ws_Access'] = ' Access ';478 $lang['ws_Start'] = ' Start ';479 $lang['ws_End'] = ' End ';480 $lang['ws_Request'] = ' Request ';481 $lang['ws_Limit'] = ' Limit ';482 $lang['ws_Comment'] = ' Comment ';483 $lang['Modify End from Now +'] = 'Modify End from Now + ';484 $lang['Delete'] = ' Remove ';485 $lang['Confidential partner key'] = 'Confidential partner key';486 $lang['Basis of access key calculation'] = 'Basis of access key calculation';487 $lang['Target'] = 'Target';488 $lang['Access: see help text for more'] = 'Access: see help text for more';489 $lang['Facultative and restrictive option'] = 'Facultative and restrictive option';490 $lang['Postponed availability in days'] = 'Postponed availability in days';491 $lang['Duration in days'] = 'Duration in days';492 $lang['Restrict access to'] = 'Restrict access to';493 $lang['Returned images limit'] = 'Returned images limit';494 $lang['Comment to identify your partner clearly'] = 'Comment to identify your partner clearly';495 $lang['Add this access definition'] = 'Add this access definition';496 $lang['Web Services availability duration in days'] = 'Web Services availability duration in days';497 $lang['Web Services under control'] = 'Piwigo Web Services are fully operationals and all requests are under control.';498 468 $lang['special_admin_menu'] = 'Specials'; 499 469 $lang['Duplicates'] = 'Files with same name in more than one physical category'; -
trunk/language/es_ES/admin.lang.php
r2491 r2516 339 339 $lang['properties'] = 'Propiedades'; 340 340 $lang['public'] = 'público'; 341 $lang['purge history'] = 'purgar la reseña histórica';342 341 $lang['purge never used notification feeds'] = 'Purgar los flujos jamás utilizados de notificación'; 343 342 $lang['purge sessions'] = 'Purgar las sesiones'; … … 467 466 $lang['Advanced_features'] = 'Funciones avanzadas'; 468 467 $lang['Elements_not_linked'] = 'Elementos no atados'; 469 $lang['web_services'] = 'Servicios Web ';470 $lang['title_wscheck'] = ' Gestión de los accesos ';471 $lang['ws_failed_upd'] = ' -> <strong>Operación no realizada</strong> ';472 $lang['ws_success_upd'] = ' -> Acción realizada correctamente ';473 $lang['ws_adding_legend'] = ' Añadido de un acceso compañero a los Servicios Web ';474 $lang['ws_update_legend'] = ' Suprimir / Modificar el acceso del compañero seleccionado ';475 $lang['ws_delete_legend'] = ' Suprimir definitivamente el acceso del compañero seleccionado ';476 $lang['ws_Methods'] = ' Métodos ';477 $lang['ws_KeyName'] = ' Compañero ';478 $lang['ws_Access'] = ' Accesso ';479 $lang['ws_Start'] = ' Principio ';480 $lang['ws_End'] = ' Fin ';481 $lang['ws_Request'] = 'Demanda';482 $lang['ws_Limit'] = ' Límite ';483 $lang['ws_Comment'] = ' Comentario ';484 $lang['Modify End from Now +'] = 'Modificar el Fin por este instante + ';485 $lang['Delete'] = ' Retirada ';486 $lang['Confidential partner key'] = 'Llave confidencial';487 $lang['Basis of access key calculation'] = 'Base de cálculo de la llave';488 $lang['Target'] = 'Blanco';489 $lang['Access: see help text for more'] = 'Acceso : ver la ayuda en línea';490 $lang['Facultative and restrictive option'] = 'Opción facultativa y restrictiva';491 $lang['Postponed availability in days'] = 'Saldo de disponibilidad en días';492 $lang['Duration in days'] = 'Durada en días';493 $lang['Restrict access to'] = 'Acceso restringindo a';494 $lang['Returned images limit'] = 'Límite de transmision';495 $lang['Comment to identify your partner clearly'] = 'Comentario que le permite identificar a su compañero fácilmente';496 $lang['Add this access definition']= 'Añadir esta definición de acceso';497 $lang['Web Services availability duration in days'] = 'Duración de abertura de los Servicios Web en días';498 $lang['Web Services under control'] = 'Los Servicios Web de Piwigo totalmente son operativos y todas las demandas son controladas.';499 468 $lang['special_admin_menu'] = 'Clases de matemáticas superiores'; 500 $lang['note_check_exif'] = '%s debe ser puesto a "false" en su fichero config_local.inc.php porque el extejo no es sostenido.';501 $lang['note_check_more_info'] = 'Vaya sobre %s or %s para más informaciones.';502 $lang['note_check_more_info_forum'] = 'el foro';503 $lang['note_check_more_info_wiki'] = 'el wiki';504 469 $lang['Duplicates'] = 'Ficheros que llevan el mismo nombre en varias categorías físicas'; 505 470 -
trunk/language/fr_FR/admin.lang.php
r2503 r2516 466 466 $lang['Advanced_features'] = 'Fonctions avancées'; 467 467 $lang['Elements_not_linked'] = 'Eléments non liés'; 468 $lang['web_services'] = 'Services Web ';469 $lang['title_wscheck'] = ' Gestion des accès ';470 $lang['ws_failed_upd'] = ' -> <strong>Opération non réalisée</strong> ';471 $lang['ws_success_upd'] = ' -> Action réalisée correctement ';472 $lang['ws_adding_legend'] = ' Ajout d\'un accès partenaire aux Services Web ';473 $lang['ws_update_legend'] = ' Supprimer / Modifier l\'accès du partenaire sélectionné ';474 $lang['ws_delete_legend'] = ' Supprimer définitivement l\'accès du partenaire sélectionné ';475 $lang['ws_Methods'] = ' Méthodes ';476 $lang['ws_KeyName'] = ' Partenaire ';477 $lang['ws_Access'] = ' Access ';478 $lang['ws_Start'] = ' Début ';479 $lang['ws_End'] = ' Fin ';480 $lang['ws_Request'] = 'Requête';481 $lang['ws_Limit'] = ' Limite ';482 $lang['ws_Comment'] = ' Commentaire ';483 $lang['Modify End from Now +'] = 'Modifier la Fin par cet instant + ';484 $lang['Delete'] = ' Retrait ';485 $lang['Confidential partner key'] = 'Clé confidentielle';486 $lang['Basis of access key calculation'] = 'Base de calcul de la clé';487 $lang['Target'] = 'Cible';488 $lang['Access: see help text for more'] = 'Accès: voir l\'aide en ligne';489 $lang['Facultative and restrictive option'] = 'Option facultative et restrictive';490 $lang['Postponed availability in days'] = 'Report de disponibilité en jours';491 $lang['Duration in days'] = 'Durée en jours';492 $lang['Restrict access to'] = 'Accès restreint à';493 $lang['Returned images limit'] = 'Limite de transmision';494 $lang['Comment to identify your partner clearly'] = 'Commentaire vous permettant d\'identifier votre partenaire facilement';495 $lang['Add this access definition']= 'Ajouter cette définition d\'accès';496 $lang['Web Services availability duration in days'] = 'Durée d\'ouverture des Services Web en jours';497 $lang['Web Services under control'] = 'Les Services Web de Piwigo sont totalement operationnels et toutes les requêtes sont contrôlées.';498 468 $lang['special_admin_menu'] = 'Spéciales'; 499 469 $lang['Duplicates'] = 'Fichiers portant le même nom dans plusieurs catégories physiques'; -
trunk/language/it_IT/admin.lang.php
r2491 r2516 466 466 $lang['Advanced_features'] = 'Funzioni avanzate'; 467 467 $lang['Elements_not_linked'] = 'Elementi sciolti'; 468 $lang['web_services'] = 'Servizzi Web ';469 $lang['title_wscheck'] = ' Gestione degli accessi ';470 $lang['ws_failed_upd'] = ' -> <strong>Operazione non efettuata</strong> ';471 $lang['ws_success_upd'] = ' -> Operazione realizzata correttamente ';472 $lang['ws_adding_legend'] = ' Aggiungere un nuovo accesso partner ai Servizi Web ';473 $lang['ws_update_legend'] = ' Cancellare / Modificare l\'accesso del partner selezionato ';474 $lang['ws_delete_legend'] = ' Cancellare definitivamente l\'accesso del partner selezionato ';475 $lang['ws_Methods'] = ' Methods ';476 $lang['ws_KeyName'] = ' Partner ';477 $lang['ws_Access'] = ' Access ';478 $lang['ws_Start'] = ' Inizzio ';479 $lang['ws_End'] = ' Fine ';480 $lang['ws_Request'] = ' Selezione ';481 $lang['ws_Limit'] = ' Limite ';482 $lang['ws_Comment'] = ' Commento ';483 $lang['Modify End from Now +'] = 'Modificare la Fine da quest\'instante + ';484 $lang['Delete'] = ' Togliere ';485 $lang['Confidential partner key'] = 'Chiave confidentiale';486 $lang['Basis of access key calculation'] = 'Base di calcolo della chiave';487 $lang['Target'] = 'Target';488 $lang['Access: see help text for more'] = 'Accesso: vedere aiuto on line';489 $lang['Facultative and restrictive option'] = 'Opzione facoltativa e restrittiva';490 $lang['Postponed availability in days'] = 'Disponibilità posposta in giorni';491 $lang['Duration in days'] = 'Durata in giorni';492 $lang['Restrict access to'] = 'Accesso limitato a';493 $lang['Returned images limit'] = 'Limite di trasferimento';494 $lang['Comment to identify your partner clearly'] = 'Commento che vi permetterà di identificare il vostro partner facilmente';495 $lang['Add this access definition']= 'Aggiungere questa definizione d\'accesso';496 $lang['Web Services availability duration in days'] = 'Durata d\'appertura dei Servizzi Web in giorni';497 $lang['Web Services under control'] = 'I Servizzi Web di Piwigo sono totalmente operativi e tutte le selezioni sono controllate.';498 468 $lang['special_admin_menu'] = 'Speciale'; 499 469 $lang['Duplicates'] = 'File con stesso nome in più di una categoria fisica'; -
trunk/language/nl_NL/admin.lang.php
r2491 r2516 339 339 $lang['properties'] = 'Eigenschappen'; 340 340 $lang['public'] = 'publiek'; 341 $lang['purge history'] = 'verwijder geschiedenis';342 341 $lang['purge never used notification feeds'] = 'verwijder nimmer gebruikte meldingen'; 343 342 $lang['purge sessions'] = 'verwijder sessies'; … … 467 466 $lang['Advanced_features'] = 'Geavanceerde functies'; 468 467 $lang['Elements_not_linked'] = 'Niet gelinkte elementen'; 469 $lang['web_services'] = 'Web services ';470 $lang['title_wscheck'] = ' Toegangsbeheer';471 $lang['ws_failed_upd'] = ' -> <strong>Niet voltooide eis</strong> ';472 $lang['ws_success_upd'] = ' -> Succesvol afgerond ';473 $lang['ws_adding_legend'] = ' Voeg een nieuwe partner toegang toe aan Web Services ';474 $lang['ws_update_legend'] = ' Ongedaan maken / bijwerken geselecteerde partner toegangaccess ';475 $lang['ws_delete_legend'] = ' Maak geselecteerde partner toegang ongedaan';476 $lang['ws_Methods'] = ' Methode ';477 $lang['ws_KeyName'] = ' Partner ';478 $lang['ws_Access'] = ' Toegang ';479 $lang['ws_Start'] = ' Start ';480 $lang['ws_End'] = ' Eind ';481 $lang['ws_Request'] = ' Vraag ';482 $lang['ws_Limit'] = ' Limiet ';483 $lang['ws_Comment'] = ' Commentaar ';484 $lang['Modify End from Now +'] = 'Verander eind vanaf hier + ';485 $lang['Delete'] = ' Verwijderen ';486 $lang['Confidential partner key'] = 'Vertrouwelijke partner sleutel';487 $lang['Basis of access key calculation'] = 'Basis van de toegangssleutel berekening';488 $lang['Target'] = 'Doel';489 $lang['Access: see help text for more'] = 'Toegang: Zie help tekst voor meer info';490 $lang['Facultative and restrictive option'] = 'Facultatieve en restrictieve optie ';491 $lang['Postponed availability in days'] = 'Uitgestelde beschikbaarheid in dagen';492 $lang['Duration in days'] = 'Duur in dagen';493 $lang['Restrict access to'] = 'Beperk toegang tot';494 $lang['Returned images limit'] = 'Teruggekeerde beeldengrens';495 $lang['Comment to identify your partner clearly'] = 'Commentaar om je partner te identificeren';496 $lang['Add this access definition'] = 'Toevoegen toegangs defenitie';497 $lang['Web Services availability duration in days'] = 'Web Services beschikbaar in aantal dagen';498 $lang['Web Services under control'] = 'Piwigo Web Services zijn volledig operationeel en alle verzoeken worden uitgevoerd.';499 468 $lang['special_admin_menu'] = 'Speciaal'; 500 $lang['note_check_exif'] = '%s moet ingesteld zijn op false in je config_local.inc.php omdat exif niet ondersteund wordt.';501 $lang['note_check_more_info'] = 'Ga naar %s of %s voor meer informatie.';502 $lang['note_check_more_info_forum'] = 'het forum';503 $lang['note_check_more_info_wiki'] = 'de wiki';504 469 $lang['Duplicates'] = 'Bestanden met de zelfde naam in meer dan één physieke categorie'; 505 470 -
trunk/ws.php
r2463 r2516 129 129 'Returns elements for the corresponding query search.' 130 130 ); 131 131 132 132 $service->addMethod( 133 133 'pwg.images.setPrivacyLevel', … … 193 193 add_event_handler('ws_invoke_allowed', 'ws_isInvokeAllowed', EVENT_HANDLER_PRIORITY_NEUTRAL, 3); 194 194 195 $calling_partner_id = '';196 195 $requestFormat = null; 197 196 $responseFormat = null; 198 197 199 if ( isset($_GET['partner']) )200 {201 $calling_partner_id = $_GET['partner'];202 }203 198 if ( isset($_GET['format']) ) 204 199 {
Note: See TracChangeset
for help on using the changeset viewer.