public static function getInstance($cookie = array()) { if (empty(self::$_Cookie)) { self::$_Cookie = FN::getConfig('cookie'); } if (!self::$_SelfInstance) { self::$_SelfInstance = new self($cookie); } return self::$_SelfInstance; }
public function __construct($relay_host = "", $smtp_port = 25, $auth = false, $user, $pass) { $this->debug = FALSE; $this->smtp_port = $smtp_port; $this->relay_host = $relay_host; $this->time_out = 30; $this->auth = $auth; $this->user = $user; $this->pass = $pass; $this->log_file = ""; $this->sock = FALSE; $this->charset = FN::getConfig('global/charset'); }
private function __construct($array, $class) { $this->classname = $class; $this->controllname = call_user_func_array(array($this->classname, 'getControllName'), array()); $this->template = FN::server('template', $this->_link); if (defined('FN_WEB_PATH')) { //如果是web访问,传递路径变量 $web_path = FN::getConfig('global/web_path'); if (!$web_path) { $web_path = FN_WEB_PATH; } $this->template->assign('url', $web_path); $this->template->assign('static', $web_path . 'static/'); } $this->action = empty($array['action']) ? '' : $array['action']; $this->param = empty($array['param']) ? array() : $array['param']; $_POST = FNbase::setEscape($_POST); $this->param = array_merge($this->param, $_POST); $this->ajax = FNbase::isAJAX(); $this->_init_before($this->action); $this->_init($this->action); $result = $this->_view($this->action); $this->_view_after($result); }
function halt($message = '', $sql = '') { //@file_put_contents(FRAME_DATA.'sql.log','[MYSQL]['.$this->errno().']'.date('Y-m-d H:m:i').':'.$this->error().' '.$sql."\r\n",FILE_APPEND); echo $message; if (FN::getConfig('debug/sql')) { echo '[' . $this->errno() . ']' . date('Y-m-d H:m:i') . ':' . $this->error() . ' ' . $sql; } }
function halt($message = '', $sql = '') { //@file_put_contents(FRAME_DATA.'sql.log','[MSSQL]'.date('Y-m-d H:m:i').':'.$sql."\r\n",FILE_APPEND); if (!FN::getConfig('debug/sql')) { $sql = ''; } echo $message . '<br />' . $sql; }
public static function cutstr($string, $length, $havedot = 0) { if (strlen($string) <= $length) { return $string; } $wordscut = ''; if (strtolower(FN::getConfig('global/charset')) == 'utf-8') { $n = 0; $tn = 0; $noc = 0; while ($n < strlen($string)) { $t = ord($string[$n]); if ($t == 9 || $t == 10 || 32 <= $t && $t <= 126) { $tn = 1; $n++; $noc++; } elseif (194 <= $t && $t <= 223) { $tn = 2; $n += 2; $noc += 2; } elseif (224 <= $t && $t <= 239) { $tn = 3; $n += 3; $noc += 2; } elseif (240 <= $t && $t <= 247) { $tn = 4; $n += 4; $noc += 2; } elseif (248 <= $t && $t <= 251) { $tn = 5; $n += 5; $noc += 2; } elseif ($t == 252 || $t == 253) { $tn = 6; $n += 6; $noc += 2; } else { $n++; } if ($noc >= $length) { break; } } if ($noc > $length) { $n -= $tn; } $wordscut = substr($string, 0, $n); } else { for ($i = 0; $i < $length - 3; $i++) { if (ord($string[$i]) > 127) { $wordscut .= $string[$i] . $string[$i + 1]; $i++; } else { $wordscut .= $string[$i]; } } } if ($string != $wordscut && $havedot) { return $wordscut . '...'; } else { return $wordscut; } }