本文整理汇总了PHP中ctrl_options类的典型用法代码示例。如果您正苦于以下问题:PHP ctrl_options类的具体用法?PHP ctrl_options怎么用?PHP ctrl_options使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ctrl_options类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GenerateVisitorStats
function GenerateVisitorStats()
{
include 'cnf/db.php';
$z_db_user = $user;
$z_db_pass = $pass;
try {
$zdbh = new db_driver("mysql:host=localhost;dbname=" . $dbname . "", $z_db_user, $z_db_pass);
} catch (PDOException $e) {
}
$sql = $zdbh->prepare("SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL");
$sql->execute();
echo "Generating visitor stats html..." . fs_filehandler::NewLine();
while ($rowvhost = $sql->fetch()) {
if (!file_exists(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "")) {
@mkdir(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "", 777, TRUE);
}
if (sys_versions::ShowOSPlatformVersion() == "Windows") {
$runcommand = ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors.exe -A -m 30 " . ctrl_options::GetOption('log_dir') . "domains/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . "-access.log -o html > " . ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . ".html";
} else {
chmod(ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors", 4777);
$runcommand = ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/bin/visitors -A -m 30 " . ctrl_options::GetOption('log_dir') . "domains/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . "-access.log -o html > " . ctrl_options::GetOption('sentora_root') . "modules/visitor_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . ".html";
}
echo "Generating stats for: " . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . fs_filehandler::NewLine();
system($runcommand);
}
}
示例2: DeleteAliasForDeletedClient
function DeleteAliasForDeletedClient()
{
global $zdbh;
$deletedclients = array();
$sql = "SELECT COUNT(*) FROM x_accounts WHERE ac_deleted_ts IS NOT NULL";
if ($numrows = $zdbh->query($sql)) {
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare("SELECT * FROM x_accounts WHERE ac_deleted_ts IS NOT NULL");
$sql->execute();
while ($rowclient = $sql->fetch()) {
$deletedclients[] = $rowclient['ac_id_pk'];
}
}
}
// Include mail server specific file here.
if (file_exists("modules/aliases/hooks/" . ctrl_options::GetSystemOption('mailserver_php') . "")) {
include "modules/aliases/hooks/" . ctrl_options::GetSystemOption('mailserver_php') . "";
}
foreach ($deletedclients as $deletedclient) {
$bindArray = array(':deletedclient' => $deletedclient);
$sqlStatment = $zdbh->bindQuery("SELECT * FROM x_aliases WHERE al_acc_fk=:deletedclient AND al_deleted_ts IS NULL", $bindArray);
$result = $zdbh->returnRow();
if ($result) {
$sql = $zdbh->prepare("UPDATE x_aliases SET al_deleted_ts=:time WHERE al_acc_fk=:deletedclient");
$sql->bindParam(':time', time());
$sql->bindParam(':deletedclient', $deletedclient);
$sql->execute();
}
}
}
示例3: getConfig
static function getConfig()
{
global $zdbh;
$currentuser = ctrl_users::GetUserDetail();
$sql = "SELECT * FROM x_settings WHERE so_module_vc=:name AND so_usereditable_en = 'true' ORDER BY so_cleanname_vc";
//$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);
$res = array();
$sql->execute();
while ($rowmailsettings = $sql->fetch()) {
if (ctrl_options::CheckForPredefinedOptions($rowmailsettings['so_defvalues_tx'])) {
$fieldhtml = ctrl_options::OuputSettingMenuField($rowmailsettings['so_name_vc'], $rowmailsettings['so_defvalues_tx'], $rowmailsettings['so_value_tx']);
} else {
$fieldhtml = ctrl_options::OutputSettingTextArea($rowmailsettings['so_name_vc'], $rowmailsettings['so_value_tx']);
}
array_push($res, array('cleanname' => ui_language::translate($rowmailsettings['so_cleanname_vc']), 'name' => $rowmailsettings['so_name_vc'], 'description' => ui_language::translate($rowmailsettings['so_desc_tx']), 'value' => $rowmailsettings['so_value_tx'], 'fieldhtml' => $fieldhtml));
}
return $res;
} else {
return false;
}
}
示例4: GenerateWebalizerStats
function GenerateWebalizerStats()
{
global $zdbh;
$sql = $zdbh->prepare("SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL");
$sql->execute();
echo "Generating webalizer stats html..." . fs_filehandler::NewLine();
while ($rowvhost = $sql->fetch()) {
$basedir = ctrl_options::GetSystemOption('MADmin_root') . "modules/webalizer_stats/stats/" . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'];
if (!file_exists($basedir)) {
@mkdir($basedir, 0755, TRUE);
}
/** set webalizer command dependant on OS */
if (sys_versions::ShowOSPlatformVersion() == "Windows") {
$command = ctrl_options::GetSystemOption('MADmin_root') . 'modules/webalizer_stats/bin/webalizer.exe';
} else {
chmod(ctrl_options::GetSystemOption('MADmin_root') . "modules/webalizer_stats/bin/webalizer", 4777);
$command = "webalizer";
}
/** all other args and flags are the same so keep them outsite to avoid duplication */
$flag = '-o';
$secondFlags = '-d -F clf -n';
$domain = $rowvhost['vh_name_vc'];
$logFile = realpath(ctrl_options::GetSystemOption('log_dir') . 'domains/' . $rowvhost['ac_user_vc'] . '/' . $rowvhost['vh_name_vc'] . '-access.log');
$statsPath = ctrl_options::GetSystemOption('MADmin_root') . "modules/webalizer_stats/stats/" . $rowvhost['ac_user_vc'] . '/' . $rowvhost['vh_name_vc'];
/** build arg array, this is in the required order! do not just change the order of this array */
$args = array($logFile, $flag, $statsPath, $secondFlags, $domain);
echo "Generating stats for: " . $rowvhost['ac_user_vc'] . "/" . $rowvhost['vh_name_vc'] . fs_filehandler::NewLine();
$returnValue = ctrl_system::systemCommand($command, $args);
echo (0 === $returnValue ? 'Succeeded' : 'Failed') . fs_filehandler::NewLine();
}
}
示例5: DisplayApacheConfig
static function DisplayApacheConfig()
{
global $zdbh;
$line = "<h2>" . ui_language::translate("Configure your Apache Settings") . "</h2>";
$line .= "<form action=\"./?module=apache_admin&action=UpdateApacheConfig\" method=\"post\">";
$line .= "<table class=\"table table-striped\">";
$count = 0;
$sql = "SELECT COUNT(*) FROM x_settings WHERE so_module_vc=:module AND so_usereditable_en = 'true'";
$moduleName = ui_module::GetModuleName();
$numrows = $zdbh->prepare($sql);
$numrows->bindParam(':module', $moduleName);
$numrows->execute();
if ($numrows) {
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare("SELECT * FROM x_settings WHERE so_module_vc=:module AND so_usereditable_en = 'true' ORDER BY so_cleanname_vc");
$sql->bindParam(':module', $moduleName);
$sql->execute();
while ($row = $sql->fetch()) {
$count++;
if (ctrl_options::CheckForPredefinedOptions($row['so_defvalues_tx'])) {
$fieldhtml = ctrl_options::OuputSettingMenuField($row['so_name_vc'], $row['so_defvalues_tx'], $row['so_value_tx']);
} else {
$fieldhtml = ctrl_options::OutputSettingTextArea($row['so_name_vc'], $row['so_value_tx']);
}
$line .= "<tr valign=\"top\"><th nowrap=\"nowrap\">" . ui_language::translate($row['so_cleanname_vc']) . "</th><td>" . $fieldhtml . "</td><td>" . ui_language::translate($row['so_desc_tx']) . "</td></tr>";
}
$line .= "<tr><th>" . ui_language::translate("Force Update") . "</th><td><input type=\"checkbox\"></td><td>" . ui_language::translate("Force vhost.conf to be updated on next daemon run. Any change in settings also triggers vhost.conf to be updated.") . "</td></tr>";
$line .= "<tr><th colspan=\"3\"><button class=\"button-loader btn btn-primary\" type=\"submit\" id=\"button\" name=\"inSaveSystem\">" . ui_language::translate("Save Changes") . "</button><button class=\"button-loader btn btn-default\" type=\"button\" onclick=\"window.location.href='./?module=moduleadmin';return false;\">" . ui_language::translate("Cancel") . "</button></th></tr>";
}
}
$line .= "</table>";
$line .= runtime_csfr::Token();
$line .= "</form>";
return $line;
}
示例6: DeleteMailboxesForDeletedClient
function DeleteMailboxesForDeletedClient()
{
global $zdbh;
$deletedclients = array();
$sql = "SELECT COUNT(*) FROM x_accounts WHERE ac_deleted_ts IS NOT NULL";
if ($numrows = $zdbh->query($sql)) {
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare("SELECT * FROM x_accounts WHERE ac_deleted_ts IS NOT NULL");
$sql->execute();
while ($rowclient = $sql->fetch()) {
$deletedclients[] = $rowclient['ac_id_pk'];
}
}
}
// Include mail server specific file here.
if (file_exists("modules/mailboxes/hooks/" . ctrl_options::GetSystemOption('mailserver_php') . "")) {
include "modules/mailboxes/hooks/" . ctrl_options::GetSystemOption('mailserver_php') . "";
}
foreach ($deletedclients as $deletedclient) {
// $result = $zdbh->query("SELECT * FROM x_mailboxes WHERE mb_acc_fk=" . $deletedclient . " AND mb_deleted_ts IS NULL")->Fetch();
$numrows = $zdbh->prepare("SELECT * FROM x_mailboxes WHERE mb_acc_fk=:deletedclient AND mb_deleted_ts IS NULL");
$numrows->bindParam(':deletedclient', $deletedclient);
$numrows->execute();
$result = $numrows->fetch();
if ($result) {
$time = time();
$sql = $zdbh->prepare("UPDATE x_mailboxes SET mb_deleted_ts=:time WHERE mb_acc_fk=:deletedclient");
$sql->bindParam(':time', $time);
$sql->bindParam(':deletedclient', $deletedclient);
$sql->execute();
}
}
}
示例7: ListPackages
/**
* The 'worker' methods.
*/
static function ListPackages($uid)
{
global $zdbh;
$sql = "SELECT * FROM x_packages WHERE pk_reseller_fk=:uid AND pk_deleted_ts IS NULL";
//$numrows = $zdbh->query($sql);
$numrows = $zdbh->prepare($sql);
$numrows->bindParam(':uid', $uid);
$numrows->execute();
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare($sql);
$sql->bindParam(':uid', $uid);
$res = array();
$sql->execute();
while ($rowpackages = $sql->fetch()) {
//$numrows = $zdbh->query("SELECT COUNT(*) FROM x_accounts WHERE ac_package_fk=" . $rowpackages['pk_id_pk'] . " AND ac_deleted_ts IS NULL")->fetchColumn();
$numrows = $zdbh->prepare("SELECT COUNT(*) FROM x_accounts WHERE ac_package_fk=:pk_id_pk AND ac_deleted_ts IS NULL");
$numrows->bindParam(':pk_id_pk', $rowpackages['pk_id_pk']);
$numrows->execute();
$Column = $numrows->fetchColumn();
array_push($res, array('packageid' => $rowpackages['pk_id_pk'], 'created' => date(ctrl_options::GetSystemOption('MADmin_df'), $rowpackages['pk_created_ts']), 'clients' => $Column[0], 'packagename' => ui_language::translate($rowpackages['pk_name_vc'])));
}
return $res;
} else {
return false;
}
}
示例8: SendEmail
/**
* Sends the email with the contents of the object (Body etc. set using the parant calls in phpMailer!)
* @author Bobby Allen (ballen@bobbyallen.me)
* @return boolean
*/
public function SendEmail()
{
$this->Mailer = ctrl_options::GetSystemOption('mailer_type');
$this->From = ctrl_options::GetSystemOption('email_from_address');
$this->FromName = ctrl_options::GetSystemOption('email_from_name');
if (ctrl_options::GetSystemOption('email_smtp') != 'false') {
$this->IsSMTP();
if (ctrl_options::GetSystemOption('smtp_auth') != 'false') {
$this->SMTPAuth = true;
$this->Username = ctrl_options::GetSystemOption('smtp_username');
$this->Password = ctrl_options::GetSystemOption('smtp_password');
}
if (ctrl_options::GetSystemOption('smtp_secure') != 'false') {
$this->SMTPSecure = ctrl_options::GetSystemOption('smtp_secure');
}
$this->Host = ctrl_options::GetSystemOption('smtp_server');
$this->Port = ctrl_options::GetSystemOption('smtp_port');
}
ob_start();
$send_resault = $this->Send();
$error = ob_get_contents();
ob_clean();
if ($send_resault) {
runtime_hook::Execute('OnSuccessfulSendEmail');
return true;
} else {
$logger = new debug_logger();
$logger->method = ctrl_options::GetSystemOption('logmode');
$logger->logcode = "061";
$logger->detail = 'Error sending email (using sys_email): ' . $error . '';
$logger->writeLog();
runtime_hook::Execute('OnFailedSendEmail');
return false;
}
}
示例9: DeleteApacheClientFiles
function DeleteApacheClientFiles()
{
global $zdbh;
$sql = "SELECT * FROM x_accounts WHERE ac_deleted_ts IS NOT NULL";
$numrows = $zdbh->query($sql);
if ($numrows->fetchColumn() != 0) {
$sql = $zdbh->prepare($sql);
$res = array();
$sql->execute();
while ($rowdeletedaccounts = $sql->fetch()) {
// Check for an active user with same username
$sql2 = "SELECT COUNT(*) FROM x_accounts WHERE ac_user_vc=:user AND ac_deleted_ts IS NULL";
$numrows2 = $zdbh->prepare($sql2);
$user = $rowdeletedaccounts['ac_user_vc'];
$numrows2->bindParam(':user', $user);
if ($numrows2->execute()) {
if ($numrows2->fetchColumn() == 0) {
if (file_exists(ctrl_options::GetSystemOption('hosted_dir') . $rowdeletedaccounts['ac_user_vc'])) {
fs_director::RemoveDirectory(ctrl_options::GetSystemOption('hosted_dir') . $rowdeletedaccounts['ac_user_vc']);
}
}
}
}
}
}
示例10: Template
public static function Template()
{
if (!fs_director::CheckForEmptyValue(ctrl_options::GetSystemOption('server_ip'))) {
return ctrl_options::GetSystemOption('server_ip');
} else {
return sys_monitoring::ServerIPAddress();
}
}
示例11: Template
public static function Template()
{
$currentuser = ctrl_users::GetUserDetail(ctrl_auth::CurrentUserID());
if ($currentuser['lastlogon']) {
return date(ctrl_options::GetSystemOption('sentora_df'), $currentuser['lastlogon']);
} else {
return "<: Never :>";
}
}
示例12: getZpanelNews
static function getZpanelNews()
{
$handle = @file_get_contents(ctrl_options::GetSystemOption('news_url'));
$content = $handle;
if (!$content) {
return false;
}
return ws_generic::JSONToArray($content, true);
}
示例13: CheckServerAPIKey
/**
* Checks that the Server API given in the webservice request XML is valid and matches the one stored in the x_settings table.
* @author Bobby Allen (ballen@bobbyallen.me)
* @return boolean
*/
public function CheckServerAPIKey()
{
if ($this->wsdataarray['apikey'] != ctrl_options::GetSystemOption('apikey')) {
runtime_hook::Execute('OnBadAPIKeyAuth');
return false;
} else {
runtime_hook::Execute('OnGoodAPIKeyAuth');
return true;
}
}
示例14: CheckZPanelLatestVersion
function CheckZPanelLatestVersion()
{
// Grab the latest version of ZPanel from the ZPanel API servers and cache it into the database.
$live_version = ws_generic::ReadURLRequestResult(ctrl_options::GetSystemOption('update_url'));
if (!$live_version) {
return false;
}
$versionnumber = ws_generic::JSONToArray($live_version);
ctrl_options::SetSystemOption('latestzpversion', $versionnumber[0]['version']);
return true;
}
示例15: LocalPortStatus
/**
* Reports on whether a TCP port is listening for connections.
* @author Pascal peyremorte
* @param int $port The port number of which to check (eg. 25 for SMTP).
* @return boolean
*/
static function LocalPortStatus($port)
{
$timeout = ctrl_options::GetSystemOption('servicechk_to');
$fp = @fsockopen('127.0.0.1', $port, $errno, $errstr, $timeout);
if ($fp !== false) {
fclose($fp);
#do not leave the port open.
return true;
}
return false;
}