[ Index ] |
PHP Cross Reference of YOURLS |
[Summary view] [Print] [Text view]
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 yourls_no_frame_header(); 11 12 if( !isset( $_REQUEST['action'] ) ) 13 die(); 14 15 // Pick action 16 $action = $_REQUEST['action']; 17 switch( $action ) { 18 19 case 'add': 20 yourls_verify_nonce( 'add_url', $_REQUEST['nonce'], false, 'omg error' ); 21 $return = yourls_add_new_link( $_REQUEST['url'], $_REQUEST['keyword'], '', $_REQUEST['rowid'] ); 22 echo json_encode($return); 23 break; 24 25 case 'edit_display': 26 yourls_verify_nonce( 'edit-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); 27 $row = yourls_table_edit_row ( $_REQUEST['keyword'], $_REQUEST['id'] ); 28 echo json_encode( array('html' => $row) ); 29 break; 30 31 case 'edit_save': 32 yourls_verify_nonce( 'edit-save_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); 33 $return = yourls_edit_link( $_REQUEST['url'], $_REQUEST['keyword'], $_REQUEST['newkeyword'], $_REQUEST['title'] ); 34 echo json_encode($return); 35 break; 36 37 case 'delete': 38 yourls_verify_nonce( 'delete-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); 39 $query = yourls_delete_link_by_keyword( $_REQUEST['keyword'] ); 40 echo json_encode(array('success'=>$query)); 41 break; 42 43 default: 44 yourls_do_action( 'yourls_ajax_'.$action ); 45 46 } 47 48 die();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Jan 21 05:10:11 2025 | Cross-referenced by PHPXref 0.7.1 |