selam, foruma yeni katildim, php konusunda yeniyim. sizden bir döküman kodu hakkinda yardim talep edicektim.
altta vbulletin forum scriptine ait rss sayfasi kodlarinin yarisini veriyorum. (external.php)
mesajim forumdaki mesaj karakter sayisi konusundaki iznin üzerine cikmasindan dolayi mesajimi 2 bölüm halinde vermek durumundayim
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.7.0 Beta 3
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000–2007 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
#phpinfo();
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NOSHUTDOWNFUNC', 1);
define('SKIP_SESSIONCREATE', 1);
define('DIE_QUIETLY', 1);
define('THIS_SCRIPT', 'external');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('postbit');
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
'bbcode_code_printable',
'bbcode_html_printable',
'bbcode_php_printable',
'bbcode_quote_printable',
'postbit_attachment',
'postbit_attachmentimage',
'postbit_attachmentthumbnail',
'postbit_external',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// take the first of "forumids" and make it "forumid" for style stuff
// see bug #22743
if ($_REQUEST['forumids'])
{
// quick way of getting the first value
$_REQUEST['forumid'] = intval($_REQUEST['forumids']);
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
// We don't want no stinkin' sessionhash
$vbulletin->session->vars['sessionurl'] =
$vbulletin->session->vars['sessionurl_q'] =
$vbulletin->session->vars['sessionurl_js'] =
$vbulletin->session->vars['sessionhash'] = '';
$vbulletin->input->clean_array_gpc('r', array(
'forumid' => TYPE_UINT,
'forumids' => TYPE_STR,
'type' => TYPE_STR,
'lastpost' => TYPE_BOOL,
'nohtml' => TYPE_BOOL,
'fulldesc' => TYPE_BOOL,
'count' => TYPE_UINT,
));
($hook = vBulletinHook::fetch_hook('external_start')) ? eval($hook) : false;
$description = $vbulletin->options['description'];
$podcast = false;
// check to see if there is a forum preference
if ($vbulletin->GPC['forumid'])
{
$vbulletin->GPC['forumids'] .= ',' . $vbulletin->GPC['forumid'];
}
if ($vbulletin->GPC['forumids'] != '')
{
$forumchoice = array();
$forumids = explode(',', $vbulletin->GPC['forumids']);
foreach ($forumids AS $forumid)
{
$forumid = intval($forumid);
$forumperms =& $vbulletin->userinfo['forumpermissions']["$forumid"];
if (isset($vbulletin->forumcache["$forumid"])
AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])
AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])
AND (($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR $vbulletin->GPC['type'] == 'JS') // JS only shows titles
AND verify_forum_password($forumid, $vbulletin->forumcache["$forumid"]['password'], false)
)
{
$forumchoice[] = $forumid;
}
}
// Sort forums for caching purposes -- ensure they are in numeric order for best potential cache hit
sort($forumchoice, SORT_NUMERIC);
$forumchoice = array_unique($forumchoice);
$number_of_forums = sizeof($forumchoice);
if ($number_of_forums == 1)
{
$title = unhtmlspecialchars($vbulletin->forumcache["$forumchoice[0]"]['title_clean']);
$description = unhtmlspecialchars($vbulletin->forumcache["$forumchoice[0]"]['description_clean']);
}
else if ($number_of_forums > 1)
{
$title = implode(',', $forumchoice);
}
else
{
$title = '';
}
if (!empty($forumchoice))
{
$forumsql = "AND thread.forumid IN(" . implode(',', $forumchoice) . ")";
}
else
{
$forumsql = "";
}
}
else
{
foreach (array_keys($vbulletin->forumcache) AS $forumid)
{
$forumperms =& $vbulletin->userinfo['forumpermissions']["$forumid"];
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']
AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])
AND (($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) OR $vbulletin->GPC['type'] == 'JS') // JS only shows titles
AND verify_forum_password($forumid, $vbulletin->forumcache["$forumid"]['password'], false)
)
{
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice))
{
$forumsql = "AND thread.forumid IN(" . implode(',', $forumchoice) . ")";
}
else
{
$forumsql = "";
}
}
if (empty($forumchoice))
{ // no access to view selected forums
exit;
}
$vbulletin->GPC['type'] = strtoupper($vbulletin->GPC['type']);
switch ($vbulletin->GPC['type'])
{
case 'JS':
if (!$vbulletin->options['externaljs'])
{
exit;
}
$vbulletin->GPC['nohtml'] = 0;
break;
case 'XML':
if (!$vbulletin->options['externalxml'])
{
exit;
}
break;
case 'RSS':
$vbulletin->GPC['nohtml'] = 0;
case 'RSS1':
case 'RSS2':
if (!$vbulletin->options['externalrss'])
{
exit;
}
break;
default:
$handled = false;
($hook = vBulletinHook::fetch_hook('external_type')) ? eval($hook) : false;
if (!$handled)
{
if (!$vbulletin->options['externalrss'])
{
exit;
}
$vbulletin->GPC['type'] = 'RSS2';
}
}
if (!$vbulletin->options['externalcount'])
{
$vbulletin->options['externalcount'] = 15;
}
if (!$vbulletin->GPC['count'] OR $vbulletin->GPC['count'] > $vbulletin->options['externalcount'])
{
$count = $vbulletin->options['externalcount'];
}
else
{
$count = $vbulletin->GPC['count'];
}
if (!intval($vbulletin->options['externalcache']) OR $vbulletin->options['externalcache'] > 1440)
{
$externalcache = 60;
}
else
{
$externalcache = $vbulletin->options['externalcache'];
}
$cachetime = $externalcache * 60;
$cachehash = md5(
$vbulletin->options['externalcutoff'] . '|' .
$externalcache . '|' .
$vbulletin->GPC['type'] . '|' .
$vbulletin->GPC['lastpost'] . '|' .
$vbulletin->GPC['nohtml'] . '|' .
$vbulletin->GPC['fulldesc'] . '|' .
$count . '|' .
$forumsql
);
if ($_SERVER['HTTP_IF_NONE_MATCH'] == "\"$cachehash\"" AND !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))
{
$timediff = strtotime(gmdate('D, d M Y H:i:s') . ' GMT') - strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
if ($timediff <= $cachetime)
{
$db->close();
if (SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi')
{
header('Status: 304 Not Modified');
}
else
{
header('HTTP/1.1 304 Not Modified');
}
exit;
}
}
if ($foundcache = $db->query_first_slave("
SELECT text, headers, dateline
FROM " . TABLE_PREFIX . "externalcache
WHERE cachehash = '" . $db->escape_string($cachehash) . "' AND
dateline >= " . (TIMENOW - $cachetime) . "
"))
{
$db->close();
if (!empty($foundcache['headers']))
{
$headers = unserialize($foundcache['headers']);
if (!empty($headers))
{
foreach($headers AS $header)
{
header($header);
}
}
}
echo $foundcache['text'];
exit;
}
$cutoff = (!$vbulletin->options['externalcutoff']) ? 0 : TIMENOW - $vbulletin->options['externalcutoff'] * 86400;
// remove threads from users on the global ignore list if user is not a moderator
$globalignore = '';
if (trim($vbulletin->options['globalignore']) != '')
{
require_once(DIR . '/includes/functions_bigthree.php');
if ($Coventry = fetch_coventry('string'))
{
$globalignore = "AND postuserid NOT IN ($Coventry) ";
}
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('external_query')) ? eval($hook) : false;
$threadcache = array();
// query last threads from visible / chosen forums
$threads = $db->query_read_slave("
SELECT thread.threadid, thread.title, thread.prefixid, post.attach,
" . ($vbulletin->GPC['lastpost']
? "thread.lastposter AS postusername, thread.lastpost AS dateline,"
: "thread.postusername, thread.dateline, podcastitem.*,")
. "
forum.forumid,
post.pagetext AS message, post.allowsmilie, post.postid
$hook_query_fields
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
" . ($vbulletin->GPC['lastpost']
? "LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.lastpostid)"
: "LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
LEFT JOIN " . TABLE_PREFIX . "podcastitem AS podcastitem ON (podcastitem.postid = thread.firstpostid)")
. "
$hook_query_joins
WHERE 1=1
$forumsql
AND thread.visible = 1
AND post.visible = 1
AND open <> 10
AND " . ($vbulletin->GPC['lastpost'] ? "thread.lastpost" : "thread.dateline") . " > $cutoff
$globalignore
$hook_query_where
ORDER BY " . ($vbulletin->GPC['lastpost'] ? "thread.lastpost DESC" : "thread.dateline DESC") . "
LIMIT $count
");
$postids = array();
while ($thread = $db->fetch_array($threads))
{ // fetch the threads
// remove sessionhash from urls:
$thread['prefix_plain'] = ($thread['prefixid'] ? htmlspecialchars_uni($vbphrase["prefix_$thread[prefixid]_title_plain"]) . ' ' : '');
$threadcache[] = $thread;
if ($thread['attach'])
{
$postids["$thread[postid]"] = $thread['threadid'];
}
}
$lastmodified = (!empty($thread[0]['dateline']) ? $thread[0]['dateline'] : TIMENOW);
$expires = TIMENOW + $cachetime;
$attachmentcache = array();
if (!$vbulletin->GPC['nohtml'] AND !empty($postids) AND ($vbulletin->GPC['type'] == 'RSS1' OR $vbulletin->GPC['type'] == 'RSS2'))
{
$attachments = $db->query_read_slave("
SELECT dateline, thumbnail_dateline, filename, filesize, visible, attachmentid, counter, attachmenttype.mimetype,
postid, IF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, thumbnail_filesize,
attachmenttype.thumbnail AS build_thumbnail, attachmenttype.newwindow
FROM " . TABLE_PREFIX . "attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype USING (extension)
WHERE postid IN (" . implode(', ', array_keys($postids)) . ")
ORDER BY attachmentid
");
while ($attachment = $db->fetch_array($attachments))
{
if (!$attachment['build_thumbnail'])
{
$attachment['hasthumbnail'] = false;
}
$attachmentcache["{$postids[$attachment[postid]]}"]["$attachment[attachmentid]"] = $attachment;
}
}
if ($number_of_forums == 1 AND $vbulletin->GPC['type'] == 'RSS2' AND $vbulletin->options['rsspodcast'])
{
$podcastinfo = $db->query_first_slave("
SELECT *
FROM " . TABLE_PREFIX . "podcast
WHERE forumid = $forumid AND enabled = 1
");
$podcastforumid = $forumchoice[0];
}
else
{
$podcastforumid = 0;
}
$output = '';
$headers = array();
if ($vbulletin->GPC['type'] == 'JS')
{ // javascript output
$output = "
function thread(threadid, title, poster, threaddate, threadtime)
{
this.threadid = threadid;
this.title = title;
this.poster = poster;
this.threaddate = threaddate;
this.threadtime = threadtime;
}
";
$output .= "var threads = new Array(" . sizeof ($threadcache) . ");\r\n";
if (!empty($threadcache))
{
foreach ($threadcache AS $threadnum => $thread)
{
$thread['title'] = addslashes_js($thread['prefix_plain'] . $thread['title']);
$thread['poster'] = addslashes_js($thread['postusername']);
$output .= "\tthreads[$threadnum] = new thread($thread[threadid], '$thread[title]', '$thread[poster]', '" . addslashes_js(vbdate($vbulletin->options['dateformat'], $thread['dateline'])) . "', '" . addslashes_js(vbdate($vbulletin->options['timeformat'], $thread['dateline'])) . "');\r\n";
}
}
}
else if ($vbulletin->GPC['type'] == 'XML')
{ // XML output
// set XML type and nocache headers
$headers[] = 'Cache-control: max-age=' . $expires;
$headers[] = 'Expires: ' . gmdate('D, d M Y H:i:s', $expires) . ' GMT';
$headers[] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT';
$headers[] = 'ETag: "' . $cachehash . '"';
$headers[] = 'Content-Type: text/xml' . ($stylevar['charset'] != '' ? '; charset=' . $stylevar['charset'] : '');
// print out the page header
$output = '<?xml version="1.0" encoding="' . $stylevar['charset'] . '"?>' . "\r\n";
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_XML_Builder($vbulletin);
$xml->add_group('source');
$xml->add_tag('url', $vbulletin->options['bburl']);
// list returned threads
if (!empty($threadcache))
{
foreach ($threadcache AS $thread)
{