MyBBDepo - Türkiyenin MyBB Deposu Forumuna Hoşgeldiniz
Eğer sitemize yaptığınız ilk ziyaretiniz ise, lütfen öncelikle Forum Kurallarını okuyunuz. Forumumuzda bilgi alışverişinde bulunabilmeniz için Kayıt olmalısınız. Üye olmayanlar forumumuzdan yararlanamazlar.
Eğer zaten kayıtlı kullanıcı iseniz, lütfen kullanıcı adınız ve şifreniz ile, Giriş yapınız. (Sitemize üyelik ücretsizdir).
ottomanuel avatar
Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5

Derecelendirme: 0/5 - 0 oy

Rss çekme botunu editleyebilecek varmı ?


Sponsor Reklam
media venus

Çevrimdışı ottomanuel
 Tarih: 14-05-2014, Saat:10:36
(Son Düzenleme: 14-05-2014, Saat:10:41, Düzenleyen: ottomanuel.)
#1
Beyler yabancı sitelerden rss çekicez Allah rızası için php bilgisi olan bir vatandaş şu eklentiyi editleyebilirmi 2 dk almaz php anlasam kendim yapıcam


resim


burdaki konuya ait kaynak linki ( alıntı ) gelmemesini istiyorum .

Burda ne değişikliği yapabilirim siz şimdi upload falan uğraşmayın ;

PLugin

Kod:
<?php
/*
RSS Feed Poster
by: vbgamer45
http://www.mybbhacks.com
Copyright 2010  MyBBHacks.com

############################################
License Information:

Links to http://www.mybbhacks.com must remain unless
branding free option is purchased.
#############################################
*/
if(!defined('IN_MYBB'))
    die('This file cannot be accessed directly.');


$plugins->add_hook('admin_config_action_handler','rssfeedposter_admin_action');
$plugins->add_hook('admin_config_menu','rssfeedposter_admin_config_menu');

$plugins->add_hook('admin_load','rssfeedposter_admin');

function rssfeedposter_info()
{

    return array(
        "name"        => "RSS Konu Çekme Botu",
        "description"        => "Eklentinin Amacı, Rss Feed Beslemesi ile Sitenize Otomatik Olarak Belirledeğiniz Forumlara Konu çekmektir.<br /><img src=\"http://destek.mybb.com.tr/turkey.gif\" border=\"0\" alt=\"MCTR\" title=\"MCTR\" /> Türkçe Çeviri: <a title=\"MyBB.Com.TR - XpSerkan\" href=\"http://www.mybb.com.tr\" target=\"_blank\"><b>MyBB.Com.TR</b></a>",
        "website"        => "http://destek.mybb.com.tr/mybb-rss-otomatik-konu-ceken-bot-rss-feed-poster-konusu.html",
        "author"        => "vbgamer45",
        "authorsite"        => "http://www.mybbhacks.com",
        "version"        => "1.5",
        "guid"             => "75763b9f3263e2646d7ebdfee6d4c895",
        "compatibility"    => "1*"
        );
}


