예제 #1
0
파일: index.php 프로젝트: slikts/feedfilter
		if (empty($_POST)) {
			message('nothing selected');
			header('Location: ' . $_SERVER['REQUEST_URI']);

			return;
		}

		if (empty($_POST['feed'])) {
			$feed = new_feed_id();
			$message = 'feed created, bookmark this page';
		} else {
			$feed = $_POST['feed'];
			$message = 'feed updated';
		}

		update_feed($feed, $module, array_keys($_POST['cat']));

		header('Location: ' . implode('/', array(WWW_ROOT, 'module', $module, feed_id_encode($feed))));
		message($message);

		return;
	}
	$feed = !empty($request_parts[2]) ? feed_id_decode($request_parts[2]) : NULL;
	$args = array(
		'module' => $module, 
		'filters' => get_filters($module),
		'feed' => $feed,
		'feed_cats' => get_feed_cats($feed)
	);

	if ($feed) {
예제 #2
0
function parse_options()
{
    global $html_out, $config_values;
    $filler = "<br>";
    array_keys($_GET);
    $commands = array_keys($_GET);
    if (empty($commands)) {
        return FALSE;
    }
    if (preg_match("/^\\//", $commands[0])) {
        $commands[0] = preg_replace("/^\\//", '', $commands[0]);
    }
    switch ($commands[0]) {
        case 'getClientData':
            if ($_REQUEST['recent']) {
                $response = getClientData(1);
            } else {
                $response = getClientData(0);
            }
            echo $response;
            exit;
        case 'delTorrent':
            $response = delTorrent($_REQUEST['delTorrent'], $_REQUEST['trash'], $_REQUEST['batch']);
            echo "{$response}";
            exit;
        case 'stopTorrent':
            $response = stopTorrent($_REQUEST['stopTorrent'], $_REQUEST['batch']);
            echo "{$response}";
            exit;
        case 'startTorrent':
            $response = startTorrent($_REQUEST['startTorrent'], $_REQUEST['batch']);
            echo "{$response}";
            exit;
        case 'moveTo':
            $response = moveTorrent($_REQUEST['moveTo'], $_REQUEST['torHash'], $_REQUEST['batch']);
            echo "{$response}";
            exit;
        case 'updateFavorite':
            $response = update_favorite();
            if (preg_match("/^Error:", $response)) {
                echo "<div id=\"fav_error\" class=\"dialog_window\" style=\"display: block\">{$response}</div>";
            }
            break;
        case 'updateFeed':
            update_feed();
            break;
        case 'clearCache':
            clear_cache();
            break;
        case 'setGlobals':
            update_global_config();
            write_config_file();
            break;
        case 'matchTitle':
            $feedLink = $_GET['rss'];
            foreach ($config_values['Feeds'] as $key => $feed) {
                if ($feed['Link'] == "{$feedLink}") {
                    $idx = $key;
                }
            }
            if ($config_values['Feeds'][$idx]['seedRatio']) {
                $seedRatio = $config_values['Feeds'][$idx]['seedRatio'];
            } else {
                $seedRatio = $config_values['Settings']['Default Seed Ratio'];
            }
            if (!$seedRatio) {
                $seedRatio = -1;
            }
            if ($tmp = guess_match(html_entity_decode($_GET['title']), TRUE)) {
                $_GET['name'] = trim(strtr($tmp['key'], "._", "  "));
                if ($config_values['Settings']['MatchStyle'] == "glob") {
                    $_GET['filter'] = trim(strtr($tmp['key'], " ._", "???"));
                    $_GET['filter'] .= '*';
                } else {
                    $_GET['filter'] = trim($tmp['key']);
                }
                $_GET['quality'] = $tmp['data'];
                $_GET['feed'] = $_GET['rss'];
                $_GET['button'] = 'Add';
                $_GET['savein'] = 'Default';
                $_GET['seedratio'] = $seedRatio;
            } else {
                $_GET['name'] = $_GET['title'];
                $_GET['filter'] = $_GET['title'];
                $_GET['quality'] = 'All';
                $_GET['feed'] = $_GET['rss'];
                $_GET['button'] = 'Add';
                $_GET['savein'] = 'Default';
                $_GET['seedratio'] = $seedRatio;
            }
            if ($config_values['Settings']['Default Feed All'] && preg_match('/^(\\d+)x(\\d+)p?$|^(\\d{8})$/i', $tmp['episode'])) {
                $_GET['feed'] = 'All';
            }
            $response = update_favorite();
            if ($response) {
                echo "{$response}";
            }
            //break;
            exit;
        case 'hide':
            $response = add_hidden(ucwords($_GET['hide']));
            if ($response) {
                echo "ERROR:{$response}";
            } else {
                $guess = guess_match(html_entity_decode($_GET['hide']), TRUE);
                echo $guess['key'];
            }
            exit;
        case 'delHidden':
            del_hidden($_GET['unhide']);
            break;
        case 'dlTorrent':
            // Loaded via ajax
            foreach ($config_values['Favorites'] as $fav) {
                $guess = guess_match(html_entity_decode($_GET['title']));
                $name = trim(strtr($guess['key'], "._", "  "));
                if ($name == $fav['Name']) {
                    $downloadDir = $fav['Save In'];
                }
            }
            if ((!isset($downloadDir) || $downloadDir == "Default") && isset($config_values['Settings']['Download Dir'])) {
                $downloadDir = $config_values['Settings']['Download Dir'];
            }
            $r = client_add_torrent(preg_replace('/ /', '%20', trim($_GET['link'])), $downloadDir, $_GET['title'], $_GET['feed']);
            if ($r == "Success") {
                $torHash = get_torHash(add_cache($_GET['title']));
            }
            if (isset($torHash)) {
                echo $torHash;
            } else {
                echo $r;
            }
            exit(0);
            break;
        case 'clearHistory':
            // Loaded via ajax
            if (file_exists($config_values['Settings']['History'])) {
                unlink($config_values['Settings']['History']);
            }
            display_history();
            close_html();
            exit(0);
            break;
        case 'get_client':
            global $config_values;
            echo $config_values['Settings']['Client'];
            exit;
        case 'version_check':
            echo version_check();
            exit;
        case 'post_bug':
            global $tw_version;
            $response = post_bug($_POST['Summary'], $_POST['Name'], $_POST['Email'], $_POST['Priority'], $_POST['Description']);
            echo $response;
            exit;
        case 'get_dialog_data':
            switch ($_GET['get_dialog_data']) {
                case '#favorites':
                    display_favorites();
                    exit;
                case '#configuration':
                    display_global_config();
                    exit;
                case '#hidelist':
                    display_hidelist();
                    exit;
                case '#feeds':
                    display_feeds();
                    exit;
                case '#history':
                    display_history();
                    exit;
                case '#show_legend':
                    display_legend();
                    exit;
                case '#report_bug':
                    report_bug();
                    exit;
                case '#clear_cache':
                    display_clearCache();
                    exit;
                case '#show_transmission':
                    display_transmission();
                    exit;
                case '#show_info':
                    show_info(urldecode($_GET['episode_name']));
                    exit;
                default:
                    exit;
            }
        default:
            $output = "<script type='text/javascript'>alert('Bad Paramaters passed to " . $_SERVER['PHP_SELF'] . ":  " . $_SERVER['REQUEST_URI'] . "');</script>";
    }
    if (isset($exec)) {
        exec($exec, $output);
    }
    if (isset($output)) {
        if (is_array($output)) {
            $output = implode($filler, $output);
        }
        $html_out .= str_replace("\n", "<br>", "<div class='execoutput'>{$output}</div>");
        echo $html_out;
        $html_out = "";
    }
    return;
}
예제 #3
0
        //Form for new feed has been posted, insert new record into database
        update_feed("insert", $fields);
        show_feed_roster();
        break;
    case "edit":
        //Display existing record for editing
        edit_feed($fields);
        break;
    case "delete":
        //Delete record
        delete_feed();
        show_feed_roster();
        break;
    case "update":
        //Update an existing record
        update_feed("update", $fields);
        show_feed_roster();
        break;
    case "topupdate":
        topupdate();
        show_feed_roster();
        break;
    case "catfeed":
        //Admin clicked button to create feed from category or album thumbnail view
        cat_feed($fields);
        break;
}
function show_feed_roster()
{
    global $CONFIG;
    $query = "SELECT name, value FROM {$CONFIG['TABLE_CONFIG']} WHERE name like 'cpg_brainfeeder_%' ORDER BY name";
예제 #4
0
파일: update.php 프로젝트: arensb/newsbite
  * remove ads. So perhaps this stuff should be left alone,
  * save that if the user left-clicks on the "Update feed"
  * link, it should use JS and update in the background, while
  * if ve middle-clicks, it should use traditional HTML.
  */
 if ($verbose) {
     error_log("Updating feed_id {$feed_id}");
 }
 $feed = db_get_feed($feed_id);
 if ($feed === NULL) {
     // Invalid feed ID, presumably..
     error_log("Invalid feed ID: {$feed_id}");
     abort("Invalid feed ID: {$feed_id}");
 }
 $handler->start_feed($feed_id, $feed['title']);
 $err = update_feed($feed_id, $feed);
 if (!$err) {
     // XXX - This should never happen
     $handler->error($feed_id, $feed['title'], "parse_feed() returned " . ($err == "" ? var_export($err) : $err));
 }
 /* Error-checking */
 if (isset($err['status']) && $err['status'] != 0) {
     switch ($out_fmt) {
         case "json":
             // XXX - Convert to print_struct()?
             echo jsonify('state', "error", 'feed_id', $feed_id, 'error', $err['errmsg']);
             exit(1);
         case "html":
         default:
             abort($err['errmsg']);
     }
}
switch ($_GET['cmd']) {
    default:
        agffeed($page);
        break;
    case 'edit':
        edit();
        break;
    case 'delete':
        delete();
        break;
    case 'install':
        $return_message = install($_GET['id']);
        break;
    case 'update':
        $feedmsg = update_feed();
        agffeed($page, $feedmsg);
        break;
}
/**
 * Main feed display and logic
 *
 * @param $page
 * @param string $feedmsg
 */
function agffeed($page, $feedmsg = '')
{
    global $domain, $db;
    ?>

    <div class="heading">