本文整理汇总了PHP中module_controller类的典型用法代码示例。如果您正苦于以下问题:PHP module_controller类的具体用法?PHP module_controller怎么用?PHP module_controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了module_controller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetServiceStatus
/**
* Returns the status of all standard ZPanel hosting ports and the current server uptime.
* @author Bobby Allen (ballen@bobbyallen.me)
* @return type
*/
function GetServiceStatus()
{
$response_xml = ws_xmws::NewXMLContentSection('portstatus', array('web' => module_controller::getIsWebServerUp() == '' ? 0 : 1, 'ftp' => module_controller::getIsFTPUp() == '' ? 0 : 1, 'pop3' => module_controller::getIsPOP3Up() == '' ? 0 : 1, 'imap' => module_controller::getIsIMAPUp() == '' ? 0 : 1, 'smtp' => module_controller::getIsSMTPUp() == '' ? 0 : 1, 'mysql' => module_controller::getIsMySQLUp() == '' ? 0 : 1));
$response_xml .= ws_xmws::NewXMLTag('serveruptime', sys_monitoring::ServerUptime());
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
$dataobject->addItemValue('content', $response_xml);
return $dataobject->getDataObject();
}
示例2: ResetUserPassword
/**
* Resets a user's ZPanel account password. Requires <uid> and <newpassword> tags.
* @return type
*/
function ResetUserPassword()
{
$contenttags = $this->XMLDataToArray($this->wsdata);
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
if (module_controller::UpdatePassword($contenttags['xmws']['content']['uid'], $contenttags['xmws']['content']['newpassword'])) {
$dataobject->addItemValue('content', ws_xmws::NewXMLTag('uid', $contenttags['xmws']['content']['uid']) . ws_xmws::NewXMLTag('reset', 'true'));
} else {
$dataobject->addItemValue('content', ws_xmws::NewXMLTag('uid', $contenttags['xmws']['content']['uid']) . ws_xmws::NewXMLTag('reset', 'false'));
}
return $dataobject->getDataObject();
}
示例3: DeleteDomain
/**
* Delete a specified domain using the content <domainid> tag to pass the domain DB ID through.
* @return type
*/
public function DeleteDomain()
{
$request_data = $this->RawXMWSToArray($this->wsdata);
$contenttags = $this->XMLDataToArray($request_data['content']);
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
if (module_controller::ExecuteDeleteDomain($contenttags['domainid'])) {
$dataobject->addItemValue('content', ws_xmws::NewXMLTag('domainid', $contenttags['domainid']) . ws_xmws::NewXMLTag('deleted', 'true'));
} else {
$dataobject->addItemValue('content', ws_xmws::NewXMLTag('domainid', $contenttags['domainid']) . ws_xmws::NewXMLTag('deleted', 'false'));
}
return $dataobject->getDataObject();
}
示例4: UsernameExists
public function UsernameExists()
{
$request_data = $this->RawXMWSToArray($this->wsdata);
$contenttags = $this->XMLDataToArray($request_data['content']);
$UsernameExists = module_controller::CheckUserExists($contenttags['username']);
$response = "false";
if ($UsernameExists) {
$response = "true";
}
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
$dataobject->addItemValue('content', $response);
return $dataobject->getDataObject();
}
示例5: CreateDNSRecord
public function CreateDNSRecord()
{
$request_data = $this->RawXMWSToArray($this->wsdata);
$response_xml = "\n";
$uid = ws_generic::GetTagValue('uid', $request_data['content']);
$domainName = ws_generic::GetTagValue('domainName', $request_data['content']);
$domainID = ws_generic::GetTagValue('domainID', $request_data['content']);
$hostName = ws_generic::GetTagValue('hostName', $request_data['content']);
$type = ws_generic::GetTagValue('type', $request_data['content']);
$target = ws_generic::GetTagValue('target', $request_data['content']);
$ttl = ws_generic::GetTagValue('ttl', $request_data['content']);
module_controller::createDNSRecord(array("uid" => $uid, "domainName" => $domainName, "domainID" => $domainID, "type" => $type, "hostName" => $hostName, "ttl" => $ttl, "target" => $target));
$response_xml = $response_xml . ws_xmws::NewXMLContentSection('dns_record', array('domainName' => $domainName, 'hostName' => $hostName, 'type' => $type, 'target' => $target, 'created' => 'true'));
$dataobject = new runtime_dataobject();
$dataobject->addItemValue('response', '');
$dataobject->addItemValue('content', $response_xml);
return $dataobject->getDataObject();
}
示例6: GetPackageId
/**
* Get and return package details for a specific package.
* @return array
*/
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();
}
示例7: getServices
public static function getServices()
{
global $controller;
if (file_exists(ui_tpl_assetfolderpath::Template() . 'img/modules/' . $controller->GetControllerRequest('URL', 'module') . '/assets/up.gif') && file_exists(ui_tpl_assetfolderpath::Template() . 'img/modules/' . $controller->GetControllerRequest('URL', 'module') . '/assets/down.gif')) {
$iconpath = '<img src="' . ui_tpl_assetfolderpath::Template() . 'img/modules/' . $controller->GetControllerRequest('URL', 'module') . '/assets/';
} else {
$iconpath = '<img src="modules/' . $controller->GetControllerRequest('URL', 'module') . '/assets/';
}
$line = "<h2>" . ui_language::translate("Checking status of services...") . "</h2>";
$line .= "<table>";
$status = fs_director::CheckForEmptyValue(sys_monitoring::PortStatus($PortNum));
$line .= '<tr><th>HTTP</th><td>' . module_controller::status_port(80, $iconpath) . '</td></tr>';
$line .= '<tr><th>FTP</th><td>' . module_controller::status_port(21, $iconpath) . '</td></tr>';
$line .= '<tr><th>SMTP</th><td>' . module_controller::status_port(25, $iconpath) . '</td></tr>';
$line .= '<tr><th>POP3</th><td>' . module_controller::status_port(110, $iconpath) . '</td></tr>';
$line .= '<tr><th>IMAP</th><td>' . module_controller::status_port(143, $iconpath) . '</td></tr>';
$line .= '<tr><th>MySQL</th><td>' . module_controller::status_port(3306, $iconpath) . '</td></tr>';
$line .= '<tr><th>DNS</th><td>' . module_controller::status_port(53, $iconpath) . '</td></tr>';
$line .= '</table>';
$line .= '<br><h2>' . ui_language::translate('Server Uptime') . '</h2>';
$line .= ui_language::translate('Uptime') . ": " . sys_monitoring::ServerUptime();
return $line;
}
示例8: doGenerate
/**
* Generate a new API key and add it to the database.
*/
static function doGenerate()
{
$new_random_key = sha1(rand() . ctrl_options::GetOption('server_ip'));
ctrl_options::SetSystemOption('apikey', $new_random_key);
self::$updated = true;
return true;
}
示例9: doUpdateConfig
static function doUpdateConfig()
{
global $zdbh;
global $controller;
runtime_csfr::Protect();
$sql = "SELECT * FROM x_settings WHERE so_module_vc=:name AND so_usereditable_en = 'true'";
//$numrows = $zdbh->query($sql);
$name = ui_module::GetModuleName();
$numrows = $zdbh->prepare($sql);
$numrows->bindParam(':name', $name);
$numrows->execute();
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare($sql);
$sql->bindParam(':name', $name);
$sql->execute();
while ($row = $sql->fetch()) {
if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', $row['so_name_vc']))) {
$updatesql = $zdbh->prepare("UPDATE x_settings SET so_value_tx = :name2 WHERE so_name_vc = :so_name_vc");
$name2 = $controller->GetControllerRequest('FORM', $row['so_name_vc']);
$updatesql->bindParam(':name2', $name2);
$updatesql->bindParam(':so_name_vc', $row['so_name_vc']);
$updatesql->execute();
}
}
}
self::$ok = true;
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->rdata = $this->read();
$this->smarty_assign("modules", $this->rdata);
$this->add_button("add_new", 'go_to_add_module');
}
示例11: doUpdatePassword
static function doUpdatePassword()
{
global $zdbh;
global $controller;
runtime_csfr::Protect();
$currentuser = ctrl_users::GetUserDetail();
$current_pass = $controller->GetControllerRequest('FORM', 'inCurPass');
$newpass = $controller->GetControllerRequest('FORM', 'inNewPass');
$conpass = $controller->GetControllerRequest('FORM', 'inConPass');
$crypto = new runtime_hash();
$crypto->SetPassword($newpass);
$randomsalt = $crypto->RandomSalt();
$crypto->SetSalt($randomsalt);
$new_secure_password = $crypto->CryptParts($crypto->Crypt())->Hash;
$sql = $zdbh->prepare("SELECT ac_pass_vc, ac_passsalt_vc FROM x_accounts WHERE ac_id_pk= :uid");
$sql->bindParam(':uid', $currentuser['userid']);
$sql->execute();
$result = $sql->fetch();
$userpasshash = new runtime_hash();
$userpasshash->SetPassword($current_pass);
$userpasshash->SetSalt($result['ac_passsalt_vc']);
$current_secure_password = $userpasshash->CryptParts($userpasshash->Crypt())->Hash;
if (fs_director::CheckForEmptyValue($newpass)) {
// Current password is blank!
self::$error = "error";
} elseif ($current_secure_password != $result['ac_pass_vc']) {
// Current password does not match!
self::$error = "nomatch";
} else {
if ($newpass == $conpass) {
// Check for password length...
if (strlen($newpass) < ctrl_options::GetSystemOption('password_minlength')) {
self::$badpassword = true;
return false;
}
// Check that the new password matches the confirmation box.
$sql = $zdbh->prepare("UPDATE x_accounts SET ac_pass_vc=:new_secure_password, ac_passsalt_vc= :randomsalt WHERE ac_id_pk=:userid");
$sql->bindParam(':randomsalt', $randomsalt);
$sql->bindParam(':new_secure_password', $new_secure_password);
$sql->bindParam(':userid', $currentuser['userid']);
$sql->execute();
self::$error = "ok";
} else {
self::$error = "error";
}
}
}
示例12: run
/**
* Run
* PHP5.4: Declaration of users_controller::run() should be compatible with front_controller::run($route, $params) : 2048
* @return template
*/
public function run($r, $params = null)
{
// base routes
if ($this->router->get_current_route()) {
return parent::run($r, $params);
}
$this->set_section_name('users');
// default action
if (empty($r->action)) {
$r->action = 'users';
}
$this->set_req($r);
if (!is_callable(array($this, $r->action))) {
throw new controller_exception('No such action', router_exception::ERROR);
}
// call method
core::dprint('users_controller::' . $r->action);
call_user_func(array($this, $r->action), $r);
return $this->get_template();
}
示例13: __construct
public function __construct()
{
parent::__construct();
}
示例14: doResetPassword
static function doResetPassword()
{
global $controller;
runtime_csfr::Protect();
$formvars = $controller->GetAllControllerRequests('FORM');
if (self::ExecuteResetPassword($formvars['inReset'], $formvars['inPassword'])) {
self::$ok = true;
}
return true;
}
示例15: doDeleteBackup
static function doDeleteBackup()
{
global $zdbh;
global $controller;
runtime_csfr::Protect();
$currentuser = ctrl_users::GetUserDetail();
$userid = $currentuser['userid'];
$username = $currentuser['username'];
$files = self::ListBackUps($userid);
//print_r($_POST);
foreach ($files as $file) {
if (!fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'inDelete_' . $file['backupfile'] . '')) || !fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'inDelete_' . $file['backupfile'] . '_x')) || !fs_director::CheckForEmptyValue($controller->GetControllerRequest('FORM', 'inDelete_' . $file['backupfile'] . '_y'))) {
self::ExecuteDeleteBackup($username, $file['backupfile']);
self::$deleteok = true;
}
}
}