3 require_once 'includes/config.php';
\r
4 if (defined('YOURLS_PRIVATE') && YOURLS_PRIVATE == true)
\r
5 require_once 'includes/auth.php';
\r
7 ### This file will output a JSON string
\r
8 header('Content-type: application/json');
\r
10 ### Connect To Database
\r
11 $db = yourls_db_connect();
\r
14 switch( stripslashes($_REQUEST['mode']) ) {
\r
17 $return = yourls_add_new_link( $_REQUEST['url'], $_REQUEST['keyword'], $db );
\r
18 echo yourls_json_encode($return);
\r
21 case 'edit_display':
\r
22 $row = yourls_table_edit_row ( $_REQUEST['id'], $db );
\r
23 echo yourls_json_encode( array('html' => $row) );
\r
27 $return = yourls_edit_link( $_REQUEST['url'], $_REQUEST['id'], $_REQUEST['newid'], $db );
\r
28 echo yourls_json_encode($return);
\r
32 $query = yourls_delete_link_by_id( $_REQUEST['id'], $db );
\r
33 echo yourls_json_encode(array('success'=>$query));
\r
37 // unused for the moment
\r
42 die('Not implemented');
\r