Merhaba, Ziyaretçi. Lütfen giriş yapın veya üye olun.
Aktivasyon mailiniz gelmediyse buraya tıklayın.
04, 2008, 11:42:59 am
42704 Mesaj 9328 Konu Gönderen: 17902 Üye
Son üye: Remark
Turk-Php.Com Forum  |  Turk-PHP  |  Sizden Bize  |  kod yarimi 2. kisim « önceki sonraki »
Sayfa: [1] Yazdır
Yazan Konu: kod yarimi 2. kisim  (Okunma Sayısı 404 defa)
sakin
Yeni Kullanıcılar
*
Offline Offline

Mesaj Sayısı: 3


Üyelik Bilgileri
kod yarimi 2. kisim
« : 12, 2008, 11:53:16 am »

Kod:
{
$xml->add_group('thread', array('id' => $thread['threadid']));
$xml->add_tag('title', $thread['prefix_plain'] . unhtmlspecialchars($thread['title']));
$xml->add_tag('author', unhtmlspecialchars($thread['postusername']));
$xml->add_tag('date', vbdate($vbulletin->options['dateformat'], $thread['dateline']));
$xml->add_tag('time', vbdate($vbulletin->options['timeformat'], $thread['dateline']));
$xml->close_group('thread');
}
}
$xml->close_group('source');
$output .= $xml->output();
unset($xml);
}
else if (in_array($vbulletin->GPC['type'], array('RSS', 'RSS1', 'RSS2')))
{ // RSS output
// setup the board title

if (empty($title))
{ // just show board title
$rsstitle = $vbulletin->options['bbtitle'];
}
else
{ // show board title plus selection
$rsstitle = $vbulletin->options['bbtitle'] . " - $title";
}
$rssicon = create_full_url($stylevar['imgdir_misc'] . '/rss.jpg');

$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'] : '');

$output = '<?xml version="1.0" encoding="' . $stylevar['charset'] . '"?>' . "\r\n\r\n";

# Each specs shared code is entered in full (duplicated) to make it easier to read
switch($vbulletin->GPC['type'])
{
case 'RSS':
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_XML_Builder($vbulletin);
$xml->add_group('rss', array('version' => '0.91'));
$xml->add_group('channel');
$xml->add_tag('title', $rsstitle);
$xml->add_tag('link', $vbulletin->options['bburl'], array(), false, true);
$xml->add_tag('description', $description);
$xml->add_tag('language', $stylevar['languagecode']);
$xml->add_group('image');
$xml->add_tag('url', $rssicon);
$xml->add_tag('title', $rsstitle);
$xml->add_tag('link', $vbulletin->options['bburl'], array(), false, true);
$xml->close_group('image');
break;
case 'RSS1':
if ($externalcache <= 60)
{
$updateperiod = 'hourly';
$updatefrequency = round(60 / $externalcache);
}
else
{
$updateperiod = 'daily';
$updatefrequency = round(1440 / $externalcache);
}

require_once(DIR . '/includes/class_xml.php');
$xml = new vB_XML_Builder($vbulletin);
$xml->add_group('rdf:RDF', array(
'xmlns:rdf'     => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
'xmlns:dc'      => 'http://purl.org/dc/elements/1.1/',
'xmlns:syn'     => 'http://purl.org/rss/1.0/modules/syndication/',
'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/',
'xmlns'         => 'http://purl.org/rss/1.0/',
));

$xml->add_group('channel', array(
'rdf:about' => $vbulletin->options['bburl']
));
$xml->add_tag('title', $rsstitle);
$xml->add_tag('link', $vbulletin->options['bburl'], array(), false, true);;
$xml->add_tag('description', $description);
$xml->add_tag('syn:updatePeriod', $updateperiod);
$xml->add_tag('syn:updateFrequency', $updatefrequency);
$xml->add_tag('syn:updateBase', '1970-01-01T00:00Z');
$xml->add_tag('dc:language', $stylevar['languagecode']);
$xml->add_tag('dc:creator', 'vBulletin');
$xml->add_tag('dc:date', gmdate('Y-m-d\TH:i:s') . 'Z');
$xml->add_group('items');
$xml->add_group('rdf:Seq');
$xml->add_tag('rdf:li', '', array('rdf:resource' => $vbulletin->options['bburl']));
$xml->close_group('rdf:Seq');
$xml->close_group('items');
$xml->add_group('image');
$xml->add_tag('url', $rssicon);
$xml->add_tag('title', $rsstitle);
$xml->add_tag('link', $vbulletin->options['bburl'], array(), false, true);;
$xml->close_group('image');
$xml->close_group('channel');

if (!$vbulletin->GPC['nohtml'])
{
require_once(DIR . '/includes/class_postbit.php');
$postbit_factory =& new vB_Postbit_Factory();
$postbit_factory->registry =& $vbulletin;
$postbit_factory->bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$postbit_factory->bbcode_parser->printable = true;
}
require_once(DIR . '/includes/class_bbcode_alt.php');

break;
case 'RSS2':
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_XML_Builder($vbulletin);
$rsstag = array(
'version'       => '2.0',
'xmlns:dc'      => 'http://purl.org/dc/elements/1.1/',
'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/'
);
if ($podcastinfo)
{
$rsstag['xmlns:itunes'] = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
}
$xml->add_group('rss', $rsstag);
$xml->add_group('channel');
$xml->add_tag('title', $rsstitle);
$xml->add_tag('link', $vbulletin->options['bburl'], array(), false, true);
$xml->add_tag('description', $description);
$xml->add_tag('language', $stylevar['languagecode']);
$xml->add_tag('lastBuildDate', gmdate('D, d M Y H:i:s') . ' GMT');
#$xml->add_tag('pubDate', gmdate('D, d M Y H:i:s') . ' GMT');
$xml->add_tag('generator', 'vBulletin');
$xml->add_tag('ttl', $externalcache);
$xml->add_group('image');
$xml->add_tag('url', $rssicon);
$xml->add_tag('title', $rsstitle);
$xml->add_tag('link', $vbulletin->options['bburl'], array(), false, true);
$xml->close_group('image');
if ($podcastinfo['subtitle'])
{
$xml->add_tag('itunes:subtitle', $podcastinfo['subtitle']);
}
if ($podcastinfo['author'])
{
$xml->add_tag('itunes:author', $podcastinfo['author']);
}
if ($podcastinfo['summary'])
{
$xml->add_tag('itunes:summary', $podcastinfo['summary']);
}
if ($podcastinfo['owneremail'] OR $podcasinfo['ownername'])
{
$xml->add_group('itunes:owner');
if ($podcastinfo['ownername'])
{
$xml->add_tag('itunes:name', $podcastinfo['ownername']);
}
if ($podcastinfo['owneremail'])
{
$xml->add_tag('itunes:email', $podcastinfo['owneremail']);
}
$xml->close_group('itunes:owner');
}
if ($podcastinfo['image'])
{
$xml->add_tag('itunes:image', '', array('href' => $podcastinfo['image']));
}
if ($podcastinfo['keywords'])
{
$xml->add_tag('itunes:keywords', $podcastinfo['keywords']);
}
if ($podcastinfo['category'])
{
if ($category = unserialize($podcastinfo['category']))
{
if (count($category) == 1)
{
$xml->add_tag('itunes:category', '', array('text' => $category[0]));
}
else
{
$xml->add_group('itunes:category', array('text' => array_shift($category)));
foreach($category AS $cat)
{
$xml->add_tag('itunes:category', '', array('text' => $cat));
}
$xml->close_group('itunes:category');
}
}
}
if ($podcastinfo)
{
$xml->add_tag('itunes:explicit', $podcastinfo['explicit'] == 1 ? 'yes' : 'no');
}

if (!$vbulletin->GPC['nohtml'])
{
require_once(DIR . '/includes/class_postbit.php');
$postbit_factory =& new vB_Postbit_Factory();
$postbit_factory->registry =& $vbulletin;
$postbit_factory->bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$postbit_factory->bbcode_parser->printable = true;
}
require_once(DIR . '/includes/class_bbcode_alt.php');
break;
}

$i = 0;
$viewattachedimages = $vbulletin->options['viewattachedimages'];
$attachthumbs = $vbulletin->options['attachthumbs'];

// list returned threads
if (!empty($threadcache))
{
foreach ($threadcache AS $thread)
{
switch($vbulletin->GPC['type'])
{
case 'RSS':
$xml->add_group('item');
$xml->add_tag('title', $thread['prefix_plain'] . unhtmlspecialchars($thread['title']));
$xml->add_tag('link', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]&goto=newpost", array(), false, true);
$xml->add_tag('description', "$vbphrase[forum]: " . unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean']) . "\r\n$vbphrase[posted_by]: " . unhtmlspecialchars($thread['postusername']) . "\r\n" .
construct_phrase($vbphrase['post_time_x_at_y'], vbdate($vbulletin->options['dateformat'], $thread['dateline']), vbdate($vbulletin->options['timeformat'], $thread['dateline'])));
$xml->close_group('item');
break;
case 'RSS1':
$xml->add_group('item', array('rdf:about' => $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]"));
$xml->add_tag('title', $thread['prefix_plain'] . unhtmlspecialchars($thread['title']));
$xml->add_tag('link', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]&goto=newpost", array(), false, true);

$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plainmessage = $plaintext_parser->parse($thread['message'], $thread['forumid']);
unset($plaintext_parser);

if ($vbulletin->GPC['fulldesc'])
{
$xml->add_tag('description', $plainmessage);
}
else
{
$xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview']));
}

if (!$vbulletin->GPC['nohtml'])
{
$thread['attachments'] =& $attachmentcache["$thread[threadid]"];
$forumperms = fetch_permissions($thread['forumid']);
$postbit_factory->thread =& $thread;
$postbit_factory->cache = array();
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']))
{
$vbulletin->options['viewattachedimages'] = 0;
$vbulletin->options['attachthumbs'] = 0;
}
else
{
$vbulletin->options['viewattachedimages'] = $viewattachedimages;
$vbulletin->options['attachthumbs'] = $attachthumbs;
}
$postbit_obj =& $postbit_factory->fetch_postbit('external');
$message = $postbit_obj->construct_postbit($thread);
$xml->add_tag('content:encoded', $message);
}

$xml->add_tag('dc:date', gmdate('Y-m-d\TH:i:s', $thread['dateline']) . 'Z');
$xml->add_tag('dc:creator', unhtmlspecialchars($thread['postusername']));
$xml->add_tag('dc:subject', unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean']));
$xml->close_group('item');
break;
case 'RSS2':
$xml->add_group('item');
$xml->add_tag('title', $thread['prefix_plain'] . unhtmlspecialchars($thread['title']));
$xml->add_tag('link', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]&goto=newpost", array(), false, true);
$xml->add_tag('pubDate', gmdate('D, d M Y H:i:s', $thread['dateline']) . ' GMT');

$plaintext_parser =& new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list());
$plainmessage = $plaintext_parser->parse($thread['message'], $thread['forumid']);
unset($plaintext_parser);

if ($vbulletin->GPC['fulldesc'])
{
$xml->add_tag('description', $plainmessage);
}
else
{
$xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview']));
}

if (!$vbulletin->GPC['nohtml'])
{
$thread['attachments'] =& $attachmentcache["$thread[threadid]"];
$forumperms = fetch_permissions($thread['forumid']);
$postbit_factory->thread =& $thread;
$postbit_factory->cache = array();
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment']))
{
$vbulletin->options['viewattachedimages'] = 0;
$vbulletin->options['attachthumbs'] = 0;
}
else
{
$vbulletin->options['viewattachedimages'] = $viewattachedimages;
$vbulletin->options['attachthumbs'] = $attachthumbs;
}
$postbit_obj =& $postbit_factory->fetch_postbit('external');
$message = $postbit_obj->construct_postbit($thread);
$xml->add_tag('content:encoded', $message);
unset($message);
}

$xml->add_tag('category', unhtmlspecialchars($vbulletin->forumcache["$thread[forumid]"]['title_clean']), array('domain' => $vbulletin->options['bburl'] . "/forumdisplay.php?f=$thread[forumid]"));
$xml->add_tag('dc:creator', unhtmlspecialchars($thread['postusername']));
$xml->add_tag('guid', $vbulletin->options['bburl'] . "/showthread.php?t=$thread[threadid]", array('isPermaLink' => 'true'));

if ($vbulletin->options['rsspodcast'] AND $podcastinfo)
{
$xml->add_tag('itunes:explicit', $thread['explicit'] == 1 ? 'yes' : 'no');
if ($thread['keywords'])
{
$xml->add_tag('itunes:keywords', $thread['keywords']);
}
if ($thread['subtitle'])
{
$xml->add_tag('itunes:subtitle', $thread['subtitle']);
}
if ($thread['author'])
{
$xml->add_tag('itunes:author', $thread['author']);
}
if ($thread['url'])
{
switch(file_extension($thread['url']))
{
case 'mp3':
$type = 'audio/mpg';
break;
case 'm4a':
$type = 'audio/x-m4a';
break;
case 'mp4':
$type = 'video/mp4';
break;
case 'm4v':
$type = 'video/x-m4v';
break;
case 'mov':
$type = 'video/quicktime';
break;
case 'pdf':
$type = 'application/pdf';
break;
default:
$type = 'unknown/unknown';
}

$xml->add_tag('enclosure', '', array(
'url'    => $thread['url'],
'length' => $thread['length'],
'type'   => $type
));
}
else if ($attachmentcache["$thread[threadid]"])
{
$type = 'unknown/unknown';
$attach = array_shift($attachmentcache["$thread[threadid]"]);
$mimetype = unserialize($attach['mimetype']);
foreach ($mimetype AS $header)
{
if (preg_match('#Content-type:(.*)$#si', $header, $matches))
{
$type = trim($matches[1]);
break;
}
}
if ((strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' AND stristr($_SERVER['SERVER_SOFTWARE'], 'apache') === false) OR (strpos(SAPI_NAME, 'cgi') !== false AND @!ini_get('cgi.fix_pathinfo')))
{
$filename = $vbulletin->options['bburl'] . "/attachment.php?attachmentid=$attach[attachmentid]&amp;dateline=$attach[dateline]&amp;filename=" . urlencode($attach['filename']);
}
else
{
$filename = $vbulletin->options['bburl'] . "/attachment.php/$attach[attachmentid]/" . urlencode($attach['filename']);
}
$xml->add_tag('enclosure', '', array(
'url'    => $filename,
'length' => $attach['filesize'],
'type'   => $type
));
}
}

$xml->close_group('item');
break;
}
}
}

switch($vbulletin->GPC['type'])
{
case 'XML':
case 'JS':
break;;
case 'RSS1':
$xml->close_group('rdf:RDF');
$output .= $xml->output();
unset($xml);
break;
case 'RSS':
$output .= '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">' . "\r\n";
$xml->close_group('channel');
$xml->close_group('rss');
$output .= $xml->output();
unset($xml);
break;
case 'RSS2':
$xml->close_group('channel');
$xml->close_group('rss');
$output .= $xml->output();
unset($xml);
}
}

$insert_cache = true;
($hook = vBulletinHook::fetch_hook('external_complete')) ? eval($hook) : false;

if ($insert_cache)
{
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "externalcache
(cachehash, dateline, text, headers, forumid)
VALUES
(
'" . $db->escape_string($cachehash) . "',
" . TIMENOW . ",
'" . $db->escape_string($output) . "',
'" . $db->escape_string(serialize($headers)) . "',
" . intval($podcastforumid) . "
)
");
}
$db->close();

foreach ($headers AS $header)
{
header($header);
}
echo $output;

/*======================================================================*\
|| ####################################################################
|| #
|| # CVS: $RCSfile$ - $Revision: 24621 $
|| ####################################################################
\*======================================================================*/
?>

vbulletin forum scriptinde foruma yazilan mesajlarin tamami diil sadece bir kismi rss cikisi olarak görüntülenebiliyor,yani bahsi gecen (external.php üzerinde foruma yazilan mesajlarin tamami gecmiyor.

yapmak istedigim bu döküman üzerinde bir kod degisikligi ile foruma yazilan mesajlarin oldugu gibi tamaminin rss cikisinda görüntülenebilmesi...birkac arkadas biraz ugrasip degisik varyasyonlar denedik ama olmadi...

bunu yapabilmem icin hangi kodlari nasil degistirebilecegim konusunda bana yardimci olmanizi rica ediyorum...

simdiden tesekkürler...
Logged
turker
türker
PHP Öğrencisi
*
Offline Offline

Mesaj Sayısı: 114


aggressiveness


Üyelik Bilgileri WWW
Ynt: kod yarimi 2. kisim
« Yanıtla #1 : 12, 2008, 01:46:10 pm »

sorgulardaki limitleri kaldır.
Logged

sakin
Yeni Kullanıcılar
*
Offline Offline

Mesaj Sayısı: 3


Üyelik Bilgileri
Ynt: kod yarimi 2. kisim
« Yanıtla #2 : 12, 2008, 05:32:29 pm »

sorgulardaki limitleri kaldır.

ilgilendigin icin tesekkür ederim arkadasim,bahsettigin sorgular ve limitlerin tam yerini tarif edermisin ?
Logged
turker
türker
PHP Öğrencisi
*
Offline Offline

Mesaj Sayısı: 114


aggressiveness


Üyelik Bilgileri WWW
Ynt: kod yarimi 2. kisim
« Yanıtla #3 : 13, 2008, 09:49:45 am »

edemem
Logged

Sayfa: [1] Yazdır 
« önceki sonraki »
Gitmek istediğiniz yer:  


Turk-Php.Com Forum | SMF Forum Software © 2005, Simple Machines LLC. All Rights Reserved.