function rssfeedposter_install()
{
    global $db, $charset;

    // Create Tables/Settings
    $db->write_query("
    CREATE TABLE IF NOT EXISTS ".TABLE_PREFIX."feedbot
(ID_FEED mediumint(8) NOT NULL auto_increment,
fid int(10) unsigned NOT NULL default '0',
feedurl tinytext NOT NULL,
title tinytext NOT NULL,
enabled tinyint(4) NOT NULL default '1',
html tinyint(4) NOT NULL default '1',
postername tinytext,
uid int(10) unsigned,
locked tinyint(4) NOT NULL default '0',
markasread tinyint(4) NOT NULL default '0',
articlelink tinyint(4) NOT NULL default '0',
topicprefix tinytext,
numbertoimport smallint(5) NOT NULL default 1,
importevery smallint(5) NOT NULL default 180,
updatetime int(10) unsigned NOT NULL default '0',
PRIMARY KEY  (ID_FEED))");

        $db->write_query("
    CREATE TABLE IF NOT EXISTS ".TABLE_PREFIX."feedbot_log
(ID_FEEDITEM mediumint(8) NOT NULL  auto_increment,
ID_FEED mediumint(8) NOT NULL,
feedhash tinytext NOT NULL,
feedtime int(10) unsigned NOT NULL default '0',
pid int(10) unsigned  NOT NULL default '0',
tid int(10) unsigned NOT NULL default '0',
PRIMARY KEY  (ID_FEEDITEM))");




}


function rssfeedposter_is_installed()
{

    global $db;
    if($db->table_exists("feedbot"))
    {
        return true;
    }
    return false;
}


function rssfeedposter_uninstall()
{
    global $db;

    // Drop the Table
    $db->drop_table("feedbot");

    // Drop the Table
    $db->drop_table("feedbot_log");

    // Delete the task just in case
    $db->query("DELETE FROM ".TABLE_PREFIX."tasks WHERE file = 'fssfeedposter'

    ");
}


function rssfeedposter_activate()
{
  global $db, $lang;

  rssfeedposter_loadlanguage();

  // Install the Task
      $query = $db->query("
            SELECT
                COUNT(*) as total
            FROM ".TABLE_PREFIX."tasks
            WHERE file = 'fssfeedposter'

    ");
    $row = $db->fetch_array($query);

    // Task not found create one!!!
    if ($row['total'] == 0)
    {
        require_once MYBB_ROOT . '/inc/functions_task.php';

        $mytask = array(
        'title' => $lang->rssfeedposter_title,
        'file' => 'rssfeedposter',
        'description' => $lang->rssfeedposter_task,
        'minute' => "5,10,15,20,25,30,35,40,45,50,55",
        'hour' => "*",
        'day' => "*",
        'weekday'  => "*",
        'month'  => "*",
        'nextrun' => TIME_NOW,
        'lastrun' => 0,
        'enabled' => 1,
        'logging' => 1,
        'locked' => 0,

        );

        $db->insert_query("tasks",$mytask);

    }


}

function rssfeedposter_deactivate()
{
    global $db;
    // Delete the task.
    $db->query("DELETE FROM ".TABLE_PREFIX."tasks WHERE file = 'fssfeedposter'");

}

function rssfeedposter_admin_action(&$action)
{
    $action['rssfeedposter'] = array('active'=>'rssfeedposter');
}

function rssfeedposter_admin_config_menu(&$admim_menu)
{
    global $lang;

    // Load Language file
    rssfeedposter_loadlanguage();

    end($admim_menu);

    $key = (key($admim_menu)) + 10;

    $admim_menu[$key] = array
    (
        'id' => 'rssfeedposter',
        'title' => $lang->rssfeedposter_title,
        'link' => 'index.php?module=config/rssfeedposter'
    );

}

function rssfeedposter_loadlanguage()
{
    global $lang;

    $lang->load('rssfeedposter');

}

function rssfeedposter_admin()
{
    global $lang, $mybb, $db, $page;

    if ($page->active_action != 'rssfeedposter')
        return false;

    require_once MYBB_ADMIN_DIR."inc/class_form.php";

        $forumList = array();
        $query = $db->query("
            SELECT
                fid, name
            FROM ".TABLE_PREFIX."forums
            WHERE type = 'f'

        ");
        $forumList[0] = '';
        while($forumRow = $db->fetch_array($query))
        {
            $forumList[$forumRow['fid']] = $forumRow['name'];
        }



    // Load Language file
    rssfeedposter_loadlanguage();

    // Create Admin Tabs
    $tabs['rssfeedposter'] = array
        (
            'title' => $lang->rssfeedposter_settings,
            'link' =>'index.php?module=config/rssfeedposter',
            'description'=> $lang->rssfeedposter_description
        );
    $tabs['rssfeedposter_addfeed'] = array
        (
            'title' => $lang->rssfeedposter_addfeed,
            'link' => 'index.php?module=config/rssfeedposter&action=add',
            'description' => $lang->rssfeedposter_addfeed_description
        );

    // No action
    if(!$mybb->input['action'])
    {


        $page->output_header($lang->rssfeedposter_title);
        $page->add_breadcrumb_item($lang->rssfeedposter_title);
        $page->output_nav_tabs($tabs,'rssfeedposter');

        $table = new Table;

        $table->output($lang->rssfeedposter_settings);

        $table = new Table;
        $table->construct_header($lang->rssfeedposter_feedtitle);
        $table->construct_header($lang->rssfeedposter_feedurl);
        $table->construct_header($lang->rssfeedposter_postername);
        $table->construct_header($lang->rssfeedposter_feedstatus);
        $table->construct_header($lang->rssfeedposter_options);
        $query = $db->query("
            SELECT
                ID_FEED, feedurl, title, postername, enabled
            FROM ".TABLE_PREFIX."feedbot

        ");
        while($feed = $db->fetch_array($query))
        {

            $table->construct_cell($feed['title']);
            $table->construct_cell('<a href="' . $feed['feedurl'] . '" target="_blank">' . $feed['feedurl'] . '</a>');
            $table->construct_cell($feed['postername']);
            $table->construct_cell( ($feed['enabled'] ? $lang->rssfeedposter_enabled : $lang->rssfeedposter_disabled));

            $table->construct_cell('
            <a href="index.php?module=config/rssfeedposter&action=edit&id=' . $feed['ID_FEED'] . '">' . $lang->rssfeedposter_editfeed . '</a>&nbsp;|&nbsp; <a href="index.php?module=config/rssfeedposter&action=delete&id=' . $feed['ID_FEED'] . '">' . $lang->rssfeedposter_delete . '</a>

            ');
            $table->construct_row();

        }

        if($table->num_rows() == 0)
        {
            $table->construct_cell($lang->rssfeedposter_no_rssfeedposters, array('colspan' => 5));
            $table->construct_row();

        }

        // Show our Donation Page
        $table->construct_cell('Bu Kısımdan Dilerseniz, Eklentinin Yapımcısına Bağışta Bulunabilirsiniz:<br />
                <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="sales@visualbasiczone.com">
                <input type="hidden" name="item_name" value="RSS Feed Poster">
                <input type="hidden" name="no_shipping" value="1">
                <input type="hidden" name="no_note" value="1">
                <input type="hidden" name="currency_code" value="USD">
                <input type="hidden" name="tax" value="0">
                <input type="hidden" name="bn" value="PP-DonationsBF">
                <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" border="0" name="submit" alt="Make payments with PayPal - it is fast, free and secure!">
                <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
            </form><br />Eklenti Türkçe Çevirisi: <a title="MyBB.Com.TR: Kurucusu" href="http://www.mybb.com.tr" target="_blank"><b>XpSerkan</b></a>', array('colspan' => 5));
        $table->construct_row();


        $table->output($lang->rssfeedposter_rssfeedposters);

        $page->output_footer();



    }

    // Add Menu
    if ($mybb->input['action'] == 'add' || $mybb->input['action'] == 'add2')
    {

        $feedposter_importevery = 360;
        $feedposter_numbertoimport = 1;
        $feedposter_feedenabled  =1;
        $feedposter_htmlenabled = 1;

        if ($mybb->input['action'] == 'add2')
        {
            // Check Post
            $feedposter_feedtitle = htmlspecialchars($_REQUEST['feedposter_feedtitle'], ENT_QUOTES);
            $feedposter_feedurl = trim($_REQUEST['feedposter_feedurl']);
            $boardselect = (int) $_REQUEST['boardselect'];
            $feedposter_postername = str_replace('"','', $_REQUEST['feedposter_postername']);
            $feedposter_postername = str_replace("'",'', $feedposter_postername);
            $feedposter_postername = str_replace('\\','', $feedposter_postername);

            $feedposter_postername = htmlspecialchars($feedposter_postername, ENT_QUOTES);
            $feedposter_topicprefix = htmlspecialchars($_REQUEST['feedposter_topicprefix'], ENT_QUOTES);
            $feedposter_importevery = (int) $_REQUEST['feedposter_importevery'];
            $feedposter_numbertoimport = (int) $_REQUEST['feedposter_numbertoimport'];

            if ($feedposter_importevery < 5)
                $feedposter_importevery = 5;

            if ($feedposter_numbertoimport < 1)
                $feedposter_numbertoimport  = 1;

            if ($feedposter_numbertoimport > 50)
                $feedposter_numbertoimport  = 25;


            $feedposter_feedenabled = isset($_REQUEST['feedposter_feedenabled']) ? 1 : 0;
            $feedposter_htmlenabled = isset($_REQUEST['feedposter_htmlenabled']) ? 1 : 0;
            $feedposter_topiclocked = isset($_REQUEST['feedposter_topiclocked']) ? 1 : 0;

            $feedposter_markread = isset($_REQUEST['feedposter_markread']) ? 1 : 0;

            //Lookup the User ID of the postername
            $memid = 0;

            $dbresult = $db->write_query("
                SELECT
                    uid
                FROM ".TABLE_PREFIX."users
                WHERE username = '$feedposter_postername' LIMIT 1");
            $row = $db->fetch_array($dbresult);
            $memid = (int) $row['uid'];


            if ($feedposter_feedtitle == '')
                $errors[] = $lang->rssfeedposter_err_feedtitle;

            if ($feedposter_feedurl == '')
                $errors[] = $lang->rssfeedposter_err_feedurl;

            if ($feedposter_postername == '')
                $errors[] = $lang->rssfeedposter_err_postername;

            if ($boardselect == 0)
                $errors[] = $lang->rssfeedposter_err_forum;

            if($errors)
            {
                $page->output_inline_error($errors);
            }
            else
            {

                // Set the RSS Feed Update time
                $updatetime = time();


                $db->write_query("INSERT IGNORE INTO ".TABLE_PREFIX."feedbot
                (fid, feedurl, title, enabled, html, postername, uid, locked,
            articlelink, topicprefix, numbertoimport, importevery, updatetime,markasread)
        VALUES
            ($boardselect,'$feedposter_feedurl','$feedposter_feedtitle',$feedposter_feedenabled,
             $feedposter_htmlenabled, '$feedposter_postername', $memid, $feedposter_topiclocked,1,
             '$feedposter_topicprefix',$feedposter_numbertoimport,$feedposter_importevery,$updatetime,$feedposter_markread)");


                admin_redirect("index.php?module=config/rssfeedposter");

            }

        }


        $page->output_header($lang->rssfeedposter_addfeed);
        $page->add_breadcrumb_item($lang->rssfeedposter_addfeedtopic);
        $page->output_nav_tabs($tabs, 'rssfeedposter_addfeed');



        $form = new Form("index.php?module=config/rssfeedposter&amp;action=add2", "post");
        $forumBox = $form->generate_select_box("boardselect",$forumList,$boardselect);

        $table = new Table;



        $table->construct_cell($lang->rssfeedposter_feedtitle);
        $table->construct_cell('<input type="text" size="50" name="feedposter_feedtitle" value="' . $feedposter_feedtitle . '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_feedurl);
        $table->construct_cell('<input type="text" size="50" name="feedposter_feedurl" value="' . $feedposter_feedurl. '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_forum);
        $table->construct_cell($forumBox);
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_postername);
        $table->construct_cell('<input type="text" size="50" name="feedposter_postername" value="' . $feedposter_postername. '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_topicprefix);
        $table->construct_cell('<input type="text" size="50" name="feedposter_topicprefix" value="' . $feedposter_topicprefix. '" />');
        $table->construct_row();


        $table->construct_cell($lang->rssfeedposter_importevery);
        $table->construct_cell('<input type="text" size="50" name="feedposter_importevery" value="' . $feedposter_importevery. '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_numbertoimport);
        $table->construct_cell('<input type="text" size="50" name="feedposter_numbertoimport" value="' . $feedposter_numbertoimport. '" />');
        $table->construct_row();


        $table->construct_cell($lang->rssfeedposter_feedenabled);
        $table->construct_cell('<input type="checkbox" name="feedposter_feedenabled" ' . ($feedposter_feedenabled ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_htmlenabled);
        $table->construct_cell('<input type="checkbox" name="feedposter_htmlenabled" ' . ($feedposter_htmlenabled ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_topiclocked);
        $table->construct_cell('<input type="checkbox" name="feedposter_topiclocked" ' . ($feedposter_topiclocked ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_markread);
        $table->construct_cell('<input type="checkbox" name="feedposter_markread" ' . ($feedposter_markread ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell('<input type="submit" value="' .$lang->rssfeedposter_addfeed . '" />', array('colspan' => 2));
        $table->construct_row();

        $form->end;
        $table->output($lang->rssfeedposter_addfeed);

        $page->output_footer();
    }

    if ($mybb->input['action'] == 'edit' || $mybb->input['action'] == 'edit2')
    {


        $id = (int) $_REQUEST['id'];

        $query = $db->query("
            SELECT
                ID_FEED, fid, feedurl, title, postername, enabled, html, uid, locked,
                articlelink, topicprefix, numbertoimport, importevery, markasread
            FROM ".TABLE_PREFIX."feedbot

            WHERE id_feed = $id LIMIT 1
        ");
        $feedRow = $db->fetch_array($query);

        $feedposter_feedtitle = $feedRow['title'];
        $feedposter_feedurl = $feedRow['feedurl'];
        $boardselect = $feedRow['fid'];

        $feedposter_postername = $feedRow['postername'];
        $feedposter_topicprefix = $feedRow['topicprefix'];
        $feedposter_importevery = $feedRow['importevery'];
        $feedposter_numbertoimport = $feedRow['numbertoimport'];

        $feedposter_feedenabled = $feedRow['enabled'];
        $feedposter_htmlenabled = $feedRow['html'];
        $feedposter_topiclocked = $feedRow['locked'];
        $feedposter_markread = $feedRow['markasread'];


        if ($mybb->input['action'] == 'edit2')
        {
            $id = (int) $_REQUEST['id'];
            $feedposter_feedtitle = htmlspecialchars($_REQUEST['feedposter_feedtitle'], ENT_QUOTES);
            $feedposter_feedurl = trim($_REQUEST['feedposter_feedurl']);
            $boardselect = (int) $_REQUEST['boardselect'];
            $feedposter_postername = str_replace('"','', $_REQUEST['feedposter_postername']);
            $feedposter_postername = str_replace("'",'', $feedposter_postername);
            $feedposter_postername = str_replace('\\','', $feedposter_postername);

            $feedposter_postername = htmlspecialchars($feedposter_postername, ENT_QUOTES);
            $feedposter_topicprefix = htmlspecialchars($_REQUEST['feedposter_topicprefix'], ENT_QUOTES);
            $feedposter_importevery = (int) $_REQUEST['feedposter_importevery'];
            $feedposter_numbertoimport = (int) $_REQUEST['feedposter_numbertoimport'];

            if ($feedposter_importevery < 5)
                $feedposter_importevery = 5;

            if ($feedposter_numbertoimport < 1)
                $feedposter_numbertoimport  = 1;

            if ($feedposter_numbertoimport > 50)
                $feedposter_numbertoimport  = 25;


            $feedposter_feedenabled = isset($_REQUEST['feedposter_feedenabled']) ? 1 : 0;
            $feedposter_htmlenabled = isset($_REQUEST['feedposter_htmlenabled']) ? 1 : 0;
            $feedposter_topiclocked = isset($_REQUEST['feedposter_topiclocked']) ? 1 : 0;

            $feedposter_markread = isset($_REQUEST['feedposter_markread']) ? 1 : 0;

            //Lookup the User ID of the postername
            $memid = 0;

            $dbresult = $db->write_query("
                SELECT
                    uid
                FROM ".TABLE_PREFIX."users
                WHERE username = '$feedposter_postername' LIMIT 1");
            $row = $db->fetch_array($dbresult);
            $memid = (int) $row['uid'];


            if ($feedposter_feedtitle == '')
                $errors[] = $lang->rssfeedposter_err_feedtitle;

            if ($feedposter_feedurl == '')
                $errors[] = $lang->rssfeedposter_err_feedurl;

            if ($feedposter_postername == '')
                $errors[] = $lang->rssfeedposter_err_postername;

            if ($boardselect == 0)
                $errors[] = $lang->rssfeedposter_err_forum;

            if($errors)
            {
                $page->output_inline_error($errors);
            }
            else
            {

                $db->write_query("
        UPDATE ".TABLE_PREFIX."feedbot
        SET
            fid = $boardselect, feedurl = '$feedposter_feedurl', title = '$feedposter_feedtitle', enabled = $feedposter_feedenabled,
              html = $feedposter_htmlenabled, postername = '$feedposter_postername', uid = $memid,
              locked = $feedposter_topiclocked,articlelink = 1, topicprefix = '$feedposter_topicprefix',
             numbertoimport = $feedposter_numbertoimport, importevery = $feedposter_importevery, markasread = $feedposter_markread
        WHERE ID_FEED = $id LIMIT 1"

                );

                admin_redirect("index.php?module=config/rssfeedposter");

            }

        }


        $page->output_header($lang->rssfeedposter_editfeed);
        $page->add_breadcrumb_item($lang->rssfeedposter_editfeed);
        $page->output_nav_tabs($tabs, 'rssfeedposter');



        $form = new Form("index.php?module=config/rssfeedposter&amp;action=edit2", "post");
        $forumBox = $form->generate_select_box("boardselect",$forumList,array($boardselect));


        $table = new Table;


        $table->construct_cell($lang->rssfeedposter_feedtitle);
        $table->construct_cell('<input type="text" size="50" name="feedposter_feedtitle" value="' . $feedposter_feedtitle . '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_feedurl);
        $table->construct_cell('<input type="text" size="50" name="feedposter_feedurl" value="' . $feedposter_feedurl. '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_forum);
        $table->construct_cell($forumBox);
        $table->construct_row();


        $table->construct_cell($lang->rssfeedposter_postername);
        $table->construct_cell('<input type="text" size="50" name="feedposter_postername" value="' . $feedposter_postername. '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_topicprefix);
        $table->construct_cell('<input type="text" size="50" name="feedposter_topicprefix" value="' . $feedposter_topicprefix. '" />');
        $table->construct_row();


        $table->construct_cell($lang->rssfeedposter_importevery);
        $table->construct_cell('<input type="text" size="50" name="feedposter_importevery" value="' . $feedposter_importevery. '" />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_numbertoimport);
        $table->construct_cell('<input type="text" size="50" name="feedposter_numbertoimport" value="' . $feedposter_numbertoimport. '" />');
        $table->construct_row();


        $table->construct_cell($lang->rssfeedposter_feedenabled);
        $table->construct_cell('<input type="checkbox" name="feedposter_feedenabled" ' . ($feedposter_feedenabled ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_htmlenabled);
        $table->construct_cell('<input type="checkbox" name="feedposter_htmlenabled" ' . ($feedposter_htmlenabled ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_topiclocked);
        $table->construct_cell('<input type="checkbox" name="feedposter_topiclocked" ' . ($feedposter_topiclocked ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();

        $table->construct_cell($lang->rssfeedposter_markread);
        $table->construct_cell('<input type="checkbox" name="feedposter_markread" ' . ($feedposter_markread ? ' checked="checked" ' : ''). ' />');
        $table->construct_row();


        $table->construct_cell('
        <input type="hidden" name="id" value="' . $id . '" />
        <input type="submit" value="' .$lang->rssfeedposter_editfeed . '" />', array('colspan' => 2));
        $table->construct_row();

        $form->end;
        $table->output($lang->rssfeedposter_editfeed);

        $page->output_footer();

    }




    if ($mybb->input['action'] == 'delete')
    {
        $id = (int) $_REQUEST['id'];
        $db->write_query("DELETE FROM ".TABLE_PREFIX."feedbot  WHERE ID_FEED = $id
                ");

        $db->write_query("DELETE FROM ".TABLE_PREFIX."feedbot_log  WHERE ID_FEED = $id
                ");


        admin_redirect("index.php?module=config/rssfeedposter");
    }




}






?>

TAsk

Kod:
<?php
/*
RSS Feed Poster
by: vbgamer45
http://www.mybbhacks.com
Copyright 2010  MyBBHacks.com

############################################
License Information:

Links to http://www.mybbhacks.com must remain unless
branding free option is purchased.
#############################################
*/

$feedcount = 0;
$maxitemcount = 0;
$tag = '';
$tag_attrs = '';
$insideitem = false;
$depth = array();



function verify_rss_url($url)
{
    global $txt, $depth;

    // Rss Data storage
    $finalrss = '';
    $failed = true;

        $fp2 = @fopen($url, "r");
        if ($fp2)
        {
            $failed = false;
            $contents = '';
            while (!feof($fp2))
            {
              $contents .= fread($fp2, 8192);
            }
    
            fclose($fp2);
    
            $finalrss = $contents;
        }
    



        if($failed == true)
        {
            $url_array = parse_url($url);
    
            $fp = @fsockopen($url_array['host'], 80, $errno, $errstr, 30);
            if (!$fp)
            {
    
            }
            else
            {
                $failed = false;
    
               $out = "GET " . $url_array['path'] . (@$url_array['query'] != '' ? '?' . $url_array['query'] : '') . "  HTTP/1.1\r\n";
               $out .= "Host: " . $url_array['host'] . "\r\n";
               $out .= "Connection: Close\r\n\r\n";
    
               fwrite($fp, $out);
    
               $rssdata = '';
              
           $header = '';
           // Remove stupid headers.
               do
            {
                $header .= fgets ($fp, 128 );

              } while ( strpos($header, "\r\n\r\n" ) === false );
    
               while (!feof($fp))
               {
                   $rssdata .= fgets($fp, 128);
               }
               fclose($fp);
    
               @$finalrss = @$rssdata;
    
            }
        }
    

    // Use cURL

        if($failed == true)
        {
            if(function_exists("curl_init"))
            {
                $failed = false;
                // Last but not least try cUrl
                $ch = curl_init();
    
                // set URL and other appropriate options
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
                // grab URL, and return output
                $output = curl_exec($ch);
    
                // close curl resource, and free up system resources
                curl_close($ch);
                return $output;
            }
        }




    // XML Parser functions to verify the XML Feed
    if($failed == false)
    {
        $depth = array();

        $xml_parser = xml_parser_create();
        xml_set_element_handler($xml_parser, "startElement2", "endElement2");


           if (!xml_parse($xml_parser, $finalrss)) {
              fatal_error(sprintf($txt['feedposter_err_xmlerror'],
                           xml_error_string(xml_get_error_code($xml_parser)),
                           xml_get_current_line_number($xml_parser)), false);
           }

        xml_parser_free($xml_parser);
    }
    else
    {
        // We were not able to download the feed :(
        
    }


}


function startElement2($parser, $name, $attrs)
{
   global $depth;
   $depth[$parser]++;
}

function endElement2($parser, $name)
{
   global $depth;
   $depth[$parser]--;
}

function UpdateRSSFeedBots($task)
{
    global $db, $context, $feedcount, $maxitemcount, $insideitem, $tag, $tag_attrs;

    // First get all the enabled bots
    $context['feeds'] = array();
    $request = $db->write_query("
            SELECT
                ID_FEED, fid, feedurl, title, postername, updatetime, enabled, html,
                uid, locked, articlelink, topicprefix, numbertoimport, importevery, markasread
            FROM ".TABLE_PREFIX."feedbot
            WHERE enabled = 1");

    while ($row = $db->fetch_array($request))
    {
        $context['feeds'][] = $row;
    }

    

    require_once MYBB_ROOT."inc/datahandlers/post.php";
    

    // Check if a field expired
    foreach ($context['feeds'] as $key => $feed)
    {

        $current_time = time();


        // If the feedbot time to next import has expired
        //add_task_log($task, "Check " . ($current_time + (60 * $feed['importevery'])) . " :" . $feed['updatetime']);
        
        if ($current_time > $feed['updatetime'])
        {

            $feeddata = GetRSSData($feed['feedurl']);



            if ($feeddata != false)
            {

                // Process the XML
                    $xml_parser = xml_parser_create();
                    $context['feeditems'] = array();
                    $feedcount = 0;
                    $maxitemcount = $feed['numbertoimport'];
                    $tag = '';
                    $tag_attrs = '';
                    $insideitem = false;
                    $context['feeditems'][0] = array();
                    $context['feeditems'][0][] = array();
                    $context['feeditems'][0]['title'] = '';
                    $context['feeditems'][0]['description'] = '';
                    $context['feeditems'][0]['link'] = '';



                    xml_set_element_handler($xml_parser, "startElement1", "endElement1");
                    xml_set_character_data_handler($xml_parser, "characterData1");

                    if (!xml_parse($xml_parser, $feeddata))
                     {
                        // Error reading xml data

                         xml_parser_free($xml_parser);
                     }
                    else
                    {
                           // Data must be valid lets extra some information from it
                           // RSS Feeds are a list of items that might contain title, description, and link


                           // Free the xml parser memory
                        xml_parser_free($xml_parser);

                        // Loop though all the items
                        $myfeedcount = 0;

                        for ($i = 0; $i < ($feedcount); $i++)
                        {
                            

                            if ($myfeedcount >= $maxitemcount)
                            {
                                continue;
                            }
                            
                            //add_task_log($task, "NotSkip: $myfeedcount : $maxitemcount : $feedcount  T:" . $context['feeditems'][$i]['title']);

                            
                            // Check feed Log
                            // Generate the hash for the log
                            if(!isset($context['feeditems'][$i]['title']) || !isset($context['feeditems'][$i]['description']))
                                continue;
                                
                            if(empty($context['feeditems'][$i]['title']) && empty($context['feeditems'][$i]['description']))
                                continue;    
                                
                            

                            $itemhash = md5($context['feeditems'][$i]['title'] . $context['feeditems'][$i]['description']);
                            $request = $db->write_query("
                            SELECT
                                feedtime
                            FROM ".TABLE_PREFIX."feedbot_log
                            WHERE feedhash = '$itemhash'");


                            // If no has has found that means no duplicate entry
                            if ($db->num_rows($request) == 0)
                            {

                                // Create the Post
                                $msg_title = ($feed['html'] ? $context['feeditems'][$i]['title'] : strip_tags($context['feeditems'][$i]['title']));

                                $msg_body =  ($feed['html'] ? $context['feeditems'][$i]['description'] . "\n\n" . $context['feeditems'][$i]['link']  : strip_tags($context['feeditems'][$i]['description'] .  "\n\n" . $context['feeditems'][$i]['link']));
                            
                                    
                                $posthandler = new PostDataHandler("insert");
                                $posthandler->action = "thread";
                                
                                if (strlen($msg_title) > 120)
                                    $msg_title = substr($msg_title,0,115);
                                
                                $msg_title = trim($msg_title);
                            

                                $new_thread = array(
                                    "fid" => $feed['fid'],
                                    "subject" => $feed['topicprefix'] . $msg_title,
                                    "icon" => '',
                                    "uid" => $feed['uid'],
                                    "username" => $feed['postername'],
                                    "message" => '[b]' . $msg_title . "[/b]\n\n" . $msg_body,
                                    "ipaddress" => '127.0.0.1',
                                    "posthash" => ''
                                );
                                
                                $new_thread['modoptions']  = array('closethread' => $feed['locked']);
                                
                                $posthandler->set_data($new_thread);
                                $valid_thread = $posthandler->validate_thread();
                                
                                if(!$valid_thread)
                                {
                                    $post_errors = $posthandler->get_friendly_errors();
                                }
                                else
                                    $thread_info = $posthandler->insert_thread();
                                    
                                    
                                $tid = (int) $thread_info['tid'];
                                $pid = (int)  $thread_info['pid'];
                                
                                if ($feed['markasread'])
                                {
                                    // Mark thread as read
                                    require_once MYBB_ROOT."inc/functions_indicators.php";
                                    mark_thread_read($tid, $feed['fid']);
                                }

                                // Add Feed Log
                                $fid = $feed['ID_FEED'];
                                $ftime = time();

                                $db->write_query("
                                INSERT INTO ".TABLE_PREFIX."feedbot_log
                                    (ID_FEED, feedhash, feedtime, tid, pid)
                                VALUES
                                    ($fid,'$itemhash',$ftime,$tid,$pid)");
                                
                                $myfeedcount++;

                            }
                        }

                     } // End valid XML check



            }  // End get feed data
            
            
            
            // Set the RSS Feed Update time
            $updatetime = time() +  (60 * $feed['importevery']);
            
            
            $db->write_query("
            UPDATE ".TABLE_PREFIX."feedbot
            SET
                updatetime = '$updatetime'
        
            WHERE ID_FEED = " . $feed['ID_FEED']);

        } // End expire check


    } // End for each feed

}

function GetRSSData($url)
{
    $url_array = parse_url($url);
    

        $fp2 = @fopen($url, "r");
        if ($fp2)
        {
            $contents = '';
            while (!feof($fp2))
            {
              $contents .= fread($fp2, 8192);
            }
    
            fclose($fp2);
    
            return $contents;
        }



        $fp = fsockopen($url_array['host'], 80, $errno, $errstr, 30);
        if (!$fp)
        {
    
        }
        else
        {
    
    
           $out = "GET " . $url_array['path'] . (@$url_array['query'] != '' ? '?' . $url_array['query'] : '') . "  HTTP/1.1\r\n";
           $out .= "Host: " . $url_array['host'] . "\r\n";
           $out .= "Connection: Close\r\n\r\n";
    
           fwrite($fp, $out);
    
           $rssdata = '';
          
           $header = '';
           // Remove stupid headers.
               do
            {
                $header .= fgets ($fp, 128 );

              } while ( strpos($header, "\r\n\r\n" ) === false );
    
           while (!feof($fp))
           {
               $rssdata .= fgets($fp, 128);
           }
           fclose($fp);

           $finalrss = $rssdata;
    
           return  $finalrss;
        }
    


        if(function_exists("curl_init"))
        {
            // Last but not least try cUrl
            $ch = curl_init();
    
            // set URL and other appropriate options
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
            // grab URL, and return output
            $output = curl_exec($ch);
    
            // close curl resource, and free up system resources
            curl_close($ch);
            
            return $output;
        }
    


    // Failure return false
    return false;

}

function startElement1($parser, $name, $attrs)
{
    global $insideitem, $tag, $tag_attrs;
    if ($insideitem)
    {
        $tag = $name;
        $tag_attrs =  $attrs;
    }
    elseif ($name == "ITEM"  || $name == "ENTRY")
    {
        $insideitem = true;
    }
}

function endElement1($parser, $name)
{
    global $insideitem, $tag, $feedcount, $context, $tag_attrs;

    if ($name == "ITEM" || $name == "ENTRY")
    {
        $feedcount++;
        $context['feeditems'][$feedcount] = array();
        $context['feeditems'][$feedcount][] = array();
        $context['feeditems'][$feedcount]['title'] = '';
        $context['feeditems'][$feedcount]['description'] = '';
        $context['feeditems'][$feedcount]['link'] = '';
        $tag_attrs = '';
        $insideitem = false;
    }
}

function characterData1($parser, $data)
{
    global $insideitem, $tag,  $feedcount, $context, $maxitemcount, $tag_attrs;

    if ($insideitem )
    {
        switch ($tag)
        {
            case "TITLE":
                $context['feeditems'][$feedcount]['title'] .= $data;
            break;

            case "DESCRIPTION":
                $context['feeditems'][$feedcount]['description'] .= $data;

            break;

            case "LINK":
                $context['feeditems'][$feedcount]['link'] .= $data;
            break;
            
            case "SUMMARY":
            $context['feeditems'][$feedcount]['description'] .= $data;

            break;
            case "CONTENT":
            $context['feeditems'][$feedcount]['description'] .= $data;

            break;

            case "LINK":
                $data = trim($data);
                $context['feeditems'][$feedcount]['link'] .= $data;
                IF (empty($data) && isset($tag_attrs['HREF']))
                    $context['feeditems'][$feedcount]['link'] .= $tag_attrs['HREF'];
                
                
            break;
            
        }
    }
}



function task_rssfeedposter($task)
{
    global $lang;
    
    $lang->load('rssfeedposter');
    
    UpdateRSSFeedBots($task);
    
    add_task_log($task, $lang->rssfeedposter_taskran);
}
?>
Cevapla
Bunu Beğenenler:
Sponsor Reklam
sponsor reklam sponsor reklam

Çevrimdışı ottomanuel
 Tarih: 25-05-2014, Saat:12:36
#2
yokmu editleyebilecek ?
Cevapla
Bunu Beğenenler:

 


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  [1.6] Eklenti İstek Elinde Olan Varmı ! Reis00 3 706 08-07-2015, Saat:10:05
Son Yorum: Reis00
  GET Eklentisi varmı ? Mustafa 7 1,126 13-07-2014, Saat:21:53
Son Yorum: 1st4n6uL
  Kayıt Olurken Cinsiyet Dogum Tarihi Şehir vb. şeyler Sorma Plugini Varmı CryLifee 6 1,167 03-05-2014, Saat:23:03
Son Yorum: S.G
  30 yorum yazmadan konu açamama eklentisi varmı jackborn17 1 607 04-01-2014, Saat:21:18
Son Yorum: EmreKarakaya
  [1.6] Üye işletim sistemi ve tarayıcısını gösteren eklenti varmı ? funnfrell 4 902 17-11-2013, Saat:01:12
Son Yorum: funnfrell



Konuyu Okuyanlar: 1 Ziyaretçi