Файл: IPBMafia.ru_IPB_3.4.6_Final_Rus _Nulled/board/upload/admin/applications/members/tasks/prunenotifications.php
Строк: 83
<?php
/**
* @file prunenotifications.php Task to remove older notifications
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: http://www.invisionpower.com/company/standards.php#license$
* $Author: ips_terabyte $ - Matt Mecham
* @since -
* $LastChangedDate: 2011-02-08 22:20:18 +0000 (Tue, 08 Feb 2011) $
* @version v3.4.6
* $Revision: 7750 $
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
*
* @class task_item
* @brief Task to remove validating members over configured time
*
*/
class task_item
{
/**
* Object that stores the parent task manager class
*
* @var $class
*/
protected $class;
/**
* Array that stores the task data
*
* @var $task
*/
protected $task = array();
/**
* Registry Object Shortcuts
*
* @var $registry
* @var $DB
* @var $settings
* @var $lang
*/
protected $registry;
protected $DB;
protected $settings;
protected $lang;
/**
* Constructor
*
* @param object $registry Registry object
* @param object $class Task manager class object
* @param array $task Array with the task data
* @return @e void
*/
public function __construct( ipsRegistry $registry, $class, $task )
{
/* Make registry objects */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->lang = $this->registry->getClass('class_localization');
$this->class = $class;
$this->task = $task;
}
/**
* Run this task
*
* @return @e void
*/
public function runTask()
{
// If enabled, remove validating new_reg members & entries from members table
if ( intval($this->settings['prune_notifications']) > 0 )
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
$notifyLibrary = new $classToLoad( $this->registry );
$olderThan = time() - ( $this->settings['prune_notifications'] * ( 86400 * 30 ) );
$removed = $notifyLibrary->deleteNotificationsOlderThan( $olderThan );
$this->registry->getClass('class_localization')->loadLanguageFile( array( 'admin_member' ), 'members' );
$this->class->appendTaskLog( $this->task, sprintf( $this->lang->words['task_removeoldnotifications'], $removed ) );
}
//-----------------------------------------
// Unlock Task: DO NOT MODIFY!
//-----------------------------------------
$this->class->unlockTask( $this->task );
}
}