/** * Send Post request with user's fbuserid * * @param vB_Registry Object * @param bool Bypass the session->created check * * @return string Response to this request from remote server */ public static function registerLogin(&$registry, $bypassCreated = false) { self::$registry = $registry; if (!$bypassCreated and !self::$registry->session->created or !self::$registry->userinfo['userid'] or !self::$registry->userinfo['fbuserid'] or !is_facebookenabled()) { return; } $params = array('facebookProfileId' => self::$registry->userinfo['fbuserid'], 'facebookAccessToken' => self::$registry->userinfo['fbaccesstoken'], 'licenseKey' => '[#]facebookguid[#]', 'hideFbConnect' => self::$registry->userinfo['disablevbsocial']); return self::sendRequest('registerConnectLogin', $params); }
public function output() { global $vbulletin, $db, $show, $VB_API_REQUESTS; // check if facebook and session is enabled if (!is_facebookenabled()) { return $this->error('feature_not_enabled'); } require_once DIR . '/includes/functions_login.php'; if (verify_facebook_app_authentication()) { // create new session process_new_login('fbauto', false, ''); // do redirect do_login_redirect(); } else { return $this->error('badlogin_facebook'); } }
private function getvBUserWithForumList() { global $vbulletin; $arrayResponse = array(); if (is_facebookenabled() and vB_Facebook::instance()->userIsLoggedIn()) { $vbulletin->input->clean_array_gpc('r', array('facebookidList' => TYPE_STR, 'timestamp' => TYPE_INT)); // ensure list is only numbers and commas .. can't use intval() as fb uid can be 64bit and intval // will eat that on a 32bit system $cleanlist = preg_replace('#[^0-9,]#s', '', $vbulletin->GPC['facebookidList']); $arraylist = preg_split("#,#s", $cleanlist, -1, PREG_SPLIT_NO_EMPTY); if ($arraylist) { $timestamp = $vbulletin->GPC['timestamp'] ? $vbulletin->GPC['timestamp'] : 7 * 3600 * 24; $vBUserlist = $vbulletin->db->query_read_slave("\n\t\t\t\t\tSELECT user.userid, user.username, user.fbuserid\n\t\t\t\t\tFROM " . TABLE_PREFIX . "userlist AS userlist\n\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = userlist.relationid)\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tuser.fbuserid IN (" . implode(',', $arraylist) . ")\n\t\t\t\t\t\tAND userlist.userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\t\t\t\tAND userlist.type = 'buddy'\n\t\t\t\t\t\tAND joindate >= {$timestamp}\n\t\t\t\t"); while ($vBUser = $vbulletin->db->fetch_array($vBUserlist)) { $arrayResponse[] = array('vBuserid' => $vBUser['userid'], 'vBusername' => $vBUser['username'], 'fbUserId' => $vBUser['fbuserid'], 'forums' => $this->getSubscribedForumsOfTheUser($vBUser['userid'])); } } if (!$arrayResponse) { $arrayResponse['response']['errormessage'][0] = 'no_users_in_facebook'; } } return $arrayResponse; }
$nextthreadinfo = goto_nextthread($thread['threadid'], false); $prevthreadinfo = goto_prevthread($thread['threadid'], false); } $pagenumber = $vbulletin->GPC['pagenumber']; if (!$show['threadrating'] or !$vbulletin->options['allowthreadedmode']) { $nodhtmlcolspan = 'colspan="2"'; } $pageinfo_linear = array('p' => $FIRSTPOSTID, 'mode' => 'linear'); $pageinfo_hybrid = array('mode' => 'hybrid'); $pageinfo_threaded = array('p' => $FIRSTPOSTID, 'mode' => 'threaded'); if ($vbulletin->GPC['highlight']) { $pageinfo_linear['highlight'] = $pageinfo_hybrid['highlight'] = $pageinfo_threaded['highlight'] = urlencode($vbulletin->GPC['highlight']); } if ($show['guestview']) { // facebook options if (is_facebookenabled()) { // display publish to Facebook checkbox in quick editor? $fbpublishcheckbox = construct_fbpublishcheckbox(); } // display the like button for this thread? $fblikebutton = construct_fblikebutton(); } // Record thread as viewed. if ($vbulletin->options['who_read']) { mark_content_read('vBForum_Thread', $thread['threadid'], 'view'); } ($hook = vBulletinHook::fetch_hook('showthread_complete')) ? eval($hook) : false; $thread_url = vB_Friendly_Url::fetchLibrary($vbulletin, 'thread|js', $threadinfo, array('pagenumber' => $vbulletin->GPC['pagenumber']))->get_url(); // ############################################################################# // output page $templater = vB_Template::create('SHOWTHREAD');
/** * Fetches the standard page view . * @param integer $nodeid - node for which we are displaying comments * * @return vBCms_View - The resolved view, or array of views */ public function getPageView($nodeid, $target_url) { global $vbphrase; require_once DIR . '/includes/functions_editor.php'; vB::$vbulletin->input->clean_array_gpc('r', array( 'nodeid' => vB_Input::TYPE_INT, 'page' => vB_Input::TYPE_INT, 'direction' => vB_Input::TYPE_STR, 'postid' => vB_Input::TYPE_UINT )); if (! $row = vB::$vbulletin->db->query_first("SELECT node.comments_enabled, node.setpublish, node.publishdate, nodeinfo.associatedthreadid, thread.forumid FROM " . TABLE_PREFIX . "cms_node AS node LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS nodeinfo ON node.nodeid = nodeinfo.nodeid LEFT JOIN " . TABLE_PREFIX . "thread AS thread on thread.threadID = nodeinfo.associatedthreadid WHERE nodeinfo.nodeid = $nodeid LIMIT 1;" )) { return false; } if (! $row['comments_enabled'] OR !$row['setpublish'] OR ($row['publishdate'] > TIMENOW)) { return false; } if (! intval($row['forumid'])) { $this->repairComments($row['associatedthreadid']); } if (!intval($row['associatedthreadid'])) { return false; } $associatedthreadid = $row['associatedthreadid']; $base_url = empty($target_url) ? vB_Router::getCurrentURL() : $target_url; // Create view $view = new vB_View('vbcms_comments_page'); $view->nodeid = $nodeid; $view->threadid = $row['associatedthreadid']; $view->this_url = str_replace('&', '&', $base_url); // display publish to Facebook checkbox in quick editor? if (is_facebookenabled()) { $view->fbpublishcheckbox = construct_fbpublishcheckbox(); } $this_user = new vB_Legacy_CurrentUser(); $pageno = vB::$vbulletin->GPC_exists['page'] ? vB::$vbulletin->GPC['page'] : 1; $view->pageno = $pageno; $view->node_comments = self::showComments($view->nodeid, $this_user, $pageno, 20, $target_url, $associatedthreadid); // make sure user has permission to post comment before displaying comment editor if (self::canPostComment($view->threadid, $this_user)) { // prepare the wyswiwig editor for comments $view->show_comment_editor = true; global $messagearea; $editor_name = construct_edit_toolbar(''); $view->messagearea = $messagearea;// $view->editor_name = $editor_name; // include captcha validation and guest username field if (fetch_require_hvcheck('post')) { require_once(DIR . '/includes/class_humanverify.php'); $reg = vB::$vbulletin; $verification =& vB_HumanVerify::fetch_library($reg); $human_verify = $verification->output_token(); } else { $human_verify = ''; } $view->human_verify = $human_verify; $view->usernamecode = new vB_View('newpost_usernamecode'); } else { $view->show_comment_editor = false; } return $view; }
$userdata->save(); if ($vbulletin->session->vars['profileupdate']) { $vbulletin->session->set('profileupdate', 0); } $vbulletin->url = 'profile.php?' . $vbulletin->session->vars['sessionurl'] . 'do=editprofile'; eval(print_standard_redirect('redirect_updatethanks', true, true)); } // ############################### start edit connections ############################### if ($_REQUEST['do'] == 'editconnections') { // if facebook connect is not enabled, go to the general settings page if (!is_facebookenabled()) { $_REQUEST['do'] = 'editoptions'; } else { ($hook = vBulletinHook::fetch_hook('profile_editconnections_start')) ? eval($hook) : false; // draw cp nav bar construct_usercp_nav('connections'); // set up navbits for shell template $navbits[''] = $vbphrase['edit_connections']; $show['fbaccount'] = !empty($vbulletin->userinfo['fbuserid']);
protected function saveData($view) { if ($this->data_saved) { return true; } $this->data_saved = true; if (!$this->content->canEdit() AND !$this->content->canPublish() ) { return $vb_phrase['no_edit_permissions']; } require_once DIR . '/includes/functions.php'; // collect error messages $errors = array(); vB::$vbulletin->input->clean_array_gpc('p', array( 'do' => vB_Input::TYPE_STR, 'cms_node_title' => vB_Input::TYPE_STR, 'cms_node_url' => vB_Input::TYPE_STR, 'message' => vB_Input::TYPE_STR, 'url' => vB_Input::TYPE_NOHTML, 'title' => vB_Input::TYPE_NOHTML, 'setpublish' => vB_Input::TYPE_UINT, 'publishdate' => vB_Input::TYPE_UINT, 'html_title' => vB_Input::TYPE_NOHTML, 'publicpreview' => vB_Input::TYPE_UINT, 'new_parentid' => vB_Input::TYPE_UINT, 'comments_enabled' => vB_Input::TYPE_UINT, 'wysiwyg' => vB_Input::TYPE_BOOL, 'parseurl' => vB_Input::TYPE_BOOL, 'posthash' => vB_Input::TYPE_NOHTML, 'poststarttime' => vB_Input::TYPE_UINT, 'htmlstate' => vB_Input::TYPE_NOHTML, )); ($hook = vBulletinHook::fetch_hook('vbcms_article_save_start')) ? eval($hook) : false; $dm = $this->content->getDM(); $dm->set('contentid', $this->content->getId()); if ($this->content->canEdit()) { // get pagetext $pagetext = vB::$vbulletin->GPC['message']; $html_title = vB::$vbulletin->GPC['html_title']; $title = vB::$vbulletin->GPC['title']; // unwysiwygify the incoming data if (vB::$vbulletin->GPC['wysiwyg']) { $html_parser = new vBCms_WysiwygHtmlParser(vB::$vbulletin); $pagetext = $html_parser->parse($pagetext); } $dm->info['parseurl'] = true; $dm->set('pagetext', $pagetext); if ($title) { $dm->set('title', $pagetext); } $bbcodesearch = array(); $video_location = stripos($pagetext, '[video'); $found_image = false; // populate the preview image field with [img] if we can find one if (($i = stripos($pagetext, '[IMG]')) !== false and ($j = stripos($pagetext, '[/IMG]')) AND $j > $i) { $previewimage = htmlspecialchars_uni(substr($pagetext, $i+5, $j - $i - 5)); $image_location = $i; if ($size = @getimagesize($previewimage)) { $dm->set('previewimage', $previewimage); $dm->set('imagewidth', $size[0]); $dm->set('imageheight', $size[1]); $bbcodesearch[] = substr($pagetext, $i, $j + 6); $found_image = true; } } // or populate the preview image field with [attachment] if we can find one if (!$found_image) { $i = stripos($pagetext, "[ATTACH=CONFIG]"); $j = stripos($pagetext, '[/ATTACH]'); if ($j !== false) { if ($i === false) { $i = stripos($pagetext, "[ATTACH]"); if ($i !== false AND ($i > $j)) { $attachmentid = substr($pagetext, $i + 15, $j - $i - 15); $found_image = $this->getAttachData($attachmentid, $dm, $bbcodesearch); } } else if ($i > $j) { $attachmentid = substr($pagetext, $i + 15, $j - $i - 15); $found_image = $this->getAttachData($attachmentid, $dm, $bbcodesearch); } } } if (!$found_image AND $this->content->canDownload()) { require_once(DIR . '/packages/vbattach/attach.php'); $attach = new vB_Attach_Display_Content(vB::$vbulletin, 'vBCms_Article'); $attachments = $attach->fetch_postattach(0, $this->content->getNodeId(), $this->content->getUserId()); if (!empty($attachments)) { foreach($attachments as $attachment) { if ($attachment['hasthumbnail']) { $found_image = $this->getAttachData($attachment['attachmentid'], $dm, $bbcodesearch); if ($found_image) { break; } } } } } // if there are no images in the article body, make sure we unset the preview in the db if (!$found_image ) { $dm->set('previewimage', ''); $dm->set('imagewidth', 0); $dm->set('imageheight', 0); $image_location = intval($video_location) + 1; } $parseurl = false; $providers = $search = $replace = $previewvideo = array(); ($hook = vBulletinHook::fetch_hook('data_preparse_bbcode_video_start')) ? eval($hook) : false; // Convert video bbcode with no option if ((($video_location !== false) AND (intval($video_location) < intval($image_location))) OR $parseurl) { if (!$providers) { $bbcodes = vB::$db->query_read_slave(" SELECT provider, url, regex_url, regex_scrape, tagoption FROM " . TABLE_PREFIX . "bbcode_video ORDER BY priority "); while ($bbcode = vB::$db->fetch_array($bbcodes)) { $providers["$bbcode[tagoption]"] = $bbcode; } } $scraped = 0; if (!empty($providers) AND preg_match_all('#\[video[^\]]*\](.*?)\[/video\]#si', $pagetext, $matches)) { foreach ($matches[1] AS $key => $url) { $match = false; foreach ($providers AS $provider) { $addcaret = ($provider['regex_url'][0] != '^') ? '^' : ''; if (preg_match('#' . $addcaret . $provider['regex_url'] . '#si', $url, $match)) { break; } } if ($match) { if (!$provider['regex_scrape'] AND $match[1]) { $previewvideo['provider'] = $provider['tagoption']; $previewvideo['code'] = $match[1]; $previewvideo['url'] = $url; $bbcodesearch[] = $matches[0][$key]; break; } else if ($provider['regex_scrape'] AND vB::$vbulletin->options['bbcode_video_scrape'] > 0 AND $scraped < vB::$vbulletin->options['bbcode_video_scrape']) { require_once(DIR . '/includes/functions_file.php'); $result = fetch_body_request($url); if (preg_match('#' . $provider['regex_scrape'] . '#si', $result, $scrapematch)) { $previewvideo['provider'] = $provider['tagoption']; $previewvideo['code'] = $scrapematch[1]; $previewvideo['url'] = $url; $bbcodesearch[] = $matches[0][$key]; break; } $scraped++; } } } } } $htmlstate = vB::$vbulletin->GPC_exists['htmlstate'] ? vB::$vbulletin->GPC['htmlstate'] : $this->content->getHtmlState(); // Try to populate previewvideo html if ($previewvideo) { $templater = vB_Template::create('bbcode_video'); $templater->register('url', $previewvideo['url']); $templater->register('provider', $previewvideo['provider']); $templater->register('code', $previewvideo['code']); $dm->set('previewvideo', $templater->render()); $dm->set('previewimage', ''); $dm->set('imagewidth', 0); $dm->set('imageheight', 0); $image_location = -1; } else { $dm->set('previewvideo', ''); } } if ($this->content->canPublish()) { $old_sectionid = $this->content->getParentId(); //set the values, for the dm and update the content. if ( vB::$vbulletin->GPC_exists['new_parentid'] AND intval(vB::$vbulletin->GPC['new_parentid'])) { vBCms_ContentManager::moveSection(array($this->content->getNodeId()), vB::$vbulletin->GPC['new_parentid']); $new_sectionid = vB::$vbulletin->GPC['new_parentid']; } if (vB::$vbulletin->GPC_exists['publicpreview']) { $dm->set('publicpreview', vB::$vbulletin->GPC['publicpreview']); } if (vB::$vbulletin->GPC_exists['comments_enabled']) { $dm->set('comments_enabled', vB::$vbulletin->GPC['comments_enabled']); } if (vB::$vbulletin->GPC_exists['setpublish']) { $dm->set('setpublish', vB::$vbulletin->GPC['setpublish']); } } if (vB::$vbulletin->GPC_exists['html_title']) { $dm->set('html_title', vB::$vbulletin->GPC['html_title']); } if (vB::$vbulletin->GPC_exists['url']) { $dm->set('url', vB::$vbulletin->GPC['url']); } if (vB::$vbulletin->GPC_exists['htmlstate']) { $dm->set('htmlstate', vB::$vbulletin->GPC['htmlstate']); } //We may have some processing to do for public preview. Let's see if comments // are enabled. We never enable them for sections, and they might be turned off globally. vB::$vbulletin->input->clean_array_gpc('r', array( 'publicpreview' => TYPE_UINT)); $success = $dm->saveFromForm($this->content->getNodeId()); $this->changed = true; if ($dm->hasErrors()) { $fieldnames = array( 'html_title' => new vB_Phrase('vbcms', 'html_title'), 'title' => new vB_Phrase('global', 'title') ); $view->errors = $dm->getErrors(array_keys($fieldnames)); $view->error_summary = self::getErrorSummary($dm->getErrors(array_keys($fieldnames)), $fieldnames); $view->status = $view->error_view->title; } else { $view->status = new vB_Phrase('vbcms', 'content_saved'); $this->cleanContentCache(); // Make sure the posthash is valid if (md5(vB::$vbulletin->GPC['poststarttime'] . vB::$vbulletin->userinfo['userid'] . vB::$vbulletin->userinfo['salt']) == vB::$vbulletin->GPC['posthash']) { vB::$vbulletin->db->query_write(" UPDATE " . TABLE_PREFIX . "attachment SET posthash = '', contentid = " . intval($this->content->getNodeId()) . " WHERE posthash = '" . vB::$vbulletin->db->escape_string(vB::$vbulletin->GPC['posthash']) . "' AND contenttypeid = " . intval(vB_Types::instance()->getContentTypeID("vBCms_Article")) . " "); } // only publish to Facebook if we are going from not-published to published, and the date is in the past if (is_facebookenabled() AND $this->content->isPublished()) { $message = new vB_Phrase('posting', 'fbpublish_message_newarticle', vB::$vbulletin->options['bbtitle']); $fblink = vBCms_Route_Content::getURL(array( 'node' => $this->content->getUrlSegment(), 'action' =>'view' )); $fblink = str_ireplace('&', '&', $fblink); publishtofacebook_newarticle($message, $this->content->getTitle(), $this->content->getPageText(), create_full_url($fblink)); } } ($hook = vBulletinHook::fetch_hook('vbcms_article_save_end')) ? eval($hook) : false; //invalidate the navigation cache. vB_Cache::instance()->event('sections_updated'); vB_Cache::instance()->event('articles_updated'); vB_Cache::instance()->event(array_merge($this->content->getCacheEvents(), array($this->content->getContentCacheEvent()))); //Make sure comment count will be updated when a comment is posted if ($threadid = $this->content->getAssociatedThreadId()) { vB_Cache::instance()->event("cms_comments_thread_$threadid"); } vB_Cache::instance()->cleanNow(); $this->content->reset(); //reset the required information $this->content->requireInfo(vBCms_Item_Content::INFO_BASIC); $this->content->requireInfo(vBCms_Item_Content::INFO_CONTENT); $this->content->requireInfo(vBCms_Item_Content::INFO_CONFIG); $this->content->requireInfo(vBCms_Item_Content::INFO_NODE); $this->content->requireInfo(vBCms_Item_Content::INFO_PARENTS); }
foreach ($parentlist as $forumID) { $forumTitle = $vbulletin->forumcache["{$forumID}"]['title']; $navbits[fetch_seo_url('forum', array('forumid' => $forumID, 'title' => $forumTitle))] = $forumTitle; } $navbits[''] = $vbphrase['post_new_thread']; $navbits = construct_navbits($navbits); $navbar = render_navbar_template($navbits); construct_forum_rules($foruminfo, $forumperms); $show['signaturecheckbox'] = ($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature'] and $vbulletin->userinfo['signature']); $show['parseurl'] = ($vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_URL and $foruminfo['allowbbcode']); $show['misc_options'] = ($show['signaturecheckbox'] or $show['parseurl'] or !empty($disablesmiliesoption)); $show['additional_options'] = ($show['misc_options'] or !empty($attachmentoption) or $show['member'] or $show['poll'] or !empty($threadmanagement)); $show['lightbox'] = ($vbulletin->options['lightboxenabled'] and $vbulletin->options['usepopups']); $guestuser = array('userid' => 0, 'usergroupid' => 0); cache_permissions($guestuser); if ($guestuser['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview'] and $guestuser['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canview'] and $guestuser['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and $guestuser['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewothers'] and is_facebookenabled()) { $fbpublishcheckbox = construct_fbpublishcheckbox(); } ($hook = vBulletinHook::fetch_hook('newthread_form_complete')) ? eval($hook) : false; $templater = vB_Template::create('newthread'); $templater->register_page_templates(); $templater->register('attachmentoption', $attachmentoption); $templater->register('checked', $checked); $templater->register('disablesmiliesoption', $disablesmiliesoption); $templater->register('editorid', $editorid); $templater->register('emailchecked', $emailchecked); $templater->register('explicitchecked', $explicitchecked); $templater->register('folderbits', $folderbits); $templater->register('forumid', $forumid); $templater->register('foruminfo', $foruminfo); $templater->register('forumrules', $forumrules);
/** * Builds the Like button * * @return string renedered template for the Like button */ function construct_fblikebutton() { global $show, $vbulletin; // make sure like button is enabled for the given page if (THIS_SCRIPT == 'showthread' and $vbulletin->options['facebooklikethreads'] or THIS_SCRIPT == 'entry' and $vbulletin->options['facebooklikeblogentries'] or THIS_SCRIPT == 'vbcms' and isset($vbulletin->vbcms['content_type']) and $vbulletin->vbcms['content_type'] == 'Article' and $vbulletin->options['facebooklikecmsarticles']) { $show['fb_likebutton'] = true; $show['loadfbroot'] = !is_facebookenabled(); $templater = vB_Template::create('facebook_likebutton'); $templater->register('appid', urlencode($vbulletin->options['facebookappid'])); // Removed IE/OPERA check, See VBIV-15694 $templater->register('href', get_fbcanonicalurl()); /* if(is_browser('ie') || is_browser('opera')) { $templater->register('href', urlencode(get_fbcanonicalurl())); } else { $templater->register('href', get_fbcanonicalurl()); } */ } else { $retval = ''; $show['fb_likebutton'] = false; } ($hook = vBulletinHook::fetch_hook('fb_like_button')) ? eval($hook) : false; if ($show['fb_likebutton']) { return $templater->render(); } else { return $retval; } }
/** * Processes the global templates (header, footer, etc) and the variables they need. */ public function process_templates() { if ($this->called('template')) { return; } $this->called['template'] = true; $this->load_style(); global $vbulletin, $show, $vbphrase, $style, $template_hook; $this->cache_templates($style['templatelist']); // ############################################################################# // turn off popups if they are not available to this browser if ($vbulletin->options['usepopups']) { if ((is_browser('ie', 5) AND !is_browser('mac')) OR is_browser('mozilla') OR is_browser('firebird') OR is_browser('opera', 7) OR is_browser('webkit') OR is_browser('konqueror', 3.2)) { // use popups } else { // don't use popups $vbulletin->options['usepopups'] = 0; } } global $vbcollapse; $vbcollapse = self::build_vbcollapse($vbulletin->GPC['vbulletin_collapse']); // ############################################################################# // set up the vars for the private message area of the navbar global $pmbox; $pmbox = array( 'lastvisitdate' => vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit'], 1), 'lastvisittime' => vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit']) ); if ($vbulletin->userinfo['userid']) { $pmunread_html = construct_phrase(($vbulletin->userinfo['pmunread'] ? $vbphrase['numeric_value_emphasized'] : $vbphrase['numeric_value']), $vbulletin->userinfo['pmunread']); $vbphrase['unread_x_nav_compiled'] = construct_phrase($vbphrase['unread_x_nav'], $pmunread_html); $vbphrase['total_x_nav_compiled'] = construct_phrase($vbphrase['total_x_nav'], $vbulletin->userinfo['pmtotal']); } // ############################################################################# // Generate Language/Style Chooser Dropdowns if (empty($_POST['do'])) { $languagecount = 0; $languagechooserbits = construct_language_options('--', true, $languagecount); $show['languagechooser'] = ($languagecount > 1 ? true : false); } else { $show['languagechooser'] = false; } if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do'])) { $stylecount = 0; $quickchooserbits = construct_style_options(-1, '--', true, true, $stylecount); $show['quickchooser'] = ($stylecount > 1 ? true : false); } else { $show['quickchooser'] = false; } // ############################################################################# // do cron stuff - goes into footer if ($vbulletin->cron <= TIMENOW) { $cronimage = '<img src="' . create_full_url('cron.php?' . $vbulletin->session->vars['sessionurl'] . 'rand=' . TIMENOW) . '" alt="" width="1" height="1" border="0" />'; } else { $cronimage = ''; } global $ad_location; // parse some global templates global $gobutton, $spacer_open, $spacer_close; $gobutton = vB_Template::create('gobutton')->render(); $spacer_open = vB_Template::create('spacer_open')->render(); $spacer_close = vB_Template::create('spacer_close')->render(); // facebook templates if (is_facebookenabled()) { $templater = vB_Template::create('facebook_opengraph'); $templater->register('opengrapharray', get_fbopengrapharray()); $facebook_opengraph = $templater->render(); $templater = vB_Template::create('facebook_header'); $templater->register('profileurl', get_fbprofileurl()); $templater->register('squarepicurl', get_fbprofilepicurl()); $facebook_header = $templater->render(); $templater = vB_Template::create('facebook_footer'); $templater->register('connected', (is_userfbconnected() ? 1 : 0)); $templater->register('active', (is_userfbactive() ? 1 : 0)); $facebook_footer = $templater->render(); } ($hook = vBulletinHook::fetch_hook('parse_templates')) ? eval($hook) : false; // parse headinclude, header & footer $admincpdir = $vbulletin->config['Misc']['admincpdir']; $modcpdir = $vbulletin->config['Misc']['modcpdir']; // advertising location setup $template = vB_Template::create('ad_navbar_below'); $template->register('adsense_pub_id', $vbulletin->adsense_pub_id); $template->register('adsense_host_id', $vbulletin->adsense_host_id); $ad_location['ad_navbar_below'] = $template->render(); $ad_location['global_header1'] = vB_Template::create('ad_global_header1')->render(); $ad_location['global_header2'] = vB_Template::create('ad_global_header2')->render(); $ad_location['global_below_navbar'] = vB_Template::create('ad_global_below_navbar')->render(); $ad_location['global_above_footer'] = vB_Template::create('ad_global_above_footer')->render(); $template = vB_Template::create('ad_footer_start'); $template->register('adsense_pub_id', $vbulletin->adsense_pub_id); $template->register('adsense_host_id', $vbulletin->adsense_host_id); $ad_location['ad_footer_start'] = $template->render(); // ############################################################################# // handle notices global $notices; $notices = $this->build_notices(); $show['notices'] = ($notices !== ''); // ############################################################################# // set up user notifications $notifications = $this->build_notifications(); if ($notifications) { $show['notifications'] = true; global $notifications_menubits, $notifications_total; $notifications_menubits = $notifications['bits']; $notifications_total = $notifications['total']; } else { $notifications_menubits = ''; $notifications_total = ''; $show['notifications'] = false; } $newpm = $this->check_new_pm(); // ############################################################################# // page number is used in meta tags (sometimes) global $pagenumber, $headinclude, $headinclude_bottom, $header, $footer; global $threadinfo, $foruminfo; if ($pagenumber === NULL) { $pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT); } $templater = vB_Template::create('headinclude'); $templater->register('foruminfo', $foruminfo); $templater->register('pagenumber', $pagenumber); $templater->register('style', $style); $templater->register('basepath', $vbulletin->input->fetch_basepath()); $templater->register('this_script', THIS_SCRIPT); $templater->register('facebook_opengraph', $facebook_opengraph); $headinclude = $templater->render(); $templater = vB_Template::create('headinclude_bottom'); $templater->register('foruminfo', $foruminfo); $templater->register('pagenumber', $pagenumber); $templater->register('style', $style); $templater->register('basepath', $vbulletin->input->fetch_basepath()); $headinclude_bottom = $templater->render(); $templater = vB_Template::create('header'); $templater->register('ad_location', $ad_location); $templater->register('pmbox', $pmbox); $templater->register('notifications_menubits', $notifications_menubits); $templater->register('notifications_total', $notifications_total); $templater->register('notices', $notices); $templater->register('facebook_header', $facebook_header); $header = $templater->render(); $templater = vB_Template::create('footer'); $templater->register('admincpdir', $admincpdir); $templater->register('ad_location', $ad_location); $templater->register('cronimage', $cronimage); $templater->register('languagechooserbits', $languagechooserbits); $templater->register('modcpdir', $modcpdir); $templater->register('quickchooserbits', $quickchooserbits); $templater->register('template_hook', $template_hook); $templater->register('facebook_footer', $facebook_footer); $footer = $templater->render(); // ############################################################################# // Check for pm popup if ($newpm) { if ($vbulletin->userinfo['pmunread'] == 1) { $pmpopupurl = 'private.php?' . $vbulletin->session->vars['sessionurl_js'] . "do=showpm&pmid=$newpm[pmid]"; } else if (!empty($vbulletin->session->vars['sessionurl_js'])) { $pmpopupurl = 'private.php?' . $vbulletin->session->vars['sessionurl_js']; } else { $pmpopupurl = 'private.php'; } $templater = vB_Template::create('pm_popup_script'); $templater->register('newpm', $newpm); $templater->register('pmpopupurl', $pmpopupurl); $footer .= $templater->render(); } if (!$vbulletin->options['bbactive'] AND ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])) { // show the board disabled warning message so that admins don't leave the board turned off by accident $warning = vB_Template::create('board_inactive_warning')->render(); $header = $warning . $header; $footer .= $warning; } ($hook = vBulletinHook::fetch_hook('process_templates_complete')) ? eval($hook) : false; exec_headers(); }
/** Creates the publish editor at the top right of the edit section * * @return mixed * ****/ public function getPublishEditor($submit_url, $formid, $showpreview = true, $showcomments = true, $publicpreview = false, $comments_enabled = false, $pagination_links = 1) { if ($this->canPublish()) { $pub_view = new vB_View('vbcms_edit_publisher'); $pub_view->formid = $formid; $pub_view->setpublish = $this->setpublish; // if this is an unpublished article then we display publish to facebook if (is_facebookenabled() AND vB::$vbulletin->options['fbfeednewarticle'] AND !$this->setpublish) { // only display box if user is connectected to facebook $pub_view->showfbpublishcheckbox = is_userfbconnected(); } //Get date is a most annoying function for us. It takes a Unix time stamp // and converts it to server local time. We need to compensate for the difference between // server time (date('Z')) and usertime (vBCms_ContentManager::getTimeOffset(vB::$vbulletin->userinfo)) $offset = vBCms_ContentManager::getTimeOffset(vB::$vbulletin->userinfo) - date('Z'); if (intval($this->publishdate)) { $pub_view->publishdate = $this->publishdate ; } else { // get the current date/time dependent on user locality $pub_view->publishdate = TIMENOW; } $then = getdate(intval($pub_view->publishdate) + $offset); $pub_view->hour = $then['hours']; $pub_view->minute = $then['minutes']; //we need to parse out the date and time //Are we using a 24 hour clock? if ((strpos(vB::$vbulletin->options['timeformat'], 'G') !== false) OR (strpos( vB::$vbulletin->options['timeformat'], 'H') !== false)) { $pub_view->show24 = 1; } else { $pub_view->show24 = 0; $pub_view->offset = $pub_view->hour >= 12 ? 'PM' : 'AM'; if ($pub_view->hour > 12) { $pub_view->hour -= 12; } } $pub_view->title = $this->title; $pub_view->html_title = $this->html_title; $pub_view->username = $this->username; $pub_view->dateformat = vB::$vbulletin->options['dateformat']; // get the appropriate date format string for the // publish date calendar based on user's locale $pub_view->calendardateformat = (!empty(vB::$vbulletin->userinfo['lang_dateoverride']) ? '%Y/%m/%d' : 'Y/m/d'); $pub_view->groups = $this->getReaderGroups(); $pub_view->parents = $this->getParentage(); $pub_view->submit_url = $submit_url; $pub_view->sectiontypeid = vb_Types::instance()->getContentTypeID("vBCms_Section"); $pub_view->parents = $this->getParentage(); $pub_view->showtitle = $this->getShowTitle(); $pub_view->showuser = $this->getShowUser(); $pub_view->showpreviewonly = $this->getShowPreviewonly(); $pub_view->showupdated = $this->getShowUpdated(); $pub_view->showviewcount = $this->getShowViewcount(); $pub_view->showpublishdate = $this->getShowPublishdate(); $pub_view->settingsforboth = $this->getSettingsForboth(); $pub_view->showall = $this->getShowall(); $pub_view->includechildren = $this->getIncludeChildren(); $pub_view->showrating = $this->getShowRating(); $pub_view->hidden = $this->getHidden(); $pub_view->pagination_links = $pagination_links; $pub_view->show_pagination_link = ($this->contenttypeid == vb_Types::instance()->getContentTypeID("vBCms_Section") ) ? 1 : 0; $pub_view->shownav = $this->getShowNav(); $pub_view->show_shownav = ($this->contenttypeid == vb_Types::instance()->getContentTypeID("vBCms_Section") ) ? 0 : 1; $pub_view->nosearch = $this->getNoSearch(); $sectionid = (1 == $this->nodeid) ? 1 : $this->parentnode; $pub_view->hours24 = vB::$vbulletin->options['dateformat']; if ($this->contenttypeid == $pub_view->sectiontypeid) { $pub_view->show_categories = 0; $pub_view->is_section = 1; $pub_view->show_showsettings = 0; } else { $pub_view->show_categories = 1; $pub_view->categories = $this->getThisCategories(); $pub_view->show_showsettings = 1; $pub_view->is_section = 0; $pub_view->sectionid = $this->parentnode; } if ($pub_view->show_htmloption = ( $this->contenttypeid == vb_Types::instance()->getContentTypeID("vBCms_Article") // this is limited here to article but could be moved to any contenttype AND $this->canusehtml // this is set by some of the member functions above... )) { $pub_view->htmloption = $this->htmlstate; } $pub_view->show_categories = ($this->contenttypeid == $pub_view->sectiontypeid ? 0 : 1); //get the nodes $nodelist = vBCms_ContentManager::getSections(false); if (! isset(vB::$vbulletin->userinfo['permissions']['cms']) ) { vBCMS_Permissions::getUserPerms(); } foreach ($nodelist as $key => $node) { if (in_array(strval($node['permissionsfrom']), vB::$vbulletin->userinfo['permissions']['cms']['canpublish'])) { $nodelist[$key]['selected'] = ($sectionid == $node['nodeid'] ? 'selected="selected"' : ''); } else { unset($nodelist[$key]); } } $pub_view->nodelist = $nodelist; $pub_view->showpreview = $showpreview; $pub_view->showcomments = $showcomments; $pub_view->publicpreview = $publicpreview; $pub_view->hidden = $this->hidden; $pub_view->comments_enabled = $comments_enabled; $pub_view->show_sections = (1 != $this->nodeid); return $pub_view; } }