} else { $template_hook["{$blockinfo['hook_location']}"] .= $block_html; } } else { $blocks["{$blockid}"] = $block_html; } } // check to see if we can see a 'Members List' link in the breadcrumb if ($vbulletin->options['enablememberlist'] and $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']) { $navbits = construct_navbits(array('memberlist.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['members_list'], '' => $userinfo['username'])); } else { $navbits = construct_navbits(array('' => $userinfo['username'])); } if ($vbulletin->products['vbcms']) { $segments = array('type' => 'author', 'value' => $userinfo['userid'] . '-' . $userinfo['username']); $author_list_url = vBCms_Route_List::getURL($segments); } else { $author_list_url = ''; } $navbar = render_navbar_template($navbits); $templatename = 'MEMBERINFO'; $show['pmlink'] =& $show['pm']; // VBIV-12742 Lets be consistant with the name. ($hook = vBulletinHook::fetch_hook('member_complete')) ? eval($hook) : false; //Now we need to get the css theme information if applicable if ($show_customize_profile) { $themes = vB_ProfileCustomize::getThemes(); if (empty($themes)) { $canusetheme = false; if (!$cancustomize) { $show_customize_profile = false;
/** * Returns the HTML for the member dwop-down pop-up menu * * @param array user information for the drop-down context * @param array template hook, if we dont want to use the global one (like in postbit) * @param string class name to apply to the div for context specific stylings * * @return string Member Drop-Down HTML */ function construct_memberaction_dropdown($memberinfo, $template_hook = array(), $page_class = null) { global $show, $vbulletin; $memberperm = cache_permissions($memberinfo, false); // display the private messgage link? $show['pmlink'] = ($vbulletin->options['enablepms'] and $vbulletin->userinfo['permissions']['pmquota'] and ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] or $memberinfo['receivepm'] and $memberperm['pmquota'])); // display the user's homepage link? $show['homepage'] = ($memberinfo['homepage'] != '' and $memberinfo['homepage'] != 'http://'); // display the add as friend link? $show['addfriend'] = ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_friends'] and $vbulletin->userinfo['userid'] and $memberinfo['userid'] != $vbulletin->userinfo['userid'] and $vbulletin->userinfo['permissions']['genericpermissions2'] & $vbulletin->bf_ugp_genericpermissions2['canusefriends'] and $memberperm['genericpermissions2'] & $vbulletin->bf_ugp_genericpermissions2['canusefriends'] and !$memberinfo['isfriend']); // Check if blog is installed, and show link if so $show['viewblog'] = $vbulletin->products['vbblog']; // Check if CMS is installed, and show link if so $show['viewarticles'] = $vbulletin->products['vbcms']; //MAPI fudge ... $show['cmsattach'] = $show['viewarticles'] ? 1 : 0; // display the email link? $show['emaillink'] = ($memberinfo['showemail'] and $vbulletin->options['displayemails'] and (!$vbulletin->options['secureemail'] or $vbulletin->options['secureemail'] and $vbulletin->options['enableemail']) and $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canemailmember'] and $vbulletin->userinfo['userid']); if ($show['viewarticles']) { $memberinfo['author_list_url'] = vBCms_Route_List::getURL(array('type' => 'author', 'value' => $memberinfo['userid'] . '-' . $memberinfo['username'])); } if (!$memberinfo['onlinestatusphrase']) { require_once DIR . '/includes/functions_bigthree.php'; fetch_online_status($memberinfo); } // execute memberaction hook ($hook = vBulletinHook::fetch_hook('memberaction_dropdown')) ? eval($hook) : false; $templater = vB_Template::create('memberaction_dropdown'); $templater->register('memberinfo', $memberinfo); $templater->register('template_hook', $template_hook); if (!empty($page_class)) { $templater->register('page_class', $page_class); } return $templater->render(); }
private function getPublished($year, $month) { //Getting the start date is easy. Getting the end date is a bit complex. Leap years and all that. //Easiest way is to get the start of the next month and subract a second. //Ensure permissions are loaded $hash = self::getMyHash($year, $month); if (!($articles = vB_Cache::instance()->read($hash, true, false))) { $offset = vBCms_ContentManager::getTimeOffset(vB::$vbulletin->userinfo); $start = gmmktime (0, 0, 0, $month, 1, $year); $weekday = gmdate('w', $start); $start -= $offset; $end = gmmktime (0, 0, 0, ($month == 12 ? 1 : $month + 1 ), 1, ($month == 12 ? $year + 1 : $year )) - $offset - 1; $articles = array(); $rst = vB::$vbulletin->db->query_read($sql = "SELECT node.nodeid, node.publishdate, node.setpublish FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid WHERE node.setpublish > 0 AND node.publishdate BETWEEN $start AND $end AND node.contenttypeid <> " . vB_Types::instance()->getContentTypeID("vBCms_Section") . " AND " . vBCMS_Permissions::getPermissionString() . " AND hidden = 0 ORDER BY node.publishdate LIMIT 5000" ); $nextday = $start + 86400; $dom = 1; $articles[1] = array('data' => array(), 'time' => $start + 1, 'wday' => $weekday); //Now we want to end with an array of day => array('data ' => array, 'time' => unixtime) //So we need to build the array as we go. while($record = vB::$vbulletin->db->fetch_array($rst)) { //see if we need to advance to a new date if (intval($record['publishdate']) > $nextday) { while (intval($record['publishdate']) > $nextday) { $nextday += 86400; $start += 86400; $dom ++; $weekday = ($weekday == 6 ? 0 : ($weekday + 1)); $articles[$dom] = array('data' => array(), 'time' => $start + 1, 'wday' => $weekday); } } if ($record['setpublish']) { $articles[$dom]['data'][] = $record; } } //we may have some days at the end without articles. while($end > $start + 86400 ) { $dom++; $weekday = ($weekday == 6 ? 0 : ($weekday + 1)); $articles[$dom] = array('data' => array(), 'time' => $start + 1, 'wday' => $weekday); $start += 86400; } vB_Cache::instance()->write($hash , $articles, 1440, array('cms_calendar_published', 'sections_updated')); } //Now we want to turn this into an array of week=>(array(1-7); $week = 1; $calendar = array(1 => array()); //Pad the start with empty records as needed if ($articles[1]['wday'] != 0) { for ($i = 0; $i < $articles[1]['wday']; $i++) { $calendar[1][$i] = array('count' => 0, 'url' => '', 'day' => ''); } } $monthday = 1; $route = new vBCms_Route_List; while($monthday <= count($articles)) { //If we've filled a week, we need to advance $count = 0; foreach ($articles[$monthday]['data'] as $record) { $count = 1; $url = $route->getCurrentUrl(array('type' =>'day', 'value' => $articles[$monthday]['time'])) ; break; } $calendar[$week][$articles[$monthday]['wday']] = array('count' => $count, 'url' => $url, 'day' =>($monthday ? $monthday : '') ); if (($articles[$monthday]['wday'] == 6) AND ($monthday < count($articles))) { $week++; $calendar[$week] = array(); } $monthday++; } //We need to fill out a full week. Note that monthday is now one past the last day of the month if ($articles[$monthday - 1]['wday'] < 6) { for ($i = $articles[$monthday - 1]['wday'] + 1; $i <= 6 ; $i++) $calendar[$week][$i] = array('count' => 0, 'url' => '', 'day' => ''); } unset($route); return $calendar; }
/** * Returns a representative URL of a route. * Optional segments and parameters may be passed to set the route state. * * @param array mixed $segments - Assoc array of segment => value * @param array mixed $parameters - Array of parameter values, in order * @return string - The URL representing the route */ public static function getURL(array $segments = null, array $parameters = null) { $route = new vBCms_Route_List(); return $route->getCurrentURL($segments, $parameters); }
/** * this will create an array of result objects from an array of ids() * * @param array of integer $ids * @return array of objects */ public static function create_array($ids) { $contenttypeid = vb_Types::instance()->getContentTypeId('vBCms_Article'); $rst = vB::$vbulletin->db->query_read($sql = " SELECT a.contentid as itemid, a.htmlstate, u.username, a.contentid, n.nodeid, u.userid, i.html_title, a.blogid, n.setpublish AS published, n.url, n.showtitle, n.showuser, n.showpreviewonly, n.showupdated, n.showviewcount, n.settingsforboth, a.pagetext, i.title, i.description, n.publishdate, parent.title as parenttitle, i.viewcount, n.parentnode as parentid, a.threadid, a.postauthor, a.poststarter, a.blogpostid, a.postid, a.post_started, a.post_posted, thread.threadid AS comment_threadid , thread.title AS threadtitle, thread.replycount, thread.lastposterid, thread.lastposter, thread.dateline, thread.views, thread.lastpost FROM " . TABLE_PREFIX . "cms_article a LEFT JOIN " . TABLE_PREFIX . "cms_node n ON n.contentid = a.contentid LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo i ON i.nodeid = n.nodeid LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS parent ON parent.nodeid = n.parentnode LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON thread.threadid = i.associatedthreadid LEFT JOIN " . TABLE_PREFIX . "user u ON u.userid = n.userid WHERE a.contentid IN (" . implode(', ', $ids) .") AND n.contenttypeid = " . $contenttypeid ); $id_list = array(); $items = array(); if ($rst) { $bbcode_parser = new vBCms_BBCode_HTML(vB::$vbulletin, vBCms_BBCode_HTML::fetchCmsTags()); $bbcode_parser->setOutputPage(1); while ($search_result = vB::$vbulletin->db->fetch_array($rst)) { //If unpublished we hide this. if (!($search_result['publishdate'] < TIMENOW)) { continue; } $item = new vBCms_Search_Result_Article(); $item->itemid = $search_result['itemid']; $categories = array(); $tags = array(); $item->contenttypeid = $contenttypeid; $search_result['pagetext'] = $bbcode_parser->do_parse($search_result['pagetext'], true); $search_result['categories'] = $categories; $item->record = $search_result; $id_list[$search_result['nodeid']] = $search_result['itemid']; $items[$search_result['itemid']] = $item; } //avoid database error when all cms items are filtered out. if (!count($id_list)) { return array(); } $ids = implode(', ', array_keys($id_list)); $rst1 = vB::$vbulletin->db->query_read( "SELECT cat.categoryid, cat.category, nc.nodeid FROM " . TABLE_PREFIX . "cms_nodecategory AS nc INNER JOIN " . TABLE_PREFIX . "cms_category AS cat ON nc.categoryid = cat.categoryid WHERE nc.nodeid IN ($ids)" ); if ($rst1) { $route = new vBCms_Route_List(); $route->setParameter('action', 'list'); while($record = vB::$vbulletin->db->fetch_array($rst1)) { $itemid = $id_list[$record['nodeid']]; $route_info = $record['categoryid'] . ($record['category'] != '' ? '-' . $record['category'] : ''); $record['category_url'] = vBCms_Route_List::getUrl(array('type' =>'category', 'value' => $route_info , 'page' => 1)); $items[$itemid]->addCategory($record['categoryid'], $record) ; } } if ($rst1 = vB::$vbulletin->db->query_read("SELECT tag.tagid, tag.tagtext, node.contentid FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "tagcontent AS tc ON (tc.contentid = node.contentid AND tc.contenttypeid = node.contenttypeid) INNER JOIN " . TABLE_PREFIX . "tag AS tag ON tag.tagid = tc.tagid WHERE node.nodeid IN ($ids) " )) { while($record = vB::$vbulletin->db->fetch_array($rst1)) { $items[$record['contentid']]->addTag($record['tagid'], $record); } } return $items; } return false; }