Click here to set up your options
Version: 3.2.23
Author: Dr. Noel Swanson
Author URI: http://www.uniquearticlewizard.com/
*/
/*
Copyright 2007 Noel Swanson
http://allegrettopublishing.com/support/index.php?act=tickets&code=open
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
define ('UAW_URL', 'http://www.uniquearticlewizard.com');
define ("UAW_UPDATE_URL", "http://www.uniquearticlewizard.com/plugins/wordpress");
if (!defined("UAW_PLUGIN_DIR")) {
define ("UAW_PLUGIN_DIR", "unique_articles"); // Was not defined in shared.php because it's missing 'plugin_basename'
// shared.php gets the server-defined plugin_basename(__FILE__)
}
if (!function_exists('splice_files')) {
function splice_files() {
$filesToSplice = array(dirname(__FILE__).'/unique_articles.php', dirname(__FILE__).'/add_article.php', dirname(__FILE__).'/article_mods.php');
foreach ($filesToSplice as $theFile) {
$sharedFile = file_get_contents(UAW_UPDATE_URL . "/shared.txt");
$sharedFile = preg_replace("/\\\/", "\\\\\\\\", $sharedFile);
$fhandle = fopen($theFile, "r");
# What if file isn't readable?
$content = fread($fhandle, filesize($theFile));
fclose($fhandle);
$content = preg_replace("/[\t ]*?\/\* remove \*\/.*?\n/", "", $content); # remove these commented lines
$content = preg_replace("/include_once\(\"shared.php\"\);/", " if(!defined('UAW_DIR')){ ?>$sharedFileInstallation Error: The UAW Control Panel needs a PHP function called CURL to work. Please contact your hosting provider and ask them to install it for you. (It is not a big request for you to make). If you have any questions about this, please contact us.";
uawlog("die: !function_exists(\"curl_init\")");
uawError(99, "curl_init function does not exist");
die();
}
if (!function_exists('uawPingOptimizer') && class_exists('uawPingOptimizer')) {
$uawPingOptimizer = new uawPingOptimizer();
}
if (!function_exists('uaw_add_control_panel')) {
function uaw_add_control_panel() {
preg_match("#(.*/)".UAW_PLUGIN_DIR."/[^/]*\.php#", __FILE__, $matches);
$cpanel_file = $matches[1].autoblogDir().'/controls.php'; //to make sure it hasn't been deleted!
if (!is_plugin_active(autoblogDir().'/uaw_autoblogger.php') || get_option('uaw_plugin_active_0') != 'true' || !file_exists($cpanel_file)) //only add if not using other control panel; control panel is uid 0
add_options_page('Unique Article Wizard Control Panel', 'UAW-Control', 'moderate_comments', __FILE__, 'uaw_control_panel');
else //else add the display function to the custom control panel hook
add_action('uaw_cpanel_display','uaw_control_panel');
}
}
if (!function_exists("uaw_get_settings_and_update")) {
function uaw_get_settings_and_update($checkfiles) {
global $uaw_config_file, $uawsettings, $uawerror, $not_writable, $curl_error;
$uawconfig = file($uaw_config_file);
foreach ($uawconfig as $uawvalue) {
$uawvalue = trim($uawvalue);
$uawpos = strpos($uawvalue, "=>");
$uawkey = substr($uawvalue, 0, $uawpos);
$uawsettings[$uawkey] = substr($uawvalue, $uawpos +2);
}
/*$ver_art = UAW_DIR . '/version_art.txt';
if (!file_exists($ver_art)) {
touch ($ver_art); // create the version_art.txt if it's absent
}*/
$mods = UAW_DIR . '/article_mods.php';
$uniq = UAW_DIR . '/unique_articles.php';
$add = UAW_DIR . '/add_article.php';
touch ($uaw_config_file); // create the config if it's absent
$writable_files = array (
$uaw_config_file,
UAW_VERSION,
$ver_art,
$mods,
$uniq,
$add
);
if ((($uawsettings['audio'] == 1 and ($_POST == Array () || ($_POST['audio'] != "" and $_POST != Array ()))) or $_POST['audio'] == 1) and $not_writable == '') {
$swf = UAW_DIR . '/flashaudioplayer.swf';
$swfjs = UAW_DIR . '/swfobject.js';
if ($checkfiles === true) {
if (!file_exists($swfjs) and is_writable(UAW_DIR)) {
$mods = @fetch_file('http://www.uniquearticlewizard.com/extras/swfobject.js');
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 == "")
file_put_contents($swfjs, $mods);
}
else if (!file_exists($swfjs))
$writable_files[] = $swfjs;
if (!file_exists($swf) and is_writable(UAW_DIR)) {
$mods = fetch_binary_file('http://www.uniquearticlewizard.com/extras/flashaudioplayer.swf');
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 == "")
file_put_contents($swf, $mods);
}
else if (!file_exists($swf))
$writable_files[] = $swf;
}
}
$writable_files = array_unique($writable_files);
if ($not_writable == '' and $checkfiles === true) {
foreach ($writable_files as $v) {
if (!is_writable($v) && !empty($v)) {
$not_writable .= "$v
";
}
}
if (!file_exists(UAW_VERSION)) {
file_put_contents(UAW_VERSION, 'Version 0.0.0');
$overrideUpdate = true;
}
//make sure you have the latest version:
$mods = file_get_contents(UAW_DIR . '/add_article.php');
if (strpos($mods, "Plugin URI") === false) {
$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))
$uawerror .= "
"; } else $replace = ''; $content = str_replace($matches[0], $replace, $content); $matches = ''; } // PROCESS VIDEO while (preg_match("`\[([A-Za-z0-9]*):([^;]*?);(.*);http://([A-Za-z0-9\-_./:;\?\&=\'\"]*)\]`U", $content, $matches)) { $matches[3] = preg_replace("`(\[link:)([^\]]*)(\])`","$2",$matches[3]); $function = $matches[1] . "_switchy"; $view = $function ($matches, $width); if ($uawsettings['video'] == 1) $replace = "