Пример #1
0
	foreach ($datastore_fetch AS $value)
	{
		$new_datastore_fetch[] = substr($value, 1, -1);
	}
}

$vbulletin->datastore->fetch($new_datastore_fetch);
unset($datastore_fetch, $new_datastore_fetch);

// #############################################################################
// Parse the friendly uri for the current request
if (defined('FRIENDLY_URL_LINK'))
{
	require_once(CWD . '/includes/class_friendly_url.php');

	$friendly = vB_Friendly_Url::fetchLibrary($vbulletin, FRIENDLY_URL_LINK . '|nosession');

	if ($vbulletin->input->friendly_uri = $friendly->get_uri())
	{
		// don't resolve the wolpath
		define('SKIP_WOLPATH', 1);
	}
}

// #############################################################################
// do a callback to modify any variables that might need modifying based on HTTP input
// eg: doing a conditional redirect based on a $goto value or $vbulletin->noheader must be set
if (function_exists('exec_postvar_call_back'))
{
	exec_postvar_call_back();
}
Пример #2
0
}
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');
$templater->register_page_templates();
$templater->register('pagenumbers', fetch_start_end_total_array($vbulletin->GPC['pagenumber'], $perpage, $totalposts));
$templater->register('totalposts', $totalposts);
$templater->register('activeusers', $activeusers);
$templater->register('ad_location', $ad_location);
$templater->register('bookmarksites', $bookmarksites);
$templater->register('editorid', $editorid);
$templater->register('FIRSTPOSTID', $FIRSTPOSTID);
$templater->register('firstunread', $firstunread);
$templater->register('forumjump', $forumjump);
$templater->register('forumrules', $forumrules);
$templater->register('gobutton', $gobutton);
Пример #3
0
 /**
  * Cleans a segment.
  *
  * @param string $value						- The value to clean
  * @param bool $canonical					- Don't encode for output
  * @return string
  */
 protected function cleanSegment($value, $canonical = false)
 {
     return vB_Friendly_Url::clean_fragment($value, $canonical);
 }
Пример #4
0
/**
* Verifies that we are at the proper canonical seo url based on admin settings
*
* @param	string	Type of link, 'thread', etc
* @param	array		Specific information relevant to the page being linked to, $threadinfo, etc
* @param	array		Other information relevant to the page being linked to
* @param	string	Override the default $linkinfo[userid] with $linkinfo[$primaryid]
* @param	string	Override the default $linkinfo[title] with $linkinfo[$primarytitle]
*/
function verify_seo_url($link, $linkinfo, $pageinfo = null, $primaryid = null, $primarytitle = null)
{
	global $vbulletin;

	require_once(DIR . '/includes/class_friendly_url.php');

	// Check we have something to compare
	if (empty($linkinfo) OR !isset($vbulletin->input->friendly_uri))
	{
		return;
	}

	// Redirect if the current request is not canonical
	$canonical = vB_Friendly_Url::fetchLibrary($vbulletin, $link . '|nosession', $linkinfo, $pageinfo, $primaryid, $primarytitle);
	$canonical->redirect_canonical_url($vbulletin->input->friendly_uri);


	// Set the WOLPATH
	$url = $canonical->get_url(FRIENDLY_URL_OFF);
	$vbulletin->session->set('location', $url);
	define('WOLPATH', $vbulletin->input->strip_sessionhash($url));
}
Пример #5
0
 /**
  * Constructor.
  *
  * @param vB_Registry $registry				- Reference to the vBulletin registry
  * @param array $linkinfo					- Info about the link, the id, title etc
  * @param array $pageinfo					- Additional info about the required request; pagenumber and query string
  * @param string $idkey						- Override the key in $linkinfo for the resource id
  * @param string $titlekey					- Override the key in $linkinfo for the resource title
  * @param int $urloptions					- Bitfield of environment options SEO_NOSESSION, SEO_JS, etc
  */
 protected function __construct(&$registry, array $linkinfo = null, array $pageinfo = null, $idkey = false, $titlekey = false, $urloptions = 0)
 {
     $this->idvar = $this->ignorelist[] = $registry->options['route_requestvar'];
     $this->script = basename(SCRIPT);
     list($this->rewrite_segment) = explode('.', $this->script);
     parent::__construct($registry, $linkinfo, $pageinfo, $idkey, $titlekey, $urloptions);
 }
