Checks scope closing brace break indent
1 | <?php |
||
2 | define( 'YOURLS_ADMIN', true ); |
||
3 | define( 'YOURLS_AJAX', true ); |
||
4 | require_once( dirname( __DIR__ ) .'/includes/load-yourls.php' ); |
||
5 | yourls_maybe_require_auth(); |
||
6 | |||
7 | // This file will output a JSON string |
||
8 | yourls_content_type_header( 'application/json' ); |
||
9 | yourls_no_cache_headers(); |
||
10 | |||
11 | if( !isset( $_REQUEST['action'] ) ) |
||
12 | die(); |
||
13 | |||
14 | // Pick action |
||
15 | $action = $_REQUEST['action']; |
||
16 | switch( $action ) { |
||
17 | |||
18 | case 'add': |
||
19 | yourls_verify_nonce( 'add_url', $_REQUEST['nonce'], false, 'omg error' ); |
||
20 | $return = yourls_add_new_link( $_REQUEST['url'], $_REQUEST['keyword'] ); |
||
21 | echo json_encode($return); |
||
22 | break; |
||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
23 | |||
24 | case 'edit_display': |
||
25 | yourls_verify_nonce( 'edit-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); |
||
26 | $row = yourls_table_edit_row ( $_REQUEST['keyword'] ); |
||
27 | echo json_encode( array('html' => $row) ); |
||
28 | break; |
||
0 ignored issues
–
show
|
|||
29 | |||
30 | case 'edit_save': |
||
31 | yourls_verify_nonce( 'edit-save_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); |
||
32 | $return = yourls_edit_link( $_REQUEST['url'], $_REQUEST['keyword'], $_REQUEST['newkeyword'], $_REQUEST['title'] ); |
||
33 | echo json_encode($return); |
||
34 | break; |
||
0 ignored issues
–
show
|
|||
35 | |||
36 | case 'delete': |
||
37 | yourls_verify_nonce( 'delete-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); |
||
38 | $query = yourls_delete_link_by_keyword( $_REQUEST['keyword'] ); |
||
39 | echo json_encode(array('success'=>$query)); |
||
40 | break; |
||
0 ignored issues
–
show
|
|||
41 | |||
42 | case 'logout': |
||
43 | // unused for the moment |
||
44 | yourls_logout(); |
||
45 | break; |
||
0 ignored issues
–
show
|
|||
46 | |||
47 | default: |
||
48 | yourls_do_action( 'yourls_ajax_'.$action ); |
||
49 | |||
50 | } |
||
51 | |||
52 | die(); |
||
53 |