summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2012-04-18 17:01:20 -0400
committerChristian Fowler <spider@viovio.com>2012-04-18 17:01:20 -0400
commitc75e4fb47bb6107db848d6cd86f2dfd52419c1c3 (patch)
treed6b006a1120813c032a0a52c93d5c6c3e01190ca
parent52b1f33dca309d3d3d38568d7e354b12e9bb7a72 (diff)
downloadnewsletters-c75e4fb47bb6107db848d6cd86f2dfd52419c1c3.tar.gz
newsletters-c75e4fb47bb6107db848d6cd86f2dfd52419c1c3.tar.bz2
newsletters-c75e4fb47bb6107db848d6cd86f2dfd52419c1c3.zip
major migration of getDisplayUrl to ->getDisplayUrl and ::getDisplayUrlFromHash
-rw-r--r--BitNewsletter.php11
-rw-r--r--BitNewsletterEdition.php13
2 files changed, 9 insertions, 15 deletions
diff --git a/BitNewsletter.php b/BitNewsletter.php
index e4e86ea..668a6f9 100644
--- a/BitNewsletter.php
+++ b/BitNewsletter.php
@@ -310,7 +310,7 @@ class BitNewsletter extends LibertyContent {
$ret = array();
while( $res = $result->fetchRow() ) {
- $res['display_url'] = BitNewsletter::getDisplayUrl( $res['nl_id'] );
+ $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'] ) );
$ret[$res['content_id']] = $res;
@@ -379,17 +379,14 @@ class BitNewsletter extends LibertyContent {
* @param object $pNewsletterId of the item to use
* @return object Url String
*/
- function getDisplayUrl( $pNewsletterId=NULL ) {
+ function getDisplayUrlFromHash( $pHash ) {
global $gBitSystem;
$ret = NULL;
- if( !BitBase::verifyId( $pNewsletterId ) ) {
- $pNewsletterId = $this->mNewsletterId;
- }
- if( BitBase::verifyId( $pNewsletterId ) ) {
+ if( BitBase::verifyId( $pHash['newsletter_id'] ) ) {
if( $gBitSystem->isFeatureActive( 'pretty_urls' ) ) {
$ret = NEWSLETTERS_PKG_URL.$pNewsletterId;
} else {
- $ret = NEWSLETTERS_PKG_URL.'index.php?nl_id='.$pNewsletterId;
+ $ret = NEWSLETTERS_PKG_URL.'index.php?nl_id='.$pHash['newsletter_id'];
}
} else {
$ret = NEWSLETTERS_PKG_URL.'index.php';
diff --git a/BitNewsletterEdition.php b/BitNewsletterEdition.php
index 3f1ff20..c841ba5 100644
--- a/BitNewsletterEdition.php
+++ b/BitNewsletterEdition.php
@@ -123,17 +123,14 @@ class BitNewsletterEdition extends LibertyMime {
* @param object PostId of the item to use
* @return object Url String
*/
- function getDisplayUrl( $pEditionId=NULL ) {
+ function getDisplayUrlFromHash( $pHash ) {
$ret = NULL;
- if( !BitBase::verifyId( $pEditionId ) ) {
- $pEditionId = $this->mEditionId;
- }
global $gBitSystem;
- if( BitBase::verifyId( $pEditionId ) ) {
+ if( BitBase::verifyId( $pHash['edition_id'] ) ) {
if( $gBitSystem->isFeatureActive( 'pretty_urls' ) ) {
- $ret = NEWSLETTERS_PKG_URL.'edition/'.$pEditionId;
+ $ret = NEWSLETTERS_PKG_URL.'edition/'.$pHash['edition_id'];
} else {
- $ret = NEWSLETTERS_PKG_URL.'edition.php?edition_id='.$pEditionId;
+ $ret = NEWSLETTERS_PKG_URL.'edition.php?edition_id='.$pHash['edition_id'];
}
} else {
$ret = NEWSLETTERS_PKG_URL.'edition.php';
@@ -170,7 +167,7 @@ class BitNewsletterEdition extends LibertyMime {
$query_cant = "select count(*) from `".BIT_DB_PREFIX."newsletters` n INNER JOIN `".BIT_DB_PREFIX."newsletters_editions` ne ON(n.`content_id`=ne.`nl_content_id`) $mid";
$ret = $gBitDb->getAssoc( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] );
foreach( array_keys( $ret ) as $k ) {
- $ret[$k]['display_url'] = BitNewsletterEdition::getDisplayUrl( $k );
+ $ret[$k]['display_url'] = BitNewsletterEdition::getDisplayUrlFromHash( $ret[$k] );
// remove formating tags
$data = preg_replace( '/{[^{}]*}/', '', $ret[$k]['data'] );
// $ret[$k]['parsed'] = BitNewsletterEdition::parseData( $data, $ret[$k]['format_guid'] );