X-Git-Url: https://git.defcon.no/?a=blobdiff_plain;f=alias.php;h=6451b2eef3efa52c774c1997afbd9b072df6f3e5;hb=e9dd114b2570a41c4f517bdee270fbc2c791de92;hp=9adb4346e82dd896d9721854f64ede3b4fdbf9fa;hpb=266a88b9c769ceb9fbb5909c1d1a033cd3421adb;p=hermes diff --git a/alias.php b/alias.php index 9adb434..6451b2e 100644 --- a/alias.php +++ b/alias.php @@ -27,6 +27,7 @@ if ( !$config['sql_link'] ) Required parameters should be... destination */ + $list = array(); $dest_username = ""; $dest_domain = ""; $e164_only = false; @@ -43,10 +44,12 @@ if ( !$config['sql_link'] ) if ( array_key_exists( 'e164', $_GET ) ) { if ( strtolower($_GET['e164']) == "true" ) $e164_only = true; + $list = get_e164_alias( $dest_username, $dest_domain ); + } + else if ( $dest_username && $dest_domain ) + { + $list = get_aliases( $dest_username, $dest_domain ); } - // TODO: Well. Code. This is a stub - - print json_encode ( array( 'response' => 'failed', 'cause' => 'notimplemented', 'detail' => 'Requested feature valid, but not implemented' ) ); } else if ( array_key_exists( 'alias', $_GET) ) { @@ -58,12 +61,13 @@ if ( !$config['sql_link'] ) } list ( $alias_username, $alias_domain ) = $tmp; - // TODO: Well. Code. This is a stub - - print json_encode ( array( 'response' => 'failed', 'cause' => 'notimplemented', 'detail' => 'Requested feature valid, but not implemented' ) ); + $list = get_destination( $alias_username, $alias_domain ); } else - print json_encode( array( 'response' => 'invalid', 'cause' => 'parameters' ) ); + $list = get_aliases( null, null ); + + + print json_encode ( array( 'response' => 'ok', 'aliases' => $list ) ); break; case "/add": if ( array_key_exists( 'destination', $_GET) @@ -134,7 +138,7 @@ if ( !$config['sql_link'] ) 'response' => 'failed', 'cause' => 'exists', 'detail' => 'User already has E164 number alias', - 'alias' => $t )); + 'alias' => $t['alias'] )); break; } }