Skip to content

Commit

Permalink
Fix more methods with some confusion over use of variable $data that …
Browse files Browse the repository at this point in the history
…caused bugs with calls to plugin events.
  • Loading branch information
ftruscot committed Mar 31, 2013
1 parent 16d0724 commit f6145b1
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions nucleus/libs/BLOG.php
Expand Up @@ -618,11 +618,11 @@ function showArchiveList($template, $mode = 'month', $limit = 0) {
}

$template =& $manager->getTemplate($template);
$data['blogid'] = $this->getID();
$archdata['blogid'] = $this->getID();

$tplt = isset($template['ARCHIVELIST_HEADER']) ? $template['ARCHIVELIST_HEADER']
: '';
echo TEMPLATE::fill($tplt, $data);
echo TEMPLATE::fill($tplt, $archdata);

$query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) as Day FROM '.sql_table('item')
. ' WHERE iblog=' . $this->getID()
Expand Down Expand Up @@ -651,33 +651,33 @@ function showArchiveList($template, $mode = 'month', $limit = 0) {
if ($mode == 'day') {
$archivedate = date('Y-m-d',$current->itime);
$archive['day'] = date('d',$current->itime);
$data['day'] = date('d',$current->itime);
$data['month'] = date('m',$current->itime);
$archive['month'] = $data['month'];
$archdata['day'] = date('d',$current->itime);
$archdata['month'] = date('m',$current->itime);
$archive['month'] = $archdata['month'];
} elseif ($mode == 'year') {
$archivedate = date('Y',$current->itime);
$data['day'] = '';
$data['month'] = '';
$archdata['day'] = '';
$archdata['month'] = '';
$archive['day'] = '';
$archive['month'] = '';
} else {
$archivedate = date('Y-m',$current->itime);
$data['month'] = date('m',$current->itime);
$archive['month'] = $data['month'];
$data['day'] = '';
$archdata['month'] = date('m',$current->itime);
$archive['month'] = $archdata['month'];
$archdata['day'] = '';
$archive['day'] = '';
}

$data['year'] = date('Y',$current->itime);
$archive['year'] = $data['year'];
$data['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);
$archdata['year'] = date('Y',$current->itime);
$archive['year'] = $archdata['year'];
$archdata['archivelink'] = createArchiveLink($this->getID(),$archivedate,$linkparams);

$data = array(
'listitem' => &$data
'listitem' => &$archdata
);
$manager->notify('PreArchiveListItem', $data);

$temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);
$temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$archdata);
echo strftime($temp,$current->itime);

}
Expand All @@ -686,7 +686,7 @@ function showArchiveList($template, $mode = 'month', $limit = 0) {

$tplt = isset($template['ARCHIVELIST_FOOTER']) ? $template['ARCHIVELIST_FOOTER']
: '';
echo TEMPLATE::fill($tplt, $data);
echo TEMPLATE::fill($tplt, $archdata);
}


Expand Down Expand Up @@ -858,22 +858,22 @@ function showBlogList($template, $bnametype, $orderby, $direction) {
$query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY '.$orderby.' '.$direction;
$res = sql_query($query);

while ($data = sql_fetch_assoc($res)) {
while ($bldata = sql_fetch_assoc($res)) {

$list = array();

// $list['bloglink'] = createLink('blog', array('blogid' => $data['bnumber']));
$list['bloglink'] = createBlogidLink($data['bnumber']);
$list['bloglink'] = createBlogidLink($bldata['bnumber']);

$list['blogdesc'] = $data['bdesc'];
$list['blogdesc'] = $bldata['bdesc'];

$list['blogurl'] = $data['burl'];
$list['blogurl'] = $bldata['burl'];

if ($bnametype=='shortname') {
$list['blogname'] = $data['bshortname'];
$list['blogname'] = $bldata['bshortname'];
}
else { // all other cases
$list['blogname'] = $data['bname'];
$list['blogname'] = $bldata['bname'];
}

$data = array(
Expand Down

0 comments on commit f6145b1

Please sign in to comment.