$showsToGetFile = 'feeds.txt';
$lastDownloadFile = 'lastDownload.txt';
$downloadLocation = '/Users/ericboehs/Downloads/';
if (file_exists($lastDownloadFile)) {
    $lastDownloadFileContents = file($lastDownloadFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
}
//Get the Last Downloaded season/episode into an array
if (file_exists($showsToGetFile)) {
    $showsToGetFileContents = file($showsToGetFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
} else {
    die("Failed to open: {$showsToGetFile}.  File doesn't exists.  Please put at least one rss feed in it and try again.");
}
foreach ($lastDownloadFileContents as $lastDownloadThisFeed) {
    //Loop through the last files downloaded for each feed and seperate the season and episode into an array
    $lastDownloadThisFeedArray[] = explode(" ", $lastDownloadThisFeed);
}
foreach ($showsToGetFileContents as $feed => $feedURL) {
    //Loop through each feed and check/update each feed
    $lastDownloadFileThisFeed = checkForUpdate(parseXML(fetchURLContents($feedURL), $lastDownloadThisFeedArray[$feed][0], $lastDownloadThisFeedArray[$feed][1]), $downloadLocation);
    if (!$lastDownloadFileThisFeed) {
        $lastDownloadFileContentsNew .= $lastDownloadFileContents[$feed] . "\n";
    } else {
        if (trim($lastDownloadFileContents[$feed]) == "") {
            $lastDownloadFileContentsNew .= $lastDownloadFileThisFeed['season'] . " " . $lastDownloadFileThisFeed['episode'] . "\n";
        } else {
            $lastDownloadFileContentsNew .= $lastDownloadFileThisFeed['season'] . " " . $lastDownloadFileThisFeed['episode'] . "\n";
        }
    }
}
file_put_contents($lastDownloadFile, $lastDownloadFileContentsNew);
//Update the lastDownload.txt file with the latest season/episode that you just downloaded.
Пример #2
0
/**
 * firstDelimiterCheckForUpdate function.
 *
 * @access public
 * @param mixed $w
 * @param mixed $query
 * @param mixed $settings
 * @param mixed $db
 * @param mixed $update_in_progress
 * @return void
 */
function firstDelimiterCheckForUpdate($w, $query, $settings, $db, $update_in_progress)
{
    $words = explode('▹', $query);
    $kind = $words[0];
    $all_playlists = $settings->all_playlists;
    $is_alfred_playlist_active = $settings->is_alfred_playlist_active;
    $radio_number_tracks = $settings->radio_number_tracks;
    $now_playing_notifications = $settings->now_playing_notifications;
    $max_results = $settings->max_results;
    $alfred_playlist_uri = $settings->alfred_playlist_uri;
    $alfred_playlist_name = $settings->alfred_playlist_name;
    $country_code = $settings->country_code;
    $last_check_update_time = $settings->last_check_update_time;
    $oauth_client_id = $settings->oauth_client_id;
    $oauth_client_secret = $settings->oauth_client_secret;
    $oauth_redirect_uri = $settings->oauth_redirect_uri;
    $oauth_access_token = $settings->oauth_access_token;
    $oauth_expires = $settings->oauth_expires;
    $oauth_refresh_token = $settings->oauth_refresh_token;
    $display_name = $settings->display_name;
    $userid = $settings->userid;
    $echonest_api_key = $settings->echonest_api_key;
    $check_results = checkForUpdate($w, 0);
    if ($check_results != null && is_array($check_results)) {
        $w->result(null, '', 'New version ' . $check_results[0] . ' is available !', $check_results[2], './images/info.png', 'no', null, '');
        $w->result(null, serialize(array('', '', '', '', '', '', 'Open▹' . $check_results[1], '', '', '', '', '', '', '', '', '')), 'Click to open and install the new version', "This will open the new version of the Spotify Mini Player workflow", './images/alfred-workflow-icon.png', 'yes', null, '');
    } elseif ($check_results == null) {
        $w->result(null, '', 'No update available', 'You are good to go!', './images/info.png', 'no', null, '');
    } else {
        $w->result(null, '', 'Error happened : ' . $check_results, 'The check for workflow update could not be done', './images/warning.png', 'no', null, '');
        if ($check_results == "This release has not been downloaded from Packal") {
            $w->result(null, serialize(array('', '', '', '', '', '', 'Open▹' . 'http://www.packal.org/workflow/spotify-mini-player', '', '', '', '', '', '', '', '', '')), 'Download workflow from Packal', "This will open the Spotify Mini Player Packal page with your default browser", './images/packal.png', 'yes', null, '');
        }
    }
    echo $w->toxml();
    return;
}
Пример #3
0
function isUpdateAvailable()
{
    if (isset($_SESSION['update_check'])) {
        if ($_SESSION['update_check'] != 0 || $_SESSION['update_check'] != false) {
            if ($_SESSION['update_check'] == 1) {
                return 1;
            } elseif ($_SESSION['update_check'] == 2) {
                return 2;
            }
        }
    } else {
        if (checkForUpdate() != -1) {
            isUpdateAvailable();
        }
    }
}
Пример #4
0
/**
 * This function is used in installing plugins or adding updates
 * for previously installed plugins.
 *
 */
function install_plugin()
{
    $result = array();
    // if logged in
    if (WebUsers::isLoggedIn()) {
        // path of temporary folder for storing files
        $temp_path = "../../ams_lib/temp";
        // create a temp directory if not exist
        // temp folder where we first store all uploaded plugins before install
        if (!file_exists("{$temp_path}")) {
            mkdir($temp_path);
        }
        // checking the server if file is uploaded or not
        if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) {
            $fileName = $_FILES["file"]["name"];
            //the files name takes from the HTML form
            $fileTmpLoc = $_FILES["file"]["tmp_name"];
            //file in the PHP tmp folder
            $dir = trim($_FILES["file"]["name"], ".zip");
            $target_path = "../../ams_lib/plugins/{$dir}";
            //path in which the zip extraction is to be done
            $destination = "../../ams_lib/plugins/";
            // scanning plugin folder if plugin with same name is already exists or not
            $x = checkForUpdate($dir, $destination, $fileTmpLoc, $temp_path);
            if ($x == '1') {
                echo "update found";
                throw new SystemExit();
            } else {
                if ($x == '2') {
                    echo "Plugin already exists with same name .";
                    throw new SystemExit();
                } else {
                    if ($x == '3') {
                        echo "Update info is not present in the update";
                        throw new SystemExit();
                    }
                }
            }
            // checking for the command to install plugin is given or not
            if (!isset($_POST['install_plugin'])) {
                if ($_FILES["file"]["type"] == 'application/zip') {
                    if (move_uploaded_file($fileTmpLoc, $temp_path . "/" . $fileName)) {
                        echo "{$fileName} upload is complete.</br>" . "<button type='submit' class='btn btn-primary' style='margin-left:5px; margin-top:10px;' name='install_plugin'>Install Plugin</button></br>";
                        throw new SystemExit();
                    } else {
                        echo "Error in uploading file.";
                        throw new SystemExit();
                    }
                } else {
                    echo "Please select a file with .zip extension to upload.";
                    throw new SystemExit();
                }
            } else {
                // calling function to unzip archives
                if (zipExtraction($temp_path . "/" . $fileName, $destination)) {
                    if (file_exists($target_path . "/.info")) {
                        $result = readPluginFile(".info", $target_path);
                        // sending all info to the database
                        $install_result = array();
                        $install_result['FileName'] = $target_path;
                        $install_result['Name'] = $result['PluginName'];
                        $install_result['Type'] = $result['Type'];
                        if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
                            $install_result['Permission'] = 'admin';
                        } else {
                            $install_result['Permission'] = 'user';
                        }
                        $install_result['Info'] = json_encode($result);
                        // connection with the database
                        $dbr = new DBLayer("lib");
                        $dbr->insert("plugins", $install_result);
                        // if everything is successfull redirecting to the plugin template
                        header("Cache-Control: max-age=1");
                        header("Location: index.php?page=plugins&result=1");
                        throw new SystemExit();
                    } else {
                        // file .info not exists
                        rmdir($target_path);
                        header("Cache-Control: max-age=1");
                        header("Location: index.php?page=install_plugin&result=2");
                        throw new SystemExit();
                    }
                } else {
                    // extraction failed
                    header("Cache-Control: max-age=1");
                    header("Location: index.php?page=install_plugin&result=0");
                    throw new SystemExit();
                }
            }
        } else {
            echo "Please Browse for a file before clicking the upload button";
            throw new SystemExit();
        }
    }
}
Пример #5
0
    if (getConfig("trustSetting") > 0) {
        if ($_SERVER['HTTP_EVE_TRUSTED'] != 'Yes') {
            // Request Trust
            echo '<META HTTP-EQUIV="refresh" CONTENT="2;URL=http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '">';
            echo "<body onLoad=\"CCPEVE.requestTrust('http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "');\" bgcolor=\"#000000\" text=\"#FFFFFF\"> ";
            ob_flush();
            die;
        } else {
            $EVE_Charname = $_SERVER['HTTP_EVE_CHARNAME'];
        }
    }
}
/* If we are this far, we have passed the checks. */
if (!isset($_SESSION["initdone"]) || $_SESSION["initdone"] != true) {
    $_SESSION['initdone'] = true;
}
// Load the sitename.
$SITENAME = getConfig("sitename");
global $BLESSED;
if ($BLESSED) {
    $VERSION .= " [blessed]";
}
//  Ebil MSIE!
//if (!$_SESSION["initdone"] && ereg("MSIE 7", $_SERVER[HTTP_USER_AGENT]) && !isset ($_GET[image])) {
//	makeNotice("MiningBuddy does not work with Internet Explorer 7.0 and above. It does work, however with free alternatives like FireFox, Mozilla or Seamonkey - and of course, from in-game. " .
//	"<br>- Mozilla: <a href=\"http:/mozilla.org\">mozilla.org</a>" . "<br>- Firefox: <a href=\"http:/mozilla.com\">mozilla.com</a>" .
//	"<br>- Seamonkey: <a href=\"http://www.mozilla.org/projects/seamonkey/\">http://www.mozilla.org/projects/seamonkey/</a>", "error", "Browser not supported", " ", " ");
//}
// Update Check!
$UPDATE = checkForUpdate();
Пример #6
0
     query('UPDATE ' . prefix('albums') . ' SET `hitcounter`= 0');
     query('UPDATE ' . prefix('images') . ' SET `hitcounter`= 0');
     query('UPDATE ' . prefix('news') . ' SET `hitcounter`= 0');
     query('UPDATE ' . prefix('pages') . ' SET `hitcounter`= 0');
     query('UPDATE ' . prefix('news_categories') . ' SET `hitcounter`= 0');
     query('UPDATE ' . prefix('options') . ' SET `value`= 0 WHERE `name` LIKE "Page-Hitcounter-%"');
     query("DELETE FROM " . prefix('plugin_storage') . " WHERE `type` = 'rsshitcounter'");
     $class = 'messagebox';
     $msg = gettext('All hitcounters have been set to zero');
     break;
     /** check for update ***********************************************************/
     /********************************************************************************/
 /** check for update ***********************************************************/
 /********************************************************************************/
 case 'check_for_update':
     $v = checkForUpdate();
     if (empty($v)) {
         $class = 'messagebox';
         $msg = gettext("You are running the latest zenphoto version.");
     } else {
         $class = 'errorbox';
         if ($v == 'X') {
             $msg = gettext("Could not connect to <a href=\"http://www.zenphoto.org\">zenphoto.org</a>");
         } else {
             $msg = "<a href=\"http://www.zenphoto.org\">" . sprintf(gettext("zenphoto version %s is available."), $v) . "</a>";
         }
     }
     break;
     //** external script return
 //** external script return
 case 'external':