Пример #6
0
	/**
	 * Gets an new URL segment "guaranteed" to be valid
	 *
	 * @param	string 	optional	the desired title. Defaults to $this->title
	 * @return string					- The assigned string
	 */
	public function getValidURL($title = false)
	{
		global $vbphrase;
		//If we don't have a nodeid we can't continue.
		if (!$title)
		{
			$title= $this->title;
		}

		if (empty($title))
		{
			//well, we got nothing so we'll have to improvise.
			$title = new $vbphrase['new_page'];
		}

		$error = string;
		$count = 0;
		$base_url = strtolower(vB_Friendly_Url::clean_entities($title));
		$test_url = $base_url;

		while ($count <= 250)
		{
			$sql = "SELECT nodeid FROM " . TABLE_PREFIX .
				"cms_node WHERE new != 1 AND lower(url) = '$test_url' " .
				(isset($this->set_fields['nodeid']) ? "' AND nodeid <> $nodeid;" : '');
			$record = vB::$vbulletin->db->query_first($sql);
			$count++;
			if (empty($record))
			{
				$this->set_fields['url'] = $test_url;
				return $test_url;
			}
			$test_url = $base_url . '_' . $count;
		}

		return false;
	}
Пример #7
0
	protected function createFromForumPost($nodedm)
	{
		global $vbphrase;
		//make sure we are only called once;

		//let's confirm the rights

		if (vB::$vbulletin->GPC_exists['postid'] )
		{
			$sql = "
				SELECT
					post.pagetext, post.userid, post.title, post.username, post.threadid, post.dateline AS post_posted,
					thread.title AS threadtitle, thread.postuserid AS poststarter, thread.postusername AS author,
					thread.dateline AS post_started
				FROM " . TABLE_PREFIX . "post AS post
				INNER JOIN " . TABLE_PREFIX . "thread AS thread ON thread.threadid = post.threadid
				WHERE
					post.postid = " . vB::$vbulletin->GPC['postid'] . "
			";
		}
		else
		{
			return false;
		}

		if ($record = vB::$vbulletin->db->query_first($sql))
		{
			$title = strlen($record['title']) > 0 ? htmlspecialchars_decode($record['title']) : htmlspecialchars_decode($record['threadtitle']);

			$nodedm->set('description', $title);
			$nodedm->set('userid', $record['userid']);
			$nodedm->set('title', $title);
			$nodedm->set('html_title', $title);
			$url = vB_Friendly_Url::clean_entities($title );
			//$url = htmlspecialchars(str_replace(' ', '-', $title ));
			$nodedm->set('url', $url);
			$nodedm->set('contenttypeid', vB_Types::instance()->getContentTypeID("vBCms_Article"));
			$nodedm->info['skip_verify_pagetext'] = true;
			$nodedm->set('pagetext', $record['pagetext']);
			$nodedm->set('threadid', $record['threadid']);
			$nodedm->set('posttitle', $record['threadtitle'] );
			$nodedm->set('postauthor', $record['author'] );
			$nodedm->set('poststarter', $record['poststarter'] );
			$nodedm->set('postid', vB::$vbulletin->GPC['postid'] );
			$nodedm->set('post_started', $record['post_started'] );
			$nodedm->set('post_posted', $record['post_posted'] );
			($hook = vBulletinHook::fetch_hook('vbcms_articlepost_presave')) ? eval($hook) : false;

			$this->duplicateAttachments($nodedm, vB_Types::instance()->getContentTypeID('vBForum_Post'), vB::$vbulletin->GPC['postid']);
		}
	}
