Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create webservice.ext.php #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions modules/packages/code/webservice.ext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/**
* @package zpanelx
* @subpackage modules
* @author Bobby Allen ([email protected])
* @copyright ZPanel Project (http://www.the4.ir/)
* @link http://www.zpanelcp.com/
* @license GPL (http://www.gnu.org/licenses/gpl.html)
*/
class webservice extends ws_xmws
{
/**
* Get the full list of packages
* @global type $zdbh
* @return type
*/
public function GetAllPackages() {
$request_data = $this->RawXMWSToArray($this->wsdata);
$contenttags = $this->XMLDataToArray($request_data['content']);
$allpackages=array();
$response_xml = "\n";
if(!is_null($contenttags['uid'])) {

$allpackages=module_controller::ListPackages($contenttags['uid']);
}
else
{
$allpackages=module_controller::ListPackages(1);
}
foreach ($allpackages as $package) {
$response_xml = $response_xml . ws_xmws::NewXMLContentSection('packages', array(
'id' => $package['packageid'],
'pakage' => $package['packagename']
));
}
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
$dataobject->addItemValue('content', $response_xml);
return $dataobject->getDataObject();


}
public function GetPackageId(){
$request_data = $this->RawXMWSToArray($this->wsdata);
$contenttags = $this->XMLDataToArray($request_data['content']);
$packageId=0;
$response_xml = "\n";
$allpackages=module_controller::ListPackages(1);
foreach ($allpackages as $package) {
if($package['packagename']===$contenttags['pakagename'])
{
$packageId=$package['packageid'];
}
}
$response_xml = $response_xml . ws_xmws::NewXMLContentSection('pakageid',$packageId );
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
$dataobject->addItemValue('content', $response_xml);
return $dataobject->getDataObject();

}

}