function send($tomail, $toname, $title, $body) { $this->config(); $this->mail->Subject = $title; //邮件标题 $this->mail->AltBody = strip_tags($body); // 客户端提示信息摘要内容 $this->mail->Body = $body; //或正文内容 $tomail = addslashes_d($tomail); $this->mail->to = array(array($tomail, $toname)); if ($this->mail->send()) { return true; } else { return false; } }
function addslashes_d($data) { if (is_string($data)) { return addslashes($data); } if (is_numeric($data)) { return $data; } if (is_array($data)) { $var = array(); foreach ($data as $k => $v) { if (is_array($v)) { $var[$k] = addslashes_d($v); continue; } else { $var[$k] = addslashes($v); } } return $var; } }
private function addslashes_d($v) { return get_magic_quotes_gpc() ? $v : addslashes_d($v); }
error_reporting(0); header('Content-type: text/html; charset=utf-8'); // The following variables values must reflect your installation needs. $aspell_prog = '"C:\\Program Files\\Aspell\\bin\\aspell.exe"'; // by FredCK (for Windows) //$aspell_prog = 'aspell'; // by FredCK (for Linux) $lang = 'en_US'; $aspell_opts = "-a --lang={$lang} --encoding=utf-8 -H --rem-sgml-check=alt"; // by FredCK $tempfiledir = "./"; $spellercss = '../spellerStyle.css'; // by FredCK $word_win_src = '../wordWindow.js'; // by FredCK if (!get_magic_quotes_gpc()) { $_POST['textinputs'] = addslashes_d($_POST['textinputs']); } $textinputs = $_POST['textinputs']; # array $input_separator = "A"; # set the JavaScript variable to the submitted text. # textinputs is an array, each element corresponding to the (url-encoded) # value of the text control submitted for spell-checking function print_textinputs_var() { global $textinputs; foreach ($textinputs as $key => $val) { # $val = str_replace( "'", "%27", $val ); echo "textinputs[{$key}] = decodeURIComponent(\"" . $val . "\");\n"; } }
/** * 格式化SQL操作参数 字段加上标识符 值进行转义处理 * @param array $vars 处理的数据 * @return array */ public function formatField($vars) { $data = array(); //格式化的数据 if (!is_array($vars)) { return; } foreach ($vars as $k => $v) { if (!$this->isField($k)) { //字段非法 continue; } $data['fields'][] = "`" . $k . "`"; $data['values'][] = "\"" . addslashes_d($v) . "\""; } return $data; }
private static function backup_data() { foreach (self::$config as $table => $config) { //已经备份过的表忽略 if ($config['success']) { continue; } //当前备份行 $current_row = $config['current_row']; C('DB_DATABASE', $config['database']); $db = M($table, TRUE); $backup_str = ""; do { $data = $db->limit($current_row, 20)->select(); $current_row += 20; self::$config[$table]['current_row'] = $current_row; //表中无数据 if (is_null($data)) { self::$config[$table]['success'] = true; self::write_backup_data($table, $backup_str, $current_row); break; } else { foreach ($data as $d) { $table_name = "\".\$db_prefix.\"" . str_ireplace(C("DB_PREFIX"), "", $table); $backup_str .= "\$db->exe(\"REPLACE INTO {$table_name} (`" . implode("`,`", array_keys($d)) . "`) VALUES('" . implode("','", array_values(addslashes_d($d))) . "')\");\n"; } } //检测本次备份是否超出分卷大小 if (strlen($backup_str) > self::$config[$table]['size']) { self::write_backup_data($table, $backup_str, $current_row); } } while (true); } //更新配置文件 $html = "<html><head><meta charset='utf-8'/></head><body><div style='text-align:center;font-size:14px;margin-top: 50px;'>完成所有数据备份!"; session('backup_dir', NULL); session('backup_fid', NULL); if (!empty($config['url'])) { $html .= "<a href='javascript:parent.location.href=\"" . $config['url'] . "\"' class='btn'>返回备份列表</a>"; } $html .= '</div></body></html>'; self::success($html); }