| [ 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 $row_id = (int) ( $_REQUEST['rowid'] ?? 1 ); // row_id starts from 1 unless passed in. 22 $return = yourls_add_new_link( $_REQUEST['url'], $_REQUEST['keyword'], '', $row_id ); 23 echo json_encode($return); 24 break; 25 26 case 'edit_display': 27 yourls_verify_nonce( 'edit-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); 28 $row = yourls_table_edit_row ( $_REQUEST['keyword'], $_REQUEST['id'] ); 29 echo json_encode( array('html' => $row) ); 30 break; 31 32 case 'edit_save': 33 yourls_verify_nonce( 'edit-save_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); 34 $return = yourls_edit_link( $_REQUEST['url'], $_REQUEST['keyword'], $_REQUEST['newkeyword'], $_REQUEST['title'] ); 35 echo json_encode($return); 36 break; 37 38 case 'delete': 39 yourls_verify_nonce( 'delete-link_'.$_REQUEST['id'], $_REQUEST['nonce'], false, 'omg error' ); 40 $query = yourls_delete_link_by_keyword( $_REQUEST['keyword'] ); 41 echo json_encode(array('success'=>$query)); 42 break; 43 44 default: 45 yourls_do_action( 'yourls_ajax_'.$action ); 46 47 } 48 49 die();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Nov 9 05:10:31 2026 | Cross-referenced by PHPXref 0.7.1 |