* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with JonesCMS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ if (eregi("header.php", $_SERVER['PHP_SELF'])) { Header("Location: index.php"); die; } $num_users = num_users(); if ($num_users == 0) { Header("Location: init.php"); die; } list($title, $sitename, $topname, $logo, $theme, $homepage) = getSiteData(); $cookie = getCookie(); updateHits(); enterSession(); header("Content-type: text/html; charset=iso-8859-1"); echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel="stylesheet" href="themes/<?php echo $theme; ?> /style.css" type="text/css" /> <title><?php echo $title;
public static function managePluginsThemesSite($siteID, $requestParams, $type, $events, $historyAdditionalData) { $action = 'manage'; $siteData = getSiteData($siteID); $requestAction = "edit_plugins_themes"; $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['requestParams'] = $requestParams; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; return prepareRequestAndAddHistory($PRP); }
public static function backupTestProcessor($siteIDs, $params) { if (empty($siteIDs)) { return false; } $type = 'site'; $action = 'backupTest'; $requestAction = 'backup_test_site'; $events = 1; $historyAdditionalData = array(); $historyAdditionalData[] = array('uniqueName' => 'backupTest', 'detailedAction' => 'Backup Test'); foreach ($siteIDs as $siteID) { $siteData = getSiteData($siteID); $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; $PRP['doNotExecute'] = false; $PRP['directExecute'] = true; $PRP['doNotShowUser'] = true; prepareRequestAndAddHistory($PRP); } }
function main($error, $uname, $fname, $lname, $email, $title, $sitename, $topname, $logo, $theme) { list($title, $sitename, $topname, $logo, $theme, $homepage) = getSiteData(); header("Content-type: text/html; charset=iso-8859-1"); echo "<?xml version=\"1.0\" encoding=\"iso-iso-8859-1\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <link rel="stylesheet" href="themes/<?php echo $theme; ?> /style.css" type="text/css"> <title><?php echo $title; ?> </title> </head> <body> <div id="container"> <div id="banner"> <img id="logo" src="img/<?php echo $logo; ?> " alt="<?php echo $sitename; ?> " /> <div id="topName"><?php echo $topname; ?> </div> </div> <div id="main"> <div id="pageHeader"> <h1>First time initialization</h1> <h2>Wecolme to Jones' CMS. Fill in these simple data to get into the system, please.</h2> </div> <div class="contentBox"> <p class="error"><?php echo $error; ?> </p> <form method="post" action="init.php?cmd=finish"> <table> <caption>User data</caption> <tr> <th>Username:</th> <td><input type="text" name="uname" value="<?php echo $uname; ?> " maxlength="20" /></td> </tr> <tr> <th>First name:</th> <td><input type="text" name="fname" value="<?php echo $fname; ?> " maxlength="20" /></td> </tr> <tr> <th>Last name:</th> <td><input type="text" name="lname" value="<?php echo $lname; ?> " maxlength="20" /></td> </tr> <tr> <th>Password:</th> <td><input type="password" name="pwd1" /></td> </tr> <tr> <th>Re-type it:</th> <td><input type="password" name="pwd2" /></td> </tr> <tr> <th>Email:</th> <td><input type="text" name="email" value="<?php echo $email; ?> " maxlength="30" /></td> </tr> </table> <table> <caption>Site data</caption> <tr> <th>Title:</th> <td><input type="text" name="title" value="<?php echo $title; ?> " maxlength="60" /></td> </tr> <tr> <th>Name:</th> <td><input type="text" name="sitename" value="<?php echo $sitename; ?> " maxlength="60" /></td> </tr> <tr> <th>Slogan:</th> <td><input type="text" name="topname" value="<?php echo $topname; ?> " maxlength="60" /></td> </tr> <tr> <th>Logo URL:</th> <td><input type="text" name="logo" value="<?php echo $logo; ?> " maxlength="60" /></td> </tr> <tr> <th>Theme:</th> <td><input type="text" name="theme" value="<?php echo $theme; ?> " maxlength="20" /></td> </tr> </table> <table class="normal"> <tr> <td class="normal"><input type="submit" value="Submit" /></td> <td class="normal"><input type="reset" value="Reset" /></td> </tr> </table> </form> </div> </div> </body> </html> <?php }
public static function removeBackupProcessor($siteIDs, $params, $extras = array()) { $type = "backup"; $action = "remove"; $requestAction = "delete_backup"; $requestParams = array('task_name' => $params['taskName'], 'result_id' => $params['resultID']); $historyAdditionalData = array(); $historyAdditionalData[] = array('uniqueName' => $params['taskName'], 'detailedAction' => $action); foreach ($siteIDs as $siteID) { $siteData = getSiteData($siteID); $events = 1; $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['requestParams'] = $requestParams; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; if (isset($extras['doNotShowUser'])) { $PRP['doNotShowUser'] = $extras['doNotShowUser']; } //if(isset($extras['runCondition']) && $extras['runCondition'] == true){ // $runCondition = array(); // $runCondition['satisfyType'] = 'AND'; // $runCondition['query'] = array('table' => "history", // 'select' => 'historyID', // 'where' => "parentHistoryID = ".$params['resultID']." AND status IN('completed', 'error', 'netError') ORDER BY ID DESC LIMIT 1"); // /*'where' => "type IN('backup', 'scheduleBackup') AND action IN('multiCallNow, 'now', 'multiCallRunTask', 'runTask') AND status IN('success', 'error', 'netError')");*/ // //'where' => "status NOT IN('multiCallWaiting')"); // $PRP['runCondition'] = serialize($runCondition); // $PRP['status'] = 'scheduled'; // } prepareRequestAndAddHistory($PRP); } }
function getFullWPURL($siteID, $URL) { //this will add http auth if it set for the site if (is_array($URL)) { $finalURL = array(); $finalKey = ''; foreach ($URL as $key => $value) { $finalURL[$key] = $value; $siteData = getSiteData($siteID); if (!empty($siteData['httpAuth'])) { $siteHttpAuth = @unserialize($siteData['httpAuth']); if (!empty($siteHttpAuth['username'])) { $URLParts = parse_url($value); $URLParts['user'] = urlencode($siteHttpAuth['username']); $URLParts['pass'] = urlencode($siteHttpAuth['password']); $finalURL[$key] = httpBuildURLCustom($URLParts); $finalKey = $key; } } } return $finalURL[$key]; } else { $finalURL = $URL; $siteData = getSiteData($siteID); if (!empty($siteData['httpAuth'])) { $siteHttpAuth = @unserialize($siteData['httpAuth']); if (!empty($siteHttpAuth['username'])) { $URLParts = parse_url($URL); $URLParts['user'] = urlencode($siteHttpAuth['username']); $URLParts['pass'] = urlencode($siteHttpAuth['password']); $finalURL = httpBuildURLCustom($URLParts); } } return $finalURL; } }
public static function terminatePendingProcess($params) { $condition = ""; if (isset($params['actionID']) && !empty($params['actionID'])) { $condition = "actionID = '" . $params['actionID'] . "'"; } elseif (isset($params['historyID']) && !empty($params['historyID'])) { $condition = "historyID = '" . $params['historyID'] . "'"; } if ($condition != "") { $historyDatas = DB::getArray("?:history", "historyID, siteID", $condition . " AND status NOT IN ('completed','error','netError') "); if (!empty($historyDatas) && is_array($historyDatas)) { foreach ($historyDatas as $key => $historyData) { updateHistory(array("status" => "error", "error" => "task_killed"), $historyData['historyID'], array("status" => "error", "errorMsg" => "Task killed by user")); if ($params["multiCall"]) { $historyAdditionalData = array(); $historyAdditionalData[] = array('uniqueName' => "Backup Now", 'detailedAction' => "remove"); $PRP = array('requestAction' => "delete_backup", 'requestParams' => array('task_name' => "Backup Now", 'result_id' => $historyData['historyID']), 'siteData' => getSiteData($historyData['siteID']), 'type' => "backup", 'action' => "remove", 'status' => "scheduled", 'events' => 1, 'historyAdditionalData' => $historyAdditionalData, 'doNotShowUser' => true, 'sendAfterAllLoad' => false, 'timeScheduled' => time() + 30); prepareRequestAndAddHistory($PRP); } } } } }
function main($error, $title, $sitename, $topname, $logo, $theme, $homepage) { include 'header.php'; list($title, $sitename, $topname, $logo, $theme, $homepage) = getSiteData(); $themeslist = getThemesList(); ?> <div id="main"> <div id="pageHeader"> <h1><span>Administration Area</span></h1> <h2><span>Edit site properties</span></h2> </div> <div class="contentBox"> <p class="error"><?php echo $error; ?> </p> <form method="post" action="properties.php"> <fieldset> <table> <caption>Site data</caption> <tr> <th>Title:</th> <td><input type="text" name="title" value="<?php echo $title; ?> " maxlength="60" /></td> </tr> <tr> <th>Name:</th> <td><input type="text" name="sitename" value="<?php echo $sitename; ?> " maxlength="60" /></td> </tr> <tr> <th>Slogan:</th> <td><input type="text" name="topname" value="<?php echo $topname; ?> " maxlength="60" /></td> </tr> <tr> <th>Logo:</th> <td> <select name="logo"> <option value="#">-- None --</option> <?php $res = sql_query("SELECT id, filename FROM jones_binarydata", $dbi); while (list($img_id, $img_filename) = sql_fetch_row($res, $dbi)) { ?> <option value="<?php echo $img_id; ?> "<?php if ($img_id == $logo) { echo " selected"; } ?> ><?php echo $img_filename; ?> </option> <?php } ?> </select> </td> </tr> <tr> <th>Theme:</th> <td> <select name="theme"> <?php for ($i = 0; $i < sizeof($themeslist); $i++) { if ($themeslist[$i] != "") { ?> <option value="<?php echo $themeslist[$i]; ?> " <?php if ($themeslist[$i] == $theme) { echo "selected"; } ?> ><?php echo $themeslist[$i]; ?> </option> <?php } } ?> </select> </td> </tr> <tr> <th>Homepage:</th> <td> <select name="homepage"> <option value="blog.php">Blog</option> <?php $result = sql_query("select id, label from jones_page", $dbi); while (list($page_id, $page_label) = sql_fetch_row($result, $dbi)) { ?> <option value="page.php?id=<?php echo $page_id; ?> " <?php $b = strcmp(trim($homepage), trim("page.php?id=" . $page_id)); if ($b == 0) { echo " selected"; } ?> ><?php echo $page_label; ?> </option> <?php } ?> </select> </td> </tr> <tr> <td class="buttons" colspan="2"> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> <input type="hidden" name="cmd" value="finish" /> </td> </tr> </table> </fieldset> </form> </div> <div class="backLink"> <a href="index.php">Back to Main Menu</a> </div> </div> <?php include 'footer.php'; }
public static function getPluginsThemesSite($siteID, $requestParams, $type) { $action = "get"; $siteData = getSiteData($siteID); $requestAction = "get_plugins_themes"; $historyAdditionalData = array(); $historyAdditionalData[] = array('detailedAction' => 'get', 'uniqueName' => 'getStats'); $events = 1; $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['requestParams'] = $requestParams; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; $PRP['doNotExecute'] = false; $PRP['sendAfterAllLoad'] = true; return prepareRequestAndAddHistory($PRP); }
public static function updateClientProcessor($siteIDs, $params) { $requestAction = 'update_client'; $type = 'clientPlugin'; $action = 'update'; $events = 1; $historyAdditionalData = array(); $historyAdditionalData[] = array('detailedAction' => 'update', 'uniqueName' => 'clientPlugin'); foreach ($siteIDs as $siteID) { $currentVersion = DB::getField("?:sites", "pluginVersion", "siteID='" . $siteID . "'"); if (version_compare($currentVersion, $params['clientUpdateVersion']) == -1) { $siteData = getSiteData($siteID); $requestParams = array('download_url' => $params['clientUpdatePackage']); $PRP = array(); $PRP['requestAction'] = $requestAction; $PRP['requestParams'] = $requestParams; $PRP['siteData'] = $siteData; $PRP['type'] = $type; $PRP['action'] = $action; $PRP['events'] = $events; $PRP['historyAdditionalData'] = $historyAdditionalData; $PRP['sendAfterAllLoad'] = true; prepareRequestAndAddHistory($PRP); } } }