- Timestamp:
- Dec 24, 2010, 12:12:03 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r8272 r8273 2465 2465 return $ret; 2466 2466 } 2467 2468 function ws_plugins_getList($params, &$service) 2469 { 2470 global $conf; 2471 2472 if (!is_admin()) 2473 { 2474 return new PwgError(401, 'Access denied'); 2475 } 2476 2477 include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); 2478 $plugins = new plugins(); 2479 $plugins->sort_fs_plugins('name'); 2480 $plugin_list = array(); 2481 2482 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) 2483 { 2484 if (isset($plugins->db_plugins_by_id[$plugin_id])) 2485 { 2486 $state = $plugins->db_plugins_by_id[$plugin_id]['state']; 2487 } 2488 else 2489 { 2490 $state = 'uninstalled'; 2491 } 2492 2493 array_push( 2494 $plugin_list, 2495 array( 2496 'id' => $plugin_id, 2497 'name' => $fs_plugin['name'], 2498 'version' => $fs_plugin['version'], 2499 'state' => $state, 2500 'description' => $fs_plugin['description'], 2501 ) 2502 ); 2503 } 2504 2505 return $plugin_list; 2506 } 2507 2508 function ws_plugins_performAction($params, &$service) 2509 { 2510 global $template; 2511 2512 if (!is_admin()) 2513 { 2514 return new PwgError(401, 'Access denied'); 2515 } 2516 2517 if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token']) 2518 { 2519 return new PwgError(403, 'Invalid security token'); 2520 } 2521 2522 define('IN_ADMIN', true); 2523 include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); 2524 $plugins = new plugins(); 2525 $errors = $plugins->perform_action($params['action'], $params['plugin']); 2526 2527 2528 if (!empty($errors)) 2529 { 2530 return new PwgError(500, $errors); 2531 } 2532 else 2533 { 2534 if (in_array($params['action'], array('activate', 'deactivate'))) 2535 { 2536 $template->delete_compiled_templates(); 2537 } 2538 return true; 2539 } 2540 } 2541 2467 2542 ?> -
trunk/ws.php
r8272 r8273 369 369 'POST method only.' 370 370 ); 371 372 $service->addMethod( 373 'pwg.plugins.getList', 374 'ws_plugins_getList', 375 array(), 376 'get the list of plugin with id, name, version, state and description 377 <br>administration status required' 378 ); 379 380 $service->addMethod( 381 'pwg.plugins.performAction', 382 'ws_plugins_performAction', 383 array( 384 'action' => array('default' => null), 385 'plugin' => array('default' => null), 386 'pwg_token' => array('default' => null), 387 ), 388 'install/activate/deactivate/uninstall/delete a plugin 389 <br>administration status required' 390 ); 371 391 } 372 392
Note: See TracChangeset
for help on using the changeset viewer.