本文整理汇总了PHP中main::thtlog方法的典型用法代码示例。如果您正苦于以下问题:PHP main::thtlog方法的具体用法?PHP main::thtlog怎么用?PHP main::thtlog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::thtlog方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smtp
public function smtp()
{
global $dbh, $postvar, $getvar, $instance;
$body = eregi_replace("[\\]", '', $body);
$users_data = $dbh->select("users", array("email", "=", $instance->email['to']), 0, "1");
$to_name = $users_data['firstname'] . " " . $users_data['lastname'];
if ($to_name == " ") {
$staff_data = $dbh->select("staff", array("email", "=", $instance->email['to']), 0, "1");
$to_name = $staff_data['name'];
}
if (!class_exists("PHPMailer")) {
include INC . "/smtp/class_phpmailer.php";
}
$mail = new PHPMailer();
$mail->IsSMTP();
// telling the class to use SMTP
$mail->SMTPAuth = true;
// enable SMTP authentication (Log in with credentials to send)
$mail->SMTPKeepAlive = true;
// SMTP connection will not close after each email sent
$mail->Host = $instance->details['smtp_host'];
// sets the SMTP server
$mail->Port = $dbh->config('smtp_port');
// set the SMTP port for the SMTP server
$mail->Username = $instance->details['smtp_user'];
// SMTP account username
$mail->Password = $instance->details['smtp_password'];
// SMTP account password
$mail->SetFrom($instance->details['from'], $dbh->config('name'));
$mail->AddReplyTo($instance->details['from'], $dbh->config('name'));
$mail->Subject = $instance->email['subject'];
$mail->MsgHTML($instance->email['content']);
$mail->AddAddress($instance->email['to'], $to_name);
if (!$mail->Send()) {
$response = "Mailer Error (" . $instance->email['to'] . ') ' . $mail->ErrorInfo . "\n";
main::thtlog("SMTP Error", $response, main::userid());
$mail->ClearAddresses();
return false;
}
$mail->ClearAddresses();
return true;
}
示例2: ConfirmClientEmail
private function ConfirmClientEmail($client)
{
global $dbh, $postvar, $getvar, $instance;
$dbh->update("users", array("status" => "1"), array("id", "=", $client['id']));
$dbh->update("users_bak", array("status" => "1"), array("uid", "=", $client['id']));
main::thtlog("Account Confirmed", "Account/E-mail Confirmed - By Admin", $client['id']);
main::redirect("?page=users&sub=search&do=" . $client['id']);
}
示例3: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
if (is_numeric($getvar['dellogid'])) {
$dbh->delete("logs", array("id", "=", $getvar['dellogid']), "1");
main::errors("Log entry deleted.");
}
if (is_numeric($getvar['removeall'])) {
if ($getvar['confirm'] != '1') {
main::errors("Are you sure you wish to remove ALL log entries? <a href = '?page=logs&removeall=" . $getvar['removeall'] . "&confirm=1'>Yes</a> | <a href = '?page=logs'>No</a>");
} else {
$dbh->delete("logs", 0, 0, 1);
main::thtlog("Logs Cleared", "All Logs were removed.", $_SESSION['user'], "", "staff");
main::redirect("?page=logs");
}
}
if (is_numeric($getvar['logid'])) {
$loginfo = $dbh->select("logs", array("id", "=", $getvar['logid']));
$admin_log_view_array['MESSAGE'] = $loginfo['message'];
echo style::replaceVar("tpl/admin/logs/admin-log-view.tpl", $admin_log_view_array);
} else {
$per_page = $getvar['limit'];
$start = $getvar['start'];
if (!$postvar['show']) {
$show = $getvar['show'];
} else {
$show = $postvar['show'];
$start = 0;
}
if (!$show) {
$show = "all";
}
if (!$per_page) {
$per_page = 10;
}
if (!$start) {
$start = 0;
}
if ($show != "all") {
$logs_query = $dbh->select("logs", array("logtype", "=", $show), array("logtime", "DESC"), $start . ", " . $per_page, 1);
} else {
$logs_query = $dbh->select("logs", 0, array("logtime", "DESC"), $start . ", " . $per_page, 1);
}
$all_logs_query = $dbh->select("logs");
$num_logs = $dbh->num_rows($all_logs_query);
$pages = ceil($num_logs / $per_page);
if ($num_logs == 0) {
$admin_logs_list_array['LOGS'] = "";
$admin_logs_list_array['PAGING'] = "";
main::errors("No logs found.");
} else {
while ($logs_data = $dbh->fetch_array($logs_query)) {
$message_data = explode("<", substr($logs_data['message'], 0, 100));
$admin_log_item_array['USER'] = $logs_data['loguser'];
$admin_log_item_array['DATE'] = main::convertdate("n/d/Y", $logs_data['logtime']);
$admin_log_item_array['TIME'] = main::convertdate("g:i A", $logs_data['logtime']);
$admin_log_item_array['MESSAGE'] = $message_data[0];
$admin_log_item_array['LOGID'] = $logs_data['id'];
$admin_logs_list_array['LOGS'] .= style::replaceVar("tpl/admin/logs/admin-log-item.tpl", $admin_log_item_array);
}
}
if ($start != 0) {
$back_page = $start - $per_page;
$admin_logs_list_array['PAGING'] = '<a href="?page=logs&show=' . $show . '&start=' . $back_page . '&limit=' . $per_page . '">BACK</a> ';
}
for ($i = 1; $i <= $pages; $i++) {
$start_link = $per_page * ($i - 1);
if ($start_link == $start) {
$admin_logs_list_array['PAGING'] .= ' <b>' . $i . '</b> ';
} else {
$admin_logs_list_array['PAGING'] .= ' <a href="?page=logs&show=' . $show . '&start=' . $start_link . '&limit=' . $per_page . '">' . $i . '</a> ';
}
}
if (($start + $per_page) / $per_page < $pages && $pages != 1) {
$next_page = $start + $per_page;
$admin_logs_list_array['PAGING'] .= ' <a href="?page=logs&show=' . $show . '&start=' . $next_page . '&limit=' . $per_page . '">NEXT</a>';
}
$shown = array();
$log_type_values[] = array("Show All", "all");
$logs_query = $dbh->select("logs", 0, array("logtype", "ASC"), 0, 1);
while ($logs_data = $dbh->fetch_array($logs_query)) {
if (!in_array($logs_data['logtype'], $shown)) {
$log_type_values[] = array($logs_data['logtype'], $logs_data['logtype']);
$shown[] = $logs_data['logtype'];
}
}
$admin_logs_list_array['SHOW_TYPE'] = main::dropdown("show", $log_type_values);
echo style::replaceVar("tpl/admin/logs/admin-logs-list.tpl", $admin_logs_list_array);
}
}
示例4: signup
public function signup($server, $reseller, $user, $email, $pass, $domain, $server_pack, $extra = array(), $domsub)
{
global $dbh, $postvar, $getvar, $instance;
$this->server = $server;
$server_details = $this->serverDetails($this->server);
$ip = gethostbyname($server_details['host']);
$string = "action=create&add=Submit&username=" . $user . "" . "&passwd=" . $pass . "" . "&passwd2=" . $pass . "" . "&domain=" . $domain . "" . "&package=" . str_replace(" ", "%20", $server_pack) . "" . "¬ify=no" . "&email=" . $email . "";
if ($reseller) {
$define = "CMD_API_ACCOUNT_RESELLER";
$string .= "&ip=shared";
} else {
$define = "CMD_API_ACCOUNT_USER";
$string .= "&ip=" . $ip;
}
//echo $action."<br />". $reseller;
$command = $this->remote($define, $string);
if ($command['error']) {
$order_error = "DA Error: <strong>" . $command['text'] . "</strong><br />" . $command['details'];
main::thtlog("DA Error", nl2br(htmlspecialchars($order_error, ENT_QUOTES)));
return "An error has occurred. Please inform your system administrator.";
} else {
return true;
}
}
示例5: signup
public function signup($server, $reseller, $user, $email, $pass, $domain, $server_pack, $extra = array(), $domsub)
{
global $dbh, $postvar, $getvar, $instance;
$this->server = $server;
$server_details = $this->serverDetails($this->server);
$ip = gethostbyname($server_details['host']);
$package = str_replace(" ", "", $server_pack);
if ($this->welcome_email) {
$send_email_kloxo = "on";
} else {
$send_email_kloxo = "off";
}
$string = "action=add&class=client&name=" . $user . "" . "&v-password=" . $pass . "" . "&v-domain_name=" . $domain . "" . "&v-dnstemplate_name=" . $this->dnstemplate . "" . "&v-plan_name=" . $package . "" . "&v-send_welcome_f=" . $send_email_kloxo . "&v-contactemail=" . $email . "";
// Reseller or Not?
if ($reseller) {
$string .= "&v-type=reseller";
} else {
$string .= "&v-type=customer";
}
//echo $action."<br />". $reseller;
$command = $this->remote($string);
if ($command == true) {
return true;
} else {
$order_error = "ORDER ERROR: There was an error on the order form. Below are the details to help you diagnose this.\n\n Data sent to the server:\n Sent to: " . $this->diagnostics["SENT"] . "\n\n Response from server:\n\n Data:\n " . $this->diagnostics["RECV"];
main::thtlog("Kloxo Error", nl2br(htmlspecialchars($order_error, ENT_QUOTES)));
return "An error has occurred. Please inform your system administrator.";
}
}
示例6: do_upgrade
//.........这里部分代码省略.........
$welcomeemail_array['EMAIL'] = $user_email;
$welcomeemail_array['PACKAGE'] = $newpack_name;
$welcomeemail_array['SERVERIP'] = $new_server_data['ip'];
$welcomeemail_array['LNAME'] = $user_info['lastname'];
$welcomeemail_array['FNAME'] = $user_info['firstname'];
$welcomeemail_array['CPPORT'] = $new_server_data['port'];
$welcomeemail_array['PASS'] = $new_serv_pass_for_email;
$welcomeemail_array['RESELLERPORT'] = $new_server_data['resellerport'];
$welcomeemail_array['NAMESERVERS'] = nl2br($new_server_data['nameservers']);
$welcomeemail_array['DOMAIN'] = $user_data['user_data']['domain'];
email::send($user_email, $uemaildata['subject'], $uemaildata['content'], $welcomeemail_array);
}
} else {
main::errors("Your upgrade request has been added.");
}
//Now we need to send the admin a dozen emails. lol FIRE! Nah, we'll only ever send them one email at a time. ;)
if ($admin_approval) {
if ($new_server) {
$emaildata = email::emailTemplate("upgrade-newserv-adminval");
} else {
$emaildata = email::emailTemplate("upgrade-adminval");
}
}
if ($admin_inform) {
$emaildata = email::emailTemplate("notify-upgrade-new-server");
}
if (!$emaildata && $change_tht) {
$emaildata = email::emailTemplate("notify-upgrade");
}
if ($emaildata) {
email::staff($emaildata['subject'], $emaildata['content'], $adminmsg_array);
}
if ($change_tht) {
main::thtlog("Client Upgraded", "Upgraded from " . $current_pack_name . " to " . $newpack_name, $userid, "");
if ($current_pack_type == "paid") {
unset($where);
$where[] = array("uid", "=", $userid, "AND");
$where[] = array("pid", "=", "");
$dbh->update("invoices", array("pid" => $current_pack_id), $where);
}
if ($new_plan_data['type'] != "p2h") {
$dbh->delete("coupons_p2h", array("uid", "=", $userid));
}
$user_pack_data = $user_data['user_data'];
$users_update = array("pid" => $newpack, "domain" => $user_pack_data['domain'], "additional" => $user_pack_data['additional']);
$dbh->update("users", $users_update, array("id", "=", $userid), "1");
$dbh->update("users_bak", $users_update, array("id", "=", $userid), "1");
if ($current_pack_type == "paid") {
unset($where);
$where[] = array("user", "=", $userid, "AND");
$where[] = array("disabled", "=", "0");
$coupons_used_query = $dbh->select("coupons_used", $where, 0, 0, 1);
while ($coupons_used_data = $dbh->fetch_array($coupons_used_query)) {
$had_coupons .= $coupons_used_data['coupcode'] . ",";
$couponvals .= $coupons_used_data['paiddisc'] . ",";
}
$had_coupons = substr($had_coupons, 0, strlen($had_coupons) - 1);
$couponvals = substr($couponvals, 0, strlen($couponvals) - 1);
if (!$had_coupons) {
$had_coupons = "0";
$couponvals = "0";
}
$invoices_update = array("changed_plan" => "1", "hadcoupons" => $had_coupons, "couponvals" => $couponvals);
unset($where);
$where[] = array("uid", "=", $userid, "AND");
$where[] = array("hadcoupons", "=", "");
示例7: signup
public function signup($server, $reseller, $user, $email, $pass, $domain, $server_pack, $extra = array(), $domsub)
{
global $dbh, $postvar, $getvar, $instance;
$this->server = $server;
$fullname = $extra['firstname'] . " " . $extra['lastname'];
$address = $extra['address'] . "<br>" . $extra['city'] . ", " . $extra['state'] . " " . $extra['zip'] . " " . $extra['country'];
$zip_code = $extra['zip'];
$phone = $extra['phone'];
$packages_data = $dbh->select("packages", array("backend", "=", $server_pack), 0, "1");
$groupid = $packages_data['groupid'];
$send_email = $packages_data['send_email'];
$email_subject = $packages_data['email_subject'];
$email_body = $packages_data['email_body'];
if (!$email_subject) {
$email_subject = $this->email_subject;
}
if (!$email_body) {
$email_body = $this->email_body;
}
$server_details = $this->serverDetails($this->server);
$reseller_id = $server_details['reseller_id'];
if (!is_numeric($server_pack) || strpos($server_pack, ".")) {
//The package backend must be the ID (number) of the package. You can find that by editing the
//created package and looking at the URL.
//Ex: ?module=packages&show=Edit&other=PACKAGEID
//
//Enter the package ID for the package instead of using the name of the package.
return "An package error has occurred. Please inform your system administrator.";
}
if (!is_numeric($groupid) || strpos($groupid, ".")) {
//The group ID must be the ID (number) of the group. You can find that by editing the
//created group and looking at the URL.
//Ex: ?module=manage_groups&show=Edit&other=GROUPID
//
//Enter the group ID for the group instead of using the name of the group.
return "An grouping error has occurred. Please inform your system administrator.";
}
if ($email_body) {
$email_body = str_replace("\n", "", $email_body);
}
$content_str = "<resellerid>" . $reseller_id . "</resellerid>\n <packageid>" . $server_pack . "</packageid>\n <groupid>" . $groupid . "</groupid>\n\n <fullname>" . $fullname . "</fullname>\n <email>" . $email . "</email>\n <address>" . $address . "</address>\n <postcode>" . $zip_code . "</postcode>\n <phone>" . $phone . "</phone>\n\n <username>" . $user . "</username>\n <password>" . $pass . "</password>\n\n <sendemail>" . $send_email . "</sendemail>\n <emailsubject>" . $email_subject . "</emailsubject>\n <emailbody>" . $email_body . "</emailbody>";
$command = $this->remote("manage_clients", "CreateClient[][]" . $content_str);
if ($command === true) {
//If we're using a domain and not a sub domain
if ($domsub == "dom") {
$domain_exists = $this->domain_exists($domain);
if (!$domain_exists) {
$uid = $this->ZPanel_UID($user);
if ($uid) {
$content_str = "<uid>" . $uid . "</uid>\n <domain>" . $domain . "</domain>\n <destination></destination>\n <autohome>1</autohome>";
$command = $this->remote("domains", "CreateDomain[][]" . $content_str);
}
}
}
//No matter what we return true because the user can always add a domain in ZPanel if automatic creation fails.
return true;
} else {
if ($this->response_number != "9999") {
$order_error = "ORDER ERROR: There was an error on the order form. Below are the details to help you diagnose this.\n\n Error number code list:\n 1101 - Request successful.\n 1102 - Request not found (class does not exist in ZPanel). (Suggestion: Report this on the forums for help.)\n 1103 - Server API key validation failed. (Suggestion: Check your server settings.)\n 1104 - User authentication required and not specified. (Suggestion: Check your server settings.)\n 1105 - Username and password validation failed. (Suggestion: Check your server settings.)\n 1106 - Request not valid (required tags not supplied) No post data etc. (Suggestion: Report this on the forums for help.)\n 1107 - Modular web service not found (eg. No file in the module named 'webservice.ext.php') (Suggestion: Report this on the forums for help.)\n\n 9999 - Username already exists in ZPanel (This should never show in the logs. The user will see this and be able to go back and change their username.)\n 9997 - The account could not be created on the server. (Most likely the email address for the client already exists on ZPanel's accounts table.)\n\n Error code given: " . $this->response_number . "\n Server type: ZPanel\n\n Data sent to the server:\n Sent to: " . $this->diagnostics["SENT"]["URL"] . "\n \n Data:\n " . $this->diagnostics["SENT"]["POST"] . "\n\n Response from server:\n \n Data:\n " . $this->diagnostics["RECV"] . "\n\n If the solution to this problem was to request help on the forums, be sure you've patched ZPanel and are using the latest version of this module and THT. Also check to see if you're running a compatible version of ZPanel.";
main::thtlog("ZPanel Error", nl2br(htmlspecialchars($order_error, ENT_QUOTES)));
return "An error has occurred. Please inform your system administrator.";
} else {
return "That username already exists.";
}
return false;
}
}
示例8: signup
public function signup($server, $reseller, $user, $email, $pass, $domain, $server_pack, $extra = array(), $domsub)
{
global $dbh, $postvar, $getvar, $instance;
$this->server = $server;
$action = "/xml-api/createacct" . "?username=" . $user . "" . "&password=" . $pass . "" . "&domain=" . $domain . "" . "&plan=" . str_replace(" ", "%20", $server_pack) . "" . "&contactemail=" . $email . "";
if ($reseller) {
$action .= "&reseller=1";
}
//echo $action."<br />". $reseller."<br>";
$command = $this->remote($action);
if ($command->result->status == 1) {
return true;
} else {
$order_error = "WHM Error: " . $command->result->statusmsg;
main::thtlog("WHM Error", nl2br(htmlspecialchars($order_error, ENT_QUOTES)));
return "An error has occurred. Please inform your system administrator.";
}
}
示例9: remove_coupon
public function remove_coupon($coupid, $package, $invoiceid, $userid = "")
{
global $dbh, $postvar, $getvar, $instance;
if (!$userid) {
$userid = $_SESSION['cuser'];
}
$used_coupon_info = self::user_coupon_data($userid, 0, "", $coupid);
$invoice_info = $dbh->select("invoices", array("id", "=", $invoiceid));
$total = $invoice_info['amount'];
$pack_info = main::uidtopack($userid);
$monthly = $pack_info['additional']['monthly'];
//Disabled 2 means the coupon didn't expire, but it was removed. If the user re-ads it, we need to put them back on the coupon for the duration
//left on the coupon. This prevents users from removing a coupon before it expired and re-adding it for unlimited uses of that discount.
$coupons_used_update = array("disabled" => "2", "datedisabled" => time());
unset($where);
$where[] = array("id", "=", $coupid, "AND");
$where[] = array("user", "=", $userid);
$dbh->update("coupons_used", $coupons_used_update, $where, "1");
$invoice_total = self::get_discount("paid", $monthly, $userid);
if ($invoice_total > $monthly) {
$invoice_total = $monthly;
} else {
$invoice_total = $invoice_total;
}
if ($invoice_total > 0) {
$invoices_update = array("is_paid" => "0", "amount" => $invoice_total);
} else {
$invoices_update = array("amount" => $invoice_total);
}
unset($where);
$where[] = array("id", "=", $invoiceid, "AND");
$where[] = array("uid", "=", $userid);
$dbh->update("invoices", $invoices_update, $where, "1");
//As this simply removes the coupon if the user ID and other info match the records, we need to make sure that somone disn't
//just type in the url of someone else's coupon. This way if it failed because they didn't realy remove the coupon, we
//don't log it.
$used_coupon_info = self::user_coupon_data($userid, 0, "", $coupid, 0);
if ($used_coupon_info['disabled'] == "2") {
main::thtlog("Coupon Removed", "Coupon removed (" . $used_coupon_info['coupcode'] . ")", $userid);
}
return true;
}
示例10: changePwd
public function changePwd($id, $newpwd)
{
global $dbh, $postvar, $getvar, $instance;
$client = $dbh->client($id);
if (!$client['id']) {
$error_array['Error'] = "That user doesn't exist.";
$error_array['User PID'] = $id;
main::error($error_array);
return;
} else {
$server = type::packageserver($client['pid']);
$serverfile = self::createServer($client['pid']);
if ($serverfile->changePwd($client['user'], $newpwd, $server)) {
main::thtlog("Client Password Changed", "Password changed", $client['id']);
return true;
} else {
return false;
}
}
}