$sharedFile0.0.00999Recovering shared.php");
}
}
/* remove */ if (file_exists(dirname(__FILE__).'/shared.php')) {
include_once("shared.php");
/* remove */ }
/* remove */ else { # When shared.php does not exist, inject it into add_article.php and unique_articles.php
/* remove */ splice_files();
/* remove */ }
// Turn on error and exception catching only for the article submission process
$uawCatch = true;
if (!function_exists("uawlog")) {
function uawlog() { /* null function to prevent uawlog function not found error if shared.php is missing for some reason */ }
}
define ("UAW_SUBMISSION_START", time());
if (!defined('UAW_DIR')) {
define ('UAW_DIR', dirname(__FILE__));
}
uawlog("add_article - Start of submission");
$overrideUpdate = false;
$versionFName = UAW_DIR . '/version_art.txt';
if (!file_exists($versionFName)) {
// Create the file used in the next update...
file_put_contents($versionFName, 'Version 0.0.0');
$overrideUpdate = true;
// However, if we're in this block, it's because unique_articles.php
// hasn't had a chance to update yet so we'll point this script to
// the original version.txt to initiate that update.
#$versionFName = UAW_DIR . '/version.txt';
uawlog("creating $versionFName");
}
else {
$our_version = @ file_get_contents($versionFName);
if ($our_version === "Version 0.0.0") {
uawlog ("Forcing update override");
$overrideUpdate = true;
}
}
// Check the version.txt and see if it's old enough for us to check for a new version
if (function_exists('get_hours_since_file_updated')) {
$hoursPassed = get_hours_since_file_updated($versionFName);
}
if (!function_exists('check_upgrade_group')) {
function check_upgrade_group() {
return true;
}
}
if ($hoursPassed >= UAW_UPDATE_CHECK_IN_HOURS) {
$upgradeThisGroup = check_upgrade_group();
}
else {
$upgradeThisGroup = false;
}
if ( ($hoursPassed >= UAW_UPDATE_CHECK_IN_HOURS && $upgradeThisGroup) || $overrideUpdate === true) { // Check for an update every 3 hours
touch($versionFName); // modify the timestamp so we only check for an update again after 3 more hours.
uawlog("add_article - writing $versionFName");
//make sure you have the latest version:
$our_version = @ file_get_contents($versionFName); //these two files are numbers.
$mods_version = @ fetch_file(UAW_UPDATE_URL . "/version.txt");
if ($our_version != $mods_version) { //updates with latest version
uawlog("Version mismatch. Local: $our_version Official: $mods_version");
$mods = @ fetch_file(UAW_UPDATE_URL . '/mods.txt');
$error = 0;
$echo = "";
if ((strpos($mods, "Oops, sorry, this page seems to be missin") > 250 or strpos($mods, "Oops, sorry, this page seems to be missin") === false) and strlen($mods) > 100 and $curl_error == "")
if (!@ file_put_contents(UAW_DIR . '/article_mods.php', $mods)) {
$echo .= " Unable to update article_mods.php. Please either download the new upgrade, or change the permissions to 666.";
$error = 1;
uawlog("Unable to update article_mods.php. Please either download the new upgrade, or change the permissions to 666.");
}
else { uawlog("add_article - updated article_mods.php"); }
$mods = @ fetch_file(UAW_UPDATE_URL . '/control.txt');
if ((strpos($mods, "Oops, sorry, this page seems to be missin") > 250 or strpos($mods, "Oops, sorry, this page seems to be missin") === false) and strlen($mods) > 100 and $curl_error == "")
if (!@ file_put_contents(UAW_DIR . '/unique_articles.php', $mods)) {
$echo .= " Unable to update unique_articles.php. Please either download the new upgrade, or change the permissions to 666.";
$error = 1;
uawlog("Unable to update unique_articles.php. Please either download the new upgrade, or change the permissions to 666.");
}
else { uawlog("add_article - updated unique_articles.php"); }
$mods = @ fetch_file(UAW_UPDATE_URL . '/add_art.txt');
if ((strpos($mods, "Oops, sorry, this page seems to be missin") > 250 or strpos($mods, "Oops, sorry, this page seems to be missin") === false) and strlen($mods) > 100 and $curl_error == "")
if (!@ file_put_contents(UAW_DIR . '/add_article.php', $mods)) {
$echo .= " Unable to update add_article.php. Please either download the new upgrade, or change the permissions to 666.";
$error = 1;
uawlog("Unable to update add_article.php. Please either download the new upgrade, or change the permissions to 666.");
}
else { uawlog("add_article - updated add_article.php"); }
$mods = @ fetch_file(UAW_UPDATE_URL . '/shared.txt');
if ((strpos($mods, "Oops, sorry, this page seems to be missin") > 250 or strpos($mods, "Oops, sorry, this page seems to be missin") === false) and strlen($mods) > 100 and $curl_error == "")
if (!@ file_put_contents(UAW_DIR . '/shared.php', $mods)) {
$echo .= " Unable to update shared.php. Please either download the new upgrade, or change the permissions to 666.";
$error = 2; // shared.php update error
uawlog("Unable to update shared.php. Please either download the new upgrade, or change the permissions to 666.");
}
else { uawlog("add_article - updated shared.php"); }
if ($error != 1) {
if (!@ file_put_contents($versionFName, $mods_version)) {
$echo .= " Unable to update $versionFName - Please either download the new upgrade, or change the permissions to 666.";
uawlog("Unable to update $versionFName - Please either download the new upgrade, or change the permissions to 666.");
}
else { uawlog("add_article - updated $versionFName"); }
}
else {
echo $echo;
}
}
}
uawlog("add_article - done in here");
include_once 'article_mods.php';
?>