Пример #7
0
         displayNotificationWithArtwork("Cannot modify library while update is in progress", './images/warning.png', 'Error!');
         return;
     }
     addCurrentTrackTo($w);
     return;
 } else {
     if ($other_action == "remove_current_track_from") {
         if (file_exists($w->data() . '/update_library_in_progress')) {
             displayNotificationWithArtwork("Cannot modify library while update is in progress", './images/warning.png', 'Error!');
             return;
         }
         removeCurrentTrackFrom($w);
         return;
     } else {
         if ($other_action == "download_update") {
             $check_results = checkForUpdate($w, 0, true);
             if ($check_results != null && is_array($check_results)) {
                 exec("open \"{$check_results['1']}\"");
                 displayNotificationWithArtwork("Please install the new version with Alfred", './images/check_update.png', 'Update available');
                 return;
             }
             return;
         } else {
             if ($other_action == "previous") {
                 if ($use_mopidy) {
                     invokeMopidyMethod($w, "core.playback.previous", array());
                 } else {
                     exec("osascript -e 'tell application \"Spotify\" to previous track'");
                 }
                 if ($now_playing_notifications == true) {
                     displayNotificationForCurrentTrack($w);
Пример #8
0
	
		<ul>
<?php 
// http://stackoverflow.com/a/25109122/5208166
function checkForUpdate($folder)
{
    return (bool) shell_exec("[ \$(git -C {$folder} rev-parse HEAD) = \$(git -C {$folder} ls-remote \$(git -C {$folder} rev-parse --abbrev-ref @{u} | \\sed 's/\\// /g') | cut -f1) ] && echo -n 0 || echo -n 1");
}
$verzeichnis_glob = glob($verzeichnis_raw . '*', GLOB_ONLYDIR);
$total = count($verzeichnis_glob);
foreach ($verzeichnis_glob as $folder) {
    $lastCommit = shell_exec('git -C ' . $folder . ' log -1 --format="%cd"');
    $folderName = str_replace($verzeichnis_raw, "", $folder);
    //	$folderName = $folder;
    echo '<li><span>';
    if (checkForUpdate($folder)) {
        // has updates
        echo '<span class="hasup">' . $lastCommit . ' | ' . $folderName . '</span>';
    } else {
        // has no updates
        echo '<span class="noup">' . $lastCommit . ' | ' . $folderName . '</span>';
    }
    echo '</li>';
}
?>

		</ul>
	</div>

	<div class="legend left green"><div class="circle hasup"></div>need to pull</div>
	<div class="legend left red"><div class="circle noup"></div>nothing changed</div>
Пример #9
0
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->query("PRAGMA synchronous = OFF");
    $db->query("PRAGMA journal_mode = OFF");
    $db->query("PRAGMA temp_store = MEMORY");
    $db->query("PRAGMA count_changes = OFF");
    $db->query("PRAGMA PAGE_SIZE = 4096");
    $db->query("PRAGMA default_cache_size=700000");
    $db->query("PRAGMA cache_size=700000");
    $db->query("PRAGMA compile_options");
} catch (PDOException $e) {
    handleDbIssuePdoXml($db);
    return;
}
//
// Check for workflow update
$check_results = checkForUpdate($w, $last_check_update_time);
if ($check_results != null && is_array($check_results)) {
    $w->result(null, '', 'New version ' . $check_results[0] . ' is available', $check_results[2], './images/info.png', 'no', null, '');
    $w->result(null, $check_results[1], 'Please install the new version in Downloads directory', $check_results[1], 'fileicon:' . $check_results[1], 'no', '', '', 'file');
    echo $w->toxml();
    return;
}
// thanks to http://www.alfredforum.com/topic/1788-prevent-flash-of-no-result
mb_internal_encoding('UTF-8');
//
// Fast access to commands
//
if (startsWith($query, ' ')) {
    searchCommandsFastAccess($w, ltrim($query), $settings, $db, $update_in_progress);
    echo $w->toxml();
    return;
Пример #10
0
<?php

if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
// if $_SESSION['update_check'] != false then there is an update available, if $_SESSION['update_check'] == 1 it's a normal one, if $_SESSION['update_check'] == 2 it's a critical update if it's -1 then there is no update available
$version = getVersion();
if (isset($_GET['refresh'])) {
    $_SESSION['update_check'] = null;
}
if (!isset($_SESSION['update_check'])) {
    if (isset($_SESSION['update_server_down'])) {
        $_SESSION['update_server_down'] = null;
        getError(true, _e('update_server_down', '', '', true), true);
        goto down;
    } elseif ($stat = checkForUpdate()) {
        if ($stat[0] - $version > 0 && $stat[2] == 'c') {
            $_SESSION['update_check'] = 2;
        } elseif ($stat[0] - $version > 0 && $stat[2] == 'r') {
            $_SESSION['update_check'] = 1;
        } else {
            down:
            $_SESSION['update_check'] = -1;
        }
    }
}
if ($_SESSION['update_check'] == 2) {
    $status = _e('new_crit_update', '', '', true);
} elseif ($_SESSION['update_check'] == 1) {
    $status = _e('new_regu_update', '', '', true);
    $status_icon = '<i></i>';
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $db->query("PRAGMA synchronous = OFF");
    $db->query("PRAGMA journal_mode = OFF");
    $db->query("PRAGMA temp_store = MEMORY");
    $db->query("PRAGMA count_changes = OFF");
    $db->query("PRAGMA PAGE_SIZE = 4096");
    $db->query("PRAGMA default_cache_size=700000");
    $db->query("PRAGMA cache_size=700000");
    $db->query("PRAGMA compile_options");
} catch (PDOException $e) {
    handleDbIssuePdoXml($db);
    return;
}
//
// Check for workflow update
checkForUpdate($w, $last_check_update_time, false);
// thanks to http://www.alfredforum.com/topic/1788-prevent-flash-of-no-result
mb_internal_encoding('UTF-8');
//
// Fast access to commands
//
if (startsWith($query, ' ')) {
    searchCommandsFastAccess($w, ltrim($query), $settings, $db, $update_in_progress);
    echo $w->toxml();
    return;
}
// Specific case for hotkeys, in order to reset history
if (substr_count($query, '✧') == 1) {
    // empty history
    $w->write(array(), 'history.json');
    $query = ltrim($query, '✧');