本文整理汇总了PHP中LogModel类的典型用法代码示例。如果您正苦于以下问题:PHP LogModel类的具体用法?PHP LogModel怎么用?PHP LogModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sitesearchAction
public function sitesearchAction()
{
$keyword = $_POST["keyword"];
$logModel = new LogModel();
$logModel->sitesearch($keyword);
echo $keyword;
}
示例2: _
public static function _($message, $channel = Ajde_Log::CHANNEL_INFO, $level = Ajde_Log::LEVEL_INFORMATIONAL, $description = '', $code = '', $trace = '')
{
// don't use db writer on db error
if (substr_count($message, 'SQLSTATE')) {
return false;
}
$log = new LogModel();
$log->populate(['message' => $message, 'channel' => $channel, 'level' => $level, 'description' => $description, 'code' => $code, 'trace' => $trace, 'request' => self::getRequest(), 'user_agent' => self::getUserAgent(), 'referer' => self::getReferer(), 'ip' => self::getIP()]);
return $log->insert();
}
示例3: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$objLog = new LogModel();
$objLog->updateLog();
/**
* Clear log
*/
if (isset($this->_config['logTime'])) {
$objLog->clearLog($this->_config['logTime']);
}
}
示例4: renderDefault
public function renderDefault()
{
$params = $this->serverRepo->getRunParams($this->selectedServerId);
$this->template->address = $this->hostIp . ":" . $params['port'];
try {
$logModel = new LogModel($params['path'] . 'logs/');
$this->template->logs = LogModel::makeColorful($logModel->getAll());
} catch (UnexpectedValueException $e) {
$this->template->logs = array('nic nenalezeno');
}
}
示例5: AjaxAuth
public function AjaxAuth()
{
/*
* Connect un utilisateur via une requette Ajax
*/
// Si une des variable est vide
if (empty($_POST['sLogin']) || empty($_POST['sPass'])) {
return 1;
}
// Prépare et envoie la requete SQL
$oSql = $this->oPDO->prepare('SELECT AID FROM bo_admin WHERE login=:login AND pass=:pass');
$oSql->bindValue(':login', $_POST['sLogin']);
$oSql->bindValue(':pass', $_POST['sPass']);
$oSql->execute();
$aResult = $oSql->fetch(PDO::FETCH_ASSOC);
// Si aucun résulta ne correspond, erreur 2
if (!$aResult) {
// array( UID, LOGIN, PASS, SUCCESS );
LogModel::logThis(1, array('', $_POST['sLogin'], $_POST['sPass'], 0));
return 2;
}
// Sinon on sauvegarde l'id utilisateur et on retourne 3
$_SESSION['AID'] = $aResult['AID'];
// array( UID, LOGIN, PASS, SUCCESS );
LogModel::logThis(1, array($_SESSION['AID'], $_POST['sLogin'], $_POST['sPass'], 1));
return 3;
}
示例6: IsSpam
/**
* Check whether or not the record is spam.
* @param string $RecordType By default, this should be one of the following:
* - Comment: A comment.
* - Discussion: A discussion.
* - User: A user registration.
* @param array $Data The record data.
* @param array $Options Options for fine-tuning this method call.
* - Log: Log the record if it is found to be spam.
*/
public static function IsSpam($RecordType, $Data, $Options = array()) {
// Set some information about the user in the data.
TouchValue('IPAddress', $Data, Gdn::Request()->IpAddress());
if ($RecordType == 'User') {
TouchValue('Username', $Data, $Data['Name']);
} else {
TouchValue('Username', $Data, Gdn::Session()->User->Name);
TouchValue('Email', $Data, Gdn::Session()->User->Email);
}
$Sp = self::_Instance();
$Sp->EventArguments['RecordType'] = $RecordType;
$Sp->EventArguments['Data'] = $Data;
$Sp->EventArguments['Options'] = $Options;
$Sp->EventArguments['IsSpam'] = FALSE;
$Sp->FireEvent('CheckSpam');
$Spam = $Sp->EventArguments['IsSpam'];
// Log the spam entry.
if ($Spam && GetValue('Log', $Options, TRUE)) {
LogModel::Insert('Spam', $RecordType, $Data);
}
return $Spam;
}
示例7: IsSpam
/**
* Check whether or not the record is spam.
* @param string $RecordType By default, this should be one of the following:
* - Comment: A comment.
* - Discussion: A discussion.
* - User: A user registration.
* @param array $Data The record data.
* @param array $Options Options for fine-tuning this method call.
* - Log: Log the record if it is found to be spam.
*/
public static function IsSpam($RecordType, $Data, $Options = array())
{
// Set some information about the user in the data.
TouchValue('IPAddress', $Data, Gdn::Request()->IpAddress());
if ($RecordType == 'Registration') {
TouchValue('Username', $Data, $Data['Name']);
} else {
TouchValue('Username', $Data, Gdn::Session()->User->Name);
TouchValue('Email', $Data, Gdn::Session()->User->Email);
}
$Sp = self::_Instance();
$Sp->EventArguments['RecordType'] = $RecordType;
$Sp->EventArguments['Data'] =& $Data;
$Sp->EventArguments['Options'] =& $Options;
$Sp->EventArguments['IsSpam'] = FALSE;
$Sp->FireEvent('CheckSpam');
$Spam = $Sp->EventArguments['IsSpam'];
// Log the spam entry.
if ($Spam && GetValue('Log', $Options, TRUE)) {
$LogOptions = array();
switch ($RecordType) {
case 'Registration':
$LogOptions['GroupBy'] = array('RecordIPAddress');
break;
case 'Comment':
case 'Discussion':
$LogOptions['GroupBy'] = array('RecordID');
break;
}
LogModel::Insert('Spam', $RecordType, $Data, $LogOptions);
}
return $Spam;
}
示例8: createComponentBasicTabella
protected function createComponentBasicTabella($name)
{
// asi nepotřebuje komentář :-)
$model = new LogModel();
$grid = new Tabella($model->getDataSource(), array('sorting' => 'id_log', 'order' => 'id_log', "onSubmit" => function ($post) {
print_r($post);
LogModel::save($post, $post['id_log']);
}));
$grid->addColumn("id_log", "id_log", array("width" => 30));
$grid->addColumn("name_modul", "name_modul", array("width" => 100, "editable" => true));
$grid->addColumn("description", "description", array("width" => 100));
$grid->addColumn("value", "value", array("width" => 100));
$grid->addColumn("query", "query", array("width" => 100));
$grid->addColumn("date", "date", array("width" => 100));
$grid->addColumn("ip", "ip", array("width" => 100));
$this->addComponent($grid, $name);
}
示例9: IsSpam
/**
* Check whether or not the record is spam.
* @param string $RecordType By default, this should be one of the following:
* - Comment: A comment.
* - Discussion: A discussion.
* - User: A user registration.
* @param array $Data The record data.
* @param array $Options Options for fine-tuning this method call.
* - Log: Log the record if it is found to be spam.
*/
public static function IsSpam($RecordType, $Data, $Options = array())
{
if (self::$Disabled) {
return FALSE;
}
// Set some information about the user in the data.
if ($RecordType == 'Registration') {
TouchValue('Username', $Data, $Data['Name']);
} else {
TouchValue('InsertUserID', $Data, Gdn::Session()->UserID);
$User = Gdn::UserModel()->GetID(GetValue('InsertUserID', $Data), DATASET_TYPE_ARRAY);
if ($User) {
if (GetValue('Verified', $User)) {
// The user has been verified and isn't a spammer.
return FALSE;
}
TouchValue('Username', $Data, $User['Name']);
TouchValue('Email', $Data, $User['Email']);
TouchValue('IPAddress', $Data, $User['LastIPAddress']);
}
}
if (!isset($Data['Body']) && isset($Data['Story'])) {
$Data['Body'] = $Data['Story'];
}
TouchValue('IPAddress', $Data, Gdn::Request()->IpAddress());
$Sp = self::_Instance();
$Sp->EventArguments['RecordType'] = $RecordType;
$Sp->EventArguments['Data'] =& $Data;
$Sp->EventArguments['Options'] =& $Options;
$Sp->EventArguments['IsSpam'] = FALSE;
$Sp->FireEvent('CheckSpam');
$Spam = $Sp->EventArguments['IsSpam'];
// Log the spam entry.
if ($Spam && GetValue('Log', $Options, TRUE)) {
$LogOptions = array();
switch ($RecordType) {
case 'Registration':
$LogOptions['GroupBy'] = array('RecordIPAddress');
break;
case 'Comment':
case 'Discussion':
case 'Activity':
case 'ActivityComment':
$LogOptions['GroupBy'] = array('RecordID');
break;
}
LogModel::Insert('Spam', $RecordType, $Data, $LogOptions);
}
return $Spam;
}
示例10: updatepwd
/**
* 更改密码
*/
public function updatepwd()
{
parent::_initalize();
$systemConfig = $this->systemConfig;
$this->assign("systemConfig", $systemConfig);
if (IS_POST) {
$a_id = $_SESSION[C('USER_AUTH_KEY')];
$oldpwd = trim($_POST['oldpwd']);
$oldpwd_md5 = encrypt($oldpwd);
$newpwd = trim($_POST['newpwd']);
$newpwd_md5 = encrypt($newpwd);
$newpwd2 = trim($_POST['newpwd2']);
if ($newpwd != $newpwd2) {
$this->error("两次输入的密码不一致");
exit;
}
$mod = M("Admin");
$ainfo = $mod->where("a_id=" . $a_id)->find();
if ($ainfo['a_pwd'] != $oldpwd_md5) {
$this->error("原来的密码输入错误");
exit;
}
//修改密码
$data = array("a_pwd" => $newpwd_md5, "a_pwd_md5" => $newpwd);
$res = $mod->where("a_id=" . $a_id)->save($data);
if ($res) {
$logmod = new LogModel();
$logmod->addlog("修改了[密码]");
$this->success("操作成功");
exit;
} else {
$this->error("操作失败");
exit;
}
}
$this->display();
}
示例11: contactMail
public function contactMail()
{
// V�rifie l'adresse mail
if (!filter_var($_POST['sMail'], FILTER_VALIDATE_EMAIL)) {
return 1;
}
// V�rifie le t�l�phone
$sTel = StrModel::is_NumPortable($_POST['sMobile']);
if (!$sTel) {
return 2;
}
if (!StrModel::strMinLen($_POST['sNom'], 2)) {
return 3;
}
// Vérifie le nom
if (!StrModel::strMinLen($_POST['sPrenom'], 2)) {
return 4;
}
// Vérifie le prénom
if (!StrModel::strMinLen($_POST['sMessage'], 30)) {
return 5;
}
// Vérifie le message
// r�cup�ration du mail � contacter
if ($_POST['sContact'] == 'commercial') {
$sMail = ConfigModel::get(4, 0);
$sLogCat = 2;
} else {
$sMail = ConfigModel::get(3, 0);
$sLogCat = 1;
}
// Formatage du nom / prénom
$_POST['sNom'] = strtoupper($_POST['sNom']);
$_POST['sPrenom'] = ucfirst(strtolower($_POST['sPrenom']));
$sWho = $_POST['sCivilite'] . ' ' . $_POST['sNom'] . ' ' . $_POST['sPrenom'];
// Log l'action
LogModel::logThis($sLogCat, array($sMail, $_POST['sMail'], $sWho, $_POST['sLogin'], $sTel, $_POST['sMotif'], $_POST['sMessage']));
// Construit le mail
$aMessage = array('Envoyé depuis le formulaire de contact [ ' . $_POST['sContact'] . ' ]', '', 'Date: ' . date('d-m-Y - H:i'), 'Éméteur: ' . $sWho, 'Login: ' . $_POST['sLogin'], 'Mobile: ' . $sTel, 'Mail: ' . $_POST['sMail'], 'Motif: ' . $_POST['sMotif'], '', 'Message:', '', $_POST['sMessage']);
// Envoie le mail
if (!$this->sendMail($sWho, $_POST['sMail'], $_POST['sContact'], 'Support ' . $_POST['sContact'], $aMessage)) {
return 6;
} else {
return 7;
}
}
示例12: Spam
/**
* View spam logs.
*
* @since 2.0.?
* @access public
*
* @param int $Page Page number.
*/
public function Spam($Page = '')
{
$this->Permission('Garden.Moderation.Manage');
list($Offset, $Limit) = OffsetLimit($Page, 10);
$this->SetData('Title', T('Spam Queue'));
$Where = array('Operation' => array('Spam'));
$RecordCount = $this->LogModel->GetCountWhere($Where);
$this->SetData('RecordCount', $RecordCount);
if ($Offset >= $RecordCount) {
$Offset = $RecordCount - $Limit;
}
$Log = $this->LogModel->GetWhere($Where, 'LogID', 'Desc', $Offset, $Limit);
$this->SetData('Log', $Log);
if ($this->DeliveryType() == DELIVERY_TYPE_VIEW) {
$this->View = 'Table';
}
$this->AddSideMenu('dashboard/log/spam');
$this->Render();
}
示例13: spam
/**
* View spam logs.
*
* @since 2.0.?
* @access public
*
* @param int $Page Page number.
*/
public function spam($Page = '')
{
$this->permission(array('Garden.Moderation.Manage', 'Moderation.Spam.Manage'), false);
list($Offset, $Limit) = offsetLimit($Page, 10);
$this->setData('Title', t('Spam Queue'));
$Where = array('Operation' => array('Spam'));
$RecordCount = $this->LogModel->getCountWhere($Where);
$this->setData('RecordCount', $RecordCount);
if ($Offset >= $RecordCount) {
$Offset = $RecordCount - $Limit;
}
$Log = $this->LogModel->getWhere($Where, 'LogID', 'Desc', $Offset, $Limit);
$this->setData('Log', $Log);
if ($this->deliveryType() == DELIVERY_TYPE_VIEW) {
$this->View = 'Table';
}
Gdn_Theme::section('Moderation');
$this->setHighlightRoute('dashboard/log/spam');
$this->render();
}
示例14: display
public function display($viewfile = "")
{
$this->endtime = microtime(true);
$time = round(($this->endtime - $this->begintime) * 1000.0);
$this->_view->assign("pagetime", $time);
if ($time > 300) {
$logModel = new LogModel();
$logModel->slowRequest($time);
}
if (!empty($viewfile)) {
$this->_mainContent->assign("retUrl", $_SERVER['REQUEST_URI']);
$this->_view->assign("retUrl", $_SERVER['REQUEST_URI']);
$mainContent = $this->_mainContent->fetch($viewfile);
$this->_view->assign('mainContent', $mainContent);
} else {
if ($this->viewFile != "") {
$this->_mainContent->assign("retUrl", $_SERVER['REQUEST_URI']);
$this->_view->assign("retUrl", $_SERVER['REQUEST_URI']);
$mainContent = $this->_mainContent->fetch($this->viewFile);
$this->_view->assign('mainContent', $mainContent);
}
}
if (isset($_SESSION['id'])) {
$notify = new NotificationModel();
$notifyCount = $notify->unreadCount($_SESSION['id']);
$this->_view->assign("notifyCount", $notifyCount);
}
parent::display();
}
示例15: createComponentProductTabella
protected function createComponentProductTabella($name)
{
// ProductModel::repairAllProductSequence();
$id_category = $this->getParam('id_category');
$fluent = ProductModel::getFluent()->orderBy('product_sequence');
if ($id_category) {
$fluent->where('id_category = %i', $id_category);
} else {
$fluent->groupBy('id_product');
}
$datasource = $fluent->toDatasource();
$grid = new Tabella($datasource, array('sorting' => 'product_sequence', 'order' => 'product_sequence', 'limit' => 400, "onSuccess" => function ($post) {
LogModel::save($post, $post['id_log']);
}));
$grid->addColumn("Názov", "name", array("width" => 300, "editable" => false));
$grid->addColumn("Cena", "min_price", array("width" => 100, "editable" => false));
$_active = array('' => '', 0 => 'Zakázaný', 1 => 'Povolený');
$grid->addColumn("Akcia", "sale", array("width" => 100, 'type' => Tabella::SELECT, "filter" => array('' => '', 0 => 'nie', 1 => 'áno'), "options" => NULL, "renderer" => function ($row) {
$el = NHtml::el("td");
$pom = array('' => '', 0 => 'nie', 1 => 'áno');
return $el->add($pom[$row['sale']]);
}));
$grid->addColumn("Najpredá.", "our_tip", array("width" => 100, 'type' => Tabella::SELECT, "filter" => array('' => '', 0 => 'nie', 1 => 'áno'), "options" => NULL, "renderer" => function ($row) {
$el = NHtml::el("td");
$pom = array('' => '', 0 => 'nie', 1 => 'áno');
return $el->add($pom[$row['our_tip']]);
}));
$grid->addColumn("_", "active", array("width" => 100, 'type' => Tabella::SELECT, "filter" => $_active, "options" => '', "editable" => false, "renderer" => function ($row) use($_active) {
$el = NHtml::el("td");
// print_r($row);exit;
/*
* link na zmazanie produktu
*/
$el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('deleteProduct!', array('id' => $row->id_product)))->addClass('deleteIcon ajax')->title('Naozaj chcete zmazať položku?'));
/*
* link na editaciu produktu
*/
$el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('Product:edit', array('id' => $row->id_product)))->addClass('editIcon'));
/*
* posuvanie - ak sa spusti posubanie, treba vypnut zoradovanie !!! order=>false
*/
// $el->add(
// NHtml::el( 'a' )->href('#')->addClass( 'moveIcon' )
// ->addId( 'index_'.$row['id_product'] )
// );
/*
* ikona aktivan polozka, neaktivan polozka
*/
$span = NHtml::el('span');
if ($row->active) {
$span->addClass('activeIcon active');
} else {
$span->addClass('unactiveIcon active ');
}
$el->add($span);
return $el;
}));
//
// $grid->addColumn( "", "id_product",
// array( "width" => 55,
// 'filter'=>null,
// 'order'=>false,
// "renderer" => function( $row ) {
//
// return NHtml::el( "td" )->add(
// NHtml::el( 'a' )->href(
// NEnvironment::getApplication()->getPresenter()->link( 'Product:edit' , array('id'=>$row->id_product))
// )
// ->addClass( 'editIcon' )
// );
//
// })
// );
$this->addComponent($grid, $name);
}