Changeset 27564 for extensions/rv_autocomplete/admin/functions.inc.php
- Timestamp:
- Mar 5, 2014, 10:44:34 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_autocomplete/admin/functions.inc.php
r22201 r27564 48 48 function rvac_ws_add_methods($srv_arr) 49 49 { 50 global $conf; 50 51 $srv = $srv_arr[0]; 51 52 include_once( dirname(__FILE__).'/../functions.inc.php' ); 52 53 $srv->addMethod('rvac.addCustom', 'rv_ac_ws_add_custom_suggestion', 53 54 array( 54 'name' => array(), 55 'counter' => array('default'=>0), 56 'url' => array('default'=>''), 55 'name' => array(), 56 'counter' => array('default'=>0), 57 'url' => array('default'=>''), 58 'level' => array('default'=>min($conf['available_permission_levels']), 'maxValue'=>max($conf['available_permission_levels']),'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 57 59 ), 58 '' );60 '','', array('admin_only'=>true, 'post_only'=>true)); 59 61 60 62 $srv->addMethod('rvac.modCustom', 'rv_ac_ws_mod_custom_suggestion', … … 64 66 'counter' => array('flags' => WS_PARAM_OPTIONAL), 65 67 'url' => array('flags' => WS_PARAM_OPTIONAL), 68 'level' => array('flags' => WS_PARAM_OPTIONAL, 'maxValue'=>max($conf['available_permission_levels']),'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 66 69 ), 67 '' );70 '','', array('admin_only'=>true, 'post_only'=>true)); 68 71 69 72 $srv->addMethod('rvac.delCustom', 'rv_ac_ws_del_custom_suggestion', 70 73 array('id'), 71 '' );74 '','', array('admin_only'=>true, 'post_only'=>true)); 72 75 } 73 76 74 77 function rv_ac_ws_add_custom_suggestion($params, $service) 75 78 { 76 global $conf;77 if (!is_admin() || !$service->isPost())78 return new PwgError(403, 'post admin');79 80 79 $name = trim($params['name']); 81 80 if (empty($name)) … … 88 87 if ( !empty($params['url']) ) 89 88 $insert['url'] = $params['url']; 89 if ( isset($params['level']) ) 90 $insert['level'] = $params['level']; 90 91 91 92 mass_inserts(RVAC_SUGGESTIONS, array_keys($insert), array($insert)); … … 100 101 function rv_ac_ws_mod_custom_suggestion($params, $service) 101 102 { 102 global $conf;103 if (!is_admin() || !$service->isPost())104 return new PwgError(403, 'post admin');105 103 $id = intval($params['id']); 106 104 $update = array(); … … 112 110 if (isset($params['url'])) 113 111 $update['url'] = $params['url']; 112 if ( isset($params['level']) ) 113 $update['level'] = $params['level']; 114 114 115 115 single_update(RVAC_SUGGESTIONS, … … 129 129 function rv_ac_ws_del_custom_suggestion($params, $service) 130 130 { 131 global $conf;132 if (!is_admin() || !$service->isPost())133 return new PwgError(403, 'post admin');134 135 131 $id = intval($params['id']); 136 132 $q = 'DELETE FROM '.RVAC_SUGGESTIONS.' WHERE id='.$id;
Note: See TracChangeset
for help on using the changeset viewer.