当前位置: 首页>>代码示例>>PHP>>正文


PHP LogModel::Restore方法代码示例

本文整理汇总了PHP中LogModel::Restore方法的典型用法代码示例。如果您正苦于以下问题:PHP LogModel::Restore方法的具体用法?PHP LogModel::Restore怎么用?PHP LogModel::Restore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LogModel的用法示例。


在下文中一共展示了LogModel::Restore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: NotSpam

 public function NotSpam($LogIDs)
 {
     $this->Permission('Garden.Moderation.Manage');
     if (!$this->Request->IsPostBack()) {
         throw PermissionException('Javascript');
     }
     $Logs = array();
     // Verify the appropriate users.
     $UserIDs = $this->Form->GetFormValue('UserID', array());
     if (!is_array($UserIDs)) {
         $UserIDs = array();
     }
     foreach ($UserIDs as $UserID) {
         Gdn::UserModel()->SetField($UserID, 'Verified', TRUE);
         $Logs = array_merge($Logs, $this->LogModel->GetWhere(array('Operation' => 'Spam', 'RecordUserID' => $UserID)));
     }
     // Grab the logs.
     $Logs = array_merge($Logs, $this->LogModel->GetIDs($LogIDs));
     //      try {
     foreach ($Logs as $Log) {
         $this->LogModel->Restore($Log);
     }
     //      } catch (Exception $Ex) {
     //         $this->Form->AddError($Ex->getMessage());
     //      }
     $this->LogModel->Recalculate();
     $this->SetData('Complete');
     $this->SetData('Count', count($Logs));
     $this->Render('Blank', 'Utility');
 }
开发者ID:bishopb,项目名称:vanilla,代码行数:30,代码来源:class.logcontroller.php

示例2: Restore

   public function Restore($LogIDs) {
      $this->Permission('Garden.Moderation.Manage');

      // Grab the logs.
      $Logs = $this->LogModel->GetIDs($LogIDs);
      foreach ($Logs as $Log) {
         $this->LogModel->Restore($Log);
      }
      $this->LogModel->Recalculate();
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:10,代码来源:class.logcontroller.php

示例3: UnBan

 /**
  * Unban a user.
  * @since 2.1
  * @param int $UserID
  * @param array $Options 
  */
 public function UnBan($UserID, $Options = array())
 {
     $User = $this->GetID($UserID, DATASET_TYPE_ARRAY);
     if (!$User) {
         throw NotFoundException();
     }
     if (!$User['Banned']) {
         throw new Gdn_UserException(T("The user isn't banned."));
     }
     // Unban the user.
     $this->SetField($UserID, 'Banned', FALSE);
     // Restore the user's content.
     if (GetValue('RestoreContent', $Options)) {
         $BanLogID = $this->GetAttribute($UserID, 'BanLogID');
         if ($BanLogID) {
             $LogModel = new LogModel();
             try {
                 $LogModel->Restore($BanLogID);
             } catch (Exception $Ex) {
                 if ($Ex->getCode() != 404) {
                     throw $Ex;
                 }
             }
             $this->SaveAttribute($UserID, 'BanLogID', NULL);
         }
     }
     // Add an activity for the unbanning.
     if (GetValue('AddActivity', $Options, TRUE)) {
         $ActivityModel = new ActivityModel();
         $Story = GetValue('Story', $Options, NULL);
         // Notify the moderators of the unban.
         $Activity = array('ActivityType' => 'Ban', 'NotifyUserID' => ActivityModel::NOTIFY_MODS, 'ActivityUserID' => $UserID, 'RegardingUserID' => Gdn::Session()->UserID, 'HeadlineFormat' => T('HeadlineFormat.Unban', '{RegardingUserID,You} unbanned {ActivityUserID,you}.'), 'Story' => $Story);
         $ActivityModel->Queue($Activity);
         // Notify the user of the unban.
         $Activity['NotifyUserID'] = $UserID;
         $Activity['Emailed'] = ActivityModel::SENT_PENDING;
         $Activity['HeadlineFormat'] = T('HeadlineFormat.Unban.Notification', "You've been unbanned.");
         $ActivityModel->Queue($Activity, FALSE, array('Force' => TRUE));
         $ActivityModel->SaveQueue();
     }
 }
开发者ID:statico,项目名称:openshift-origin-vanillaforums,代码行数:47,代码来源:class.usermodel.php

示例4: unBan

 /**
  * Unban a user.
  *
  * @since 2.1
  *
  * @param int $UserID
  * @param array $Options
  */
 public function unBan($UserID, $Options = array())
 {
     $User = $this->getID($UserID, DATASET_TYPE_ARRAY);
     if (!$User) {
         throw notFoundException();
     }
     $Banned = $User['Banned'];
     if (!BanModel::isBanned($Banned, BanModel::BAN_MANUAL)) {
         throw new Gdn_UserException(t("The user isn't banned.", "The user isn't banned or is banned by some other function."));
     }
     // Unban the user.
     $NewBanned = BanModel::setBanned($Banned, false, BanModel::BAN_MANUAL);
     $this->setField($UserID, 'Banned', $NewBanned);
     // Restore the user's content.
     if (val('RestoreContent', $Options)) {
         $BanLogID = $this->getAttribute($UserID, 'BanLogID');
         if ($BanLogID) {
             $LogModel = new LogModel();
             try {
                 $LogModel->Restore($BanLogID);
             } catch (Exception $Ex) {
                 if ($Ex->getCode() != 404) {
                     throw $Ex;
                 }
             }
             $this->saveAttribute($UserID, 'BanLogID', null);
         }
     }
     // Add an activity for the unbanning.
     if (val('AddActivity', $Options, true)) {
         $ActivityModel = new ActivityModel();
         $Story = val('Story', $Options, null);
         // Notify the moderators of the unban.
         $Activity = array('ActivityType' => 'Ban', 'NotifyUserID' => ActivityModel::NOTIFY_MODS, 'ActivityUserID' => $UserID, 'RegardingUserID' => Gdn::session()->UserID, 'HeadlineFormat' => t('HeadlineFormat.Unban', '{RegardingUserID,You} unbanned {ActivityUserID,you}.'), 'Story' => $Story, 'Data' => array('Unban' => true));
         $ActivityModel->Queue($Activity);
         // Notify the user of the unban.
         $Activity['NotifyUserID'] = $UserID;
         $Activity['Emailed'] = ActivityModel::SENT_PENDING;
         $Activity['HeadlineFormat'] = t('HeadlineFormat.Unban.Notification', "You've been unbanned.");
         $ActivityModel->Queue($Activity, false, array('Force' => true));
         $ActivityModel->SaveQueue();
     }
 }
开发者ID:dimassrio,项目名称:vanilla,代码行数:51,代码来源:class.usermodel.php


注:本文中的LogModel::Restore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。