diff options
| author | lsces <lester@lsces.co.uk> | 2025-08-28 21:22:38 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2025-08-28 21:22:38 +0100 |
| commit | 6a24df4d086833667f52c8ee197148698ae2156e (patch) | |
| tree | 4328742328f6dcb694ca48627a5603d2e7d4eb45 | |
| parent | e7b82920b6a5f6a04ddebfb375714c04d6d10f51 (diff) | |
| download | newsletters-6a24df4d086833667f52c8ee197148698ae2156e.tar.gz newsletters-6a24df4d086833667f52c8ee197148698ae2156e.tar.bz2 newsletters-6a24df4d086833667f52c8ee197148698ae2156e.zip | |
Initial conversion to PHP8.4 and namespace, still needs testing
| -rw-r--r-- | includes/bit_setup_inc.php | 45 | ||||
| -rw-r--r-- | includes/classes/BitNewsletter.php | 121 | ||||
| -rw-r--r-- | includes/classes/BitNewsletterEdition.php | 74 | ||||
| -rw-r--r-- | includes/classes/BitNewsletterMailer.php | 110 |
4 files changed, 184 insertions, 166 deletions
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php index 31acee0..f024dea 100644 --- a/includes/bit_setup_inc.php +++ b/includes/bit_setup_inc.php @@ -1,38 +1,48 @@ <?php +use Bitweaver\Newsletters\BitNewsletter; +use Bitweaver\Newsletters\BitNewsletterMailer; global $gBitSystem; define( 'LIBERTY_SERVICE_NEWSLETTERS', 'newsletters' ); -$registerHash = array( +$pRegisterHash = [ 'package_name' => 'newsletters', - 'package_path' => dirname( dirname( __FILE__ ) ).'/', - 'homeable' => TRUE, -); -$gBitSystem->registerPackage( $registerHash ); + 'package_path' => dirname( dirname( __FILE__ ) ) . '/', + 'homeable' => true, +]; +// fix to quieten down VS Code which can't see the dynamic creation of these ... +define( 'NEWSLETTERS_PKG_NAME', $pRegisterHash['package_name'] ); +define( 'NEWSLETTERS_PKG_URL', BIT_ROOT_URL . basename( $pRegisterHash['package_path'] ) . '/' ); +define( 'NEWSLETTERS_PKG_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/' ); +define( 'NEWSLETTERS_PKG_INCLUDE_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/'); +define( 'NEWSLETTERS_PKG_CLASS_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/classes/'); +define( 'NEWSLETTERS_PKG_ADMIN_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/admin/'); + +$gBitSystem->registerPackage( $pRegisterHash ); if( $gBitSystem->isPackageActive( NEWSLETTERS_PKG_NAME ) ) { - $menuHash = array( + $menuHash = [ 'package_name' => NEWSLETTERS_PKG_NAME, - 'index_url' => NEWSLETTERS_PKG_URL.'index.php', + 'index_url' => NEWSLETTERS_PKG_URL . 'index.php', 'menu_template' => 'bitpackage:newsletters/menu_newsletters.tpl', - ); + ]; $gBitSystem->registerAppMenu( $menuHash ); if( isset( $_GET['ct'] ) && strlen( $_GET['ct'] ) == 32 ) { - require_once( NEWSLETTERS_PKG_CLASS_PATH.'BitNewsletterMailer.php' ); + require_once NEWSLETTERS_PKG_CLASS_PATH . 'BitNewsletterMailer.php'; BitNewsletterMailer::storeClickthrough( $_GET['ct'] ); } - $gLibertySystem->registerService( LIBERTY_SERVICE_NEWSLETTERS, NEWSLETTERS_PKG_NAME, array( - 'users_expunge_function' => 'newsletters_user_expunge', - 'users_register_function' => 'newsletters_user_register', - ) ); + $gLibertySystem->registerService( LIBERTY_SERVICE_NEWSLETTERS, NEWSLETTERS_PKG_NAME, [ + 'users_expunge_function' => 'newsletters_user_expunge', + 'users_register_function' => 'newsletters_user_register', + ] ); // make sure all mail_queue messages from a deleted user are nuked function newsletters_user_expunge( &$pObject ) { if( is_a( $pObject, 'BitUser' ) && !empty( $pObject->mUserId ) ) { $pObject->mDb->StartTrans(); - $pObject->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_queue` WHERE user_id=?", array( $pObject->mUserId ) ); - $pObject->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE user_id=?", array( $pObject->mUserId ) ); + $pObject->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_queue` WHERE user_id=?", [ $pObject->mUserId ] ); + $pObject->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE user_id=?", [ $pObject->mUserId ] ); $pObject->mDb->CompleteTrans(); } } @@ -47,7 +57,7 @@ if( $gBitSystem->isPackageActive( NEWSLETTERS_PKG_NAME ) ) { $subHash['unsubscribe_all'] = 'y'; } else { $newsletter = new BitNewsletter(); - $pParamHash = array(); + $pParamHash = []; $newsletters = $newsletter->getList($pParamHash); foreach( array_keys( $newsletters ) as $nlContentId ) { if( empty( $_REQUEST['nl_content_id'] ) || !in_array( $nlContentId, $_REQUEST['nl_content_id'] ) ) { @@ -58,10 +68,9 @@ if( $gBitSystem->isPackageActive( NEWSLETTERS_PKG_NAME ) ) { } if( !empty( $subHash ) ) { - $subHash['sub_lookup'] = array( 'user_id' => $pObject->mUserId ); + $subHash['sub_lookup'] = [ 'user_id' => $pObject->mUserId ]; BitNewsletterMailer::storeSubscriptions( $subHash ); } } } } -?> diff --git a/includes/classes/BitNewsletter.php b/includes/classes/BitNewsletter.php index b08d6d2..67304f9 100644 --- a/includes/classes/BitNewsletter.php +++ b/includes/classes/BitNewsletter.php @@ -22,8 +22,11 @@ /** * required setup */ -require_once( LIBERTY_PKG_CLASS_PATH.'LibertyContent.php' ); -require_once( NEWSLETTERS_PKG_CLASS_PATH.'BitNewsletterEdition.php' ); +namespace Bitweaver\Newsletters; +use Bitweaver\BitBase; +use Bitweaver\KernelTools; +use Bitweaver\Liberty\LibertyContent; +use Bitweaver\Users\RoleUser; define( 'BITNEWSLETTER_CONTENT_TYPE_GUID', 'bitnewsletter' ); @@ -31,16 +34,19 @@ define( 'BITNEWSLETTER_CONTENT_TYPE_GUID', 'bitnewsletter' ); * @package newsletters */ class BitNewsletter extends LibertyContent { - function __construct( $pNlId=NULL, $pContentId=NULL ) { + + public $mNewsletterId; + + public function __construct( $pNlId=NULL, $pContentId=NULL ) { parent::__construct(); - $this->registerContentType( BITNEWSLETTER_CONTENT_TYPE_GUID, array( + $this->registerContentType( BITNEWSLETTER_CONTENT_TYPE_GUID, [ 'content_type_guid' => BITNEWSLETTER_CONTENT_TYPE_GUID, - 'content_name' => 'Newsletter', - 'handler_class' => 'BitNewsletter', - 'handler_package' => 'newsletters', - 'handler_file' => 'BitNewsletter.php', - 'maintainer_url' => 'http://www.bitweaver.org' - ) ); + 'content_name' => 'Newsletter', + 'handler_class' => 'BitNewsletter', + 'handler_package' => 'newsletters', + 'handler_file' => 'BitNewsletter.php', + 'maintainer_url' => 'http://www.bitweaver.org', + ] ); $this->mNewsletterId = $this->verifyId( $pNlId ) ? $pNlId : NULL; $this->mContentId = $pContentId; $this->mContentTypeGuid = BITNEWSLETTER_CONTENT_TYPE_GUID; @@ -51,11 +57,11 @@ class BitNewsletter extends LibertyContent { $this->mAdminContentPerm = 'p_newsletters_admin'; } - function load( $pContentId = NULL, $pPluginParams = NULL ) { + public function load( $pContentId = NULL, $pPluginParams = NULL ): void { if( $this->verifyId( $this->mNewsletterId ) || $this->verifyId( $this->mContentId ) ) { global $gBitSystem; - $bindVars = array(); $selectSql = ''; $joinSql = ''; $whereSql = ''; + $bindVars = []; $selectSql = ''; $joinSql = ''; $whereSql = ''; $lookupColumn = $this->verifyId( $this->mNewsletterId ) ? 'nl_id' : 'content_id'; $bindVars[] = $this->verifyId( $this->mNewsletterId )? $this->mNewsletterId : $this->mContentId; @@ -80,16 +86,15 @@ class BitNewsletter extends LibertyContent { $this->mContentId = $this->mInfo['content_id']; } } - return( count( $this->mInfo ) ); } - function loadEditions() { + public function loadEditions() { if( $this->isValid() ) { $this->mEditions = $this->getEditions(); } } - function store( &$pParamHash ) { //$nl_id, $name, $description, $allow_user_sub, $allow_any_sub, $unsub_msg, $validate_addr) { + public function store( &$pParamHash ): bool { //$nl_id, $name, $description, $allow_user_sub, $allow_any_sub, $unsub_msg, $validate_addr) { if( $this->verify( $pParamHash ) ) { $this->mDb->StartTrans(); if( parent::store( $pParamHash ) ) { @@ -107,7 +112,7 @@ class BitNewsletter extends LibertyContent { return( count( $this->mErrors ) == 0 ); } - function verify( &$pParamHash ) { + public function verify( &$pParamHash ): bool { // It is possible a derived class set this to something different if( empty( $pParamHash['content_type_guid'] ) ) { $pParamHash['content_type_guid'] = $this->mContentTypeGuid; @@ -119,10 +124,10 @@ class BitNewsletter extends LibertyContent { return( count( $this->mErrors ) == 0 ); } - function getSubscriberInfo( $pLookup ) { - $ret = array(); + public function getSubscriberInfo( $pLookup ) { + $ret = []; if( $this->isValid() ) { - $bindVars = array(); + $bindVars = []; $whereSql = ''; if( !empty( $pLookup['email'] ) ) { $whereSql .= ' AND `email`=? ` '; @@ -141,28 +146,28 @@ class BitNewsletter extends LibertyContent { return $ret; } - function getSubscribers( $pAll=FALSE) { - $ret = array(); + public function getSubscribers( $pAll=FALSE) { + $ret = []; if( $this->isValid() ) { $whereSql = $pAll ? '' : ' `unsubscribe_date` is NULL AND '; $query = "select * from `".BIT_DB_PREFIX."mail_subscriptions` WHERE $whereSql `content_id`=?"; - if( $res = $this->mDb->query( $query, array( $this->mContentId ) ) ) { + if( $res = $this->mDb->query( $query, [ $this->mContentId ] ) ) { $ret = $res->GetRows(); } } return $ret; } - function removeSubscription( $email, $notify = FALSE, $del_record = FALSE ) { + public function removeSubscription( $email, $notify = FALSE, $del_record = FALSE ) { if ($del_record) { - $this->mDb->query("DELETE FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `content_id`=? AND `email`=?", array($this->mContentId, $email)); + $this->mDb->query("DELETE FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `content_id`=? AND `email`=?", [ $this->mContentId, $email ]); } else { - $urlCode = $this->mDb->getOne("select `sub_code` from `".BIT_DB_PREFIX."mail_subscriptions` where `content_id`=? and `email`=?", array($this->mContentId, $email)); + $urlCode = $this->mDb->getOne("select `sub_code` from `".BIT_DB_PREFIX."mail_subscriptions` where `content_id`=? and `email`=?", [ $this->mContentId, $email ]); $this->unsubscribe($urlCode, $notify); } } - function subscribe( $pSubscribeHash ) { // $notify = FALSE, $remind = FALSE ) { + public function subscribe( $pSubscribeHash ) { // $notify = FALSE, $remind = FALSE ) { $ret = FALSE; if( $this->isValid() ) { global $gBitSystem; @@ -180,7 +185,7 @@ class BitNewsletter extends LibertyContent { } } - $urlCode = (!$duplicate) ? md5( BitUser::genPass() ) : $urlCode; + $urlCode = (!$duplicate) ? md5( RoleUser::genPass() ) : $urlCode; $now = date("U"); // Generate a code and store it and send an email with the // URL to confirm the subscription put valid as 'n' @@ -195,13 +200,13 @@ class BitNewsletter extends LibertyContent { $subEmail = $pSubscribeHash['email']; } $query = "insert into `".BIT_DB_PREFIX."mail_subscriptions` (`content_id`, `user_id`, `email`,`sub_code`,`is_valid`,`subscribed_date`) VALUES (?,?,?,?,?,?)"; - $result = $this->mDb->query( $query, array( $this->mContentId, $subUserId, $subEmail, $urlCode, 'n', (int)$now ) ); + $result = $this->mDb->query( $query, [ $this->mContentId, $subUserId, $subEmail, $urlCode, 'n', (int) $now ] ); } if( ( !empty( $pSubscribeHash['notify'] ) && $this->getField( 'validate_addr' ) == 'y') || !empty( $pSubscribeHash['remind'] ) ) { // Generate a code and store it and send an email with the $gBitSmarty->assign( 'sub_code', $urlCode ); $mail_data = $gBitSmarty->fetch('bitpackage:newsletters/confirm_newsletter_subscription.tpl'); - @mail($email, tra('Newsletter subscription information at') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data, + @mail($subEmail, KernelTools::tra('Newsletter subscription information at') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data, "From: " . $gBitSystem->getConfig( "sender_email" ) . "\r\nContent-type: text/plain;charset=utf-8\r\n"); } $ret = TRUE; @@ -209,7 +214,7 @@ class BitNewsletter extends LibertyContent { return $ret; } - function unsubscribe( $pMixed, $notify = TRUE ) { + public function unsubscribe( $pMixed, $notify = TRUE ) { global $gBitSystem; global $gBitSmarty; global $gBitUser; @@ -219,13 +224,13 @@ class BitNewsletter extends LibertyContent { if( is_numeric( $pMixed ) ) { $query = "SELECT `content_id` FROM `".BIT_DB_PREFIX."newsletters` WHERE `nl_id`=?"; - if( $subRow['content_id'] = $this->mDb->getOne( $query, array( $pMixed ) ) ) { + if( $subRow['content_id'] = $this->mDb->getOne( $query, [ $pMixed ] ) ) { $subRow['col_name'] = 'user_id'; $subRow['col_val'] = $gBitUser->mUserId; } } elseif( is_string( $pMixed ) ) { $query = "SELECT * FROM `".BIT_DB_PREFIX."mail_queue` WHERE `url_code`=?"; - if( $subRow = $this->mDb->getRow( $query, array( $pMixed ) ) ) { + if( $subRow = $this->mDb->getRow( $query, [ $pMixed ] ) ) { $subRow['col_name'] = !empty( $subRow['user_id'] ) ? 'user_id' : 'email'; $subRow['col_val'] = !empty( $subRow['user_id'] ) ? $subRow['user_id'] : $subRow['email']; } @@ -234,17 +239,17 @@ class BitNewsletter extends LibertyContent { if( !empty( $subRow ) ) { $this->mContentId = $subRow['content_id']; $this->load(); - if( $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `$subRow[col_name]`=?", array( $subRow['col_val'] ) ) ) { + if( $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `$subRow[col_name]`=?", [ $subRow['col_val'] ] ) ) { $query = "UPDATE `".BIT_DB_PREFIX."mail_subscriptions` SET `unsubscribe_date`=?, `content_id`=? WHERE `$subRow[col_name]`=? AND `unsubscribe_date` IS NULL"; } else { $query = "INSERT INTO `".BIT_DB_PREFIX."mail_subscriptions` (`unsubscribe_date`,`content_id`,`$subRow[col_name]`) VALUES(?,?,?)"; } - $result = $this->mDb->query( $query, array( $now, $subRow['content_id'], $subRow['col_val'] ) ); + $result = $this->mDb->query( $query, [ $now, $subRow['content_id'], $subRow['col_val'] ] ); if( $notify ) { // Now send a bye bye email - $gBitSmarty->assign('sub_code', $res["sub_code"]); + $gBitSmarty->assign('sub_code', $subRow["sub_code"]); $mail_data = $gBitSmarty->fetch('bitpackage:newsletters/newsletter_byebye.tpl'); - @mail($res["email"], tra('Thank you from') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data, + @mail($subRow["email"], KernelTools::tra('Thank you from') . ' ' . $gBitSystem->getConfig( "bitmailer_from" ), $mail_data, "From: " . $gBitSystem->getConfig( "sender_email" ) . "\r\nContent-type: text/plain;charset=utf-8\r\n"); } $ret = TRUE; @@ -255,7 +260,7 @@ class BitNewsletter extends LibertyContent { /* function add_all_users($nl_id) { $query = "select `email` from `".BIT_DB_PREFIX."users_users`"; - $result = $this->mDb->query($query,array()); + $result = $this->mDb->query($query,[]); while ($res = $result->fetchRow()) { $email = $res["email"]; if (!empty($email)) { @@ -266,9 +271,9 @@ class BitNewsletter extends LibertyContent { function updateUsers() { if( $this->isValid() ) { - $users = $this->mDb->getOne( "select count(*) from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=?", array( $this->mNewsletterId ) ); + $users = $this->mDb->getOne( "select count(*) from `".BIT_DB_PREFIX."mail_subscriptions` where `nl_id`=?", [ $this->mNewsletterId ] ); $query = "update `".BIT_DB_PREFIX."newsletters` set `users`=? where `nl_id`=?"; - $result = $this->mDb->query( $query, array( $users, $this->mNewsletterId ) ); + $result = $this->mDb->query( $query, [ $users, $this->mNewsletterId ] ); } } */ @@ -279,7 +284,7 @@ class BitNewsletter extends LibertyContent { $pListHash['sort_mode'] = 'created_desc'; } BitBase::prepGetList( $pListHash ); - $bindVars = array(); + $bindVars = []; $joinSql = ''; $mid = ''; @@ -308,11 +313,11 @@ class BitNewsletter extends LibertyContent { $query_cant = "select count(*) from `".BIT_DB_PREFIX."newsletters` $mid"; - $ret = array(); + $ret = []; while( $res = $result->fetchRow() ) { $res['display_url'] = BitNewsletter::getDisplayUrlFromHash( $res ); - $res["confirmed"] = $gBitDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `unsubscribe_date` IS NULL and `content_id`=?",array( (int)$res['content_id'] ) ); - $res["unsub_count"] = $gBitDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `content_id`=?",array( (int)$res['content_id'] ) ); + $res["confirmed"] = $gBitDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `unsubscribe_date` IS NULL and `content_id`=?", [ (int) $res['content_id'] ] ); + $res["unsub_count"] = $gBitDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `content_id`=?", [ (int) $res['content_id'] ] ); $ret[$res['content_id']] = $res; } @@ -320,7 +325,7 @@ class BitNewsletter extends LibertyContent { } /* function list_newsletter_subscriptions($nl_id, $offset, $maxRecords, $sort_mode, $find) { - $bindVars = array((int)$nl_id); + $bindVars = [ (int)$nl_id ]; if ($find) { $findesc = '%' . $find . '%'; $mid = " where `nl_id`=? and (`name` like ? or `description` like ?)"; @@ -334,12 +339,12 @@ class BitNewsletter extends LibertyContent { $query_cant = "select count(*) from mail_subscriptions $mid"; $result = $this->mDb->query($query,$bindVars,$maxRecords,$offset); $cant = $this->mDb->getOne($query_cant,$bindVars); - $ret = array(); + $ret = []; while ($res = $result->fetchRow()) { $ret[] = $res; } - $retval = array(); + $retval = []; $retval["data"] = $ret; $retval["cant"] = $cant; return $retval; @@ -347,17 +352,17 @@ class BitNewsletter extends LibertyContent { */ - function expunge() { + public function expunge(): bool { $ret = FALSE; if( $this->isValid() ) { $this->mDb->StartTrans(); $query = "DELETE FROM `".BIT_DB_PREFIX."newsletters` where `nl_id`=?"; - $result = $this->mDb->query( $query, array( $this->mNewsletterId ) ); + $result = $this->mDb->query( $query, [ $this->mNewsletterId ] ); // Clear out all individual subscriptions/unsubscriptions, but preserve the unsubscribe_all's $query = "DELETE FROM `".BIT_DB_PREFIX."mail_subscriptions` WHERE `content_id`=? AND `unsubscribe_all` IS NOT NULL"; - $result = $this->mDb->query( $query, array( $this->mContentId ) ); + $result = $this->mDb->query( $query, [ $this->mContentId ] ); $query = "UPDATE `".BIT_DB_PREFIX."mail_subscriptions` SET `content_id`=NULL WHERE `content_id`=? AND `unsubscribe_all` IS NOT NULL"; - $result = $this->mDb->query( $query, array( $this->mContentId ) ); + $result = $this->mDb->query( $query, [ $this->mContentId ] ); if( parent::expunge() ) { $ret = TRUE; $this->mDb->CompleteTrans(); @@ -368,7 +373,7 @@ class BitNewsletter extends LibertyContent { return $ret; } - function isValid() { + public function isValid() { return( $this->verifyId( $this->mNewsletterId ) ); } @@ -376,8 +381,8 @@ class BitNewsletter extends LibertyContent { /** * Generate a valid url for the Newsletter * - * @param object $pNewsletterId of the item to use - * @return object Url String + * @param array $pParamHash $pNewsletterId of the item to use + * @return string Url String */ public static function getDisplayUrlFromHash( &$pParamHash ) { global $gBitSystem; @@ -395,24 +400,24 @@ class BitNewsletter extends LibertyContent { } - function getEditions( $pNewsletterId = NULL ) { - $ret = array(); + public function getEditions( $pNewsletterId = NULL ) { + $ret = []; if( empty( $pNewsletterId ) ) { $nlId = $this->mNewsletterId; } elseif( BitBase::verifyId( $pNewsletterId ) ) { $nlId = $pNewsletterId; } if( !empty( $nlId ) ) { - $listHash = array( 'nl_id' => $nlId ); + $listHash = [ 'nl_id' => $nlId ]; $ret = BitNewsletterEdition::getList( $listHash ); } return $ret; } - function getUserSubscriptions( $pUserId, $pEmail ) { + public function getUserSubscriptions( $pUserId, $pEmail ) { global $gBitDb; $query = "SELECT `content_id` AS hash_key, ms.* FROM `".BIT_DB_PREFIX."mail_subscriptions` ms WHERE `user_id`=? OR `email`=?"; - $ret = $gBitDb->getAssoc( $query, array( $pUserId, $pEmail ) ); + $ret = $gBitDb->getAssoc( $query, [ $pUserId, $pEmail ] ); return $ret; } diff --git a/includes/classes/BitNewsletterEdition.php b/includes/classes/BitNewsletterEdition.php index 37b418b..21a9a85 100644 --- a/includes/classes/BitNewsletterEdition.php +++ b/includes/classes/BitNewsletterEdition.php @@ -21,8 +21,10 @@ /** * required setup */ -require_once( NEWSLETTERS_PKG_CLASS_PATH.'BitNewsletter.php' ); -require_once( LIBERTY_PKG_CLASS_PATH.'LibertyMime.php' ); +namespace Bitweaver\Newsletters; +use Bitweaver\BitBase; +use Bitweaver\KernelTools; +use Bitweaver\Liberty\LibertyMime; define( 'BITNEWSLETTEREDITION_CONTENT_TYPE_GUID', 'bitnewsletteredn' ); @@ -30,16 +32,20 @@ define( 'BITNEWSLETTEREDITION_CONTENT_TYPE_GUID', 'bitnewsletteredn' ); * @package newsletters */ class BitNewsletterEdition extends LibertyMime { - function __construct( $pEditionId=NULL, $pContentId=NULL, $pNlId=NULL ) { + + public $mEditionId; + public $mNewsletter; + + public function __construct( $pEditionId=NULL, $pContentId=NULL, $pNlId=NULL ) { parent::__construct(); - $this->registerContentType( BITNEWSLETTEREDITION_CONTENT_TYPE_GUID, array( + $this->registerContentType( BITNEWSLETTEREDITION_CONTENT_TYPE_GUID, [ 'content_type_guid' => BITNEWSLETTEREDITION_CONTENT_TYPE_GUID, - 'content_name' => 'Edition', - 'handler_class' => 'BitNewsletterEdition', - 'handler_package' => 'newsletters', - 'handler_file' => 'BitNewsletterEdition.php', - 'maintainer_url' => 'http://www.bitweaver.org' - ) ); + 'content_name' => 'Edition', + 'handler_class' => 'BitNewsletterEdition', + 'handler_package' => 'newsletters', + 'handler_file' => 'BitNewsletterEdition.php', + 'maintainer_url' => 'http://www.bitweaver.org', + ] ); $this->mEditionId = $pEditionId; $this->mContentId = $pContentId; $this->mContentTypeGuid = BITNEWSLETTEREDITION_CONTENT_TYPE_GUID; @@ -51,20 +57,20 @@ class BitNewsletterEdition extends LibertyMime { $this->mAdminContentPerm = 'p_newsletters_admin'; } - function verify( &$pParamHash ) { + public function verify( &$pParamHash ): bool { if( @$this->verifyId( $pParamHash['nl_content_id'] ) ) { $pParamHash['edition_store']["nl_content_id"] = $pParamHash['nl_content_id']; } else { - $this->mErrors['nl_content_id'] = tra( 'No newsletter was selected for this edition.' ); + $this->mErrors['nl_content_id'] = KernelTools::tra( 'No newsletter was selected for this edition.' ); } $pParamHash['edition_store']['is_draft'] = !empty( $pParamHash['is_draft'] ) ? 'y' : NULL; $pParamHash['edition_store']['reply_to'] = !empty( $pParamHash['reply_to'] ) ? $pParamHash['reply_to'] : NULL; - return( count( $this->mErrors ) == 0 ); + return count( $this->mErrors ) == 0; } - function store( &$pParamHash ) { + public function store( &$pParamHash ): bool { if( $this->verify( $pParamHash ) ) { $this->mDb->StartTrans(); if( parent::store( $pParamHash ) ) { @@ -83,11 +89,11 @@ class BitNewsletterEdition extends LibertyMime { return( count( $this->mErrors ) == 0 ); } - function load( $pContentId = NULL, $pPluginParams = NULL ) { + public function load( $pContentId = NULL, $pPluginParams = NULL ) { if( $this->verifyId( $this->mEditionId ) || $this->verifyId( $this->mContentId ) ) { global $gBitSystem; - $bindVars = array(); $selectSql = ''; $joinSql = ''; $whereSql = ''; + $bindVars = []; $selectSql = ''; $joinSql = ''; $whereSql = ''; $lookupColumn = $this->verifyId( $this->mEditionId )? 'edition_id' : 'content_id'; $lookupId = $this->verifyId( $this->mEditionId )? $this->mEditionId : $this->mContentId; @@ -113,15 +119,15 @@ class BitNewsletterEdition extends LibertyMime { return( count( $this->mInfo ) ); } - function isValid() { + public function isValid() { return( $this->verifyId( $this->mEditionId ) ); } /** * Generate a valid url for the Newsletter Edition * - * @param object PostId of the item to use - * @return object Url String + * @param array $pParamHash PostId of the item to use + * @return string Url String */ public static function getDisplayUrlFromHash( &$pParamHash ) { $ret = NULL; @@ -139,10 +145,10 @@ class BitNewsletterEdition extends LibertyMime { } - function getList( &$pListHash ) { + public static function getList( &$pListHash ) { global $gBitDb; - $bindVars = array(); + $bindVars = []; parent::prepGetList( $pListHash ); $mid = ''; @@ -179,12 +185,12 @@ class BitNewsletterEdition extends LibertyMime { return $ret; } - function expunge() { + public function expunge(): bool { $ret = FALSE; if( $this->isValid() ) { $this->mDb->StartTrans(); $query = "DELETE FROM `".BIT_DB_PREFIX."newsletters_editions` WHERE `content_id`=?"; - $result = $this->mDb->query( $query, array( $this->mContentId ) ); + $result = $this->mDb->query( $query, [ $this->mContentId ] ); if( LibertyMime::expunge() ) { $ret = TRUE; $this->mDb->CompleteTrans(); @@ -195,21 +201,21 @@ class BitNewsletterEdition extends LibertyMime { return $ret; } - function isDraft() { - return( $this->getField( 'is_draft' ) ); + public function isDraft() { + return $this->getField( 'is_draft' ); } - function getRecipients( $pGroupArray, $validated = TRUE, $pRequeue = FALSE ) { + public function getRecipients( $pGroupArray, $validated = TRUE, $pRequeue = FALSE ) { global $gBitUser; - $ret = array(); + $ret = []; if( is_array( $pGroupArray ) ) { foreach( $pGroupArray as $groupId ) { - $ret = array_merge( $ret, $gBitUser->getGroupUserData( $groupId, array( 'email', 'uu.user_id', 'login', 'real_name' ) ) ); + $ret = array_merge( $ret, $gBitUser->getGroupUserData( $groupId, [ 'email', 'uu.user_id', 'login', 'real_name' ] ) ); } if ( array_search( 'send_subs', $pGroupArray ) !== false ) { $valid = ""; - $bindvars = array( $this->mNewsletter->mNewsletterId ); + $bindvars = [ $this->mNewsletter->mNewsletterId ]; if ($validated) { $valid = " AND `is_valid`=?"; $bindvars[] = 'y'; @@ -224,23 +230,21 @@ class BitNewsletterEdition extends LibertyMime { } if( !$pRequeue ) { $query = "SELECT `email`, `user_id` FROM `".BIT_DB_PREFIX."mail_queue` WHERE `content_id`=?"; - if( $dupes = $this->mDb->getAssoc( $query, array( $this->mContentId ) ) ) { - $ret = array_diff_keys( $ret, $dupes ); + if( $dupes = $this->mDb->getAssoc( $query, [ $this->mContentId ] ) ) { + $ret = KernelTools::array_diff_keys( $ret, $dupes ); } } } return $ret; } - function render() { + public function render() { global $gBitSmarty; $ret = NULL; if( $this->isValid() ) { - $gBitSmarty->assignByRef( 'gContent', $this ); + $gBitSmarty->assign( 'gContent', $this ); $ret = $gBitSmarty->fetch( 'bitpackage:newsletters/view_edition.tpl' ); } return $ret; } } - -?> diff --git a/includes/classes/BitNewsletterMailer.php b/includes/classes/BitNewsletterMailer.php index 18f298c..fcea035 100644 --- a/includes/classes/BitNewsletterMailer.php +++ b/includes/classes/BitNewsletterMailer.php @@ -21,7 +21,11 @@ /** * required setup */ -require_once( NEWSLETTERS_PKG_CLASS_PATH.'BitNewsletter.php' ); +namespace Bitweaver\Newsletters; +use Bitweaver\BitBase; +use Bitweaver\Liberty\LibertyContent; +use Bitweaver\Users\RoleUser; + require_once( UTIL_PKG_INCLUDE_PATH.'phpmailer/class.phpmailer.php' ); /** @@ -29,36 +33,34 @@ require_once( UTIL_PKG_INCLUDE_PATH.'phpmailer/class.phpmailer.php' ); */ class BitNewsletterMailer { // Set default variables for all new objects - var $From; - var $FromName; - var $Host; - var $Mailer; // Alternative to IsSMTP() - var $WordWrap; - function BitNewsletterMailer () { + public $From; + public $FromName; + public $Host; + public $Mailer; // Alternative to IsSMTP() + public $WordWrap; + public $mDb; + public function BitNewsletterMailer () { global $gBitDb, $gBitSystem, $gBitLanguage; $this->mDb = $gBitDb; } // Replace the default error_handler - function error_handler( $msg ) { + public function error_handler( $msg ) { global $gBitDb; - bit_error_handler( NULL, NULL, NULL, "FULFILLMENT ERROR: MISSSING PDF for ORDER $pOrderId CID ".$prod->mInfo['related_content_id'], $pdfInfo['pdf_file'], '', $prod->mDb ); - print("My Site Error"); - print("Description:"); + + \Bitweaver\bit_error_handler( NULL, NULL, NULL, "FULFILLMENT ERROR: MISSSING PDF for ORDER" ); // $pOrderId CID ".$prod->mInfo['related_content_id'], $pdfInfo['pdf_file'] , '', $prod->mDb ); + print "My Site Error"; + print "Description:"; printf("%s", $msg); exit; } - function isRecipientQueued( $pRecipientMixed, $pContentId ) { - if( BitBase::verifyId( $pRecipientMixed ) ) { - $lookupCol = 'user_id'; - } else { - $lookupCol = 'email'; - } - return( $this->mDb->getOne( "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."mail_queue` WHERE `content_id`=? AND `$lookupCol`=?", array( $pContentId, $pRecipientMixed ) ) ); + public function isRecipientQueued( $pRecipientMixed, $pContentId ) { + $lookupCol = BitBase::verifyId( $pRecipientMixed ) ? 'user_id' : 'email'; + return $this->mDb->getOne( "SELECT COUNT(*) FROM `" . BIT_DB_PREFIX . "mail_queue` WHERE `content_id`=? AND `$lookupCol`=?", [ $pContentId, $pRecipientMixed ] ); } - function queueRecipients( $pContentId, $pNewsletterContentId, $pRecipients, $pRequeue=FALSE ) { + public function queueRecipients( $pContentId, $pNewsletterContentId, $pRecipients, $pRequeue=FALSE ) { $ret = 0; if( !empty( $pRecipients ) && BitBase::verifyId( $pContentId ) ) { $queueTime = time(); @@ -77,7 +79,7 @@ class BitNewsletterMailer { $this->mDb->associateInsert( BIT_DB_PREFIX.'mail_queue', $insertHash ); $ret++; } elseif( empty( $unsub ) && $pRequeue ) { - $bindVars = array( $queueTime, $pContentId ); + $bindVars = [ $queueTime, $pContentId ]; if( !empty( $pRecipients[$email]['user_id'] ) ) { $lookupCol = 'user_id'; $bindVars[] = $pRecipients[$email]['user_id']; @@ -85,7 +87,7 @@ class BitNewsletterMailer { $lookupCol = 'email'; $bindVars[] = $email; } - $rs = $this->mDb->query( "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `queue_date`=?, `begin_date`=NULL, `sent_date`=NULL, `last_read_date`=NULL, `mail_error`=NULL, `hits`=0 WHERE `content_id`=? AND `$lookupCol`=?", array( $bindVars ) ); + $rs = $this->mDb->query( "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `queue_date`=?, `begin_date`=NULL, `sent_date`=NULL, `last_read_date`=NULL, `mail_error`=NULL, `hits`=0 WHERE `content_id`=? AND `$lookupCol`=?", [ $bindVars ] ); $ret++; } } @@ -94,7 +96,7 @@ class BitNewsletterMailer { } - function tendQueue() { + public function tendQueue() { $this->mDb->StartTrans(); $query = "SELECT * FROM `".BIT_DB_PREFIX."mail_queue` mq @@ -110,21 +112,21 @@ class BitNewsletterMailer { $this->mDb->CompleteTrans(); } - function sendQueue( $pQueueMixed ) { + public function sendQueue( $pQueueMixed ) { global $gBitSmarty, $gBitSystem, $gBitLanguage; - static $body = array(); + static $body = []; if( is_array( $pQueueMixed ) ) { $pick = $pQueueMixed; } elseif( is_numeric( $pQueueMixed ) ) { - $pick = $this->mDb->GetRow( "SELECT * FROM `".BIT_DB_PREFIX."mail_queue` mq WHERE `mail_queue_id` = ? ".$this->mDb->SQLForUpdate(), array( $pQueueMixed ) ); + $pick = $this->mDb->GetRow( "SELECT * FROM `".BIT_DB_PREFIX."mail_queue` mq WHERE `mail_queue_id` = ? ".$this->mDb->SQLForUpdate(), [ $pQueueMixed ] ); } if( !empty( $pick ) ) { $startTime = microtime( TRUE ); - $this->mDb->query( "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `begin_date`=? WHERE `mail_queue_id` = ? ", array( time(), $pick['mail_queue_id'] ) ); + $this->mDb->query( "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `begin_date`=? WHERE `mail_queue_id` = ? ", [ time(), $pick['mail_queue_id'] ] ); if( !empty( $pick['user_id'] ) ) { - $userHash = $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."users_users` WHERE `user_id`=?", array( $pick['user_id'] ) ); - $pick['full_name'] = BitUser::getDisplayName( FALSE, $userHash ); + $userHash = $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."users_users` WHERE `user_id`=?", [ $pick['user_id'] ] ); + $pick['full_name'] = RoleUser::getDisplayNameFromHash( $userHash ); } else { $pick['full_name'] = NULL; } @@ -138,7 +140,7 @@ class BitNewsletterMailer { $body[$pick['content_id']]['reply_to'] = $content->getField( 'reply_to', $gBitSystem->getConfig( 'site_sender_email', $_SERVER['SERVER_ADMIN'] ) ); $body[$pick['content_id']]['object'] = $content; } else { - bit_error_log( $this->mErrors ); + \Bitweaver\bit_error_log( $content->mErrors ); } // $content[$pick['content_id']] = LibertyBase::getLibertyObject(); } @@ -147,7 +149,7 @@ class BitNewsletterMailer { $unsub = $this->getUnsubscription( $pick['email'], $pick['nl_content_id'] ); if( !empty( $unsub ) ) { print " SKIPPED (unsubscribed) <br/>\n"; - $this->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_queue` WHERE `mail_queue_id`=?", array( $pick['mail_queue_id'] ) ); + $this->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_queue` WHERE `mail_queue_id`=?", [ $pick['mail_queue_id'] ] ); } elseif( !empty( $body[$pick['content_id']] ) ) { $pick['url_code'] = md5( $pick['content_id'].$pick['email'].$pick['queue_date'] ); $unsub = ''; @@ -162,7 +164,7 @@ class BitNewsletterMailer { $htmlBody = $gBitSmarty->fetch( 'bitpackage:newsletters/mail_edition.tpl' ); $htmlBody = bit_add_clickthrough( $htmlBody, $pick['url_code'] ); - $mailer = new PHPMailer(); + $mailer = new \PHPMailer(); if( $gBitSystem->getConfig( 'bitmailer_errors_to' ) ) { $mailer->Sender = $gBitSystem->getConfig( 'bitmailer_errors_to' ); $mailer->addCustomHeader( "Errors-To: ".$gBitSystem->getConfig( 'bitmailer_errors_to' ) ); @@ -193,10 +195,10 @@ class BitNewsletterMailer { if( $mailer->Send() ) { print " SENT ".round( microtime( TRUE ) - $startTime, 2)." secs<br/>\n"; flush(); $updateQuery = "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `sent_date`=?,`url_code`=? WHERE `content_id`=? AND `email`=?"; - $this->mDb->query( $updateQuery, array( time(), $pick['url_code'], $pick['content_id'], $pick['email'] ) ); + $this->mDb->query( $updateQuery, [ time(), $pick['url_code'], $pick['content_id'], $pick['email'] ] ); } else { $updateQuery = "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `mail_error`=?,`sent_date`=? WHERE `content_id`=? AND `email`=?"; - $this->mDb->query( $updateQuery, array( $mailer->ErrorInfo, time(), $pick['content_id'], $pick['email'] ) ); + $this->mDb->query( $updateQuery, [ $mailer->ErrorInfo, time(), $pick['content_id'], $pick['email'] ] ); $pick['error'] = $mailer->ErrorInfo; $this->logError( $pick ); } @@ -204,14 +206,14 @@ class BitNewsletterMailer { } } - function trackMail( $pUrlCode ) { + public function trackMail( $pUrlCode ) { global $gBitDb; $query = "UPDATE `".BIT_DB_PREFIX."mail_queue` SET `hits`=`hits`+1, `last_read_date`=?, `last_read_ip`=? WHERE `url_code`=? "; - $gBitDb->query( $query, array( time(), $_SERVER['REMOTE_ADDR'], $pUrlCode ) ); + $gBitDb->query( $query, [ time(), $_SERVER['REMOTE_ADDR'], $pUrlCode ] ); } - function logError( $pInfo ) { - if( !empty( $pInfo['url_code'] ) && !$this->mDb->getOne( "SELECT `url_code` FROM `".BIT_DB_PREFIX."mail_errors` WHERE `url_code`=?", array( $pInfo['url_code'] ) ) ) { + public function logError( $pInfo ) { + if( !empty( $pInfo['url_code'] ) && !$this->mDb->getOne( "SELECT `url_code` FROM `".BIT_DB_PREFIX."mail_errors` WHERE `url_code`=?", [ $pInfo['url_code'] ] ) ) { $store['url_code'] = $pInfo['url_code']; $store['user_id'] = !empty( $pInfo['user_id'] ) ? $pInfo['user_id'] : NULL; $store['content_id'] = !empty( $pInfo['content_id'] ) ? $pInfo['content_id'] : NULL; @@ -225,7 +227,7 @@ class BitNewsletterMailer { // Looks up the code from the url to determine if the unsubscribe URL is valid. // Can be statically called - function lookupSubscription( $pLookup ) { + public function lookupSubscription( $pLookup ) { global $gBitDb; $ret = NULL; if( is_array( $pLookup ) ) { @@ -234,14 +236,14 @@ class BitNewsletterMailer { INNER JOIN `".BIT_DB_PREFIX."liberty_content_types` tct ON( tct.`content_type_guid`=lc.`content_type_guid` ) LEFT OUTER JOIN `".BIT_DB_PREFIX."users_users` uu ON( mq.`user_id`=uu.`user_id` ) WHERE mq.`".key( $pLookup )."`=? "; - $ret = $gBitDb->getRow( $query, array( current( $pLookup ) ) ); + $ret = $gBitDb->getRow( $query, [ current( $pLookup ) ] ); } return( $ret ); } // Accepts a single row has containing the column of mail_subscriptions as the key to lookup the unsubscription info // Can be statically called - function getUnsubscriptions( $pMixed ) { + public function getUnsubscriptions( $pMixed ) { global $gBitDb; $ret = NULL; if( is_array( $pMixed ) ) { @@ -257,20 +259,20 @@ class BitNewsletterMailer { return( $ret ); } - function getUnsubscription( $pEmail, $pNewsletterContentId ) { + public function getUnsubscription( $pEmail, $pNewsletterContentId ) { global $gBitDb; - return $gBitDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."mail_subscriptions` ms LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON (uu.`user_id`=ms.`user_id`) WHERE (ms.`content_id`=? OR `unsubscribe_all`='y') AND (ms.`email`=? OR uu.`email`=?)", array( $pNewsletterContentId, $pEmail, $pEmail ) ); + return $gBitDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."mail_subscriptions` ms LEFT JOIN `".BIT_DB_PREFIX."users_users` uu ON (uu.`user_id`=ms.`user_id`) WHERE (ms.`content_id`=? OR `unsubscribe_all`='y') AND (ms.`email`=? OR uu.`email`=?)", [ $pNewsletterContentId, $pEmail, $pEmail ] ); } - function storeSubscriptions( $pSubHash ) { + public static function storeSubscriptions( $pSubHash ) { global $gBitSystem, $gBitDb; $ret = FALSE; $query = "delete from `".BIT_DB_PREFIX."mail_subscriptions` where `".key( $pSubHash['sub_lookup'] )."`=?"; - $result = $gBitDb->query($query, array( current( $pSubHash['sub_lookup'] ) ) ); + $result = $gBitDb->query($query, [ current( $pSubHash['sub_lookup'] ) ] ); $ret = TRUE; if( !empty( $pSubHash['unsub_content'] ) ) { foreach( $pSubHash['unsub_content'] as $conId ) { - $storeHash = array(); + $storeHash = []; $storeHash['content_id'] = $conId; $storeHash['unsubscribe_all'] = !empty( $pSubHash['unsubscribe_all'] ) ? 'y' : NULL; $storeHash['unsubscribe_date'] = time(); @@ -282,7 +284,7 @@ class BitNewsletterMailer { } } elseif( !empty( $pSubHash['unsubscribe_all'] ) ) { // unsub all with no reference content_id - $storeHash = array(); + $storeHash = []; $storeHash['unsubscribe_all'] = !empty( $pSubHash['unsubscribe_all'] ) ? 'y' : NULL; $storeHash['unsubscribe_date'] = time(); $storeHash[key( $pSubHash['sub_lookup'] )] = current( $pSubHash['sub_lookup'] ); @@ -294,8 +296,8 @@ class BitNewsletterMailer { return $ret; } - function getQueue( &$pListHash ) { - $ret = array(); + public function getQueue( &$pListHash ) { + $ret = []; LibertyContent::prepGetList( $pListHash ); @@ -312,22 +314,22 @@ class BitNewsletterMailer { return $ret; } - function expungeQueueRow( $pQueueId ) { + public function expungeQueueRow( $pQueueId ) { if( BitBase::verifyId( $pQueueId ) ) { - $this->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_queue` WHERE `mail_queue_id`=?", array( $pQueueId ) ); + $this->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."mail_queue` WHERE `mail_queue_id`=?", [ $pQueueId ] ); } } - function storeClickthrough( $pUrlCode ) { + public static function storeClickthrough( $pUrlCode ) { global $gBitDb; $uri = substr( preg_replace( '/[&\?]?ct=[a-z0-9]{32}/', '', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ), 0, 250 ); $query = "SELECT mc.`clicks`, mq.`content_id`, mq.`user_id`, mc.`clicked_url` FROM `".BIT_DB_PREFIX."mail_queue` mq LEFT JOIN `".BIT_DB_PREFIX."mail_clickthrough` mc ON (mq.`user_id`=mc.`user_id` AND mq.`content_id`=mc.`content_id` AND mc.`clicked_url`=?) WHERE `url_code`=?"; - if( $row = $gBitDb->getRow( $query, array( $uri, $pUrlCode ) ) ) { + if( $row = $gBitDb->getRow( $query, [ $uri, $pUrlCode ] ) ) { if( $row['clicked_url'] ) { - $gBitDb->query( "UPDATE `".BIT_DB_PREFIX."mail_clickthrough` SET `clicks`=`clicks`+1 WHERE `user_id`=? AND `content_id`=? AND `clicked_url`=? ", array( $row['user_id'], $row['content_id'], $row['clicked_url'] ) ); + $gBitDb->query( "UPDATE `".BIT_DB_PREFIX."mail_clickthrough` SET `clicks`=`clicks`+1 WHERE `user_id`=? AND `content_id`=? AND `clicked_url`=? ", [ $row['user_id'], $row['content_id'], $row['clicked_url'] ] ); } else { $row['clicks'] = 1; $row['clicked_url'] = $uri; @@ -362,5 +364,3 @@ function process_clickthrough_match( $matches ) { } return $ret; } - -?> |
