Merge branch 'master' into dev

This commit is contained in:
Andy Dixon
2024-07-23 19:03:59 +01:00
committed by GitHub
29 changed files with 24 additions and 6691 deletions
-8
View File
@@ -1,8 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
$doc = file_get_contents("./login.php", true);
$doc = stripslashes($doc);
$cb = true;
-35
View File
@@ -1,35 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
@session_start();
if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSsession')) {
include_once('createsession.php');
$forgotproxy = 'https://www.neogate.com/licencing/forgotpass-serv.php?';
if ($_POST && $_POST['neoCMSUsername']) {
include_once('getpath.php');
$forgotgets = 'neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . $path . '&neoCMSAcctUser=' . urlencode($_POST['neoCMSUsername']);
header("Location:$forgotproxy$forgotgets");
} elseif ($_GET && $_GET['neoCMSSess'] == $_SESSION['neoCMSSess']) {
$m = $_GET['neoCMSPassMessage'];
echo $m;
if ($m == '0') $getmessage = "Your password was reset and an email was sent.";
elseif ($m == '1') $getmessage = "There is no such user on this domain.";
$script = '<script type="text/javascript">window.top.window.forgotReset("' . $getmessage . '");</script>';
echo $script;
}
}
?>
-67
View File
@@ -1,67 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
@session_start();
if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSsession')) {
include_once('urldissect.php');
include_once('createsession.php');
if (isset($_SESSION['neoCMSUserid']) && isset($_SESSION['neoCMSIsadmin']) && $_SESSION['neoCMSIsadmin'] == 'Y') {
$ftpconn = false;
$ftpvars = "<?php\n\n";
$ftpvars .= "\t" . '$ftpu = ' . "false;\n";
$ftpvars .= "\t" . '$ftpp = ' . "false;\n";
$ftpvars .= "\t" . '$ftps = ' . "false;\n";
$ftpvars .= "\t" . '$ftpwd = ' . "false;\n\n";
$ftpvars .= '?>';
$fftp = '';
include_once('ftpvars.php');
include_once('ftpconnect.php');
ftpconnect();
if ($ftpconn) {
$ftpdoc = tmpfile();
if (!$ftpdoc) {
$ftpdocp = tempnam(dirname(__FILE__) . '/../settings/tmp', 'Ftpdoc');
chmod($ftpdocp, 0777);
$ftpdoc = fopen($ftpdocp, 'w+');
}
fwrite($ftpdoc, $ftpvars);
rewind($ftpdoc);
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 1);
$remotefile = $ftpwd . $path . 'ftpvars.php';
if (ftp_fput($ftpconn, $remotefile, $ftpdoc, FTP_BINARY)) {
$getmessage = "Your FTP information has been successfully cleared.";
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
} else {
$getmessage = '<strong>Error:</strong> neocms could not find this page: <em>' . $remotefile . '</em>';
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
}
fclose($ftpdoc);
if (isset($ftpdocp)) unlink($ftpdocp);
}
echo '<script type="text/javascript">window.top.window.clearFTPInfo();window.top.window.removeFrames();</script>';
}
}
?>
-34
View File
@@ -1,34 +0,0 @@
<?php
function ftpconnect()
{
global $fftp, $ftpu, $ftpp, $ftps, $ftpwd, $ftpconn;
if ($ftpu && $ftpp && $ftps && $ftpwd) {
if ($ftpwd != '/') $ftpwd = rtrim($ftpwd, '/');
//start ftp connection
if (function_exists('ftp_connect')) {
$ftpconn = ftp_connect($ftps) or die("Couldn't connect to $ftps");
ftp_login($ftpconn, $ftpu, $ftpp);
ftp_pasv($ftpconn, true);
} else {
$ftpconn = false;
$getmessage = "<strong>Error:</strong> FTP is not enabled for your install of PHP. <a href='http://www.php.net/manual/en/ftp.setup.php' title='Installing FTP on PHP'>More info here.</a>";
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
}
}
}
?>
-82
View File
@@ -1,82 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
@session_start();
if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSsession')) {
include_once('urldissect.php');
include_once('createsession.php');
if (isset($_SESSION['neoCMSUserid']) && isset($_SESSION['neoCMSIsadmin']) && $_SESSION['neoCMSIsadmin'] == 'Y') {
extract($_POST);
$ftpconn = false;
$ftpu = ($ftpu != '') ? $ftpu : false;
$ftpp = ($ftpp != '') ? $ftpp : false;
$ftps = ($ftps != '') ? $ftps : false;
$ftpwd = ($ftpwd != '') ? $ftpwd : false;
if ($ftpu && $ftpp && $ftps && $ftpwd) {
$ftpvars = "<?php\n\n";
$ftpvars .= "\t" . '$ftpu = "' . $ftpu . '"' . ";\n";
$ftpvars .= "\t" . '$ftpp = "' . $ftpp . '"' . ";\n";
$ftpvars .= "\t" . '$ftps = "' . $ftps . '"' . ";\n";
$ftpvars .= "\t" . '$ftpwd = "' . $ftpwd . '"' . "\n\n";
$ftpvars .= '?>';
include_once('ftpconnect.php');
ftpconnect();
if ($ftpconn) {
$ftpdoc = tmpfile();
if (!$ftpdoc) {
$ftpdocp = tempnam(dirname(__FILE__) . '/../settings/tmp', 'Ftpdoc');
chmod($ftpdocp, 0777);
$ftpdoc = fopen($ftpdocp, 'w+');
}
fwrite($ftpdoc, $ftpvars);
rewind($ftpdoc);
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 1);
$remotefile = $ftpwd . $path . 'ftpvars.php';
if (ftp_fput($ftpconn, $remotefile, $ftpdoc, FTP_BINARY)) {
$getmessage = "Your FTP information was successfully saved.";
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
} else {
$getmessage = "<strong>Error:</strong> There is an error in your FTP credentials. Please try entering them again.";
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
}
fclose($ftpdoc);
if (isset($ftpdocp)) unlink($ftpdocp);
}
echo '<script type="text/javascript">window.top.window.removeFrames();</script>';
} else {
$getmessage = '<strong>Error:</strong> All fields are required.';
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
echo '<script type="text/javascript">window.top.window.removeFrames();</script>';
}
}
}
?>
-10
View File
@@ -1,10 +0,0 @@
<?php
$ftpconn = false;
include_once('ftpvars.php');
include_once('ftpconnect.php');
ftpconnect($ftpu, $ftpp, $ftps, $ftpwd);
?>
-8
View File
@@ -1,8 +0,0 @@
<?php
$ftpu = false;
$ftpp = false;
$ftps = false;
$ftpwd = false;
?>
-25
View File
@@ -1,25 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
@session_start();
if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSsession')) {
include_once('geturi.php');
include_once('createsession.php');
$pathproxy = 'https://www.neogate.com/licencing/prefs-serv.php?';
$scripturl = $_SERVER['HTTP_HOST'] . uri();
$path = explode('/', $scripturl);
$path = $path[sizeof($path) - 3];
if (isset($_SESSION['neoCMSPath']) && $_SESSION['neoCMSPath'] != $path) {
$pathgets = 'neoCMSUsername=' . urlencode($_SESSION['neoCMSUserid']) . '&neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . urlencode($_POST['neoCMSHTML']);
header("Location:$pathproxy$pathgets");
}
}
-98
View File
@@ -1,98 +0,0 @@
<?php
error_reporting(E_ALL & ~E_NOTICE);
@session_start();
if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSsession')) {
include_once('createsession.php');
if (isset($_SESSION['neoCMSUserid'])) {
$userproxy = 'https://www.neogate.com/licencing/users-serv.php?';
if ($_POST && $_POST['neoCMSAcctUser'] && $_POST['neoCMSAcctEmail'] && $_POST['neoCMSAcctUser-orig'] && $_POST['neoCMSAcctEmail-orig']) {
include_once('getpath.php');
$usergets = 'neoCMSUsername=' . urlencode($_SESSION['neoCMSUserid']) . '&neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . urlencode($path) . '&neoCMSAcctUser=' . urlencode($_POST['neoCMSAcctUser']) . '&neoCMSAcctEmail=' . urlencode($_POST['neoCMSAcctEmail']) . '&neoCMSOrigEmail=' . urlencode($_POST['neoCMSAcctEmail-orig']) . '&neoCMSOrigUser=' . urlencode($_POST['neoCMSAcctUser-orig']);
if ($_POST['neoCMSAcctName']) $usergets .= '&neoCMSAcctName=' . urlencode($_POST['neoCMSAcctName']);
if ($_POST['neoCMSAcctPass'] != '' && $_POST['neoCMSAcctPassConfirm'] != '') $usergets .= '&neoCMSAcctPass=' . urlencode($_POST['neoCMSAcctPass']) . '&neoCMSAcctPassConfirm=' . urlencode($_POST['neoCMSAcctPassConfirm']);
header("Location:$userproxy$usergets");
} elseif ($_POST && $_POST['neoCMSNewAcctUser'] && $_POST['neoCMSNewAcctEmail'] && $_POST['neoCMSNewAcctName'] && $_POST['neoCMSNewAcctPass'] && $_POST['neoCMSNewAcctPassConfirm']) {
include_once('getpath.php');
$usergets = 'neoCMSUsername=' . urlencode($_SESSION['neoCMSUserid']) . '&neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . urlencode($path) . '&neoCMSNewAcctUser=' . urlencode($_POST['neoCMSNewAcctUser']) . '&neoCMSNewAcctEmail=' . urlencode($_POST['neoCMSNewAcctEmail']) . '&neoCMSNewAcctName=' . urlencode($_POST['neoCMSNewAcctName']) . '&neoCMSNewAcctPass=' . urlencode($_POST['neoCMSNewAcctPass']) . '&neoCMSNewAcctPassConfirm=' . urlencode($_POST['neoCMSNewAcctPassConfirm']);
header("Location:$userproxy$usergets");
} elseif (empty($_GET)) {
include_once('getpath.php');
$usergets = 'neoCMSUsername=' . urlencode($_SESSION['neoCMSUserid']) . '&neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . urlencode($path);
header("Location:$userproxy$usergets");
} elseif ($_GET && $_GET['neoCMSDelUser']) {
include_once('getpath.php');
$usergets = 'neoCMSUsername=' . urlencode($_SESSION['neoCMSUserid']) . '&neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . urlencode($path) . '&neoCMSDelUser=' . urlencode($_GET['neoCMSDelUser']);
header("Location:$userproxy$usergets");
} elseif ($_GET && $_GET['neoCMSSess'] == $_SESSION['neoCMSSess']) {
$admin = array();
$users = array();
foreach ($_GET as $key => $val) {
if (strstr($key, '-A')) $admin[str_replace('-A', '', $key)] = $val;
elseif (!strstr($key, 'neoCMSSess') && !strstr($key, 'neoCMSUserMessage')) {
$num = explode('-', $key);
$users[$num[1]][$num[0]] = $val;
}
}
$adminscript = '<script type="text/javascript">window.top.window.adminUser("' . $admin['neoCMSName'] . '", "' . $admin['neoCMSUsername'] . '", "' . $admin['neoCMSEmail'] . '");</script>';
echo $adminscript;
foreach ($users as $user) {
$userscript = '<script type="text/javascript">window.top.window.buildUser("' . $user['neoCMSName'] . '", "' . $user['neoCMSUsername'] . '", "' . $user['neoCMSEmail'] . '", "' . $user['neoCMSId'] . '");</script>';
echo $userscript;
}
if ($_GET['neoCMSUserMessage'] != '0') {
$m = $_GET['neoCMSUserMessage'];
if ($m == '1') $getmessage = "Your account settings were successfully saved.";
elseif ($m == '2') $getmessage = "Your new account has been successfully created.";
elseif ($m == '3') $getmessage = "<strong>Error:</strong> This account has already been created.";
elseif ($m == '4') $getmessage = "Account successfully deleted.";
elseif ($m == '5') $getmessage = "<strong>Error:</strong> There was an error deleting this account.";
else $getmessage = "<strong>Error:</strong> There was an error saving.";
$savescript = '<script type="text/javascript">window.top.window.userBar("' . $getmessage . '");</script>';
echo $savescript;
$_SESSION['neoCMSUserid'] = $admin['neoCMSUsername'];
}
echo '<script type="text/javascript">window.top.window.removeFrames();</script>';
}
}
}
?>
-4
View File
@@ -10,10 +10,6 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
if ($_POST) {
include_once('getpath.php');
$logingets = 'neoCMSUsername=' . urlencode($_POST['neoCMSUsername']) . '&neoCMSPassword=' . urlencode($_POST['neoCMSPassword']) . '&neoCMSSess=' . urlencode($_SESSION['neoCMSSess']) . '&neoCMSPath=' . urlencode($path);
include_once('../config.php');
if (@$_users[$_POST['neoCMSUsername']]["password"] == $_POST['neoCMSPassword']) {
-2
View File
@@ -10,5 +10,3 @@ session_destroy();
@session_write_close();
exit;
?>
+2 -50
View File
@@ -10,7 +10,6 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
if (isset($_SESSION['neoCMSUserid'])) {
include_once('urldissect.php');
include_once('ftpstart.php');
include_once('checkpath.php');
$message = '<strong>Error:</strong> There was an error restoring your page. Please try again.';
@@ -103,58 +102,15 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
function editfile($content, $backcontent, $url, $incpath, $inc)
{
global $ftpconn, $ftpwd;
if ($content != $backcontent && ((!stristr($content, '<?php') && !strstr($content, '<%')) || (preg_match('/>[^<]+</', $backcontent) || preg_match('/<html/', $backcontent)) && strstr($backcontent, 'neocms'))) {
if ($ftpconn) {
$restdoc = tmpfile();
if (!$restdoc) {
$restdocp = tempnam(dirname(__FILE__) . '/../settings/tmp', 'Rest');
chmod($restdocp, 0777);
$restdoc = fopen($restdocp, 'w+');
}
fwrite($restdoc, $backcontent);
rewind($restdoc);
if (strstr($url, $_SERVER['DOCUMENT_ROOT'])) {
$nfkey = explode($_SERVER['DOCUMENT_ROOT'], $url);
$nfkey = $nfkey[1];
if ($inc) $remotefile = $ftpwd . $nfkey;
else {
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 3);
$filename = explode('../../', $url);
$filename = "$filename[1]";
$remotefile = $ftpwd . $path . $filename;
}
} else {
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 3);
$filename = explode('../../', $url);
$filename = "$filename[1]";
$remotefile = $ftpwd . $path . $filename;
}
if (ftp_fput($ftpconn, $remotefile, $restdoc, FTP_BINARY)) echo "Uploaded: $remotefile\n\n";
else $message = '<strong>Error:</strong> neocms could not find this page: <em>' . $remotefile . '</em>';
fclose($restdoc);
if (isset($restdocp)) unlink($restdocp);
} elseif (is_writable($url)) {
if (is_writable($url)) {
//restores file
$restdoc = fopen($url, "w");
fputs($restdoc, $backcontent);
fclose($restdoc);
} else $message = "<strong>Error:</strong> You do not have permission to edit this page. Try <a href='settings/ftpinfo.php' title='Enter your FTP info'>saving your FTP info here</a>.";
} else $message = "<strong>Error:</strong> You do not have permission to edit this page.";
}
@@ -172,9 +128,5 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
echo $script;
}
if ($ftpconn) ftp_close($ftpconn);
}
}
?>
+4 -29
View File
@@ -10,7 +10,6 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
if (isset($_SESSION['neoCMSUserid'])) {
include_once('urldissect.php');
include_once('ftpstart.php');
include_once('checkpath.php');
$message = 'Your page was successfully published.';
@@ -47,7 +46,7 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
function loadfile($url, $incpath, $f)
{
global $message, $includes, $pagepath, $ftpconn, $ftpwd, $doctype, $encode, $edit;
global $message, $includes, $pagepath, $doctype, $encode, $edit;
$ssi = false;
@@ -85,37 +84,13 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
$pagename = preg_replace('/(\.php|\.asp|\.html|\.htm|\.phtml|\.shtml|\.cfm)/', '', $pagename);
$backup = dirname(__FILE__) . '/../backups/' . $pagename . '_Bak.' . $pageext[1];
if ($ftpconn) {
$backdoc = tmpfile();
if (!$backdoc) {
$backdocp = tempnam(dirname(__FILE__) . '/../settings/tmp', 'Back');
chmod($backdocp, 0777);
$backdoc = fopen($backdocp, 'w+');
}
fwrite($backdoc, $content);
rewind($backdoc);
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 2);
$remotefile = $ftpwd . $path . 'backups/' . $pagename . '_Bak.' . $pageext[1];
echo "Backup File: $remotefile\n\n";
if (ftp_fput($ftpconn, $remotefile, $backdoc, FTP_BINARY)) echo "Uploaded Backup: $remotefile!\n\n";
else $message = '<strong>Error:</strong> neocms failed creating backup for: <em>' . $remotefile . '</em>';
fclose($backdoc);
if (isset($backdocp)) unlink($backdocp);
} elseif (is_writable($url)) {
if (is_writable($url)) {
$backdoc = fopen($backup, "w+");
fwrite($backdoc, $content);
fclose($backdoc);
} else $message = '<strong>Error:</strong> You do not have permission to edit this page: <em>' . $pagefile . "</em>. Try <a href='settings/ftpinfo.php' title='Enter your FTP info'>saving your FTP info here</a>.";
} else $message = '<strong>Error:</strong> You do not have permission to edit this page: <em>' . $pagefile . "</em>.";
// clean up content
@@ -500,7 +475,7 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
fwrite($doc, $fpost);
fclose($doc);
} else $message = "<strong>Error:</strong> You do not have permission to edit this page. Try <a href='settings/ftpinfo.php' title='Enter your FTP info'>saving your FTP info here</a>.";
} else $message = "<strong>Error:</strong> You do not have permission to edit this page.";
} else $message = '<strong>Error:</strong> neocms is unable find this page.';
+2 -2
View File
@@ -9,9 +9,9 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
if (isset($_SESSION['neoCMSUserid'])) {
$_SESSION['neoCMSHTML'] = $gethtml = "";
$_SESSION['neoCMSHTML'] = $gethtml = "Y";
$_SESSION['neoCMSPath'] = $getpath = "cms";
$_SESSION['neoCMSFiles'] = $getfile = 1;
$_SESSION['neoCMSFiles'] = $getfile = "Y";
$_SESSION['neoCMSFilePath'] = $getfilepath = "files";
$_SESSION['neoCMSImagePath'] = $getimagepath = "images";
$_SESSION['neoCMSExFolders'] = $getexfolders = "ext";
+1 -31
View File
@@ -6,7 +6,6 @@
if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSsession')) {
include_once('urldissect.php');
include_once('ftpstart.php');
include_once('createsession.php');
if (!empty($_POST) && isset($_SESSION['neoCMSUserid'])) {
@@ -30,16 +29,6 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
if (move_uploaded_file($file['tmp_name'], $uploadfile)) {
$alert = "Your file was successfully uploaded.";
} elseif ($ftpconn) {
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 3);
$uploadfile = str_ireplace('../../', '', $uploadfile);
$remotefile = $ftpwd . $path . $uploadfile;
$tempfile = fopen($file['tmp_name'], 'r');
if (ftp_fput($ftpconn, $remotefile, $tempfile, FTP_BINARY)) $alert = "Your file was successfully uploaded.";
}
} else {
@@ -73,22 +62,7 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
if (!preg_match('/(\.html|\.php|\.js|\.css|\.htm|\.shtml|\.asp|\.cfm|\.phtml)$/i', $fileName) && $fileSize < 100000000) {
if ($ftpconn) {
$path = urldissect($_SERVER['SCRIPT_NAME'], false, 3);
$uploadfile = str_ireplace('../../', '', $uploadfile);
$remotefile = $ftpwd . $path . $uploadfile;
$tempfile = fopen($file['tmp_name'], 'r');
if (ftp_fput($ftpconn, $remotefile, $tempfile, FTP_BINARY)) $alert = "Your file was successfully uploaded.";
else {
$alert = "<strong>Error:</strong> You do not have permission to upload files to this folder.";
$script = '<script language="javascript" type="text/javascript">window.top.window.fileInfo("", "' . $alert . '", "", "" );</script>';
echo $script;
}
} elseif (move_uploaded_file($file['tmp_name'], $uploadfile)) {
if (move_uploaded_file($file['tmp_name'], $uploadfile)) {
$alert = "Your file was successfully uploaded.";
} else {
$alert = "<strong>Error:</strong> You do not have permission to upload files to this folder.";
@@ -111,10 +85,6 @@ if (isset($_SESSION['neoCMSSess']) && strstr($_SESSION['neoCMSSess'], 'neoCMSses
}
if ($ftpconn) ftp_close($ftpconn);
}
}
?>