本文整理汇总了PHP中Logs::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP Logs::Add方法的具体用法?PHP Logs::Add怎么用?PHP Logs::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logs
的用法示例。
在下文中一共展示了Logs::Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sqldumptable
$tableid = 0;
$startfrom = 0;
for (; $tableid < count($tables); $tableid++) {
$sqldump .= sqldumptable($tables[$tableid], $startfrom, strlen($sqldump));
$startfrom = 0;
}
$dumpfile = $backupfilename . '.sql';
$tableid--;
if (trim($sqldump)) {
$fp = file_put_contents($dumpfile, $sqldump);
unset($sqldump);
$result = $pdb->Execute("UPDATE {$tb_prefix}settings SET valued=" . $time_stamp . " WHERE variable='last_backup'");
$data['handle_type'] = 'info';
$data['source_module'] = 'backup';
$data['description'] = $_POST['message'];
$result = $log->Add($data);
if ($result) {
flash("success", 'db.php?do=restore');
} else {
flash("failed", "db.php", 0);
}
} else {
flash();
}
}
}
if (isset($_GET['do'])) {
$do = trim($_GET['do']);
if ($do == "refresh" && !empty($_GET['id'])) {
$datafile = DATA_PATH . "backup_" . $backupdir . DS . $_GET['id'];
if (!file_exists($datafile)) {
示例2: pb_sendmail
/**
* PHPB2B : Opensource B2B Script (http://www.phpb2b.com/)
* Copyright (C) 2007-2010, Ualink. All Rights Reserved.
*
* Licensed under The Languages Packages Licenses.
* Support : phpb2b@hotmail.com
*
* @version $Revision: 1393 $
*/
function pb_sendmail($to_users = array(), $subject, $template = null, $body = null, $redirect_url = null)
{
global $charset, $smarty, $theme_name, $_PB_CACHE;
require_once LIB_PATH . "phpmailer/class.phpmailer.php";
$content = null;
$mail = new PHPMailer();
$result = false;
$logdata['created'] = time();
if (!empty($_PB_CACHE['setting']['mail'])) {
extract(unserialize($_PB_CACHE['setting']['mail']));
}
if ($send_mail == 2) {
$mail->IsSMTP();
$mail->Host = $smtp_server;
$mail->Port = $smtp_port;
if ($smtp_auth) {
$mail->SMTPAuth = true;
}
if (!empty($auth_protocol)) {
$mail->SMTPSecure = $auth_protocol;
}
$mail->Username = $auth_username;
$mail->Password = $auth_password;
} else {
$mail->IsMail();
}
$mail->IsHTML(true);
$mail->CharSet = $charset;
$mail->Encoding = "base64";
$mail->From = $mail_from;
$mail->FromName = empty($mail_fromwho) ? $_PB_CACHE['setting']['site_name'] : $mail_fromwho;
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
// optional, comment out and test
$tpl_file = $theme_name . "/emails/" . $template . $smarty->tpl_ext;
if (!empty($template) && $smarty->template_exists($tpl_file)) {
$content = $smarty->fetch($tpl_file);
} elseif (!empty($body)) {
$content = $body;
}
$mail->MsgHTML($content);
if (!empty($to_users)) {
if (!is_array($to_users[0])) {
$mail->AddAddress($to_users[0], $to_users[1]);
$result = $mail->Send();
} elseif (is_array($to_users[0])) {
$mail->ClearAddresses();
foreach ($to_users as $key => $val) {
$mail->AddAddress($val[0], $val[1]);
$result = $mail->Send();
}
}
}
if ($mail->error_count > 0) {
if (class_exists("Logs")) {
$log = new Logs();
} else {
uses("log");
$log = new Logs();
}
$logdata['handle_type'] = "error";
$logdata['source_module'] = "sendmail";
$logdata['description'] = $mail->ErrorInfo;
$log->Add($logdata);
return false;
}
if (!empty($redirect_url)) {
pheader("Location:" . $redirect_url);
} else {
return $result;
}
}