Пример #8
0
                    $vbulletin->GPC['postvars'] = '';
                }
            } else {
                $vbulletin->GPC['postvars'] = '';
            }
        }
        // workaround IIS cookie+location header bug
        $forceredirect = strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false;
        print_standard_redirect('forumpasswordcorrect', true, $forceredirect);
    } else {
        require_once DIR . '/includes/functions_misc.php';
        $vbulletin->GPC['url'] = str_replace('&amp;', '&', $vbulletin->GPC['url']);
        $postvars = construct_post_vars_html() . '<input type="hidden" name="securitytoken" value="' . $vbulletin->userinfo['securitytoken'] . '" />';
        //use the basic link here.  I'm not sure how the advanced link will play with the postvars in the form.
        require_once DIR . '/includes/class_friendly_url.php';
        $forumlink = vB_Friendly_Url::fetchLibrary($vbulletin, 'forum|nosession', $foruminfo, array('do' => 'doenterpwd'));
        $forumlink = $forumlink->get_url(FRIENDLY_URL_OFF);
        // TODO; Convert 'forumpasswordincorrect' to vB4 style
        eval(standard_error(fetch_error('forumpasswordincorrect', $vbulletin->session->vars['sessionhash'], htmlspecialchars_uni($vbulletin->GPC['url']), $foruminfo['forumid'], $postvars, 10, 1, $forumlink)));
    }
}
// ###### END SPECIAL PATHS
// These $_REQUEST values will get used in the sort template so they are assigned to normal variables
$perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
$daysprune = $vbulletin->input->clean_gpc('r', 'daysprune', TYPE_INT);
$sortfield = $vbulletin->input->clean_gpc('r', 'sortfield', TYPE_STR);
$sortorder = $vbulletin->input->clean_gpc('r', 'sortorder', TYPE_STR);
// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($foruminfo['forumid']);
Пример #9
0
function verify_subdirectory_url($prefix, $scriptid = null)
{
    global $vbulletin;
    if (!$prefix) {
        return;
    }
    // Never redirect a post
    // unless we're in debug mode and we wan't to error out on the bad urls
    // unless again its ajax... we're relying on the old urls for ajax because
    // a) it doesn't matter, users and search engines one see them and b) getting the
    // url logic into javascript is difficult.
    if ('GET' != $_SERVER['REQUEST_METHOD'] and (!(defined('DEV_REDIRECT_404') and DEV_REDIRECT_404) or $vbulletin->GPC['ajax'])) {
        return;
    }
    if (defined('FRIENDLY_URL_LINK')) {
        $friendly = vB_Friendly_Url::fetchLibrary($vbulletin, FRIENDLY_URL_LINK . '|nosession');
        if (vB_Friendly_Url::getMethodUsed() == FRIENDLY_URL_REWRITE) {
            $scriptid = $friendly->getRewriteSegment();
        } else {
            $scriptid = $friendly->getScript();
        }
    } else {
        if (is_null($scriptid)) {
            $scriptid = THIS_SCRIPT;
        }
    }
    $pos = strrpos(VB_URL_CLEAN, '/' . $scriptid);
    if ($pos === false) {
        //if we don't know what this url is, then lets not try to mess with it.
        //this came up with the situation where the main index.php is set to forum
        //but the forums have been moved to a subdirectory.  Doesn't make much sense
        //but we should handle it gracefully.
        return;
    }
    $base_part = substr(VB_URL_CLEAN, 0, $pos);
    $script_part = substr(VB_URL_CLEAN, $pos + 1);
    if (!preg_match('#' . preg_quote($prefix) . '$#', $base_part)) {
        //force the old urls to 404 for testing purposes
        if (defined('DEV_REDIRECT_404') and DEV_REDIRECT_404) {
            //dev only, no need to phrase the error.
            header("HTTP/1.0 404 Not Found");
            standard_error("old style url found, shouldn't get here");
        } else {
            $url = $prefix . '/' . $script_part;
            // redirect to the correct url
            exec_header_redirect($url, 301);
        }
    }
}
Пример #10
0
        log_moderator_action($pictureinfo, 'social_group_picture_x_in_y_removed', array(fetch_trimmed_title($pictureinfo['caption'], 50), $group['name']));
    }
    ($hook = vBulletinHook::fetch_hook('group_picture_delete')) ? eval($hook) : false;
    if ($groupdm->fetch_field('picturecount')) {
        $vbulletin->url = fetch_seo_url('group', $group, array('do' => 'grouppictures'));
    } else {
        $vbulletin->url = fetch_seo_url('group', $group);
    }
    unset($groupdm);
    print_standard_redirect('picture_removed_from_group');
}
// #######################################################################
if ($_REQUEST['do'] == 'removepicture') {
    $vbulletin->input->clean_array_gpc('r', array('attachmentid' => TYPE_UINT));
    $confirmdo = 'doremovepicture';
    $confirmaction = vB_Friendly_Url::fetchLibrary($vbulletin, 'group|nosession', $group, array('do' => $confirmdo));
    $confirmaction = $confirmaction->get_url(FRIENDLY_URL_OFF);
    $title_phrase = $vbphrase['remove_picture_from_group'];
    $question_phrase = construct_phrase($vbphrase['confirm_remove_picture_group_x'], $group['name']);
    $navbits = array(fetch_seo_url('grouphome', array()) => $vbphrase['social_groups'], fetch_seo_url('groupcategory', $group) => $group['categoryname'], fetch_seo_url('group', $group) => $group['name'], '' => $vbphrase['remove_picture_from_group']);
    $page_templater = vB_Template::create('socialgroups_confirm');
    $page_templater->register('confirmaction', $confirmaction);
    $page_templater->register('confirmdo', $confirmdo);
    $page_templater->register('extratext', $extratext);
    $page_templater->register('group', $group);
    $page_templater->register('pictureinfo', $pictureinfo);
    $page_templater->register('question_phrase', $question_phrase);
    $page_templater->register('title_phrase', $title_phrase);
    $page_templater->register('url', $url);
}
// #######################################################################
     $ajaxout = '';
     while ($thread = $db->fetch_array($result)) {
         $thread['ftitle'] =& $vbulletin->forumcache[$thread['forumid']]['title'];
         $thread['detailtime'] = vbdate('h:m:i A', $thread['lastpost']);
         //--Get mUsername
         $postuser = $vbulletin->db->query_first("SELECT usergroupid,displaygroupid,username FROM " . TABLE_PREFIX . "user WHERE userid = '{$thread['lastposterid']}' LIMIT 1");
         //$thread['musername'] = str_replace(array('<b>','</b>'),'',fetch_musername($postuser));
         $thread['musername'] = fetch_musername($postuser);
         if ($forumids == 'mypost' && $thread['lastposterid'] == $vbulletin->userinfo['userid']) {
             $poster = array('username' => $thread['susername'], 'usergroupid' => $vbulletin->userinfo['usergroupid']);
             $thread['susername'] = fetch_musername($poster);
         }
         $page = ceil(($thread['replycount'] + 1) / $vbulletin->options['maxposts']);
         $thread['link'] = vB_Friendly_Url::fetchLibrary($vbulletin, 'thread', $thread, array('page' => $page))->get_url();
         $thread['flink'] = vB_Friendly_Url::fetchLibrary($vbulletin, 'forum', $vbulletin->forumcache[$thread['forumid']], null)->get_url();
         $thread['ulink'] = vB_Friendly_Url::fetchLibrary($vbulletin, 'member', array('userid' => $thread['lastposterid'], 'username' => $thread['lastposter']), null)->get_url();
         $tem->register('thread', $thread);
         $ajaxout .= $tem->render();
     }
     $db->free_result($result);
     //--Save to cache
     if ($vbulletin->options['vtlai_topx_cachesystem'] == 1) {
         $f = @fopen($cachefilename, 'w+');
         if ($f) {
             fwrite($f, serialize(array('exptime' => time() + intval($vbulletin->options['vtlai_topx_cachetime']), 'content' => $ajaxout)));
             fclose($f);
         }
     }
     //--
     print_output($ajaxout);
 }