/** * Shows a list of all blogs in the system using a given template * ordered by number, name, shortname or description * in ascending or descending order */ function showBlogList($template, $bnametype, $orderby, $direction) { global $CONF, $manager; switch ($orderby) { case 'number': $orderby = 'bnumber'; break; case 'name': $orderby = 'bname'; break; case 'shortname': $orderby = 'bshortname'; break; case 'description': $orderby = 'bdesc'; break; default: $orderby = 'bnumber'; break; } $direction = strtolower($direction); switch ($direction) { case 'asc': $direction = 'ASC'; break; case 'desc': $direction = 'DESC'; break; default: $direction = 'ASC'; break; } $template =& $manager->getTemplate($template); echo TEMPLATE::fill(isset($template['BLOGLIST_HEADER']) ? $template['BLOGLIST_HEADER'] : null, array('sitename' => $CONF['SiteName'], 'siteurl' => $CONF['IndexURL'])); $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)) { $list = array(); // $list['bloglink'] = createLink('blog', array('blogid' => $data['bnumber'])); $list['bloglink'] = createBlogidLink($data['bnumber']); $list['blogdesc'] = $data['bdesc']; $list['blogurl'] = $data['burl']; if ($bnametype == 'shortname') { $list['blogname'] = $data['bshortname']; } else { // all other cases $list['blogname'] = $data['bname']; } $manager->notify('PreBlogListItem', array('listitem' => &$list)); echo TEMPLATE::fill(isset($template['BLOGLIST_LISTITEM']) ? $template['BLOGLIST_LISTITEM'] : null, $list); } sql_free_result($res); echo TEMPLATE::fill(isset($template['BLOGLIST_FOOTER']) ? $template['BLOGLIST_FOOTER'] : null, array('sitename' => $CONF['SiteName'], 'siteurl' => $CONF['IndexURL'])); }
function doSkinVar($skinType, $numberOfWritebacks = 5, $filter = '', $TBorCm = 'all', $numberOfCharacters = 60, $numberOfTitleCharacters = 40, $toadd = "...") { global $manager, $CONF, $blog; if (!is_numeric($numberOfWritebacks)) { $filter = $numberOfWritebacks; $numberOfWritebacks = 5; // defaults to 5 } $b =& $manager->getBlog($CONF['DefaultBlog']); $this->defaultblogurl = $b->getURL(); if (!$this->defaultblogurl) { $this->defaultblogurl = $CONF['IndexURL']; } if ($blog) { $b =& $blog; } $blogid = $b->getID(); //for select $filter = trim($filter); if ($filter == 'current') { $filter = 'cblog = ' . $blogid; } elseif (strstr($filter, '=')) { $filter = str_replace('=', '', $filter); $filter = ' cblog IN(' . str_replace('/', ',', $filter) . ')'; } elseif (strstr($filter, '<>')) { $filter = str_replace('<>', '', $filter); $filter = ' cblog <> ' . str_replace('/', ' AND cblog <> ', $filter); } setlocale(LC_TIME, $this->getOption('timelocale')); $arr_res = array(); if ($TBorCm != 't') { $join = ''; $query = 'SELECT' . ' c.cnumber as commentid,' . ' c.cuser as commentator,' . ' c.cbody as commentbody,' . ' c.citem as itemid,' . ' c.cmember as memberid,' . ' SUBSTRING(c.ctime, 6, 5) as commentday,' . ' UNIX_TIMESTAMP(c.ctime) as ctimest'; if ($EzComment2 = $this->pluginCheck('EzComment2')) { if (method_exists($EzComment2, 'getTemplateParts')) { $query .= ', s.comid as cid, ' . 's.secflg as secret, ' . 's.module as modname, ' . 's.userID as identity '; $join = ' LEFT OUTER JOIN ' . sql_table('plug_ezcomment2') . ' as s ' . ' ON c.cnumber = s.comid '; } } // select $query .= ' FROM ' . sql_table('comment') . ' as c ' . $join; if ($filter) { $query .= ' WHERE ' . $filter; } $query .= ' ORDER by c.ctime DESC LIMIT 0, ' . $numberOfWritebacks; $comments = sql_query($query); if (sql_num_rows($comments)) { while ($row = sql_fetch_object($comments)) { $content = (array) $row; $tempBody = strip_tags($content['commentbody']); $tempBody = htmlspecialchars($tempBody, ENT_QUOTES, _CHARSET); $tempBody = shorten($tempBody, $numberOfCharacters, $toadd); $tempBody = htmlspecialchars($tempBody, ENT_QUOTES, _CHARSET); $tempBody = str_replace("\r\n", ' ', $tempBody); $tempBody = str_replace("&", '&', $tempBody); $tempBody = str_replace(">", '>', $tempBody); $tempBody = str_replace("<", '<', $tempBody); $content['commentdate'] = strftime($this->getOption('cmdateformat'), $content['ctimest']); $content['commentbody'] = str_replace("&amp;", '&', $tempBody); if (!empty($row->memberid)) { $mem = new MEMBER(); $mem->readFromID(intval($row->memberid)); $content['commentator'] = $mem->getRealName(); } if ($EzComment2) { $bid = intval(getBlogIDFromItemID(intval($comment['itemid']))); if ($EzComment2->getBlogOption($bid, 'secret') == 'yes') { $b = $manager->getBlog($bid); global $member; $judge = $EzComment2->setSecretJudge($bid, $member, $b); } } if ($judge && $content['secret']) { $content = $EzComment2->JudgementCommentSecrets($content, $judge); } /* $cid = $row->cnumber; $ct = $row->ctimest; $ctst = date("y-m-d H:i",$ct); $text = strip_tags($row->cbody); $text = htmlspecialchars($text, ENT_QUOTES,_CHARSET); $ctext = shorten($text,$numberOfCharacters,$toadd); if (!$row->cmember) $myname = $row->cuser; else { $mem = new MEMBER; $mem->readFromID(intval($row->cmember)); $myname = $mem->getRealName(); }*/ // $itemlink = $this->_createItemLink($row->citem, ''); // $arr_res[$ct] = "<li>♣<a href=\"".$itemlink."#c".$cid."\">$ctst|".$myname.">".$ctext."</a></li>" ; $itemlink = $this->_createItemLink($content['itemid']); $content['itemlink'] = $itemlink; $arr_res[$content['ctimest']] = TEMPLATE::fill($this->getOption('cmttemplate'), $content); } } } //========================= if ($manager->pluginInstalled('NP_TrackBack') && $TBorCm != 'c') { $query = 'SELECT' . ' t.id as tbid,' . ' t.title as entrytitle,' . ' t.excerpt as expect,' . ' t.url as tburl,' . ' t.tb_id as trackbackid,' . ' t.blog_name as blogname,' . ' t.timestamp as tbdate,' . ' SUBSTRING(t.timestamp, 6, 5) as tbday,' . ' UNIX_TIMESTAMP(t.timestamp) as ttimest' . ' FROM ' . sql_table('plugin_tb') . ' t,' . sql_table('item') . ' i' . ' WHERE t.tb_id = i.inumber'; if ($this->checkTBVersion()) { $query .= ' and t.block = 0'; } if ($filter) { $tfilter = str_replace('c.cblog', 'i.iblog', $filter); $query .= ' and ' . $tfilter; } $query .= ' ORDER by t.timestamp DESC LIMIT 0, ' . $numberOfWritebacks; $comments = sql_query($query); if (sql_num_rows($comments)) { while ($row = sql_fetch_object($comments)) { $content = (array) $row; $entrytitle = strip_tags($content['entrytitle']); $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES, _CHARSET); $entrytitle = shorten($entrytitle, $numberOfCharacters, $toadd); $entrytitle = htmlspecialchars($entrytitle, ENT_QUOTES, _CHARSET); $content['entrytitle'] = $entrytitle; $content['expect'] = str_replace("\r\n", ' ', $content['expect']); $blogname = htmlspecialchars($content['blogname'], ENT_QUOTES, _CHARSET); $content['blogname'] = $blogname; $content['tbdate'] = strftime($this->getOption('tbdateformat'), $content['ttimest']); /* $title = strip_tags($row->title); $title = htmlspecialchars($title, ENT_QUOTES,_CHARSET); $ctitle = shorten($title,$numberOfCharacters,$toadd); $blogname = htmlspecialchars($row->blog_name, ENT_QUOTES,_CHARSET); $tbtime = $row->ttimest; $ttst = date("y-m-d H:i",$tbtime);*/ // $itemlink = $this->_createItemLink($row->tb_id, ''); // $arr_res[$tbtime] = '<li>…<a href="'.$itemlink.'#trackback">'.$ttst.'|'.$blogname.' ping: "'.$ctitle.'"</a></li>'; $itemlink = $this->_createItemLink($content['trackbackid']); $content['itemlink'] = $itemlink; $arr_res[$content['ttimest']] = TEMPLATE::fill($this->getOption('tbktemplate'), $content); } } } //========================= krsort($arr_res); $ress = array_values($arr_res); $show_rescnt = min(intval($numberOfWritebacks), count($arr_res)); switch ($TBorCm) { case 'c': $head = $this->getOption('cmlisthead'); $foot = $this->getOption('cmlistfoot'); break; case 't': $head = $this->getOption('tblisthead'); $foot = $this->getOption('tblistfoot'); break; default: $head = ' <ul class="nobullets"> '; $foot = ' </ul> '; break; } // echo ' <ul class="nobullets"> '; echo $head; for ($j = 0; $j < $show_rescnt; $j++) { echo $ress[$j] . "\n"; } echo $foot; // echo " </ul> "; }
/** * @todo document this */ function _showActivationPage($key, $message = '') { global $manager; // clean up old activation keys MEMBER::cleanupActivationTable(); // get activation info $info = MEMBER::getActivationInfo($key); if (!$info) { $this->error(_ERROR_ACTIVATE); } $mem = MEMBER::createFromId($info->vmember); if (!$mem) { $this->error(_ERROR_ACTIVATE); } $text = ''; $title = ''; $bNeedsPasswordChange = true; switch ($info->vtype) { case 'forgot': $title = _ACTIVATE_FORGOT_TITLE; $text = _ACTIVATE_FORGOT_TEXT; break; case 'register': $title = _ACTIVATE_REGISTER_TITLE; $text = _ACTIVATE_REGISTER_TEXT; break; case 'addresschange': $title = _ACTIVATE_CHANGE_TITLE; $text = _ACTIVATE_CHANGE_TEXT; $bNeedsPasswordChange = false; MEMBER::activate($key); break; } $aVars = array('memberName' => htmlspecialchars($mem->getDisplayName())); $title = TEMPLATE::fill($title, $aVars); $text = TEMPLATE::fill($text, $aVars); $this->pagehead(); echo '<h2>', $title, '</h2>'; echo '<p>', $text, '</p>'; if ($message != '') { echo '<p class="error">', $message, '</p>'; } if ($bNeedsPasswordChange) { ?> <div><form action="index.php" method="post"> <input type="hidden" name="action" value="activatesetpwd" /> <?php $manager->addTicketHidden(); ?> <input type="hidden" name="key" value="<?php echo htmlspecialchars($key); ?> " /> <table><tr> <td><?php echo _MEMBERS_PWD; ?> </td> <td><input type="password" maxlength="40" size="16" name="password" /></td> </tr><tr> <td><?php echo _MEMBERS_REPPWD; ?> </td> <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td> <?php global $manager; $manager->notify('FormExtra', array('type' => 'activation', 'member' => $mem)); ?> </tr><tr> <td><?php echo _MEMBERS_SETPWD; ?> </td> <td><input type='submit' value='<?php echo _MEMBERS_SETPWD_BTN; ?> ' /></td> </tr></table> </form></div> <?php } $this->pagefoot(); }
function sendActivationLink($type, $extra = '') { global $CONF; if (!isset($CONF['ActivationDays'])) { $CONF['ActivationDays'] = 2; } // generate key and URL $key = $this->generateActivationEntry($type, $extra); $url = $CONF['AdminURL'] . 'index.php?action=activate&key=' . $key; // choose text to use in mail switch ($type) { case 'register': $message = _ACTIVATE_REGISTER_MAIL; $title = _ACTIVATE_REGISTER_MAILTITLE; break; case 'forgot': $message = _ACTIVATE_FORGOT_MAIL; $title = _ACTIVATE_FORGOT_MAILTITLE; break; case 'addresschange': $message = _ACTIVATE_CHANGE_MAIL; $title = _ACTIVATE_CHANGE_MAILTITLE; break; default: } // fill out variables in text $aVars = array('siteName' => $CONF['SiteName'], 'siteUrl' => $CONF['IndexURL'], 'memberName' => $this->getDisplayName(), 'activationUrl' => $url, 'activationDays' => $CONF['ActivationDays']); $message = TEMPLATE::fill($message, $aVars); $title = TEMPLATE::fill($title, $aVars); // send mail mb_language('ja'); mb_internal_encoding(_CHARSET); @mb_send_mail($this->getEmail(), $title, $message, 'From: ' . $CONF['AdminEmail']); ACTIONLOG::add(INFO, _ACTIONLOG_ACTIVATIONLINK . ' (' . $this->getDisplayName() . ' / type: ' . $type . ')'); }
function RegistPath($objID, $path, $bid, $oParam, $name, $new = FALSE) { global $CONF; switch ($oParam) { case 'item': case 'member': if (preg_match('/.html$/', $path)) { $path = substr($path, 0, -5); } break; case 'blog': case 'category': case 'subcategory': break; default: return; break; } $bid = intval($bid); $objID = intval($objID); $name = rawurlencode($name); if ($new && $oParam == 'item') { $tque = 'SELECT itime as result FROM %s WHERE inumber = %d'; $itime = quickQuery(sprintf($tque, sql_table('item'), $objID)); list($y, $m, $d, $trush) = sscanf($itime, '%d-%d-%d %s'); $param['year'] = sprintf('%04d', $y); $param['month'] = sprintf('%02d', $m); $param['day'] = sprintf('%02d', $d); $dfItem = $this->getOption('customurl_dfitem'); $ikey = TEMPLATE::fill($dfItem, $param); if ($path == $ikey) { $path = $ikey . '_' . $objID; } } elseif (!$new && strlen($path) == 0) { $del_que = 'DELETE FROM %s WHERE obj_id = %d AND obj_param = "%s"'; sql_query(sprintf($del_que, _CUSTOMURL_TABLE, $objID, $oParam)); $msg = array(0, _DELETE_PATH, $name, _DELETE_MSG); return $msg; exit; } $dotslash = array('.', '/'); $path = str_replace($dotslash, '_', $path); if (!preg_match('/^[-_a-zA-Z0-9]+$/', $path)) { $msg = array(1, _INVALID_ERROR, $name, _INVALID_MSG); return $msg; exit; } $tempPath = $path; if ($oParam == 'item' || $oParam == 'member') { $tempPath .= '.html'; } $conf_que = 'SELECT obj_id FROM %s' . ' WHERE obj_name = "%s"' . ' AND obj_bid = %d' . ' AND obj_param = "%s"' . ' AND obj_id != %d'; $res = sql_query(sprintf($conf_que, _CUSTOMURL_TABLE, $tempPath, $bid, $oParam, $objID)); if ($res && sql_num_rows($res)) { $msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG); $path .= '_' . $objID; } if ($oParam == 'category' && !$msg) { $conf_cat = 'SELECT obj_id FROM %s WHERE obj_name = "%s"' . ' AND obj_param = "blog"'; $res = sql_query(sprintf($conf_cat, _CUSTOMURL_TABLE, $tempPath)); if ($res && sql_num_rows($res)) { $msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG); $path .= '_' . $objID; } } if ($oParam == 'blog' && !$msg) { $conf_blg = 'SELECT obj_id FROM %s WHERE obj_name = "%s"' . ' AND obj_param = "category"'; $res = sql_query(sprintf($conf_blg, _CUSTOMURL_TABLE, $tempPath)); if ($res && sql_num_rows($res)) { $msg = array(0, _CONFLICT_ERROR, $name, _CONFLICT_MSG); $path .= '_' . $objID; } } $newPath = $path; if ($oParam == 'item' || $oParam == 'member') { $newPath .= '.html'; } $query = 'SELECT * FROM %s WHERE obj_id = %d AND obj_param = "%s"'; $res = sql_query(sprintf($query, _CUSTOMURL_TABLE, $objID, $oParam)); $row = sql_fetch_object($res); $pathID = $row->id; if ($pathID) { $query = 'UPDATE %s SET obj_name = "%s" WHERE id = %d'; sql_query(sprintf($query, _CUSTOMURL_TABLE, $newPath, $pathID)); } else { $query = 'INSERT INTO %s (obj_param, obj_name, obj_id, obj_bid)' . ' VALUES ("%s", "%s", %d, %d)'; sql_query(sprintf($query, _CUSTOMURL_TABLE, $oParam, $newPath, $objID, $bid)); } switch ($oParam) { case 'blog': $this->setBlogOption($objID, 'customurl_bname', $path); break; case 'category': $this->setCategoryOption($objID, 'customurl_cname', $path); break; case 'member': $this->setMemberOption($objID, 'customurl_mname', $path); break; default: break; } return $msg; }
function createPopupCode($filename, $width, $height, $text = '') { global $CONF; // select private collection when no collection given if (!strstr($filename, '/')) { $filename = $this->currentItem->authorid . '/' . $filename; } $windowwidth = $width; $windowheight = $height; $vars['rawpopuplink'] = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename, ENT_QUOTES) . "&width={$width}&height={$height}&imagetext=" . urlencode(htmlspecialchars($text)); $vars['popupcode'] = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width={$windowwidth},height={$windowheight}');return false;"; $vars['popuptext'] = htmlspecialchars($text, ENT_QUOTES); $vars['popuplink'] = '<a href="' . $vars['rawpopuplink'] . '" onclick="' . $vars['popupcode'] . '" >' . $vars['popuptext'] . '</a>'; $vars['width'] = $width; $vars['height'] = $height; $vars['text'] = $text; $vars['link'] = htmlspecialchars($CONF['MediaURL'] . $filename, ENT_QUOTES); $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>'; echo TEMPLATE::fill($this->template['POPUP_CODE'], $vars); }
function doSkinVar($skinType, $type = 'list20/1/0/1/4') { // global $ecatid; // echo 'ecat='.$ecatid.'<br />'; // type[0]: type ( + amount (int)) // type[1]: $narrowMode (0/1/2) // type[2]: sortMode (1/2/3/4) // type[3]: Minimum font-sizem(em) 0.5/1/1.5/2... // type[4]: Maximum font-sizem(em) $maxtaglevel = $this->getOption('maxTagLevel'); $mintaglevel = $this->getOption('minTagLevel'); $taglevel = 1; // default if (empty($type)) { $type = 'list20/2/1/1/4'; } $type = explode('/', $type); if (preg_match('@list@i', $type[0])) { $amount = str_ireplace("list", "", $type[0]); $type[0] = 'list'; // keywords="TAG" } elseif (preg_match('@meta@i', $type[0])) { $amount = str_ireplace("meta", "", $type[0]); $type[0] = 'meta'; } // default amount $amount = !empty($amount) ? intval($amount) : 99999999; $defaultType = array('list', '1', '0', '1', '4'); $type = $type + $defaultType; $requestT = $this->getNoDecodeQuery('tag'); if (!empty($requestT)) { $requestT = rawurldecode($requestT); $requestTarray = $this->splitRequestTags($requestT); $reqAND = $requestTarray['and']; if ($requestTarray['or']) { $reqOR = $requestTarray['or']; } } switch ($type[0]) { case 'tag': if ($requestTarray) { $reqAndLink = array(); foreach ($reqAND as $val) { $reqAndLink[] = '<a href="' . $this->creatTagLink($val) . '" title="' . $val . '">' . $val . '</a>'; } $reqANDp = implode('" + "', $reqAndLink); if ($reqOR) { $reqOrLink = array(); foreach ($reqOR as $val) { $reqOrLink[] = '<a href="' . $this->creatTagLink($val) . '" title="' . $val . '">' . $val . '</a>'; } $reqORp = '"</u> or <u>"' . implode('"</u> or <u>"', $reqOrLink); } echo '<h1> Tag for <u>"' . $reqANDp . $reqORp . '"</u></h1>'; } break; // meta keywords="TAG" // and AWS keywords // meta keywords="TAG" // and AWS keywords case 'meta': global $manager, $itemid; $itemid = intval($itemid); if ($type[3] != 'ad') { echo '<meta name="keywords" content="'; $sep = ' '; } elseif ($type[3] == 'ad') { $sep = ' '; } if ($skinType == 'item') { $q = 'SELECT * FROM %s WHERE inum = %d'; $res = sql_query(sprintf($q, _TAGEX_TABLE, $itemid)); while ($o = sql_fetch_object($res)) { $temp_tags_array = preg_split("/[\n,]+/", trim($o->itags)); $temp_tags_count = count($temp_tags_array); for ($i = 0; $i < $temp_tags_count; $i++) { $tag = trim($temp_tags_array[$i]); $taglist[$i] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET); } } if ($taglist) { echo implode(' ', $taglist); } } else { if ($tags = $this->scanExistTags(intval($type[1]), $amount, intval($type[2]))) { $eachTag = array(); $t = 0; foreach ($tags as $tag => $inums) { $eachTag[$t] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET); $t++; } if ($type[3] != 'ad') { echo implode($sep, $eachTag); } elseif ($type[3] == 'ad') { $tag_str = implode($sep, $eachTag); } } } if ($type[3] != 'ad') { echo '" />'; } elseif ($type[3] == 'ad') { // $tag_str = mb_convert_encoding($tag_str, 'UTF-8', 'UTF-8'); $tag_str = urlencode($tag_str); echo $tag_str; } break; // TAG list(tag cloud) // TAG list(tag cloud) case 'list': $template['and'] = $this->getOption('and'); $template['or'] = $this->getOption('or'); $template['tagIndex'] = $this->getOption('tagIndex'); $template['tagItemHeader'] = $this->getOption('tagItemHeader'); $template['tagItem'] = $this->getOption('tagItem'); $template['tagItemSeparator'] = $this->getOption('tagItemSeparator'); $template['tagItemFooter'] = $this->getOption('tagItemFooter'); $template['tagIndexSeparator'] = $this->getOption('tagIndexSeparator'); if ($tags = $this->scanExistTags($type[1])) { if ($type[3] != $type[4]) { $minFontSize = min((double) $type[3], (double) $type[4]) - 0.5; $maxFontSize = max((double) $type[3], (double) $type[4]); $levelsum = ($maxFontSize - $minFontSize) / 0.5; $taglevelsum = $maxtaglevel - $mintaglevel; list($maxCount, $minCount) = $this->scanCount($tags); $eachCount = ceil(($maxCount - $minCount) / $levelsum); } $select = array(); if ($reqAND) { $req = $reqOR ? array_merge($reqAND, $reqOR) : $reqAND; foreach ($req as $tag) { if (array_key_exists($tag, $tags)) { $select = array_merge($select, $tags[$tag]); $selected = array_unique($select); } } } foreach ($tags as $tag => $inums) { if ($selected) { if (!in_array($tag, $req)) { // shiborikomi // if (!in_array($tag, $req) && !array_diff($tags[$tag], $selected)) { $tagCount[$tag] = count($inums); } } else { $tagCount[$tag] = count($inums); } } if ($tagCount) { arsort($tagCount); foreach ($tagCount as $k => $v) { $r[$k] = $tags[$k]; } unset($tags); if (count($r) > $amount) { $r = array_slice($r, 0, $amount); } $tags = array(); if (count($r) == 1) { $tags = $r; } else { $tags = $this->sortTags($r, intval($type[2])); } } else { echo 'No Tags'; return; } $eachTag = array(); $t = 0; foreach ($tags as $tag => $inums) { $tagitems = array(); $tagAmount = count($inums); if ($eachCount) { $fontlevel = ceil($tagAmount / $eachCount) * 0.5 + $minFontSize; } else { $fontlevel = 1; } if ($maxCount == $minCount) { //2008-05-22 Cacher $taglevel = 1; } else { $taglevel = round(($tagAmount - $minCount) / ($maxCount - $minCount) * $taglevelsum + $mintaglevel); } /// Item's name had TAGs $iids = array_slice($inums, 0, 4); sort($iids); $qQuery = ' SELECT ' . ' SUBSTRING(ititle, 1, 12) as short_title' . ' FROM ' . sql_table('item') . ' WHERE ' . ' inumber in (' . implode(',', $iids) . ') ' . 'ORDER BY ' . ' inumber'; $sTitles = sql_query($qQuery); $i = 0; while ($sTitle = sql_fetch_assoc($sTitles)) { $shortTitle = mb_convert_encoding($sTitle['short_title'], _CHARSET, _CHARSET); $shortTitle = htmlspecialchars($shortTitle, ENT_QUOTES, _CHARSET); $printData['tagItem'] = array('itemid' => intval($iids[$i]), 'itemtitle' => $shortTitle . '..'); $i++; $tagitems[] = TEMPLATE::fill($template['tagItem'], $printData['tagItem']); } $tagitem = implode($template['tagItemSeparator'], $tagitems) . '...etc.'; // Generate URL link to TAGs $and = $or = ''; /********************* * comment out this line when nodisplay selected TAGs */ // $req = ($reqOR) ? array_merge($reqAND, $reqOR) : $reqAND; /*********************/ if ($req && !in_array($tag, $req)) { $printData['and'] = array('andurl' => $this->creatTagLink($tag, $type[1], $requestT, '+')); $printData['or'] = array('orurl' => $this->creatTagLink($tag, $type[1], $requestT, ':')); $and = TEMPLATE::fill($template['and'], $printData['and']); // insert URL to template $or = TEMPLATE::fill($template['or'], $printData['or']); } // insert data to template $printData['tagIndex'] = array('and' => $and, 'or' => $or, 'tag' => htmlspecialchars($tag, ENT_QUOTES, _CHARSET), 'tagamount' => $tagAmount, 'fontlevel' => $fontlevel, 'taglevel' => $taglevel, 'taglinkurl' => $this->creatTagLink($tag, intval($type[1])), 'tagitems' => $tagitem); $eachTag[$t] = TEMPLATE::fill($template['tagIndex'], $printData['tagIndex']); // format outputdata and data output $eachTag[$t] .= $template['tagItemHeader']; $eachTag[$t] .= $template['tagItemFooter']; $t++; } echo implode($template['tagIndexSeparator'] . "\n", $eachTag); } break; // show selected TAGs for <title></title> // show selected TAGs for <title></title> case 'title': if ($reqAND) { $req = $reqOR ? array_merge($reqAND, $reqOR) : $reqAND; $data = htmlspecialchars(implode('|', $req), ENT_QUOTES, _CHARSET); echo ' : Selected Tag(s) » "' . $data . '"'; } break; default: break; } // end of switch(type) }
/** * Called from e.g. the commentform-notloggedin.template file, at the time * a comment form is included. We'll add HTML code to insert the captcha image */ function event_FormExtra(&$data) { switch ($data['type']) { case 'commentform-notloggedin': // anonymous comments // anonymous comments case 'membermailform-notloggedin': // anonymous message to site member // anonymous message to site member case 'activation': // activation or re-activation of member account break; default: return; } // initialize on first call if (!$this->inited) { $this->init_captcha(); } // don't do anything when no GD libraries are available if (!$this->isAvailable()) { return; } // create captcha key. This key is required to // // 1. create the captcha image // 2. check the validity of the entered solution $key = $this->generateKey(); $aVars = array('imgHtml' => $this->generateImgHtml($key), 'key' => htmlspecialchars($key, ENT_QUOTES, _CHARSET)); switch ($data['type']) { case 'activation': echo TEMPLATE::fill($this->getOption('ActivationHtml'), $aVars); break; case 'commentform-notloggedin': echo TEMPLATE::fill($this->getOption('CommentFormHtml'), $aVars); break; case 'membermailform-notloggedin': echo TEMPLATE::fill($this->getOption('MemberMailHtml'), $aVars); break; } }
/** * Parse skinvar preview */ function parse_preview($template) { global $blog, $CONF, $manager; $template =& $manager->getTemplate($template); $row['body'] = '<span id="prevbody"></span>'; $row['title'] = '<span id="prevtitle"></span>'; $row['more'] = '<span id="prevmore"></span>'; $row['itemlink'] = ''; $row['itemid'] = 0; $row['blogid'] = $blog->getID(); echo TEMPLATE::fill($template['ITEM_HEADER'], $row); echo TEMPLATE::fill($template['ITEM'], $row); echo TEMPLATE::fill($template['ITEM_FOOTER'], $row); }