Version 2.1.7
This commit is contained in:
1 parent
0eecc172d9
commit
f73f8bff6d
941 files changed
+215301
-103093
No files matched your search
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
|
||||
| > $Revision: 23 $
|
||||
| > $Author: matt $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > TASK SCRIPT: Test
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 28th January 2004
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//+--------------------------------------------------------------------------
|
||||
// THIS TASKS OPERATIONS:
|
||||
// Sends out an email if the subspackage is about to expire
|
||||
//+--------------------------------------------------------------------------
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class task_item
|
||||
{
|
||||
var $class = "";
|
||||
var $root_path = "";
|
||||
var $task = "";
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Our 'auto_run' function
|
||||
// ADD CODE HERE
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function run_task()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// GET EMAIL CLASS
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( $this->root_path."sources/classes/class_email.php" );
|
||||
$this->email = new emailer( $this->root_path );
|
||||
$this->email->ipsclass =& $this->ipsclass;
|
||||
$this->email->email_init();
|
||||
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$members = array();
|
||||
$ids = array();
|
||||
$expired = time() + 86400 + 3600; // Tomorrow + 1 hour
|
||||
$now = time() - 3600;
|
||||
|
||||
//-----------------------------------------
|
||||
// Get members
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'st.subtrans_member_id',
|
||||
'from' => array( 'subscription_trans' => 'st' ),
|
||||
'where' => "st.subtrans_state='paid' AND st.subtrans_end_date >= $now AND st.subtrans_end_date <= $expired",
|
||||
'add_join' => array( 0 => array( 'select' => 'm.id, m.name, m.members_display_name, m.email',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.id=st.subtrans_member_id',
|
||||
'type' => 'left' ) ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$members[ $r['id'] ] = $r;
|
||||
$ids[] = $r['id'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get subscription packages
|
||||
//-----------------------------------------
|
||||
|
||||
if ( count( $ids ) )
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'st.subtrans_sub_id, st.subtrans_member_id',
|
||||
'from' => array( 'subscription_trans' => 'st' ),
|
||||
'where' => 'st.subtrans_member_id IN ('.implode( ",", $ids ) . ") AND st.subtrans_state='paid'",
|
||||
'add_join' => array( 0 => array( 'select' => 's.sub_title',
|
||||
'from' => array( 'subscriptions' => 's' ),
|
||||
'where' => 's.sub_id=st.subtrans_sub_id',
|
||||
'type' => 'left' ) ) ) );
|
||||
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
while( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$members[ $r['subtrans_member_id'] ]['sub_title'] = $r['sub_title'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Send out the EMAILS
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $members as $id => $member )
|
||||
{
|
||||
$this->email->get_template("subscription_expires");
|
||||
$this->email->build_message( array(
|
||||
'PACKAGE' => $member['sub_title'],
|
||||
'EXPIRES' => $this->ipsclass->get_date( $member['sub_end'], 'DATE' ),
|
||||
'LINK' => $this->ipsclass->vars['board_url'].'/index.'.$this->ipsclass->vars['php_ext'].'?act=paysubs&CODE=index',
|
||||
) );
|
||||
|
||||
$this->email->to = trim( $member['email'] );
|
||||
$this->email->send_mail();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Log to log table - modify but dont delete
|
||||
//-----------------------------------------
|
||||
|
||||
$this->class->append_task_log( $this->task, intval(count($ids)).' Ïîëüçîâàòåëÿì âûñëàíî ïèñüìî îá îêîí÷àíèè äåéñòâèÿ ïîäïèñêè' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Unlock Task: DO NOT MODIFY!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->class->unlock_task( $this->task );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// register_class
|
||||
// LEAVE ALONE
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function register_class(&$class)
|
||||
{
|
||||
$this->class = $class;
|
||||
$this->ipsclass =& $class->ipsclass;
|
||||
$this->root_path = $this->class->root_path;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// pass_task
|
||||
// LEAVE ALONE
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function pass_task( $this_task )
|
||||
{
|
||||
$this->task = $this_task;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in new issue
Block a user