コード例 #1
0
ファイル: rss_import_main.php プロジェクト: pantofla/geez
function rss_import_showpage()
{
    global $main_smarty, $the_template, $db;
    include_once 'config.php';
    include_once mnminclude . 'html1.php';
    include_once mnminclude . 'link.php';
    include_once mnminclude . 'tags.php';
    include_once mnminclude . 'smartyvariables.php';
    require_once 'class.rssimport.php';
    require_once 'modules/rss_import/magpierss/rss_fetch.inc';
    define('MAGPIE_CACHE_DIR', 'cache/templates_c/');
    define('rss_import_export_version', '0.4');
    $smarty = $main_smarty;
    include_once mnminclude . 'qeip_0_3.php';
    force_authentication();
    $amIgod = 0;
    $amIgod = $amIgod + checklevel('god');
    // pagename
    define('modulename', 'rss_import');
    $main_smarty->assign('modulename', modulename);
    // breadcrumbs and page title
    $navwhere['text1'] = $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
    $navwhere['link1'] = getmyurl('admin', '');
    $navwhere['text2'] = $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_RSSImport');
    $smarty->assign('navbar_where', $navwhere);
    $smarty->assign('posttitle', ' / ' . $smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_RSSImport'));
    // sidebar
    $main_smarty = do_sidebar($main_smarty);
    if ($amIgod == 1) {
        $tableexists = checkfortable(table_prefix . 'feeds');
        if (!$tableexists) {
            echo "Creating Tables<hr />";
            include_once 'create_feed_tables.php';
            die("<hr />If there are no errors then refresh this page to continue");
        }
        $filename = 'create_feed_tables.php';
        if (file_exists($filename)) {
            // die("Please delete or rename the file create_feed_tables.php, then refresh this page");
        }
        $smarty->register_function('feedsListFeeds', 'smarty_function_feedsListFeeds');
        $smarty->register_function('feedsListFeedLinks', 'smarty_function_feedsListFeedLinks');
        $smarty->register_function('feedsListFeedFields', 'smarty_function_feedsListFeedFields');
        $smarty->register_function('feedsListPliggLinkFields', 'smarty_function_feedsListPliggLinkFields');
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_name', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedName', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_url', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedURL', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_category', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedCategory', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_freq_hours', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedFreqHours', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_votes', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedVotes', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_item_limit', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedItemLimit', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_url_dupe', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedURLDupe', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_title_dupe', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedTitleDupe', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_submitter', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedSubmitter', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'feed_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
        // the type of EIP field to show
        $smarty->assign('qeip_FeedLink_FeedField', $QEIPA);
        $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'pligg_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
        // the type of EIP field to show
        $smarty->assign('qeip_FeedLink_PliggField', $QEIPA);
        // feed oldest first
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_last_item_first', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedLastItemFirst', $QEIPA);
        // feed random vote
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_enable', 'key' => 'feed_id');
        // a unique identifier for the row
        $smarty->assign('qeip_FeedRandomVoteEnable', $QEIPA);
        // feed random vote min
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_min', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedRandomVotesMin', $QEIPA);
        // feed random vote max
        $QEIPA = array('table_name' => table_prefix . 'feeds', 'field_name' => 'feed_random_vote_max', 'key' => 'feed_id', 'field_type' => 'number');
        // the type of database field we are reading from / writing to
        $smarty->assign('qeip_FeedRandomVotesMax', $QEIPA);
        $QEIP = new QuickEIP();
        if (!isset($_REQUEST['action'])) {
            $smarty->assign('tpl_center', rss_import_tpl_path . 'admin_rss_center');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
            echo $QEIP->ShowOnloadJS();
        } else {
            if ($_REQUEST['action'] == "addnewfieldlink") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
                $RSSImport->new_field_link();
                redirect('module.php?module=rss_import&action=editfeed&feed_id=' . $_REQUEST['FeedLinkId']);
            }
            if ($_REQUEST['action'] == "dropfieldlink") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
                $RSSImport->drop_field_link();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "addnewfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedName = "New Feed";
                $RSSImport->new_feed();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "dropfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $RSSImport->drop_feed();
                redirect('module.php?module=rss_import');
            }
            if ($_REQUEST['action'] == "save") {
                echo $QEIP->save_field($smarty);
            }
            if ($_REQUEST['action'] == "examinefeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $RSSImport->read_feed();
                $rss = fetch_rss($RSSImport->FeedURL);
                $z = $rss->items[0];
                if ($z) {
                    echo 'First item in the feed.<hr />';
                    print_r_html($z);
                    echo '<hr />Feed dump.<hr />';
                    print_r_html($rss);
                } else {
                    echo '<hr />There are no items in this feed<hr />';
                }
            }
            if ($_REQUEST['action'] == "editfeed") {
                $RSSImport = new RSSImport();
                $RSSImport->FeedId = $_REQUEST['feed_id'];
                $smarty->assign('tpl_center', rss_import_tpl_path . 'admin_rss_center2');
                $main_smarty->display($template_dir . '/admin/admin.tpl');
            }
            if ($_REQUEST['action'] == "exportfeed") {
                echo 'copy all the text in the box<br />';
                echo '<textarea rows=10 cols=70>' . serialize_feed($_REQUEST['feed_id']) . '</textarea>';
                echo '<br /><br /><a href = "module.php?module=rss_import">return to the rss importer</a>';
            }
            if ($_REQUEST['action'] == "importprebuiltfeed_go") {
                $feed = stripslashes($_REQUEST['prebuiltfeed']);
                if (strpos($feed, '://') < 10) {
                    $r = new HTTPRequest($feed);
                    $feed = $r->DownloadToString();
                }
                if (import_prebuilt($feed)) {
                    redirect(my_pligg_base . '/module.php?module=rss_import');
                } else {
                    // what do we do if error?
                }
            }
        }
        //echo $QEIP->ShowOnloadJS();
    }
}
コード例 #2
0
ファイル: rss_main.php プロジェクト: holsinger/openfloor
 // the type of database field we are reading from / writing to
 $smarty->assign('qeip_FeedSubmitter', $QEIPA);
 $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'feed_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
 // the type of EIP field to show
 $smarty->assign('qeip_FeedLink_FeedField', $QEIPA);
 $QEIPA = array('table_name' => table_prefix . 'feed_link', 'field_name' => 'pligg_field', 'key' => 'feed_link_id', 'eip_type' => 'select');
 // the type of EIP field to show
 $smarty->assign('qeip_FeedLink_PliggField', $QEIPA);
 $QEIP = new QuickEIP();
 if (!isset($_REQUEST['action'])) {
     $smarty->display('rss_main.tpl');
 } else {
     if ($_REQUEST['action'] == "addnewfieldlink") {
         $RSSImport = new RSSImport();
         $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
         $RSSImport->new_field_link();
         header("Location: rss_main.php");
     }
     if ($_REQUEST['action'] == "dropfieldlink") {
         $RSSImport = new RSSImport();
         $RSSImport->FeedLinkId = $_REQUEST['FeedLinkId'];
         $RSSImport->drop_field_link();
         header("Location: rss_main.php");
     }
     if ($_REQUEST['action'] == "addnewfeed") {
         $RSSImport = new RSSImport();
         $RSSImport->FeedName = "New Feed";
         $RSSImport->new_feed();
         header("Location: rss_main.php");
     }
     if ($_REQUEST['action'] == "dropfeed") {