From 5665d317db7763650e7827c20f6fe131bcce9ad3 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Feb 2016 21:00:31 +0100 Subject: liste des cird --- server/Test/DisplayListCidr.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 server/Test/DisplayListCidr.php (limited to 'server') diff --git a/server/Test/DisplayListCidr.php b/server/Test/DisplayListCidr.php new file mode 100644 index 0000000..119b218 --- /dev/null +++ b/server/Test/DisplayListCidr.php @@ -0,0 +1,26 @@ +"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]); + $options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"])); + $options["authUrl"] = "http://148.60.11.31:5000/v3"; + $openstack = new OpenStack\OpenStack($options); + $networking = $openstack->networkingV2(["region"=>"RegionOne"]); + $ls = $networking->listSubnets(); + + foreach ($ls as $subnet) { + echo $subnet->cidr."
"; +} + + + + + + + + + -- cgit v1.2.3 From 154d49d1089d34ada6744556cca8028d1ec11430 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Feb 2016 21:36:07 +0100 Subject: la premiere version de la classe netork --- server/core/Network.php | 104 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/core/Network.php b/server/core/Network.php index 8d1c8b6..38e20be 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -1 +1,103 @@ - +] + * + * @return Image + */ + public function __construct($app, $openstack){ + $this->app = $app; + $this->libClass = $app->getLibClass("networkingV2"); + $this->networking = $openstack->networkingV2(["region"=>"RegionOne"]); + } + + + + + + public function create_network(array $options) + { + + $network = $networking->createNetworks($options); + + + return $network; + } + + public function create_subnet(array $options) + { + + $subnet = $networking->createSubnet($options); + + + return $subnet; + } + + public function list_network_ids() + { + + $ln = $networking->listNetworks(); + + $list_ids = array(); + + + foreach($ln as $n) + { + + $list_ids[] = $n->id; + + + } + + return $list_ids; + } + + public function list_network_names() + { + + $ln = $networking->listNetworks(); + + $list_names = array(); + + + foreach($ln as $n) + { + + $list_names[] = $n->name; + + + } + + return $list_names; + } + + public function list_cidr() + { + + $ls = $networking->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + return $list_names; + } + + -- cgit v1.2.3 From 38ba61c6eebadb79a23044b06671fd7c73975516 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Feb 2016 19:42:01 +0100 Subject: modification dans network --- server/core/Network.php | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'server') diff --git a/server/core/Network.php b/server/core/Network.php index 38e20be..2e09508 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -6,34 +6,29 @@ class network{ protected $libClass; - protected $networking; + - protected $actions = array(); + - /** - * Image constructor - * - * @param App $app the main app object - * - * @throws [Type] [] - * - * @return Image - */ - public function __construct($app, $openstack){ + public function __construct($app){ $this->app = $app; - $this->libClass = $app->getLibClass("networkingV2"); - $this->networking = $openstack->networkingV2(["region"=>"RegionOne"]); + $this->libClass = $app->getLibClass("network"); + } - + public function action($action){ + + $this->{$action.""}(); + + } public function create_network(array $options) { - $network = $networking->createNetworks($options); + $network = $this->libClass->createNetworks($options); return $network; @@ -42,7 +37,7 @@ class network{ public function create_subnet(array $options) { - $subnet = $networking->createSubnet($options); + $subnet = $this->libClass->createSubnet($options); return $subnet; @@ -51,7 +46,7 @@ class network{ public function list_network_ids() { - $ln = $networking->listNetworks(); + $ln = $this->libClass->listNetworks(); $list_ids = array(); @@ -70,7 +65,7 @@ class network{ public function list_network_names() { - $ln = $networking->listNetworks(); + $ln = $this->libClass->listNetworks(); $list_names = array(); @@ -89,7 +84,7 @@ class network{ public function list_cidr() { - $ls = $networking->listSubnets(); + $ls = $this->libClass->listSubnets(); $list_cidr = array(); foreach ($ls as $subnet) { -- cgit v1.2.3 From 70fcf3553abb4a25672ee198dafb89e430e2bd79 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 2 Mar 2016 01:34:10 +0100 Subject: ajout des fonctions --- server/Test/getIdNetwork.php | 34 +++++++++++++++ server/Test/getNetwork.php | 26 ++++++++++++ server/core/Network.php | 98 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 server/Test/getIdNetwork.php create mode 100644 server/Test/getNetwork.php (limited to 'server') diff --git a/server/Test/getIdNetwork.php b/server/Test/getIdNetwork.php new file mode 100644 index 0000000..1e38627 --- /dev/null +++ b/server/Test/getIdNetwork.php @@ -0,0 +1,34 @@ +"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]); + $options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"])); + $options["authUrl"] = "http://148.60.11.31:5000/v3"; + $openstack = new OpenStack\OpenStack($options); + $networking = $openstack->networkingV2(["region"=>"RegionOne"]); + + $ls = $networking->getNetwork('5f78d3c1-1f53-4be7-897b-cf3c797961e0'); +try{ +$ls->retrieve(); + + + +echo "oui";} + + catch (OpenStack\Common\Error\BadResponseError $e){ +echo "non"; } + + + + + + + + + + + diff --git a/server/Test/getNetwork.php b/server/Test/getNetwork.php new file mode 100644 index 0000000..4c76480 --- /dev/null +++ b/server/Test/getNetwork.php @@ -0,0 +1,26 @@ +"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]); + $options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"])); + $options["authUrl"] = "http://148.60.11.31:5000/v3"; + $openstack = new OpenStack\OpenStack($options); + $networking = $openstack->networkingV2(["region"=>"RegionOne"]); + $ls = $networking->listNetworks(); + + foreach ($ls as $subnet) { + echo $subnet->id."
"; +} + + + + + + + + + diff --git a/server/core/Network.php b/server/core/Network.php index 2e09508..6363fdb 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -94,5 +94,101 @@ class network{ return $list_names; } + //option array() + public function getNetwork($idNet) + { + $network=""; + + try + { $newtork = $networking->getNetwork($idNet); + $network->retrieve(); + + + } + + catch (OpenStack\Common\Error\BadResponseError $e) + { + $network = "Id non existant "; + } + catch (Exception $e) + { + $network = 'Exception reçue : ', $e->getMessage(), "\n"; + } + + return $network; + } + + public function getSubnet($idSub) + { + $sbnet=""; + + try + { $subnet = $networking->getSubnet($idSub); + $subnet->retrieve(); + + + } + + catch (OpenStack\Common\Error\BadResponseError $e) + { + $sbnet = "Id non existant "; + } + catch (Exception $e) + { + $sbnet = 'Exception reçue : ', $e->getMessage(), "\n"; + } + + return $sbnet; + } + + public function updateNetwork($idNet,$name,$shared,$adminStateUp) + { + $network = getNetwork($idNet); + if(!is_null($name)) + { + $network->name = $name; + } + if(!is_null($shared)) + { + $network->shared = $shared; + } + if(!is_null($adminStateUp)) + { + $network->adminStateUp = $shared; + } + $network->update(); + } - + public function updateSubnet($idSub,$name,$networkId,$ipVersion,$cidr) + { + $subnet = getNetwork($idSub); + if(!is_null($name)) + { + $subnet->name = $name; + } + if(!is_null($networkId)) + { + $subnet->networkId = $networkId; + } + if(!is_null($ipVersion)) + { + $subnet->ipVersion = $ipVersion; + } + if(!is_null($cidr)) + { + $subnet->cidr = $cidr; + } + $subnet->update(); + } + + public function deleteNetwork($idNet) + { + $network = getNetwork($idNet); + $network->delete(); + } + + public function deleteSubnet($idSub) + { + $subnet = getNetwork($idSub); + $subnet->delete(); + } -- cgit v1.2.3 From a51bcad21a526b5077f52bb8e12417e4b921f06b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 8 Mar 2016 00:26:20 +0100 Subject: terminaison des fonctions --- server/core/Network.php | 276 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 265 insertions(+), 11 deletions(-) (limited to 'server') diff --git a/server/core/Network.php b/server/core/Network.php index 6363fdb..75ba2fd 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -25,18 +25,77 @@ class network{ } - public function create_network(array $options) + public function create_network($name,$adminStateUp,$shared,$tenantId) { - + $options = array(); + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (!is_null($shared)) + { + $options['shared'] = $shared; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } $network = $this->libClass->createNetworks($options); return $network; } - public function create_subnet(array $options) - { - + public function create_subnet($networkId,$ipVersion,$cidr,$name,$gatewayIp,$dnsNameservers,$allocationPools,$hostRoutes,$enableDhcp,$tenantId) + { $options = array(); + if (!is_null($networkId)) + { + $options['networkId'] = $networkId; + } + if (!is_null($ipVersion)) + { + $options['ipVersion'] = $ipVersion; + } + if (!is_null($cidr)) + { + $options['cidr'] = $cidr; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($gatewayIp)) + { + $options['gatewayIp'] = $gatewayIp; + } + if (!is_null($dnsNameservers)) + { + $options['dnsNameservers'] = $dnsNameservers; + } + if (!is_null($allocationPools)) + { + $options['allocationPools'] = $allocationPools; + } + if (!is_null($hostRoutes)) + { + $options['hostRoutes'] = $hostRoutes; + } + if (!is_null($enableDhcp)) + { + $options['enableDhcp'] = $enableDhcp; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } $subnet = $this->libClass->createSubnet($options); @@ -100,7 +159,7 @@ class network{ $network=""; try - { $newtork = $networking->getNetwork($idNet); + { $newtork = $this->libClass->getNetwork($idNet); $network->retrieve(); @@ -123,22 +182,22 @@ class network{ $sbnet=""; try - { $subnet = $networking->getSubnet($idSub); + { $subnet = $this->libClass->getSubnet($idSub); $subnet->retrieve(); - + return $sbnet; } catch (OpenStack\Common\Error\BadResponseError $e) { - $sbnet = "Id non existant "; + echo "Id non existant "; } catch (Exception $e) { - $sbnet = 'Exception reçue : ', $e->getMessage(), "\n"; + echo 'Exception reçue : ', $e->getMessage(), "\n"; } - return $sbnet; + } public function updateNetwork($idNet,$name,$shared,$adminStateUp) @@ -192,3 +251,198 @@ class network{ $subnet = getNetwork($idSub); $subnet->delete(); } + + public function createPort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + { + $options = array(); + if (!is_null($networkId)) + { + $options['networkId'] = $networkId; + } + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (!is_null($macAddress)) + { + $options['macAddress'] = $macAddress; + } + if (!is_null($fixedIps)) + { + $options['fixedIps'] = $fixedIps; + } + if (!is_null($deviceId)) + { + $options['deviceId'] = $deviceId; + } + if (!is_null($deviceOwner)) + { + $options['deviceOwner'] = $deviceOwner; + } + if (!is_null($securityGroups)) + { + $options['securityGroups'] = $securityGroups; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } + + $this->libClass->createPort($options); + } + + public function listPorts() + { + return $this->libClass->listPorts(); + } + + public function getPort($portId) + { + try + { + $port = $this->libClass->getport($portId); + return $port; + } + catch (Exception $e) + { + echo 'id fourni non disponible'; + } + + } + + public function updatePort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + { + $options = array(); + if (!is_null($networkId)) + { + $options['networkId'] = $networkId; + } + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (!is_null($macAddress)) + { + $options['macAddress'] = $macAddress; + } + if (!is_null($fixedIps)) + { + $options['fixedIps'] = $fixedIps; + } + if (!is_null($deviceId)) + { + $options['deviceId'] = $deviceId; + } + if (!is_null($deviceOwner)) + { + $options['deviceOwner'] = $deviceOwner; + } + if (!is_null($securityGroups)) + { + $options['securityGroups'] = $securityGroups; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } + + $this->libClass->update($options); + } + + public function deletePort($portId) + { + $port = getPort($portId); + $port->delete(); + } + + public function createSecurityGroup($name,$description) + { + $options = array(); + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($description)) + { + $options['description'] = $description; + } + + $this->libClass->createSecurityGroup($options); + } + + public function createSecurityGroupRule($securityGroupId,$direction,$ethertype,$portRangeMin,$portRangeMax,$protocol,$remoteGroupId,$remoteIpPrefix) + { + $options = array(); + if (!is_null($securityGroupId)) + { + $options['securityGroupId'] = $securityGroupId; + } + if (!is_null($direction)) + { + $options['direction'] = $direction; + } + if (!is_null($ethertype)) + { + $options['ethertype'] = $ethertype; + } + if (!is_null($portRangeMin)) + { + $options['portRangeMin'] = $portRangeMin; + } + if (!is_null($portRangeMax)) + { + $options['portRangeMax'] = $portRangeMax; + } + if (!is_null($protocol)) + { + $options['protocol'] = $protocol; + } + if (!is_null($remoteGroupId)) + { + $options['remoteGroupId'] = $remoteGroupId; + } + if (!is_null($remoteIpPrefix)) + { + $options['remoteIpPrefix'] = $remoteIpPrefix; + } + $this->libClass->createSecurityGroupRule($options); + } + + + public function listSecurityGroupe() + { + return $this->libClass->listSecurityGroups(); + } + + public function listSecurityGroupeRule() + { + return $this->libClass->listSecurityGroupRules(); + } + + public function getSecurityGroupe($securityGroupeId) + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); + return $securityGroupe; + } + catch (Exception $e) + { + echo 'id fourni non disponible'; + } + + } + + public function deleteSecurityGroupe($securityGroupeId) + { + $securityGroupe = getSecurityGroupe($securityGroupeId); + $securityGroupe->delete(); + } -- cgit v1.2.3 From 20f8eb41d3ae5e53fd4bb53e55f0627ff7b7f15c Mon Sep 17 00:00:00 2001 From: Othmane Kabir <16008902@e003m10.istic.univ-rennes1.fr> Date: Wed, 9 Mar 2016 16:13:20 +0100 Subject: commit finale --- server/core/Network.php | 880 +++++++++++++++++++++++++++++++++---------- server/core/Network.php~ | 952 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1644 insertions(+), 188 deletions(-) create mode 100644 server/core/Network.php~ (limited to 'server') diff --git a/server/core/Network.php b/server/core/Network.php index 75ba2fd..65de962 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -25,279 +25,595 @@ class network{ } - public function create_network($name,$adminStateUp,$shared,$tenantId) + public function create_network() { $options = array(); - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $this->app->getPostParam("name"); } - if (!is_null($adminStateUp)) + if (isset($this->app->getPostParam("adminStateUp"))) { - $options['adminStateUp'] = $adminStateUp; + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } - if (!is_null($shared)) + if (isset($this->app->getPostParam("shared"))) { - $options['shared'] = $shared; + $options['shared'] = $this->app->getPostParam("shared"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } + try + { $network = $this->libClass->createNetworks($options); - + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $network; + } - public function create_subnet($networkId,$ipVersion,$cidr,$name,$gatewayIp,$dnsNameservers,$allocationPools,$hostRoutes,$enableDhcp,$tenantId) + public function create_subnet() { $options = array(); - if (!is_null($networkId)) + if (isset($this->app->getPostParam("networkId"))) { $options['networkId'] = $networkId; } - if (!is_null($ipVersion)) + if (isset($this->app->getPostParam("ipVersion"))) { - $options['ipVersion'] = $ipVersion; + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); } - if (!is_null($cidr)) + if (isset($this->app->getPostParam("cidr"))) { - $options['cidr'] = $cidr; + $options['cidr'] = $this->app->getPostParam("cidr"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $$this->app->getPostParam("name"); } - if (!is_null($gatewayIp)) + if (isset($this->app->getPostParam("gatewayIp"))) { - $options['gatewayIp'] = $gatewayIp; + $options['gatewayIp'] = $this->app->getPostParam("gatewayIp"); } - if (!is_null($dnsNameservers)) + if (isset($this->app->getPostParam("dnsNameservers"))) { - $options['dnsNameservers'] = $dnsNameservers; + $options['dnsNameservers'] = $this->app->getPostParam("dnsNameservers"); } - if (!is_null($allocationPools)) + if (isset($this->app->getPostParam("allocationPools"))) { - $options['allocationPools'] = $allocationPools; + $options['allocationPools'] = $this->app->getPostParam("allocationPools"); } - if (!is_null($hostRoutes)) + if (isset($this->app->getPostParam("hostRoutes"))) { - $options['hostRoutes'] = $hostRoutes; + $options['hostRoutes'] = $this->app->getPostParam("hostRoutes"); } - if (!is_null($enableDhcp)) + if (isset($this->app->getPostParam("enableDhcp"))) { - $options['enableDhcp'] = $enableDhcp; + $options['enableDhcp'] = $this->app->getPostParam("enableDhcp"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - $subnet = $this->libClass->createSubnet($options); + try + { + $subnet = $this->libClass->createSubnet($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $subnet; + } public function list_network_ids() { + try + { + $ln = $this->libClass->listNetworks(); - $ln = $this->libClass->listNetworks(); - - $list_ids = array(); + $list_ids = array(); - foreach($ln as $n) - { + foreach($ln as $n) + { - $list_ids[] = $n->id; + $list_ids[] = $n->id; + } } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $list_ids; + $this->app->setOutput("ListNetworkIds", $list_ids); } public function list_network_names() { + try + { + $ln = $this->libClass->listNetworks(); - $ln = $this->libClass->listNetworks(); - - $list_names = array(); + $list_names = array(); - foreach($ln as $n) - { + foreach($ln as $n) + { - $list_names[] = $n->name; + $list_names[] = $n->name; + } + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $list_names; + $this->app->setOutput("ListNetworkNames", $list_names); } public function list_cidr() { - - $ls = $this->libClass->listSubnets(); - $list_cidr = array(); - foreach ($ls as $subnet) - { - - $list_cidr[] = $subnet->cidr; - } - - return $list_names; + try + { + $ls = $this->libClass->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + $this->app->setOutput("ListCidr", $list_cidr); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - //option array() - public function getNetwork($idNet) + + public function getNetwork() { $network=""; try - { $newtork = $this->libClass->getNetwork($idNet); + { $newtork = $this->libClass->getNetwork($this->app->getPostParam("networkId")); $network->retrieve(); } - catch (OpenStack\Common\Error\BadResponseError $e) + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) { - $network = "Id non existant "; - } - catch (Exception $e) + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) { - $network = 'Exception reçue : ', $e->getMessage(), "\n"; + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("Network", $network); + } + + public function getNetwork($netId) + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($netId); + $network->retrieve(); + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $network; } - public function getSubnet($idSub) + public function getSubnet() { $sbnet=""; try - { $subnet = $this->libClass->getSubnet($idSub); + { $subnet = $this->libClass->getSubnet($this->app->getPostParam("subnetId")); $subnet->retrieve(); - return $sbnet; + } - catch (OpenStack\Common\Error\BadResponseError $e) + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) { - echo "Id non existant "; - } - catch (Exception $e) + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) { - echo 'Exception reçue : ', $e->getMessage(), "\n"; + $this->app->getErrorInstance->NotImplementedHandler($e); + } + $this->app->setOutput("Subnet", subnet); + + } + + public function getSubnet($subnetId) + { + $subnet=""; + + try + { $subnet = $this->libClass->getSubnet($subnetId); + $subnet->retrieve(); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $subnet; - } + } - public function updateNetwork($idNet,$name,$shared,$adminStateUp) - { - $network = getNetwork($idNet); - if(!is_null($name)) + public function updateNetwork() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) { - $network->name = $name; + $options['name'] = $this->app->getPostParam("name"); } - if(!is_null($shared)) + if(isset($this->app->getPostParam("shared"))) { - $network->shared = $shared; + $options['shared'] = $this->app->getPostParam("shared"); } - if(!is_null($adminStateUp)) + if(isset($this->app->getPostParam("adminStateUp"))) { - $network->adminStateUp = $shared; + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } - $network->update(); + try + { + $network = getNetwork($this->app->getPostParam("networkId")); + + $network->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function updateSubnet($idSub,$name,$networkId,$ipVersion,$cidr) - { - $subnet = getNetwork($idSub); - if(!is_null($name)) + public function updateSubnet() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) { - $subnet->name = $name; + $options['name'] = $this->app->getPostParam("name"); } - if(!is_null($networkId)) + if(isset($this->app->getPostParam("networkId"))) { - $subnet->networkId = $networkId; + $options['networkId'] = $this->app->getPostParam("networkId"); } - if(!is_null($ipVersion)) + if(isset($this->app->getPostParam("ipVersion"))) { - $subnet->ipVersion = $ipVersion; + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); } - if(!is_null($cidr)) + if(isset($this->app->getPostParam("cidr"))) { - $subnet->cidr = $cidr; + $options['cidr'] = $this->app->getPostParam("cidr"); } - $subnet->update(); + try + { + $subnet = getSubnet($this->app->getPostParam("networkId")); + + $subnet->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deleteNetwork($idNet) + public function deleteNetwork() { - $network = getNetwork($idNet); - $network->delete(); + try + { + + $network = getNetwork($this->app->getPostParam("networkId")); + $network->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deleteSubnet($idSub) + public function deleteSubnet() { - $subnet = getNetwork($idSub); - $subnet->delete(); + try + { + $subnet = getNetwork($this->app->getPostParam("subnetId")); + $subnet->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function createPort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + public function createPort() { $options = array(); - if (!is_null($networkId)) + if (isset($this->app->getPostParam("networkId"))) { - $options['networkId'] = $networkId; + $options['networkId'] = $this->app->getPostParam("networkId"); } - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $this->app->getPostParam("name"); } - if (!is_null($adminStateUp)) + if (isset($this->app->getPostParam("adminStateUp"))) { - $options['adminStateUp'] = $adminStateUp; + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } - if (!is_null($macAddress)) + if (isset($this->app->getPostParam("macAddress"))) { - $options['macAddress'] = $macAddress; + $options['macAddress'] = $this->app->getPostParam("macAddress"); } - if (!is_null($fixedIps)) + if (isset($this->app->getPostParam("fixedIps"))) { - $options['fixedIps'] = $fixedIps; + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); } - if (!is_null($deviceId)) + if (isset($this->app->getPostParam("deviceId"))) { - $options['deviceId'] = $deviceId; + $options['deviceId'] = $this->app->getPostParam("deviceId"); } - if (!is_null($deviceOwner)) + if (isset($this->app->getPostParam("deviceOwner"))) { - $options['deviceOwner'] = $deviceOwner; + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); } - if (!is_null($securityGroups)) + if (isset($this->app->getPostParam("securityGroups"))) { - $options['securityGroups'] = $securityGroups; + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - - $this->libClass->createPort($options); + try + { + $this->libClass->createPort($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } public function listPorts() { - return $this->libClass->listPorts(); + try + { + $this->app->setOutput("listPorts", $this->libClass->listPorts()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getPort() + { + try + { + $port = $this->libClass->getport($this->app->getPostParam("portId")); + $this->app->setOutput("Port", $port); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } public function getPort($portId) @@ -307,124 +623,280 @@ class network{ $port = $this->libClass->getport($portId); return $port; } - catch (Exception $e) + catch(BadResponseError $e) { - echo 'id fourni non disponible'; - } + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - } + } - public function updatePort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + public function updatePort() { $options = array(); - if (!is_null($networkId)) + + if (isset($this->app->getPostParam("networkId"))) { - $options['networkId'] = $networkId; + $options['networkId'] = $this->app->getPostParam("networkId"); } - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] =$this->app->getPostParam("name"); } - if (!is_null($adminStateUp)) + if (isset($this->app->getPostParam("adminStateUp"))) { - $options['adminStateUp'] = $adminStateUp; + $options['adminStateUp'] =$this->app->getPostParam("adminStateUp"); } - if (!is_null($macAddress)) + if (isset($this->app->getPostParam("macAddress"))) { - $options['macAddress'] = $macAddress; + $options['macAddress'] = $this->app->getPostParam("macAddress"); } - if (!is_null($fixedIps)) + if (isset($this->app->getPostParam("fixedIps"))) { - $options['fixedIps'] = $fixedIps; + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); } - if (!is_null($deviceId)) + if (isset($this->app->getPostParam("deviceId"))) { - $options['deviceId'] = $deviceId; + $options['deviceId'] = $this->app->getPostParam("deviceId"); } - if (!is_null($deviceOwner)) + if (isset($this->app->getPostParam("deviceOwner"))) { - $options['deviceOwner'] = $deviceOwner; + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); } - if (!is_null($securityGroups)) + if (isset($this->app->getPostParam("networkId"))) { - $options['securityGroups'] = $securityGroups; + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - - $this->libClass->update($options); + try + { + $port = getPort($this->app->getPostParam("networkId")); + $port->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deletePort($portId) + public function deletePort() { - $port = getPort($portId); - $port->delete(); + + try + { + $port = getPort($this->app->getPostParam("portId")); + $port->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function createSecurityGroup($name,$description) + public function createSecurityGroup() { $options = array(); - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $this->app->getPostParam("name"); } - if (!is_null($description)) + if (isset($this->app->getPostParam("description"))) { - $options['description'] = $description; + $options['description'] = $this->app->getPostParam("description"); } - - $this->libClass->createSecurityGroup($options); + try + { + $this->libClass->createSecurityGroup($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } - public function createSecurityGroupRule($securityGroupId,$direction,$ethertype,$portRangeMin,$portRangeMax,$protocol,$remoteGroupId,$remoteIpPrefix) + public function createSecurityGroupRule() { $options = array(); - if (!is_null($securityGroupId)) + if (isset($this->app->getPostParam("securityGroupId"))) { - $options['securityGroupId'] = $securityGroupId; + $options['securityGroupId'] = $this->app->getPostParam("securityGroupId"); } - if (!is_null($direction)) + if (isset($this->app->getPostParam("direction"))) { - $options['direction'] = $direction; + $options['direction'] = $this->app->getPostParam("direction"); } - if (!is_null($ethertype)) + if (isset($this->app->getPostParam("ethertype"))) { - $options['ethertype'] = $ethertype; + $options['ethertype'] = $this->app->getPostParam("ethertype"); } - if (!is_null($portRangeMin)) + if (isset($this->app->getPostParam("portRangeMin"))) { - $options['portRangeMin'] = $portRangeMin; + $options['portRangeMin'] = $this->app->getPostParam("portRangeMin"); } - if (!is_null($portRangeMax)) + if (isset($this->app->getPostParam("portRangeMax"))) { - $options['portRangeMax'] = $portRangeMax; + $options['portRangeMax'] = $this->app->getPostParam("portRangeMax"); } - if (!is_null($protocol)) + if (isset($this->app->getPostParam("protocol"))) { - $options['protocol'] = $protocol; + $options['protocol'] = $this->app->getPostParam("protocol"); } - if (!is_null($remoteGroupId)) + if (isset($this->app->getPostParam("remoteGroupId"))) { - $options['remoteGroupId'] = $remoteGroupId; + $options['remoteGroupId'] = $this->app->getPostParam("remoteGroupId"); } - if (!is_null($remoteIpPrefix)) + if (isset($this->app->getPostParam("remoteIpPrefix"))) { - $options['remoteIpPrefix'] = $remoteIpPrefix; + $options['remoteIpPrefix'] = $this->app->getPostParam("remoteIpPrefix"); } - $this->libClass->createSecurityGroupRule($options); + try + { + $this->libClass->createSecurityGroupRule($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } public function listSecurityGroupe() { - return $this->libClass->listSecurityGroups(); + try + { + $this->app->setOutput("listSecurityGroups", $this->libClass->listSecurityGroups()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } public function listSecurityGroupeRule() { - return $this->libClass->listSecurityGroupRules(); + try + { + + $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getSecurityGroupe() + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $this->app->setOutput("securityGroupe", $securityGroupe); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } public function getSecurityGroupe($securityGroupeId) @@ -434,15 +906,47 @@ class network{ $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); return $securityGroupe; } - catch (Exception $e) + catch(BadResponseError $e) { - echo 'id fourni non disponible'; - } + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deleteSecurityGroupe($securityGroupeId) - { - $securityGroupe = getSecurityGroupe($securityGroupeId); - $securityGroupe->delete(); + public function deleteSecurityGroupe() + { + try + { + + $securityGroupe = getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $securityGroupe->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } diff --git a/server/core/Network.php~ b/server/core/Network.php~ new file mode 100644 index 0000000..65de962 --- /dev/null +++ b/server/core/Network.php~ @@ -0,0 +1,952 @@ +app = $app; + $this->libClass = $app->getLibClass("network"); + + } + + + public function action($action){ + + $this->{$action.""}(); + + } + + + public function create_network() + { + $options = array(); + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); + } + if (isset($this->app->getPostParam("shared"))) + { + $options['shared'] = $this->app->getPostParam("shared"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + try + { + $network = $this->libClass->createNetworks($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + + } + + public function create_subnet() + { $options = array(); + if (isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $networkId; + } + if (isset($this->app->getPostParam("ipVersion"))) + { + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); + } + if (isset($this->app->getPostParam("cidr"))) + { + $options['cidr'] = $this->app->getPostParam("cidr"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $$this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("gatewayIp"))) + { + $options['gatewayIp'] = $this->app->getPostParam("gatewayIp"); + } + if (isset($this->app->getPostParam("dnsNameservers"))) + { + $options['dnsNameservers'] = $this->app->getPostParam("dnsNameservers"); + } + if (isset($this->app->getPostParam("allocationPools"))) + { + $options['allocationPools'] = $this->app->getPostParam("allocationPools"); + } + if (isset($this->app->getPostParam("hostRoutes"))) + { + $options['hostRoutes'] = $this->app->getPostParam("hostRoutes"); + } + if (isset($this->app->getPostParam("enableDhcp"))) + { + $options['enableDhcp'] = $this->app->getPostParam("enableDhcp"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + + try + { + $subnet = $this->libClass->createSubnet($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + + } + + public function list_network_ids() + { + try + { + $ln = $this->libClass->listNetworks(); + + $list_ids = array(); + + + foreach($ln as $n) + { + + $list_ids[] = $n->id; + + + } + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("ListNetworkIds", $list_ids); + } + + public function list_network_names() + { + try + { + $ln = $this->libClass->listNetworks(); + + $list_names = array(); + + + foreach($ln as $n) + { + + $list_names[] = $n->name; + + + } + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("ListNetworkNames", $list_names); + } + + public function list_cidr() + { + try + { + $ls = $this->libClass->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + $this->app->setOutput("ListCidr", $list_cidr); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getNetwork() + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($this->app->getPostParam("networkId")); + $network->retrieve(); + + + } + + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("Network", $network); + } + + public function getNetwork($netId) + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($netId); + $network->retrieve(); + + + } + + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + return $network; + } + + public function getSubnet() + { + $sbnet=""; + + try + { $subnet = $this->libClass->getSubnet($this->app->getPostParam("subnetId")); + $subnet->retrieve(); + + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + $this->app->setOutput("Subnet", subnet); + + } + + public function getSubnet($subnetId) + { + $subnet=""; + + try + { $subnet = $this->libClass->getSubnet($subnetId); + $subnet->retrieve(); + + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $subnet; + + } + + public function updateNetwork() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if(isset($this->app->getPostParam("shared"))) + { + $options['shared'] = $this->app->getPostParam("shared"); + } + if(isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); + } + try + { + $network = getNetwork($this->app->getPostParam("networkId")); + + $network->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function updateSubnet() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if(isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $this->app->getPostParam("networkId"); + } + if(isset($this->app->getPostParam("ipVersion"))) + { + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); + } + if(isset($this->app->getPostParam("cidr"))) + { + $options['cidr'] = $this->app->getPostParam("cidr"); + } + try + { + $subnet = getSubnet($this->app->getPostParam("networkId")); + + $subnet->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function deleteNetwork() + { + try + { + + $network = getNetwork($this->app->getPostParam("networkId")); + $network->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function deleteSubnet() + { + try + { + $subnet = getNetwork($this->app->getPostParam("subnetId")); + $subnet->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function createPort() + { + $options = array(); + if (isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $this->app->getPostParam("networkId"); + } + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); + } + if (isset($this->app->getPostParam("macAddress"))) + { + $options['macAddress'] = $this->app->getPostParam("macAddress"); + } + if (isset($this->app->getPostParam("fixedIps"))) + { + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); + } + if (isset($this->app->getPostParam("deviceId"))) + { + $options['deviceId'] = $this->app->getPostParam("deviceId"); + } + if (isset($this->app->getPostParam("deviceOwner"))) + { + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); + } + if (isset($this->app->getPostParam("securityGroups"))) + { + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + try + { + $this->libClass->createPort($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function listPorts() + { + try + { + $this->app->setOutput("listPorts", $this->libClass->listPorts()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getPort() + { + try + { + $port = $this->libClass->getport($this->app->getPostParam("portId")); + $this->app->setOutput("Port", $port); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function getPort($portId) + { + try + { + $port = $this->libClass->getport($portId); + return $port; + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function updatePort() + { + $options = array(); + + if (isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $this->app->getPostParam("networkId"); + } + if (isset($this->app->getPostParam("name"))) + { + $options['name'] =$this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] =$this->app->getPostParam("adminStateUp"); + } + if (isset($this->app->getPostParam("macAddress"))) + { + $options['macAddress'] = $this->app->getPostParam("macAddress"); + } + if (isset($this->app->getPostParam("fixedIps"))) + { + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); + } + if (isset($this->app->getPostParam("deviceId"))) + { + $options['deviceId'] = $this->app->getPostParam("deviceId"); + } + if (isset($this->app->getPostParam("deviceOwner"))) + { + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); + } + if (isset($this->app->getPostParam("networkId"))) + { + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + try + { + $port = getPort($this->app->getPostParam("networkId")); + $port->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function deletePort() + { + + try + { + $port = getPort($this->app->getPostParam("portId")); + $port->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function createSecurityGroup() + { + $options = array(); + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("description"))) + { + $options['description'] = $this->app->getPostParam("description"); + } + try + { + $this->libClass->createSecurityGroup($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function createSecurityGroupRule() + { + $options = array(); + if (isset($this->app->getPostParam("securityGroupId"))) + { + $options['securityGroupId'] = $this->app->getPostParam("securityGroupId"); + } + if (isset($this->app->getPostParam("direction"))) + { + $options['direction'] = $this->app->getPostParam("direction"); + } + if (isset($this->app->getPostParam("ethertype"))) + { + $options['ethertype'] = $this->app->getPostParam("ethertype"); + } + if (isset($this->app->getPostParam("portRangeMin"))) + { + $options['portRangeMin'] = $this->app->getPostParam("portRangeMin"); + } + if (isset($this->app->getPostParam("portRangeMax"))) + { + $options['portRangeMax'] = $this->app->getPostParam("portRangeMax"); + } + if (isset($this->app->getPostParam("protocol"))) + { + $options['protocol'] = $this->app->getPostParam("protocol"); + } + if (isset($this->app->getPostParam("remoteGroupId"))) + { + $options['remoteGroupId'] = $this->app->getPostParam("remoteGroupId"); + } + if (isset($this->app->getPostParam("remoteIpPrefix"))) + { + $options['remoteIpPrefix'] = $this->app->getPostParam("remoteIpPrefix"); + } + try + { + $this->libClass->createSecurityGroupRule($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + + public function listSecurityGroupe() + { + try + { + $this->app->setOutput("listSecurityGroups", $this->libClass->listSecurityGroups()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function listSecurityGroupeRule() + { + try + { + + $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getSecurityGroupe() + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $this->app->setOutput("securityGroupe", $securityGroupe); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function getSecurityGroupe($securityGroupeId) + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); + return $securityGroupe; + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function deleteSecurityGroupe() + { + try + { + + $securityGroupe = getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $securityGroupe->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } -- cgit v1.2.3 From 1061d8c85e5b5ce7c1bf3e79685e9e19f92f7353 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Wed, 16 Mar 2016 13:07:04 +0100 Subject: Test --- server/vendor/php-opencloud/openstack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server') diff --git a/server/vendor/php-opencloud/openstack b/server/vendor/php-opencloud/openstack index f2ee770..4ba218f 160000 --- a/server/vendor/php-opencloud/openstack +++ b/server/vendor/php-opencloud/openstack @@ -1 +1 @@ -Subproject commit f2ee77024843659d970817a9e7055bb40a3724f9 +Subproject commit 4ba218fc7ed0e618fd83eaf690b2e4e3bf22cde5 -- cgit v1.2.3 From e01936a73e75350a40fafd80995b1525a11c9da1 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Thu, 17 Mar 2016 09:46:32 +0100 Subject: add commentaries, update error management and correct some mistakes in Image.php, resolve conflict in AppTestClass.php --- server/Test/AppTestClass.php | 12 -- server/core/Image.php | 279 +++++++++++++++++++++---------------------- 2 files changed, 133 insertions(+), 158 deletions(-) (limited to 'server') diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index b398088..5e8efc7 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -1,24 +1,12 @@ >>>>>> Stashed changes -======= -include_once("../core/ErrorManagement.php"); - -use OpenStack\Common\Error\BadResponseError; -use OpenStack\Common\Error\BaseError; -use OpenStack\Common\Error\NotImplementedError; -use OpenStack\Common\Error\UserInputError; ->>>>>>> develop class AppTest{ diff --git a/server/core/Image.php b/server/core/Image.php index d37c828..f309943 100755 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -9,15 +9,13 @@ * * @todo Complete the functions with errors detection and finish the descriptions */ -use OpenStack\Common\Error\BadResponseError; -use OpenStack\Common\Error\BaseError; -use OpenStack\Common\Error\NotImplementedError; -use OpenStack\Common\Error\UserInputError; - +use OpenCloud\Common\Error\BadResponseError; +use OpenCloud\Common\Error\BaseError; +use OpenCloud\Common\Error\NotImplementedError; +use OpenCloud\Common\Error\UserInputError; include("CoreInterface.php"); - /** * Image Class of the back-end application * @@ -37,13 +35,11 @@ class image implements Core{ * * @param App $app the main app object * - * @throws [Type] [] - * * @return Image */ public function __construct($app){ if(!isset($app)){ - $this->app->setOutput("Error", "Incorrect parameter"); + $this->app->setOutput("Error", "Incorrect parameter app"); } $this->app = $app; $this->libClass = $app->getLibClass("Image"); @@ -58,47 +54,46 @@ class image implements Core{ * @return void */ public function action($action){ - - $this->{$action.""}(); - + $this->{$action.""}(); } /** - * Details about an image + * Create a new image * - * @param array $opt - * options for the image creation + * @param array $opt Options for the image creation (name is required, others are optionals) * - **/ + * @return Image + */ private function createImage(){ $opt = $this->app->getPostParam("opt"); - if(!isset($opt)){ - $this->app->setOutput("Error", "Incorrect parameter"); + $this->app->setOutput("Error", "Incorrect parameter opt"); } - try{ - // VOIR SI MAUVAIS TYPE $options = Array(); - if(isset($opt['name'])){ // if the image name already exists -> error + + // Check the image name + if(isset($opt['name'])){ $imagesList = listImage(); - if(isset($images)){ + if(isset($imagesList)){ foreach($imagesList as $image){ - if(strcmp($image->name, $opt['name']) == 0){ - + if(strcmp($image->name, $opt['name']) == 0){ // if the image name already exists -> error + $this->app->setOutput("Error", "Image name already exists"); } } } } else{ - $this->app->setOutput("Error", "Image name already exists"); + $this->app->setOutput("Error", "Missing parameter 'name' for the new image"); } + + // Check optionals arguments if(isset($opt['id'])){ // UUID : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn if($this->libClass->getImage($opt['id']) != null){ // if the id already exists -> error - + $this->app->setOutput("Error", "Image id already exists"); } $options['id'] = $opt['id']; } @@ -131,11 +126,11 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } $this->app->setOutput("Images", $image); @@ -144,7 +139,7 @@ class image implements Core{ /** * List the images of the server * - * @return the list with all images on the server + * @return List of Image */ private function listImage(){ try{ @@ -156,11 +151,11 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } $this->app->setOutput("Images", $result); @@ -170,10 +165,10 @@ class image implements Core{ /** * Details about an image * - * @param string $id - * identifier of the image - * - **/ + * @param String $id Identifier of the image + * + * @return Image + */ private function detailsImage(){ $id = $this->app->getPostParam("id"); if(!isset($id)){ @@ -186,29 +181,26 @@ class image implements Core{ if($image == null){ // if the image don't exists -> error $this->app->setOutput("Error", "Image doesn't exist"); } - $this->app->setOutput("Images", $image); - }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } /** - * Details about an image + * Update informations about an image * - * @param string $id - * id of the image - * - * @param array $opt - * options for the image creation - **/ + * @param String $id id of the image + * @param array $opt Options for the image creation + * + * @return Image + */ private function updateImage(){ $id = $this->app->getPostParam("id"); @@ -254,11 +246,11 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } $this->app->setOutput("Images", $image); } @@ -266,9 +258,10 @@ class image implements Core{ /** * Delete an image * - * @param string $id - * identifier of the image - **/ + * @param String $id Identifier of the image + * + * @return void + */ private function deleteImage(){ // si protected = true, demander de le mettre a false // vérifier existence image @@ -280,27 +273,28 @@ class image implements Core{ try{ $service = $this->libClass; $image = $this->libClass->getImage($id); - if($image == null){ // if the image don't exists -> error + if($image == null){ // if the image doesn't exists -> error $this->app->setOutput("Error", "Image doesn't exist"); } $image->delete(); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } /** * Resactive an image * - * @param string $id - * identifier of the image - **/ + * @param String $id Identifier of the image + * + * @return void + */ private function reactivateImage(){ $id = $this->app->getPostParam("id"); @@ -308,7 +302,6 @@ class image implements Core{ $this->app->setOutput("Error", "Incorrect parameter"); } try{ - // vérifier existence image $service = $this->libClass; $image = $service->getImage($id); if($image == null){ // if the image don't exists -> error @@ -318,20 +311,21 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } /** * Desactive an image * - * @param string $id - * identifier of the image - **/ + * @param String $id Identifier of the image + * + * @return void + */ private function desactivateImage(){ $id = $this->app->getPostParam("id"); @@ -349,23 +343,22 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } /** * Upload an image * - * @param string $id - * identifier of the image - * - * @param string $file_name - * path of the image - **/ + * @param String $id Identifier of the image + * @param String $file_name Path of the image + * + * @return void + */ private function uploadImage(){ $id = $this->app->getPostParam("id"); $file_name = $this->app->getPostParam("file_name"); @@ -375,7 +368,7 @@ class image implements Core{ $this->app->setOutput("Error", "Incorrect id parameter"); } if(!isset($file_name)){ - $this->app->setOutput("Error", "Incorrect file_name parameter"); + $this->app->setOutput("Error", "Incorrect file name parameter"); } try{ // vérifier existence image @@ -389,25 +382,26 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } /** * Download an image * - * @param string $id - * identifier of the image - **/ + * @param String $id Identifier of the image + * + * @return Stream + */ private function downloadImage(){ $id = $this->app->getPostParam("id"); if(!isset($id)){ - $this->app->setOutput("Error", "Incorrect parameter"); + $this->app->setOutput("Error", "Incorrect id parameter"); } try{ // vérifier existence image @@ -420,11 +414,11 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } $this->app->setOutput("Images", $stream); } @@ -432,21 +426,20 @@ class image implements Core{ /** * Add a member to image * - * @param string $image_id - * identifier of the image - * - * @param string $member_id - * identifier of the member - **/ + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return Member + */ private function addMemberImage(){ $image_id = $this->app->getPostParam("image_id"); $member_id = $this->app->getPostParam("member_id"); if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + $this->app->setOutput("Error", "Incorrect member id parameter"); } try{ $service = $this->libClass; @@ -456,14 +449,15 @@ class image implements Core{ $this->app->setOutput("Error", "Image doesn't exist"); } $member_id = $image->addMember($member_id); + $this->app->setOutput("Images", $member_id); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } @@ -471,18 +465,19 @@ class image implements Core{ /** * List members of an image * - * @param string $image_id - * identifier of the image - **/ + * @param String $image_id identifier of the image + * + * @return List of Member + */ private function listMemberImage(){ $image_id = $this->app->getPostParam("image_id"); $member_id = $this->app->getPostParam("member_id"); if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + $this->app->setOutput("Error", "Incorrect member id parameter"); } try{ // vérifier existence image @@ -492,44 +487,40 @@ class image implements Core{ $this->app->setOutput("Error", "Image doesn't exist"); } $members = $image->listMembers(); - if($member == null){ // if the image don't exists -> error + if($members == null){ // if the image don't exists -> error $this->app->setOutput("Error", "No member"); } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } - $this->app->setOutput("Images", $member); + $this->app->setOutput("Images", $members); } /** * Show details of a member of an image * - * @param string $image_id - * identifier of the image + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member * - * @param string $member_id - * identifier of the member - **/ + * @return Member + */ private function detailMemberImage(){ $image_id = $this->app->getPostParam("image_id"); $member_id = $this->app->getPostParam("member_id"); if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + $this->app->setOutput("Error", "Incorrect member id parameter"); } try{ - // vérifier existence image - // on doit être le proprio de l'image - // vérifier membre existe $service = $this->libClass; $image = $service->getImage($id); @@ -544,11 +535,11 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } $this->app->setOutput("Images", $member); } @@ -556,21 +547,20 @@ class image implements Core{ /** * Remove a member of an image * - * @param string $image_id - * identifier of the image - * - * @param string $member_id - * identifier of the member - **/ + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return void + */ private function removeMemberImage(){ $image_id = $this->app->getPostParam("image_id"); $member_id = $this->app->getPostParam("member_id"); if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + $this->app->setOutput("Error", "Incorrect member id parameter"); } try{ $service = $this->libClass; @@ -587,25 +577,22 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } /** * Update a member of an image * - * @param string $image_id - * identifier of the image - * - * @param string $member_id - * identifier of the member + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * @param String $status New status for the member * - * @param string $status - * new status for the member + * @return void **/ private function updateMemberImage(){ $image_id = $this->app->getPostParam("image_id"); @@ -613,10 +600,10 @@ class image implements Core{ $status = $this->app->getPostParam("status"); if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + $this->app->setOutput("Error", "Incorrect member id parameter"); } try{ $service = $this->libClass; @@ -633,11 +620,11 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); } } -- cgit v1.2.3 From fe0eb3a9e259b4fe09df364f0660ebc62185f9dd Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Thu, 17 Mar 2016 11:34:56 +0100 Subject: add exception management, correct mistakes in error management in Image.php and add function to simplify parameters using in tests --- server/Test/AppTestClass.php | 8 +- server/Test/imageTests.php | 68 ++--- server/core/ErrorManagement.php | 4 + server/core/Image.php | 549 ++++++++++++++++++++++------------------ 4 files changed, 339 insertions(+), 290 deletions(-) (limited to 'server') diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index 5e8efc7..e1631c5 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -89,10 +89,16 @@ class AppTest{ } public function getPostParam($name){ - + return $this->postParams[$name]; } + + public function setPostParam($name, $value){ + + $this->postParams[$name] = $value; + + } public function setOutput($key, $out){ diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php index 3af12fc..883387d 100644 --- a/server/Test/imageTests.php +++ b/server/Test/imageTests.php @@ -14,55 +14,39 @@ $opt['minDisk'] = 1; $opt['protected'] = false; $opt['minRam'] = 10; -//$new_image = $image->createImage($opt); +//$App->setPostParam('id', 'sdfihlus154dfhj'); +$err = $image->action("createImage"); + //Liste des images $image->action("listImage"); -//$images = $image->listImage(); $im = $App->show(); -$images = json_decode($im, true)["Images"]; -if(isset($images)){ - echo "Images présentes :"; - echo "
"; - foreach($images as $i){ - echo $i['name']; - echo "
"; - } +$images = json_decode($im, true)["Images"]; +$recup; + +echo "Images présentes :"; +echo "
"; +foreach($images as $i){ + $recup = $i; + echo $recup['name']; echo "
"; + //echo $recup['id']; + } +echo "
"; +echo "Erreur capturée: "; +echo "
"; + + /* + //$App->setPostParam('id', $recup['id']); + $App->setPostParam('id', 'sdfihlus154dfhj'); + $err = $image->action("detailsImage"); + $temp = $App->show(); + $ret = json_decode($temp, true)["Images"]; + echo $ret['id']; + */ + //$App->getPostParam("id"); - if(isset($list)){ - foreach ($list as $l) { - echo $l; - echo "
"; - } -} -} -else{ - echo "Aucune image présente\n"; -} - - - -// Détails Image -//$details = $image->imageDetails($id_image); - -//$image->deleteImage('123456'); - -//$image->desactivateImage($id_image); -//$image->reactivateImage($id_image); - -//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso"; -//$image->uploadImage($id_image, $file_name); - -//$image->downloadImage($id_image); -/* -$opt_update = Array(); -$opt_update['name'] = "Test"; -$opt_update['tags'] = null; -$update = $image->updateImage($id_image, $opt_update); -echo $update->name; -*/ ?> \ No newline at end of file diff --git a/server/core/ErrorManagement.php b/server/core/ErrorManagement.php index 4ba3493..ff66339 100755 --- a/server/core/ErrorManagement.php +++ b/server/core/ErrorManagement.php @@ -32,6 +32,10 @@ Class errorManagement{ public function UserInputHandler($error){ } + + public function OtherException($error){ + $this->app->setOutput("Error", $error->getMessage); + } } diff --git a/server/core/Image.php b/server/core/Image.php index f309943..71e19ce 100755 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -131,6 +131,8 @@ class image implements Core{ $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } $this->app->setOutput("Images", $image); @@ -156,6 +158,8 @@ class image implements Core{ $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } $this->app->setOutput("Images", $result); @@ -171,26 +175,33 @@ class image implements Core{ */ private function detailsImage(){ $id = $this->app->getPostParam("id"); + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); - } - try{ - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $this->app->setOutput("Images", $image); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + else{ + echo 'toto'; + $this->app->setOutput("Images", $image); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -209,50 +220,53 @@ class image implements Core{ if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } - if(!isset($opt)){ + else if(!isset($opt)){ $this->app->setOutput("Error", "Incorrect opt parameter"); } + else{ + try{ + //vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } - try{ - //vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - - $options = Array(); + $options = Array(); - // Voir vérification des types - if(isset($opt['name'])){ //string - $options['name'] = $opt['name']; - } - if(isset($opt['minDisk'])){ //int - $options['minDisk'] = $opt['minDisk']; - } - if(isset($opt['minRam'])){ // int - $options['minRam'] = $opt['minRam']; - } - if(isset($opt['protected'])){ // boolean - $options['protected'] = $opt['protected']; - } - if(isset($opt['visibility'])){ // public, private - $options['visibility'] = $opt['visibility']; - } - if(isset($opt['tags'])){ // list - $options['tags'] = $opt['tags']; - } - $image->update($options); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } - $this->app->setOutput("Images", $image); + // Voir vérification des types + if(isset($opt['name'])){ //string + $options['name'] = $opt['name']; + } + if(isset($opt['minDisk'])){ //int + $options['minDisk'] = $opt['minDisk']; + } + if(isset($opt['minRam'])){ // int + $options['minRam'] = $opt['minRam']; + } + if(isset($opt['protected'])){ // boolean + $options['protected'] = $opt['protected']; + } + if(isset($opt['visibility'])){ // public, private + $options['visibility'] = $opt['visibility']; + } + if(isset($opt['tags'])){ // list + $options['tags'] = $opt['tags']; + } + $image->update($options); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $image); + } } /** @@ -269,23 +283,26 @@ class image implements Core{ if(!isset($id)){ $this->app->setOutput("Error", "Image doesn't exist"); } - - try{ - $service = $this->libClass; - $image = $this->libClass->getImage($id); - if($image == null){ // if the image doesn't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $image->delete(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + else{ + try{ + $service = $this->libClass; + $image = $this->libClass->getImage($id); + if($image == null){ // if the image doesn't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->delete(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -301,22 +318,27 @@ class image implements Core{ if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } - try{ - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $image->reactivate(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + else + { + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->reactivate(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -332,23 +354,28 @@ class image implements Core{ if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $image->deactivate(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + else + { + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->deactivate(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -367,26 +394,30 @@ class image implements Core{ if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } - if(!isset($file_name)){ + else if(!isset($file_name)){ $this->app->setOutput("Error", "Incorrect file name parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r')); - $image->uploadData($stream); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); + else{ + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r')); + $image->uploadData($stream); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } } @@ -403,24 +434,28 @@ class image implements Core{ if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $stream = $image->downloadData(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } - $this->app->setOutput("Images", $stream); + else{ + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $stream = $image->downloadData(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $stream); + } } /** @@ -438,27 +473,31 @@ class image implements Core{ if(!isset($image_id)){ $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ + else if(!isset($member_id)){ $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; + else{ + try{ + $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $member_id = $image->addMember($member_id); - $this->app->setOutput("Images", $member_id); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member_id = $image->addMember($member_id); + $this->app->setOutput("Images", $member_id); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } @@ -476,30 +515,34 @@ class image implements Core{ if(!isset($image_id)){ $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ + else if(!isset($member_id)){ $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($image_id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $members = $image->listMembers(); - if($members == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "No member"); - } - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } - $this->app->setOutput("Images", $members); + else{ + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($image_id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $members = $image->listMembers(); + if($members == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "No member"); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $members); + } } /** @@ -517,31 +560,35 @@ class image implements Core{ if(!isset($image_id)){ $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ + else if(!isset($member_id)){ $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; + else{ + try{ + $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } - $member = $image->getMember($member_id); - if($member == null){ // if the member don't exists -> error - $this->app->setOutput("Error", "Member doesn't exist"); - } - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } - $this->app->setOutput("Images", $member); + $member = $image->getMember($member_id); + if($member == null){ // if the member don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $member); + } } /** @@ -559,30 +606,34 @@ class image implements Core{ if(!isset($image_id)){ $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ + else if(!isset($member_id)){ $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; - - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $member = $image->getMember($member_id); - if($member == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Member doesn't exist"); - } - $member->delete(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + else{ + try{ + $service = $this->libClass; + + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member = $image->getMember($member_id); + if($member == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + $member->delete(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -602,30 +653,34 @@ class image implements Core{ if(!isset($image_id)){ $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ + else if(!isset($member_id)){ $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; + else{ + try{ + $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $member = $image->getMember($member_id); - if($member == null){ // if the member don't exists -> error - $this->app->setOutput("Error", "Member doesn't exist"); - } - $member->updateStatus($status); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member = $image->getMember($member_id); + if($member == null){ // if the member don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + $member->updateStatus($status); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } } -- cgit v1.2.3 From f9643dd9ffeec5eda4f563dd695135ac3a681d60 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 19 Mar 2016 12:49:07 +0100 Subject: Time maagement on token --- server/config.inc.php | 1 + server/core/App.php | 4 ++++ server/core/LibOverride/genTokenOptions.php | 10 +++++++++- server/index.php | 5 ++++- 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/config.inc.php b/server/config.inc.php index 9767c72..636ee5e 100644 --- a/server/config.inc.php +++ b/server/config.inc.php @@ -5,6 +5,7 @@ $config["modules_enabled"] = ""; $config["urlAuth"] = "http://148.60.11.31:5000/v3"; + $config["tokenTime"] = 60 //miunte = 60 //miuntess ?> diff --git a/server/core/App.php b/server/core/App.php index d35ccc0..e3c9c22 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -37,6 +37,10 @@ class App{ } + public function checkToken(){ + $this->tokenClass->checkToken(); + } + public function getLibClass($service){ switch($service){ diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index bdae8a6..028226a 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -49,6 +49,12 @@ class genTokenOptions $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); } } + + public function checkToken(){ + + return $this->backup['time'] > time(); + + } public function genIdentityToken(){ $options = $this->optionsGlobal['Common']; @@ -271,6 +277,7 @@ class genTokenOptions $path = "core/LibOverride/projectTokenData/".$token['saved']["project"]["name"]; //error_log(print_r($path, true), 0); file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved'])); + $this->backup['time'] = $token['time']; $this->backup["roles"] = $token["roles"]; $this->backup["project"] = $token['saved']["project"]["name"]; $this->backup["user"] = $token["user"]; @@ -284,7 +291,7 @@ class genTokenOptions public function loadBackup($back){ $backup = unserialize($back); - + $this->backup['time'] = $backup['time']; $this->backup["roles"] = $backup["roles"]; $this->backup["project"] = $backup["project"]; $this->backup["user"] = $backup["user"]; @@ -343,6 +350,7 @@ class genTokenOptions $tokenSerialized["user"]["name"] = serialize($token->user->name); $tokenSerialized["token"]["issued"] = serialize($token->issued); $tokenSerialized["token"]["id"] = serialize($token->id); + $tokenSerialized['time'] = time()+$config['tokenTime']*60; return $tokenSerialized; } diff --git a/server/index.php b/server/index.php index 31feb08..4e9c82b 100755 --- a/server/index.php +++ b/server/index.php @@ -22,7 +22,7 @@ $App->deauthenticate(); $App->show(); - }else{ + }else if($App->checkToken()){ switch($task) { case "identity": @@ -54,6 +54,9 @@ break; } + }else{ + $App->setOuptut("Error", "Token Invalide"); + $App->show(); } -- cgit v1.2.3 From 700a849da8a6905ba33ccf47cdbc5c031e1994f3 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Sun, 20 Mar 2016 10:41:58 +0100 Subject: add other exceptions management and correct syntax on exception mangement --- server/core/Identity.php | 713 ++++++++++++++++++++++++++++------------------- 1 file changed, 429 insertions(+), 284 deletions(-) (limited to 'server') diff --git a/server/core/Identity.php b/server/core/Identity.php index 7100c9f..464522a 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -87,13 +87,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -111,13 +113,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -144,13 +148,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -187,13 +193,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -220,14 +228,17 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } + }- /** @@ -266,13 +277,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -291,13 +304,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -325,13 +340,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -374,13 +391,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -407,13 +426,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -442,13 +463,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -480,13 +503,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -519,13 +544,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -557,13 +584,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -592,13 +621,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -630,13 +661,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -669,13 +702,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -714,13 +749,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -754,13 +791,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -786,13 +825,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -810,13 +851,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -849,13 +892,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -881,13 +926,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -914,13 +961,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -947,13 +996,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -981,13 +1032,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1022,13 +1075,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1056,13 +1111,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1090,13 +1147,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1125,13 +1184,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1160,13 +1221,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1195,13 +1258,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1228,13 +1293,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1261,13 +1328,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1294,13 +1363,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1328,13 +1399,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1361,13 +1434,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1398,13 +1473,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1422,13 +1499,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1455,13 +1534,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1495,13 +1576,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1528,13 +1611,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1563,13 +1648,17 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1602,13 +1691,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1643,13 +1734,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1682,13 +1775,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1718,13 +1813,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1757,13 +1854,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1798,13 +1897,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1837,13 +1938,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1871,13 +1974,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1895,13 +2000,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1919,13 +2026,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1954,13 +2063,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1978,13 +2089,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2009,13 +2122,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2043,13 +2158,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2081,13 +2198,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2123,13 +2242,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2159,13 +2280,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2201,13 +2324,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2249,13 +2374,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2285,13 +2412,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2317,13 +2446,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2362,13 +2493,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2386,13 +2519,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2419,13 +2554,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2458,13 +2595,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2491,13 +2630,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2525,13 +2666,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2559,13 +2702,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } } -- cgit v1.2.3 From 3c336f00d29ba927d41e2029a3c1d893cee43f9d Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 21 Mar 2016 06:47:01 +0100 Subject: Add login check witouth reloading page --- .gitignore | 2 +- client/index.html | 5 +- client/js/app.js | 2 +- client/js/controllers/home/home.js | 2 +- client/js/controllers/image/image.js | 3 -- client/js/controllers/image/upload.js | 60 +++++++++++++++++++++ client/js/controllers/login.js | 16 +++--- client/js/controllers/status.js | 4 +- client/js/services/Identity.js | 15 ++++-- client/js/services/Image.js | 37 ++++++++++--- client/partials/image/upload.html | 13 +++-- .../vendors/angularjs/angular-file-upload.min.js | 7 +++ client/vendors/angularjs/angular-upload.min.js | 1 + client/vendors/jquery/dmuploader.min.js | 9 ++++ server/Readme.md | 0 server/Test/DisplayNetIds.php | 0 server/Test/computeTest.php | 0 server/Test/create_network.php | 0 server/Test/create_subnet.php | 0 server/Test/genTokenOptionsTest.php | 0 server/Test/imageTests.php | 0 server/composer.json | 0 server/composer.lock | 0 server/composer.phar | Bin server/config.inc.php | 0 server/core/CoreInterface.php | 0 server/core/LibOverride/projectTokenData/demo | 0 server/core/Network.php | 0 server/core/Plugin.php | 0 server/core/Plugin_Api.php | 0 server/core/Readme.txt | 0 server/create_serv.php | 0 server/modules/Readme.txt | 0 server/vendor/autoload.php | 0 server/vendor/composer/ClassLoader.php | 0 server/vendor/composer/LICENSE | 0 server/vendor/composer/autoload_classmap.php | 0 server/vendor/composer/autoload_files.php | 0 server/vendor/composer/autoload_namespaces.php | 0 server/vendor/composer/autoload_psr4.php | 0 server/vendor/composer/autoload_real.php | 0 server/vendor/composer/installed.json | 0 server/vendor/guzzlehttp/guzzle/.travis.yml | 0 server/vendor/guzzlehttp/guzzle/CHANGELOG.md | 0 server/vendor/guzzlehttp/guzzle/LICENSE | 0 server/vendor/guzzlehttp/guzzle/README.md | 0 server/vendor/guzzlehttp/guzzle/UPGRADING.md | 0 server/vendor/guzzlehttp/guzzle/composer.json | 0 server/vendor/guzzlehttp/guzzle/src/Client.php | 0 .../guzzlehttp/guzzle/src/ClientInterface.php | 0 .../guzzlehttp/guzzle/src/Cookie/CookieJar.php | 0 .../guzzle/src/Cookie/CookieJarInterface.php | 0 .../guzzlehttp/guzzle/src/Cookie/FileCookieJar.php | 0 .../guzzle/src/Cookie/SessionCookieJar.php | 0 .../guzzlehttp/guzzle/src/Cookie/SetCookie.php | 0 .../guzzle/src/Exception/BadResponseException.php | 0 .../guzzle/src/Exception/ClientException.php | 0 .../guzzle/src/Exception/ConnectException.php | 0 .../guzzle/src/Exception/GuzzleException.php | 0 .../guzzle/src/Exception/RequestException.php | 0 .../guzzle/src/Exception/SeekException.php | 0 .../guzzle/src/Exception/ServerException.php | 0 .../src/Exception/TooManyRedirectsException.php | 0 .../guzzle/src/Exception/TransferException.php | 0 .../guzzlehttp/guzzle/src/Handler/CurlFactory.php | 0 .../guzzle/src/Handler/CurlFactoryInterface.php | 0 .../guzzlehttp/guzzle/src/Handler/CurlHandler.php | 0 .../guzzle/src/Handler/CurlMultiHandler.php | 0 .../guzzlehttp/guzzle/src/Handler/EasyHandle.php | 0 .../guzzlehttp/guzzle/src/Handler/MockHandler.php | 0 .../vendor/guzzlehttp/guzzle/src/Handler/Proxy.php | 0 .../guzzle/src/Handler/StreamHandler.php | 0 .../vendor/guzzlehttp/guzzle/src/HandlerStack.php | 0 .../guzzlehttp/guzzle/src/MessageFormatter.php | 0 server/vendor/guzzlehttp/guzzle/src/Middleware.php | 0 server/vendor/guzzlehttp/guzzle/src/Pool.php | 0 .../guzzle/src/PrepareBodyMiddleware.php | 0 .../guzzlehttp/guzzle/src/RedirectMiddleware.php | 0 .../guzzlehttp/guzzle/src/RequestOptions.php | 0 .../guzzlehttp/guzzle/src/RetryMiddleware.php | 0 .../vendor/guzzlehttp/guzzle/src/TransferStats.php | 0 .../vendor/guzzlehttp/guzzle/src/UriTemplate.php | 0 server/vendor/guzzlehttp/guzzle/src/functions.php | 0 .../guzzlehttp/guzzle/src/functions_include.php | 0 server/vendor/guzzlehttp/promises/.gitignore | 0 server/vendor/guzzlehttp/promises/.travis.yml | 0 server/vendor/guzzlehttp/promises/CHANGELOG.md | 0 server/vendor/guzzlehttp/promises/LICENSE | 0 server/vendor/guzzlehttp/promises/Makefile | 0 server/vendor/guzzlehttp/promises/README.md | 0 server/vendor/guzzlehttp/promises/composer.json | 0 server/vendor/guzzlehttp/promises/phpunit.xml.dist | 0 .../guzzlehttp/promises/src/AggregateException.php | 0 .../promises/src/CancellationException.php | 0 .../vendor/guzzlehttp/promises/src/EachPromise.php | 0 .../guzzlehttp/promises/src/FulfilledPromise.php | 0 server/vendor/guzzlehttp/promises/src/Promise.php | 0 .../guzzlehttp/promises/src/PromiseInterface.php | 0 .../guzzlehttp/promises/src/PromisorInterface.php | 0 .../guzzlehttp/promises/src/RejectedPromise.php | 0 .../guzzlehttp/promises/src/RejectionException.php | 0 .../vendor/guzzlehttp/promises/src/TaskQueue.php | 0 .../vendor/guzzlehttp/promises/src/functions.php | 0 .../guzzlehttp/promises/src/functions_include.php | 0 .../promises/tests/AggregateExceptionTest.php | 0 .../guzzlehttp/promises/tests/EachPromiseTest.php | 0 .../promises/tests/FulfilledPromiseTest.php | 0 .../promises/tests/NotPromiseInstance.php | 0 .../guzzlehttp/promises/tests/PromiseTest.php | 0 .../promises/tests/RejectedPromiseTest.php | 0 .../promises/tests/RejectionExceptionTest.php | 0 .../guzzlehttp/promises/tests/TaskQueueTest.php | 0 .../vendor/guzzlehttp/promises/tests/Thennable.php | 0 .../vendor/guzzlehttp/promises/tests/bootstrap.php | 0 .../guzzlehttp/promises/tests/functionsTest.php | 0 server/vendor/guzzlehttp/psr7/.gitignore | 0 server/vendor/guzzlehttp/psr7/.travis.yml | 0 server/vendor/guzzlehttp/psr7/CHANGELOG.md | 0 server/vendor/guzzlehttp/psr7/LICENSE | 0 server/vendor/guzzlehttp/psr7/Makefile | 0 server/vendor/guzzlehttp/psr7/README.md | 0 server/vendor/guzzlehttp/psr7/composer.json | 0 server/vendor/guzzlehttp/psr7/phpunit.xml.dist | 0 server/vendor/guzzlehttp/psr7/src/AppendStream.php | 0 server/vendor/guzzlehttp/psr7/src/BufferStream.php | 0 .../vendor/guzzlehttp/psr7/src/CachingStream.php | 0 .../vendor/guzzlehttp/psr7/src/DroppingStream.php | 0 server/vendor/guzzlehttp/psr7/src/FnStream.php | 0 .../vendor/guzzlehttp/psr7/src/InflateStream.php | 0 .../vendor/guzzlehttp/psr7/src/LazyOpenStream.php | 0 server/vendor/guzzlehttp/psr7/src/LimitStream.php | 0 server/vendor/guzzlehttp/psr7/src/MessageTrait.php | 0 .../vendor/guzzlehttp/psr7/src/MultipartStream.php | 0 server/vendor/guzzlehttp/psr7/src/NoSeekStream.php | 0 server/vendor/guzzlehttp/psr7/src/PumpStream.php | 0 server/vendor/guzzlehttp/psr7/src/Request.php | 0 server/vendor/guzzlehttp/psr7/src/Response.php | 0 server/vendor/guzzlehttp/psr7/src/Stream.php | 0 .../guzzlehttp/psr7/src/StreamDecoratorTrait.php | 0 .../vendor/guzzlehttp/psr7/src/StreamWrapper.php | 0 server/vendor/guzzlehttp/psr7/src/Uri.php | 0 server/vendor/guzzlehttp/psr7/src/functions.php | 0 .../guzzlehttp/psr7/src/functions_include.php | 0 .../guzzlehttp/psr7/tests/AppendStreamTest.php | 0 .../guzzlehttp/psr7/tests/BufferStreamTest.php | 0 .../guzzlehttp/psr7/tests/CachingStreamTest.php | 0 .../guzzlehttp/psr7/tests/DroppingStreamTest.php | 0 .../vendor/guzzlehttp/psr7/tests/FnStreamTest.php | 0 .../vendor/guzzlehttp/psr7/tests/FunctionsTest.php | 0 .../guzzlehttp/psr7/tests/InflateStreamTest.php | 0 .../guzzlehttp/psr7/tests/LazyOpenStreamTest.php | 0 .../guzzlehttp/psr7/tests/LimitStreamTest.php | 0 .../guzzlehttp/psr7/tests/MultipartStreamTest.php | 0 .../guzzlehttp/psr7/tests/NoSeekStreamTest.php | 0 .../guzzlehttp/psr7/tests/PumpStreamTest.php | 0 .../vendor/guzzlehttp/psr7/tests/RequestTest.php | 0 .../vendor/guzzlehttp/psr7/tests/ResponseTest.php | 0 .../psr7/tests/StreamDecoratorTraitTest.php | 0 server/vendor/guzzlehttp/psr7/tests/StreamTest.php | 0 .../guzzlehttp/psr7/tests/StreamWrapperTest.php | 0 server/vendor/guzzlehttp/psr7/tests/UriTest.php | 0 server/vendor/guzzlehttp/psr7/tests/bootstrap.php | 0 .../justinrainbow/json-schema/.gitattributes | 0 server/vendor/justinrainbow/json-schema/LICENSE | 0 server/vendor/justinrainbow/json-schema/README.md | 0 .../justinrainbow/json-schema/bin/validate-json | 0 .../vendor/justinrainbow/json-schema/composer.json | 0 .../justinrainbow/json-schema/phpunit.xml.dist | 0 .../Constraints/CollectionConstraint.php | 0 .../src/JsonSchema/Constraints/Constraint.php | 0 .../JsonSchema/Constraints/ConstraintInterface.php | 0 .../src/JsonSchema/Constraints/EnumConstraint.php | 0 .../src/JsonSchema/Constraints/Factory.php | 0 .../JsonSchema/Constraints/FormatConstraint.php | 0 .../JsonSchema/Constraints/NumberConstraint.php | 0 .../JsonSchema/Constraints/ObjectConstraint.php | 0 .../JsonSchema/Constraints/SchemaConstraint.php | 0 .../JsonSchema/Constraints/StringConstraint.php | 0 .../src/JsonSchema/Constraints/TypeConstraint.php | 0 .../JsonSchema/Constraints/UndefinedConstraint.php | 0 .../Exception/InvalidArgumentException.php | 0 .../Exception/InvalidSchemaMediaTypeException.php | 0 .../Exception/InvalidSourceUriException.php | 0 .../JsonSchema/Exception/JsonDecodingException.php | 0 .../Exception/ResourceNotFoundException.php | 0 .../JsonSchema/Exception/UriResolverException.php | 0 .../json-schema/src/JsonSchema/RefResolver.php | 0 .../Uri/Retrievers/AbstractRetriever.php | 0 .../src/JsonSchema/Uri/Retrievers/Curl.php | 0 .../JsonSchema/Uri/Retrievers/FileGetContents.php | 0 .../JsonSchema/Uri/Retrievers/PredefinedArray.php | 0 .../Uri/Retrievers/UriRetrieverInterface.php | 0 .../json-schema/src/JsonSchema/Uri/UriResolver.php | 0 .../src/JsonSchema/Uri/UriRetriever.php | 0 .../json-schema/src/JsonSchema/Validator.php | 0 server/vendor/php-opencloud/common/.gitignore | 0 server/vendor/php-opencloud/common/composer.json | 0 .../vendor/php-opencloud/common/phpunit.xml.dist | 0 .../common/src/Common/Api/AbstractApi.php | 0 .../common/src/Common/Api/AbstractParams.php | 0 .../common/src/Common/Api/ApiInterface.php | 0 .../common/src/Common/Api/Operation.php | 0 .../common/src/Common/Api/Operator.php | 0 .../common/src/Common/Api/OperatorInterface.php | 0 .../common/src/Common/Api/Parameter.php | 0 .../common/src/Common/ArrayAccessTrait.php | 0 .../common/src/Common/Auth/AuthHandler.php | 0 .../common/src/Common/Auth/Catalog.php | 0 .../common/src/Common/Auth/IdentityService.php | 0 .../php-opencloud/common/src/Common/Auth/Token.php | 0 .../common/src/Common/Error/BadResponseError.php | 0 .../common/src/Common/Error/BaseError.php | 0 .../common/src/Common/Error/Builder.php | 0 .../src/Common/Error/NotImplementedError.php | 0 .../common/src/Common/Error/UserInputError.php | 0 .../common/src/Common/HydratorStrategyTrait.php | 0 .../php-opencloud/common/src/Common/JsonPath.php | 0 .../common/src/Common/JsonSchema/JsonPatch.php | 0 .../common/src/Common/JsonSchema/Schema.php | 0 .../src/Common/Resource/AbstractResource.php | 0 .../common/src/Common/Resource/Creatable.php | 0 .../common/src/Common/Resource/Deletable.php | 0 .../common/src/Common/Resource/HasMetadata.php | 0 .../common/src/Common/Resource/HasWaiterTrait.php | 0 .../common/src/Common/Resource/Iterator.php | 0 .../common/src/Common/Resource/Listable.php | 0 .../src/Common/Resource/ResourceInterface.php | 0 .../common/src/Common/Resource/Retrievable.php | 0 .../common/src/Common/Resource/Updateable.php | 0 .../common/src/Common/Service/AbstractService.php | 0 .../common/src/Common/Service/Builder.php | 0 .../common/src/Common/Service/ServiceInterface.php | 0 .../common/src/Common/Transport/HandlerStack.php | 0 .../common/src/Common/Transport/JsonSerializer.php | 0 .../common/src/Common/Transport/Middleware.php | 0 .../src/Common/Transport/RequestSerializer.php | 0 .../common/src/Common/Transport/Utils.php | 0 .../common/tests/integration/DefaultLogger.php | 0 .../common/tests/integration/Runner.php | 0 .../common/tests/integration/SampleManager.php | 0 .../tests/integration/SampleManagerInterface.php | 0 .../common/tests/integration/TestCase.php | 0 .../common/tests/integration/TestInterface.php | 0 .../common/tests/integration/Utils.php | 0 .../php-opencloud/common/tests/integration/run.php | 0 .../common/tests/unit/Common/Api/OperationTest.php | 0 .../common/tests/unit/Common/Api/OperatorTest.php | 0 .../common/tests/unit/Common/Api/ParameterTest.php | 0 .../tests/unit/Common/Api/fixtures/headers.php | 0 .../tests/unit/Common/Api/fixtures/jsonBody.php | 0 .../tests/unit/Common/ArrayAccessTraitTest.php | 0 .../tests/unit/Common/Auth/AuthHandlerTest.php | 0 .../common/tests/unit/Common/DateTime.php | 0 .../unit/Common/Error/BadResponseErrorTest.php | 0 .../common/tests/unit/Common/Error/BuilderTest.php | 0 .../tests/unit/Common/HydratorStrategyTraitTes.php | 0 .../common/tests/unit/Common/JsonPathTest.php | 0 .../Common/JsonSchema/Fixtures/jsonPatchTests.json | 0 .../tests/unit/Common/JsonSchema/JsonPatchTest.php | 0 .../tests/unit/Common/JsonSchema/SchemaTest.php | 0 .../unit/Common/Resource/AbstractResourceTest.php | 0 .../Common/Resource/Fixtures/servers-empty.resp | 0 .../Common/Resource/Fixtures/servers-page1.resp | 0 .../Common/Resource/Fixtures/servers-page2.resp | 0 .../tests/unit/Common/Service/BuilderTest.php | 0 .../unit/Common/Transport/HandlerStackTest.php | 0 .../unit/Common/Transport/JsonSerializerTest.php | 0 .../tests/unit/Common/Transport/MiddlewareTest.php | 0 .../Common/Transport/RequestSerializerTest.php | 0 .../tests/unit/Common/Transport/UtilsTest.php | 0 .../common/tests/unit/Fixtures/ComputeV2Api.php | 0 .../common/tests/unit/Fixtures/IdentityV2Api.php | 0 .../common/tests/unit/Fixtures/IdentityV3Api.php | 0 .../php-opencloud/common/tests/unit/TestCase.php | 0 server/vendor/psr/http-message/LICENSE | 0 server/vendor/psr/http-message/README.md | 0 server/vendor/psr/http-message/composer.json | 0 .../psr/http-message/src/MessageInterface.php | 0 .../psr/http-message/src/RequestInterface.php | 0 .../psr/http-message/src/ResponseInterface.php | 0 .../http-message/src/ServerRequestInterface.php | 0 .../psr/http-message/src/StreamInterface.php | 0 .../psr/http-message/src/UploadedFileInterface.php | 0 .../vendor/psr/http-message/src/UriInterface.php | 0 284 files changed, 143 insertions(+), 33 deletions(-) create mode 100644 client/js/controllers/image/upload.js create mode 100644 client/vendors/angularjs/angular-file-upload.min.js create mode 100644 client/vendors/angularjs/angular-upload.min.js create mode 100644 client/vendors/jquery/dmuploader.min.js mode change 100644 => 100755 server/Readme.md mode change 100644 => 100755 server/Test/DisplayNetIds.php mode change 100644 => 100755 server/Test/computeTest.php mode change 100644 => 100755 server/Test/create_network.php mode change 100644 => 100755 server/Test/create_subnet.php mode change 100644 => 100755 server/Test/genTokenOptionsTest.php mode change 100644 => 100755 server/Test/imageTests.php mode change 100644 => 100755 server/composer.json mode change 100644 => 100755 server/composer.lock mode change 100644 => 100755 server/composer.phar mode change 100644 => 100755 server/config.inc.php mode change 100644 => 100755 server/core/CoreInterface.php mode change 100644 => 100755 server/core/LibOverride/projectTokenData/demo mode change 100644 => 100755 server/core/Network.php mode change 100644 => 100755 server/core/Plugin.php mode change 100644 => 100755 server/core/Plugin_Api.php mode change 100644 => 100755 server/core/Readme.txt mode change 100644 => 100755 server/create_serv.php mode change 100644 => 100755 server/modules/Readme.txt mode change 100644 => 100755 server/vendor/autoload.php mode change 100644 => 100755 server/vendor/composer/ClassLoader.php mode change 100644 => 100755 server/vendor/composer/LICENSE mode change 100644 => 100755 server/vendor/composer/autoload_classmap.php mode change 100644 => 100755 server/vendor/composer/autoload_files.php mode change 100644 => 100755 server/vendor/composer/autoload_namespaces.php mode change 100644 => 100755 server/vendor/composer/autoload_psr4.php mode change 100644 => 100755 server/vendor/composer/autoload_real.php mode change 100644 => 100755 server/vendor/composer/installed.json mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/.travis.yml mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/CHANGELOG.md mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/LICENSE mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/README.md mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/UPGRADING.md mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/composer.json mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Client.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/ClientInterface.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/HandlerStack.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/MessageFormatter.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Middleware.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/Pool.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/RequestOptions.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/TransferStats.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/UriTemplate.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/functions.php mode change 100644 => 100755 server/vendor/guzzlehttp/guzzle/src/functions_include.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/.gitignore mode change 100644 => 100755 server/vendor/guzzlehttp/promises/.travis.yml mode change 100644 => 100755 server/vendor/guzzlehttp/promises/CHANGELOG.md mode change 100644 => 100755 server/vendor/guzzlehttp/promises/LICENSE mode change 100644 => 100755 server/vendor/guzzlehttp/promises/Makefile mode change 100644 => 100755 server/vendor/guzzlehttp/promises/README.md mode change 100644 => 100755 server/vendor/guzzlehttp/promises/composer.json mode change 100644 => 100755 server/vendor/guzzlehttp/promises/phpunit.xml.dist mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/AggregateException.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/CancellationException.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/EachPromise.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/FulfilledPromise.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/Promise.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/PromiseInterface.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/PromisorInterface.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/RejectedPromise.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/RejectionException.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/TaskQueue.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/functions.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/src/functions_include.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/AggregateExceptionTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/EachPromiseTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/FulfilledPromiseTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/NotPromiseInstance.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/PromiseTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/RejectedPromiseTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/RejectionExceptionTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/TaskQueueTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/Thennable.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/bootstrap.php mode change 100644 => 100755 server/vendor/guzzlehttp/promises/tests/functionsTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/.gitignore mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/.travis.yml mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/CHANGELOG.md mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/LICENSE mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/Makefile mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/README.md mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/composer.json mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/phpunit.xml.dist mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/AppendStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/BufferStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/CachingStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/DroppingStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/FnStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/InflateStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/LazyOpenStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/LimitStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/MessageTrait.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/MultipartStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/NoSeekStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/PumpStream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/Request.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/Response.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/Stream.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/StreamWrapper.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/Uri.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/functions.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/src/functions_include.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/AppendStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/BufferStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/DroppingStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/FnStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/LazyOpenStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/LimitStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/NoSeekStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/PumpStreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/RequestTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/ResponseTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/StreamDecoratorTraitTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/StreamTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/UriTest.php mode change 100644 => 100755 server/vendor/guzzlehttp/psr7/tests/bootstrap.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/.gitattributes mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/LICENSE mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/README.md mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/bin/validate-json mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/composer.json mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/phpunit.xml.dist mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/RefResolver.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php mode change 100644 => 100755 server/vendor/justinrainbow/json-schema/src/JsonSchema/Validator.php mode change 100644 => 100755 server/vendor/php-opencloud/common/.gitignore mode change 100644 => 100755 server/vendor/php-opencloud/common/composer.json mode change 100644 => 100755 server/vendor/php-opencloud/common/phpunit.xml.dist mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/Operation.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/Operator.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Api/Parameter.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Auth/IdentityService.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Auth/Token.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Error/BadResponseError.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Error/BaseError.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Error/Builder.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Error/UserInputError.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/HydratorStrategyTrait.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/JsonPath.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/AbstractResource.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/Creatable.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/Deletable.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/HasMetadata.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/HasWaiterTrait.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/Iterator.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/Listable.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/ResourceInterface.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/Retrievable.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Resource/Updateable.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Service/AbstractService.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Service/Builder.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Service/ServiceInterface.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php mode change 100644 => 100755 server/vendor/php-opencloud/common/src/Common/Transport/Utils.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/DefaultLogger.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/Runner.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/SampleManager.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/SampleManagerInterface.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/TestCase.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/TestInterface.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/Utils.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/integration/run.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Api/OperationTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Api/OperatorTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Api/ParameterTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/headers.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Api/fixtures/jsonBody.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/ArrayAccessTraitTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Auth/AuthHandlerTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/DateTime.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Error/BadResponseErrorTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Error/BuilderTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/HydratorStrategyTraitTes.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/JsonPathTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/Fixtures/jsonPatchTests.json mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/JsonPatchTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/JsonSchema/SchemaTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Resource/AbstractResourceTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-empty.resp mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page1.resp mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Resource/Fixtures/servers-page2.resp mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Service/BuilderTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Transport/HandlerStackTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Transport/JsonSerializerTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Transport/MiddlewareTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Transport/RequestSerializerTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Common/Transport/UtilsTest.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV2Api.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/Fixtures/IdentityV3Api.php mode change 100644 => 100755 server/vendor/php-opencloud/common/tests/unit/TestCase.php mode change 100644 => 100755 server/vendor/psr/http-message/LICENSE mode change 100644 => 100755 server/vendor/psr/http-message/README.md mode change 100644 => 100755 server/vendor/psr/http-message/composer.json mode change 100644 => 100755 server/vendor/psr/http-message/src/MessageInterface.php mode change 100644 => 100755 server/vendor/psr/http-message/src/RequestInterface.php mode change 100644 => 100755 server/vendor/psr/http-message/src/ResponseInterface.php mode change 100644 => 100755 server/vendor/psr/http-message/src/ServerRequestInterface.php mode change 100644 => 100755 server/vendor/psr/http-message/src/StreamInterface.php mode change 100644 => 100755 server/vendor/psr/http-message/src/UploadedFileInterface.php mode change 100644 => 100755 server/vendor/psr/http-message/src/UriInterface.php (limited to 'server') diff --git a/.gitignore b/.gitignore index 00495dc..424829c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/nbproject \ No newline at end of file +nbproject \ No newline at end of file diff --git a/client/index.html b/client/index.html index 08be038..97e0734 100644 --- a/client/index.html +++ b/client/index.html @@ -66,7 +66,8 @@ - + + @@ -75,6 +76,7 @@ + @@ -90,6 +92,7 @@ + diff --git a/client/js/app.js b/client/js/app.js index 1602e65..f571cb7 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -3,7 +3,7 @@ * The main app module instance * @type angular.module.angular-1_3_6_L1749.moduleInstance */ -var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize', 'ngCookies']); +var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize', 'ngCookies','lr.upload']); /** * Configure routeProvider diff --git a/client/js/controllers/home/home.js b/client/js/controllers/home/home.js index 2b355b1..835d6ac 100644 --- a/client/js/controllers/home/home.js +++ b/client/js/controllers/home/home.js @@ -29,7 +29,7 @@ mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','I if(Identity.isAlreadyLogin()){ - if(Compute.getData().machines == null{ + if(Compute.getData().machines == null){ Loading.start(); Compute.pullData(callMeAfterPullData); } diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js index b0b162b..d9a9c06 100644 --- a/client/js/controllers/image/image.js +++ b/client/js/controllers/image/image.js @@ -11,9 +11,6 @@ mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', funct Loading.stop(); }; - $scope.doUpload = function () { - Image.uploadImage($scope.myFile,function(){}); - }; if(Identity.isAlreadyLogin()){ diff --git a/client/js/controllers/image/upload.js b/client/js/controllers/image/upload.js new file mode 100644 index 0000000..eca9406 --- /dev/null +++ b/client/js/controllers/image/upload.js @@ -0,0 +1,60 @@ +/** + * The image controller + * + * @param {$scope} $scope The $scope service from angular + */ +mainApp.controller('uploadImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', function ($scope, Image, Loading, Identity,upload) +{ + /*$scope.uploader = new FileUploader({ + "token" : Identity.getToken(), + "task" : "image", + 'action':'uploadImage', + 'id':'6564' + }); + $scope.uploader.url='../server/index.php' + $scope.uploader.alias='file_name' + $scope.uploader.formData={ + "token" : Identity.getToken(), + "task" : "image", + 'action':'uploadImage', + 'id':'6564' + } + */ + + $scope.doUpload = function () { + console.log($('#imageToUpload').prop('files')[0]); + Image.uploadImage($('#imageToUpload').prop('files')[0], function(){alert("done")}) + /*$("#drop-area-div").dmUploader({ + extraData: { + "token" : Identity.getToken(), + "task" : "image", + 'action':'uploadImage', + 'id':'6564'}, + url:"../server/index.php" + }); + */ + + /*upload({ + url: '../server/index.php', + method: 'POST', + data: { + "token" : Identity.getToken(), + "task" : "image", + 'action':'uploadImage', + 'id':'6564', + "file_name": $scope.myFile, // a jqLite type="file" element, upload() will extract all the files from the input and put them into the FormData object before sending. + } + }).then( + function (response) { + console.log(response.data); // will output whatever you choose to return from the server on a successful upload + }, + function (response) { + console.error(response); // Will return if status code is above 200 and lower than 300, same as $http + } + );*/ + + + }; + + +}]); diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js index 63cb6d1..fed358d 100644 --- a/client/js/controllers/login.js +++ b/client/js/controllers/login.js @@ -9,15 +9,15 @@ */ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity) { - // Check for login and define default states - if(!Identity.isAlreadyLogin()){ - $('#loginModal').modal({backdrop: 'static', keyboard: false}); - } + // Check for login and define default states + if(!Identity.isAlreadyLogin()){ + $('#loginModal').modal({backdrop: 'static', keyboard: false}); + } - // Manager logout event - $scope.$on('logoutEvent', function(){ - $('#loginModal').modal({backdrop: 'static', keyboard: false}); - }); + // Manager logout event + $scope.$on('logoutEvent', function(){ + $('#loginModal').modal({backdrop: 'static', keyboard: false}); + }); diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index b4a5dd9..15850f4 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -15,7 +15,7 @@ mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($ // Function to logout $scope.logout=function(){ - Identity.logout(); - }; + Identity.logout(); + }; }]); diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js index f9d1df4..1e8d9ff 100644 --- a/client/js/services/Identity.js +++ b/client/js/services/Identity.js @@ -1,5 +1,5 @@ -mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ +mainApp.factory('Identity',[ '$http', '$cookies', '$rootScope', function($http, $cookies, $rootScope){ /* Create profile structure to store informations * about current session @@ -27,17 +27,20 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ && typeof tokenPart_1InCookie !== 'undefined' ){ - if(token!==null){ + //if(token!==null){ // If yes, put it into variables angular.extend(profile, profileInCookie); token=tokenPart_0InCookie+tokenPart_1InCookie; - } + //} // Return I'm Login return true; } - + + // Show the login overlay + $rootScope.$broadcast("logoutEvent"); + // Return I'm not Login return false; } @@ -56,7 +59,9 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ profile.projectname=null; // Reload Page - location.reload(); + //location.reload(); + $rootScope.$broadcast("logoutEvent"); + } diff --git a/client/js/services/Image.js b/client/js/services/Image.js index decb5b2..d427e51 100644 --- a/client/js/services/Image.js +++ b/client/js/services/Image.js @@ -45,17 +45,42 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){ }; var uploadImage=function(fileToUpload, callback) { - - - var result=$http.post('../server/index.php', - $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'filename':fileToUpload, 'id':'6564'})); + var form_data = new FormData(); + form_data.append('file', fileToUpload); + console.log(fileToUpload) + form_data.append("task" , "image") + form_data.append("token" , Identity.getToken()) + form_data.append('action',"uploadImage") + form_data.append('id','6564') + form_data.append('file_name', fileToUpload.name); + + $.ajax({ + url: "../server/index.php", // Url to which the request is send + type: "POST", // Type of request to be send, called as method + data: form_data, // Data sent to server, a set of key/value pairs (i.e. form fields and values) + file_name:fileToUpload.name, + token : Identity.getToken(), + task : "image", + action:'uploadImage', + id:'6564', + contentType: false, // The content type used when sending data to the server. + cache: false, // To unable request pages to be cached + processData:false, // To send DOMDocument or non processed data file it is set to false + success: function(data) // A function to be called if request succeeds + { + alert("success") + } + }); + + //var result=$http.post('../server/index.php', + // $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'file_name':form_data, 'id':'6564'})); // Wait and handle the response - result.then(function (response){ + /* result.then(function (response){ callback(parseUploadImageAnswer(response, false)); },function(response){ callback(parseUploadImageAnswer(response, true)); - }); + });*/ diff --git a/client/partials/image/upload.html b/client/partials/image/upload.html index 9049abf..72a8e01 100644 --- a/client/partials/image/upload.html +++ b/client/partials/image/upload.html @@ -1,4 +1,4 @@ -