本文整理汇总了PHP中LogModel类的典型用法代码示例。如果您正苦于以下问题:PHP LogModel类的具体用法?PHP LogModel怎么用?PHP LogModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sitesearchAction
public function sitesearchAction()
{
$keyword = $_POST["keyword"];
$logModel = new LogModel();
$logModel->sitesearch($keyword);
echo $keyword;
}
开发者ID:lilhorse,项目名称:cocoa,代码行数:7,代码来源:LogController.php
示例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();
}
开发者ID:nabble,项目名称:ajde,代码行数:10,代码来源:Db.php
示例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']);
}
}
开发者ID:judasnow,项目名称:qspread20101020,代码行数:18,代码来源:Log.php
示例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');
}
}
开发者ID:VNovotna,项目名称:MP2014,代码行数:11,代码来源:StatusPresenter.php
示例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;
}
开发者ID:nesthub,项目名称:php_jannus,代码行数:27,代码来源:AuthModel.php
示例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;
}
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:38,代码来源:class.spammodel.php
示例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;
}
开发者ID:seedbank,项目名称:old-repo,代码行数:43,代码来源:class.spammodel.php
示例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);
}
开发者ID:oaki,项目名称:demoshop,代码行数:17,代码来源:LogPresenter.php
示例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;
}
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:60,代码来源:class.spammodel.php
示例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();
}
开发者ID:snowtl,项目名称:tanglang,代码行数:40,代码来源:MyInfoAction.class.php
示例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;
}
}
开发者ID:nesthub,项目名称:php_jannus,代码行数:46,代码来源:MailModel.php
示例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();
}
开发者ID:bishopb,项目名称:vanilla,代码行数:27,代码来源:class.logcontroller.php
示例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();
}
开发者ID:vanilla,项目名称:vanilla,代码行数:28,代码来源:class.logcontroller.php
示例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();
}
开发者ID:lilhorse,项目名称:cocoa,代码行数:29,代码来源:baseController.php
示例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);
}
开发者ID:oaki,项目名称:demoshop,代码行数:75,代码来源:Admin_EShopPresenter.php
示例16: Delete
/**
* Delete a comment.
*
* This is a hard delete that completely removes it from the database.
* Events: DeleteComment.
*
* @since 2.0.0
* @access public
*
* @param int $CommentID Unique ID of the comment to be deleted.
* @param bool Always returns TRUE.
*/
public function Delete($CommentID) {
$this->EventArguments['CommentID'] = $CommentID;
// Grab the comment to check on it.
$Data = $this->SQL
->Select('c.*, d.LastCommentID, d.DateInserted as DiscussionDateInserted')
->From('Comment c')
->Join('Discussion d', 'c.DiscussionID = d.DiscussionID')
->Where('c.CommentID', $CommentID)
->Get()->FirstRow(DATASET_TYPE_ARRAY);
if ($Data) {
// If this is the last comment, get the one before and update the LastCommentID field
if ($Data['LastCommentID'] == $CommentID) {
$OldData = $this->SQL
->Select('c.CommentID, c.InsertUserID, c.DateInserted')
->From('Comment c')
->Where('c.DiscussionID', $Data['DiscussionID'])
->OrderBy('c.DateInserted', 'desc')
->Limit(1, 1)
->Get()->FirstRow(DATASET_TYPE_ARRAY);
if (is_array($OldData)) {
$this->SQL->Update('Discussion')
->Set('LastCommentID', $OldData['CommentID'])
->Set('LastCommentUserID', $OldData['InsertUserID'])
->Set('DateLastComment', $OldData['DateInserted'])
->Where('DiscussionID', $Data['DiscussionID'])
->Put();
} else { // It was the ONLY comment
$this->SQL->Update('Discussion')
->Set('LastCommentID', NULL)
->Set('LastCommentUserID', NULL)
->Set('DateLastComment', $Data['DateInserted'])
->Where('DiscussionID', $Data['DiscussionID'])
->Put();
}
}
// Decrement the UserDiscussion comment count if the user has seen this comment
$Offset = $this->GetOffset($CommentID);
$this->SQL->Update('UserDiscussion')
->Set('CountComments', 'CountComments - 1', FALSE)
->Where('DiscussionID', $Data['DiscussionID'])
->Where('CountComments >', $Offset)
->Put();
// Decrement the Discussion's Comment Count
$this->SQL->Update('Discussion')
->Set('CountComments', 'CountComments - 1', FALSE)
->Where('DiscussionID', $Data['DiscussionID'])
->Put();
$this->FireEvent('DeleteComment');
// Log the deletion.
unset($Data['LastCommentID'], $Data['DiscussionDateInserted']);
LogModel::Insert('Delete', 'Comment', $Data);
// Delete the comment.
$this->SQL->Delete('Comment', array('CommentID' => $CommentID));
// Update the user's comment count
$this->UpdateUser($Data['InsertUserID']);
}
return TRUE;
}
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:79,代码来源:class.commentmodel.php
示例17: statusAction
/**
* 修改状态
*
*
*/
public function statusAction()
{
$id = $this->getg('id', 0);
if (empty($id)) {
$this->error('id 不能为空!');
}
$status = $this->getg('status', 0);
$status = $status ? 0 : 1;
// 实例化Model
$log = new LogModel();
$row = $log->update(array('id' => $id), array('status' => $status));
if ($row) {
$this->error('恭喜,操作成功', 'Message');
} else {
$this->error('操作失败');
}
}
开发者ID:xujunjiepk,项目名称:yaf_base,代码行数:22,代码来源:Log.php
示例18: LogModel
<?php
if (!defined('APPLICATION')) {
exit;
}
$Session = Gdn::session();
$User = $Session->User;
$CssClass = '';
if ($this->CssClass) {
$CssClass .= ' ' . $this->CssClass;
}
$DashboardCount = 0;
// Spam & Moderation Queue
if ($Session->checkPermission(array('Garden.Settings.Manage', 'Garden.Moderation.Manage', 'Moderation.Spam.Manage', 'Moderation.ModerationQueue.Manage'), false)) {
$LogModel = new LogModel();
//$SpamCount = $LogModel->GetOperationCount('spam');
$ModerationCount = $LogModel->GetOperationCount('moderate');
$DashboardCount += $ModerationCount;
}
// Applicant Count
if ($Session->checkPermission('Garden.Users.Approve')) {
$RoleModel = new RoleModel();
$ApplicantCount = $RoleModel->GetApplicantCount();
$DashboardCount += $ApplicantCount;
} else {
$ApplicantCount = null;
}
$this->EventArguments['DashboardCount'] =& $DashboardCount;
$this->fireEvent('BeforeFlyoutMenu');
if ($Session->isValid()) {
echo '<div class="MeBox' . $CssClass . '">';
开发者ID:caidongyun,项目名称:vanilla,代码行数:31,代码来源:me.php
示例19: Save
//.........这里部分代码省略.........
// Check to see if we are sharing this activity with another one.
if ($CommentActivityID = GetValue('CommentActivityID', $Activity['Data'])) {
$CommentActivity = $this->GetID($CommentActivityID);
$Activity['Data']['CommentNotifyUserID'] = $CommentActivity['NotifyUserID'];
}
// Make sure this activity isn't a duplicate.
if (GetValue('CheckRecord', $Options)) {
// Check to see if this record already notified so we don't notify multiple times.
$Where = ArrayTranslate($Activity, array('NotifyUserID', 'RecordType', 'RecordID'));
$Where['DateUpdated >'] = Gdn_Format::ToDateTime(strtotime('-2 days'));
// index hint
$CheckActivity = $this->SQL->GetWhere('Activity', $Where)->FirstRow();
if ($CheckActivity) {
return FALSE;
}
}
// Check to share the activity.
if (GetValue('Share', $Options)) {
$this->Share($Activity);
}
// Group he activity.
if ($GroupBy = GetValue('GroupBy', $Options)) {
$GroupBy = (array) $GroupBy;
$Where = array();
foreach ($GroupBy as $ColumnName) {
$Where[$ColumnName] = $Activity[$ColumnName];
}
$Where['NotifyUserID'] = $Activity['NotifyUserID'];
// Make sure to only group activities by day.
$Where['DateInserted >'] = Gdn_Format::ToDateTime(strtotime('-1 day'));
// See if there is another activity to group these into.
$GroupActivity = $this->SQL->GetWhere('Activity', $Where)->FirstRow(DATASET_TYPE_ARRAY);
if ($GroupActivity) {
$GroupActivity['Data'] = @unserialize($GroupActivity['Data']);
$Activity = $this->MergeActivities($GroupActivity, $Activity);
$NotificationInc = 0;
}
}
$Delete = FALSE;
if ($Activity['Emailed'] == self::SENT_PENDING) {
$this->Email($Activity);
$Delete = GetValue('_Delete', $Activity);
}
$ActivityData = $Activity['Data'];
if (isset($Activity['Data']) && is_array($Activity['Data'])) {
$Activity['Data'] = serialize($Activity['Data']);
}
$this->DefineSchema();
$Activity = $this->FilterSchema($Activity);
$ActivityID = GetValue('ActivityID', $Activity);
if (!$ActivityID) {
if (!$Delete) {
$this->AddInsertFields($Activity);
TouchValue('DateUpdated', $Activity, $Activity['DateInserted']);
$this->EventArguments['Activity'] =& $Activity;
$this->EventArguments['ActivityID'] = NULL;
$this->FireEvent('BeforeSave');
if (count($this->ValidationResults()) > 0) {
return FALSE;
}
if (GetValue('CheckSpam', $Options)) {
// Check for spam
$Spam = SpamModel::IsSpam('Activity', $Activity);
if ($Spam) {
return SPAM;
}
// Check for approval
$ApprovalRequired = CheckRestriction('Vanilla.Approval.Require');
if ($ApprovalRequired && !GetValue('Verified', Gdn::Session()->User)) {
LogModel::Insert('Pending', 'Activity', $Activity);
return UNAPPROVED;
}
}
$ActivityID = $this->SQL->Insert('Activity', $Activity);
$Activity['ActivityID'] = $ActivityID;
}
} else {
$Activity['DateUpdated'] = Gdn_Format::ToDateTime();
unset($Activity['ActivityID']);
$this->EventArguments['Activity'] =& $Activity;
$this->EventArguments['ActivityID'] = $ActivityID;
$this->FireEvent('BeforeSave');
if (count($this->ValidationResults()) > 0) {
return FALSE;
}
$this->SQL->Put('Activity', $Activity, array('ActivityID' => $ActivityID));
$Activity['ActivityID'] = $ActivityID;
}
$Activity['Data'] = $ActivityData;
if (isset($CommentActivity)) {
$CommentActivity['Data']['SharedActivityID'] = $Activity['ActivityID'];
$CommentActivity['Data']['SharedNotifyUserID'] = $Activity['NotifyUserID'];
$this->SetField($CommentActivity['ActivityID'], 'Data', $CommentActivity['Data']);
}
if ($NotificationInc > 0) {
$CountNotifications = Gdn::UserModel()->GetID($Activity['NotifyUserID'])->CountNotifications + $NotificationInc;
Gdn::UserModel()->SetField($Activity['NotifyUserID'], 'CountNotifications', $CountNotifications);
}
return $Activity;
}
开发者ID:robhazkes,项目名称:Garden,代码行数:101,代码来源:class.activitymodel.php
示例20: deleteContent
/**
* Delete a user's content across many contexts.
*
* @param int $UserID
* @param array $Options
* @param array $Content
* @return bool|int
*/
public function deleteContent($UserID, $Options = [], $Content = [])
{
$Log = val('Log', $Options);
if ($Log === true) {
$Log = 'Delete';
}
$Result = false;
// Fire an event so applications can remove their associated user data.
$this->EventArguments['UserID'] = $UserID;
$this->EventArguments['Options'] = $Options;
$this->EventArguments['Content'] =& $Content;
$this->fireEvent('BeforeDeleteUser');
$User = $this->getID($UserID, DATASET_TYPE_ARRAY);
if (!$Log) {
$Content = null;
}
// Remove invitations
$this->getDelete('Invitation', ['InsertUserID' => $UserID], $Content);
$this->getDelete('Invitation', ['AcceptedUserID' => $UserID], $Content);
// Remove activities
$this->getDelete('Activity', ['InsertUserID' => $UserID], $Content);
// Remove activity comments.
$this->getDelete('ActivityComment', ['InsertUserID' => $UserID], $Content);
// Remove comments in moderation queue
$this->getDelete('Log', ['RecordUserID' => $UserID, 'Operation' => 'Pending'], $Content);
// Clear out information on the user.
$this->setField($UserID, ['About' => null, 'Title' => null, 'Location' => null]);
if ($Log) {
$User['_Data'] = $Content;
unset($Content);
// in case data gets copied
$Result = LogModel::insert($Log, 'User', $User, val('LogOptions', $Options, []));
}
return $Result;
}
开发者ID:vanilla,项目名称:vanilla,代码行数:43,代码来源:class.usermodel.php
注:本文中的LogModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论