commit 5c41c928a63640c6143f0e13595a7bea8ae443f8 Author: Andy Dixon Date: Tue Jul 23 16:21:39 2024 +0100 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c71b3d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/cms/.idea/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/New folder.iml b/.idea/New folder.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/New folder.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ed380a0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..f324872 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/cms/config.php b/cms/config.php new file mode 100644 index 0000000..ad7bfff --- /dev/null +++ b/cms/config.php @@ -0,0 +1,10 @@ + ["password"=>"password","isAdmin"=>1], + "user" => ["password"=>"password","isAdmin"=>0], +]; diff --git a/cms/core/checkbrand.php b/cms/core/checkbrand.php new file mode 100644 index 0000000..65a30da --- /dev/null +++ b/cms/core/checkbrand.php @@ -0,0 +1,8 @@ +/'; + $aspreg = '/<%(.|\n|\r)+?\%>/'; + $jsreg = '/]*>\s*[^<](.|\n)*?<\/\s*script>/'; + $prereg = '/]*>(.|\n)*?<\/\s*pre>/'; + $codereg = '/]*>(.|\n)*?<\/\s*code>/'; + $cssreg = '/]*>(.|\n)*?<\/\s*style>/'; + + $stufflen = strlen($stuff); + + try { + + //grab php + preg_match_all($phpreg, $stuff, $code['PHP']); + $stuff = preg_replace($phpreg, '----||PHPGO3SHERE||----', $stuff); + + //grab asp + preg_match_all($aspreg, $stuff, $code['ASP']); + $stuff = preg_replace($aspreg, '----||ASPGO3SHERE||----', $stuff); + + //grab on-page js + preg_match_all($jsreg, $stuff, $code['JS']); + $stuff = preg_replace($jsreg, '----||JSGO3SHERE||----', $stuff); + + //grab on-page CSS + preg_match_all($cssreg, $stuff, $code['CSS']); + $stuff = preg_replace($cssreg, '----||CSSGO3SHERE||----', $stuff); + + } catch (Exception $e) { + + $message = 'Error: There may be too much on page Javascript or CSS. Please try moving them to external files and/or validating your HTML.'; + output(); + + } + + $stuff = stripslashes($stuff); + $stuff = trim($stuff); + + //grab pre + preg_match_all($prereg, $stuff, $code['PRE']); + $stuff = preg_replace($prereg, '----||PREGO3SHERE||----', $stuff); + + //grab code + preg_match_all($codereg, $stuff, $code['CODE']); + $stuff = preg_replace($codereg, '----||CODEGO3SHERE||----', $stuff); + + function lower($matches) { + + } + + //fix uppercase tags + $stuff = preg_replace_callback('/<(\/|)[A-Z]+[A-Z0-9]*\b/', function($matches){return strtolower($matches[0]);}, $stuff); + + //fix attribute quotes + $stuff = preg_replace('/(<(?!meta)[^>]*\s[A-Za-z]+=)([^>\'\"\s]+)(\s*[^>]*)/', '$1"$2"$3', $stuff); + + // fix self-closing tags + if (preg_match('/XHTML/', $doctype)) { + $stuff = preg_replace("/(%]*[^\/%])(>)/i", "$1/>", $stuff); + $stuff = preg_replace("//", "
", $stuff); + } + + $nstuff = htmlentities($stuff, ENT_QUOTES, $encode); + if ($nstuff == '') $nstuff = htmlentities($stuff, ENT_QUOTES, 'ISO-8859-15'); + $stuff = $nstuff; + + $stuff = str_replace("<", "<", $stuff); + $stuff = str_replace(">", ">", $stuff); + $stuff = str_replace("&", '&', $stuff); + $stuff = str_replace("'", "'", $stuff); + $stuff = str_replace(""", '"', $stuff); + + // remove TinyMCE stuff + preg_match_all('/(?:<[^>]*)(_mce_[^=]+=(?:\"|\'|)[^\"]*(?:\"|\'|)\s*)/', $stuff, $mces); + foreach ($mces[1] as $mce) { + $stuff = str_replace($mce, "", $stuff); + } + + // add back original code + + $replace = array('CODE', 'PRE', 'CSS', 'JS', 'ASP', 'PHP'); + + foreach ($replace as $r) { + $rreg = '/\-\-\-\-\|\|' . $r . 'GO3SHERE\|\|\-\-\-\-/'; + $c = 0; + + preg_match_all($rreg, $stuff, $newcode); + foreach ($newcode[0] as $ncode) { + $stuff = preg_replace($rreg, $code[$r][0][$c], $stuff, 1); + $c++; + } + $c = 0; + + } + + // remove extra line breaks + $stuff = preg_replace("/\r\n/", "\n", $stuff); + + if ($stuff != '' || $stufflen == 0) return $stuff; + else $message = 'Error: Some characters couldn’t be recognized. Try switching to UTF-8 encoding and be sure all special characters are properly encoded.'; + +} diff --git a/cms/core/createsession.php b/cms/core/createsession.php new file mode 100644 index 0000000..d6c73cf --- /dev/null +++ b/cms/core/createsession.php @@ -0,0 +1,31 @@ +read())) { + + if (!preg_match($neocmspath, $path)) $entries[] = $entry; + + } + + $dir->close(); + + foreach ($entries as $entry) { + + $fullname = $path . $entry; + $pathname = str_replace('../..', '', $path); + + $exFolders = preg_replace('/,\s*/', '/|', $_SESSION['neoCMSExFolders']); + $exFolders = str_replace('-', '\-', $exFolders); + $exFolders = str_replace('.', '\.', $exFolders); + $exFolders = '/' . str_replace('/', '\/', $exFolders) . '\//'; + + if ($entry != '.' && $entry != '..' && is_dir($fullname) && is_readable($fullname) && (!preg_match($exFolders, $fullname) || $_SESSION['neoCMSExFolders'] == '')) findfiles($fullname, $pattern); + elseif ($entry != '.' && $entry != '..' && is_file($fullname) && preg_match($pattern, $entry)) { + + if (!in_array($pathname, $matches)) { + + if (preg_match('/\.html|\.htm|\.php|\.cfm|\.phtml|\.shtml|\.asp/', $fullname)) { + + $content = file_get_contents($fullname); + + if (checkContent($content)) $matches[] = $fullname; + + } else $matches[] = $fullname; + + } + + } + + } + + } + + function checkContent($content) + { + + global $type; + + if (stristr($content, '[^<]+ 0) { + + foreach ($matches as $match) { + + $fname = str_replace('../../', '', $match); + $flink = siteURL() . $fname; + + if (preg_match('/\.bmp|\.gif|\.jpeg|\.jpg|\.png/i', $fname)) { + + if (!strstr($imghtml, 'neoCMSImgUL')) $imghtml = '
    '; + + if (($_SESSION['neoCMSImagePath'] == null || $_SESSION['neoCMSImagePath'] == '') || strstr($fname, $_SESSION['neoCMSImagePath'])) $imghtml = str_replace('', '
  • ' . $fname . ' Thumbnail

    ' . $fname . '

  • ', $imghtml); + + } elseif (preg_match('/\.html|\.htm|\.php|\.phtml|\.cfm|\.shtml|\.asp/i', $fname)) { + + if (!strstr($pagehtml, 'neoCMSPagesUL')) $pagehtml = '
      '; + + $pagehtml = str_replace('', '
    • ' . $fname . '
    • ', $pagehtml); + + } else { + + if (!strstr($filehtml, 'neoCMSFileUL')) $filehtml = '
        '; + + if (($_SESSION['neoCMSFilePath'] == null || $_SESSION['neoCMSFilePath'] == '') || strstr($fname, $_SESSION['neoCMSFilePath'])) $filehtml = str_replace('', '
      • ' . $fname . '
      • ', $filehtml); + + } + + } + + $matches = $imghtml . $pagehtml . $filehtml; + + $script = ""; + echo $script; + + } else { + + $script = ''; + echo $script; + + } + + $endscript = ""; + echo $endscript; + + } + + } + +} diff --git a/cms/core/folderload.php b/cms/core/folderload.php new file mode 100644 index 0000000..7530056 --- /dev/null +++ b/cms/core/folderload.php @@ -0,0 +1,111 @@ +read())) { + + if (!preg_match('/(\/neocms\-js\/|\/neocms\-images\/)/', $path)) $entries[] = $entry; + + } + + $dir->close(); + + foreach ($entries as $entry) { + + $fullname = $path . $entry; + $pathname = str_replace('../..', '', $path); + + $exFolders = preg_replace('/,\s*/', '|', $_SESSION['neoCMSExFolders']); + $exFolders = str_replace('-', '\-', $exFolders); + $exFolders = str_replace('.', '\.', $exFolders); + $exFolders = '/' . str_replace('/', '\/', $exFolders) . '/'; + + if ($entry != '.' && $entry != '..' && is_dir($fullname)) { + + if (preg_match($pathpatt, $path) && !in_array($pathname, $matches) && is_writable($path)) $matches[] = $pathname; + if (!preg_match($exFolders, $fullname) || $_SESSION['neoCMSExFolders'] == '') findfiles($fullname, $pattern, $pathpatt); + + } elseif (($entry == '.' || $entry == '..') && is_dir($fullname)) { + + if (preg_match($pathpatt, $path) && !in_array($pathname, $matches) && is_writable($path)) $matches[] = $pathname; + + } elseif (is_file($fullname) && preg_match($pattern, $entry)) { + + if (!in_array($pathname, $matches) && is_writable($path)) $matches[] = $pathname; + + } + + } + + } + + findfiles("../../$pathdefault", $pattern, $pathpatt); + + if (sizeof($matches) > 0) { + + foreach ($matches as $match) { + + $script = ''; + echo $script; + + } + + } else { + $script = ''; + echo $script; + } + + $endscript = ''; + echo $endscript; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/core/forgotpassword.php b/cms/core/forgotpassword.php new file mode 100644 index 0000000..d9e93eb --- /dev/null +++ b/cms/core/forgotpassword.php @@ -0,0 +1,35 @@ +window.top.window.forgotReset("' . $getmessage . '");'; + echo $script; + + } +} + +?> \ No newline at end of file diff --git a/cms/core/ftpclear.php b/cms/core/ftpclear.php new file mode 100644 index 0000000..52a830e --- /dev/null +++ b/cms/core/ftpclear.php @@ -0,0 +1,67 @@ +'; + + $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 = ''; + echo $savescript; + + } else { + $getmessage = 'Error: neocms could not find this page: ' . $remotefile . ''; + $savescript = ''; + echo $savescript; + } + + fclose($ftpdoc); + if (isset($ftpdocp)) unlink($ftpdocp); + } + + echo ''; + + } + +} + +?> \ No newline at end of file diff --git a/cms/core/ftpconnect.php b/cms/core/ftpconnect.php new file mode 100644 index 0000000..9c9c30d --- /dev/null +++ b/cms/core/ftpconnect.php @@ -0,0 +1,34 @@ +Error: FTP is not enabled for your install of PHP. More info here."; + $savescript = ''; + echo $savescript; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/core/ftpcreate.php b/cms/core/ftpcreate.php new file mode 100644 index 0000000..6240809 --- /dev/null +++ b/cms/core/ftpcreate.php @@ -0,0 +1,82 @@ +'; + + 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 = ''; + echo $savescript; + + } else { + $getmessage = "Error: There is an error in your FTP credentials. Please try entering them again."; + $savescript = ''; + echo $savescript; + } + + fclose($ftpdoc); + if (isset($ftpdocp)) unlink($ftpdocp); + } + + echo ''; + + } else { + + $getmessage = 'Error: All fields are required.'; + $savescript = ''; + echo $savescript; + + echo ''; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/core/ftpstart.php b/cms/core/ftpstart.php new file mode 100644 index 0000000..61acbcb --- /dev/null +++ b/cms/core/ftpstart.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/cms/core/ftpvars.php b/cms/core/ftpvars.php new file mode 100644 index 0000000..f7af05b --- /dev/null +++ b/cms/core/ftpvars.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/cms/core/getpage.php b/cms/core/getpage.php new file mode 100644 index 0000000..b01b544 --- /dev/null +++ b/cms/core/getpage.php @@ -0,0 +1,11 @@ + $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 = ''; + echo $adminscript; + + foreach ($users as $user) { + + $userscript = ''; + 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 = "Error: This account has already been created."; + elseif ($m == '4') $getmessage = "Account successfully deleted."; + elseif ($m == '5') $getmessage = "Error: There was an error deleting this account."; + else $getmessage = "Error: There was an error saving."; + + $savescript = ''; + echo $savescript; + + $_SESSION['neoCMSUserid'] = $admin['neoCMSUsername']; + } + + echo ''; + } + } +} + +?> \ No newline at end of file diff --git a/cms/core/geturi.php b/cms/core/geturi.php new file mode 100644 index 0000000..89692a9 --- /dev/null +++ b/cms/core/geturi.php @@ -0,0 +1,14 @@ +window.top.window.location="../";'; + echo $script; + } else { + $script = ''; + echo $script; + } +} + +} else { + + $script = ''; + echo $script; + +} diff --git a/cms/core/logout.php b/cms/core/logout.php new file mode 100644 index 0000000..a4f9618 --- /dev/null +++ b/cms/core/logout.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/cms/core/restore.php b/cms/core/restore.php new file mode 100644 index 0000000..f8709fb --- /dev/null +++ b/cms/core/restore.php @@ -0,0 +1,180 @@ +Error: There was an error restoring your page. Please try again.'; + + if (@file_exists($pageurl)) { + + function loadfile($url, $incpath, $inc) + { + + global $message, $pagepath; + + // read the file + + $doc = fopen($url, "r"); + $content = stream_get_contents($doc); + fclose($doc); + + $reginclude = '/(?:include\b|include_once\b|require\b|require_once\b)(?:\s*\(*[^;\?>]*)(?:\"|\')([^\"\'<>]*)(?:(\"|\')\)*(;|[\s\t\r\n]*\?>))/i'; // php include regexp + if (!preg_match($reginclude, $content)) $reginclude = '/(?:)/i'; // SSI regexp + + // read the backup + $pagename = (strstr($url, $_SERVER['DOCUMENT_ROOT'])) ? explode($_SERVER['DOCUMENT_ROOT'], $url) : explode('../../', $url); + $pagename = trim($pagename[1], '/'); + $pagename = str_ireplace('/', '-', $pagename); + + $pageext = explode('.', $pagename); + $pagename = preg_replace('/(\.php|\.asp|\.html|\.htm|\.phtml|\.shtml|\.cfm)/', '', $pagename); + $backup = dirname(__FILE__) . '/../backups/' . $pagename . '_Bak.' . $pageext[1]; + + if (@file_exists($backup)) { + + $backdoc = fopen($backup, "r"); + $backcontent = stream_get_contents($backdoc); + + fclose($backdoc); + + echo "File Found: $backup\n\n"; + + editfile($content, $backcontent, $url, $incpath, $inc); + + } + + if (preg_match($reginclude, $content)) { + + preg_match_all($reginclude, $content, $includes); + + foreach ($includes[1] as &$value) { + + if (@file_exists($_SERVER['DOCUMENT_ROOT'] . $value) && $value != '') { + + $incfile = $_SERVER['DOCUMENT_ROOT'] . $value; + $incpath = false; + + } elseif (!stristr($value, 'http://')) { + + $incfile = "$pagepath/$value"; + + if ($incpath) { + + $incpathreg = preg_replace('/\//', '\/', $incpath); + $incpathreg = '/(^' . $incpathreg . '\/|\/' . $incpathreg . '\/)/'; + + $incorigpath = preg_replace($incpathreg, '', $value, 1); + + $newinc = "$pagepath/$incpath/$incorigpath"; + + $incfile = (@file_exists($newinc)) ? $newinc : $incfile; + + $incpatharr = explode('/', $incorigpath); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } else { + + $incpatharr = explode('/', $value); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } + + } else $incpath = false; + + if (!preg_match('/\/$/', $incfile)) loadfile($incfile, $incpath, true); + + } + + } + } + + function editfile($content, $backcontent, $url, $incpath, $inc) + { + + global $ftpconn, $ftpwd; + + if ($content != $backcontent && ((!stristr($content, '[^<]+Error: neocms could not find this page: ' . $remotefile . ''; + + fclose($restdoc); + if (isset($restdocp)) unlink($restdocp); + + } elseif (is_writable($url)) { + //restores file + $restdoc = fopen($url, "w"); + fputs($restdoc, $backcontent); + fclose($restdoc); + } else $message = "Error: You do not have permission to edit this page. Try saving your FTP info here."; + + } + + } + + loadfile($pageurl, false, false); + + $message = 'Your page was successfully restored.'; + $script = ''; + echo $script; + + } else { + $message = 'Error: neocms could not find this page: ' . $url . ''; + $script = ''; + echo $script; + } + + if ($ftpconn) ftp_close($ftpconn); + + } +} + +?> \ No newline at end of file diff --git a/cms/core/save.php b/cms/core/save.php new file mode 100644 index 0000000..5e7676a --- /dev/null +++ b/cms/core/save.php @@ -0,0 +1,525 @@ + $post) { + + $post = thecleaner($post); + if (preg_match("/^edit/", $key)) $edit[$key] = $post; + + } + + } + + function loadfile($url, $incpath, $f) + { + + global $message, $includes, $pagepath, $ftpconn, $ftpwd, $doctype, $encode, $edit; + + $ssi = false; + + $pagename = (strstr($url, $_SERVER['DOCUMENT_ROOT'])) ? explode($_SERVER['DOCUMENT_ROOT'], $url) : explode('../../', $url); + $pagename = trim($pagename[1], '/'); + $pagename = str_ireplace('/', '-', $pagename); + $pagefile = $pagename; + + if (@file_exists($url)) { + + // read the file + $doc = fopen($url, "r"); + $content = stream_get_contents($doc); + fclose($doc); + + if ((!stristr($content, '[^<]+]*>/', $content)) { + preg_match_all('/]*>/', $content, $dtarr); + $doctype = $dtarr[0][0]; + } + if (preg_match('/(?:]*charset=\"*)([^\"<]+)/', $stuff)) { + preg_match_all($charreg, $stuff, $enc); + $encode = $enc[1][0]; + } + + if ($f) cleanpost(); + + $elereg = '/<[^>]*class=(?:\"|\'|)[^>]*(\bneocms\b|\bneocmsRepeatArea\b)[^>]*?(?:\"|\'|)[^>]*>/'; + $reginclude = '/(?:include\b|include_once\b|require\b|require_once\b)(?:\s*\(*[^;\?>]*)(?:\"|\')([^\"\'<>]*)(?:(\"|\')\)*(;|[\s\t\r\n]*\?>))/i'; // php include regexp + if (!preg_match($reginclude, $content)) $reginclude = '/(?:)/i'; // SSI regexp + + // create a backup + $pageext = explode('.', $pagename); + $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 = 'Error: neocms failed creating backup for: ' . $remotefile . ''; + + fclose($backdoc); + if (isset($backdocp)) unlink($backdocp); + + } elseif (is_writable($url)) { + + $backdoc = fopen($backup, "w+"); + fwrite($backdoc, $content); + fclose($backdoc); + + } else $message = 'Error: You do not have permission to edit this page: ' . $pagefile . ". Try saving your FTP info here."; + + // clean up content + + if (preg_match($reginclude, $content)) { + + preg_match_all($reginclude, $content, $includes[$url]); + + $incArr = preg_split($reginclude, $content); + $incfiles = $includes[$url][1]; + $neoCon = array(); + + foreach ($incArr as $k => $v) { + + $docroot = $_SERVER['DOCUMENT_ROOT']; + + if (@file_exists($docroot . $incfiles[$k]) && $incfiles[$k] != '') { + + $neoCon[$k] = $v; + + $incfile = $docroot . $incfiles[$k]; + $incpath = false; + + } elseif (!stristr($incfiles[$k], 'http://')) { + + $neoCon[$k] = $v; + + $incfile = "$pagepath/$incfiles[$k]"; + + if ($incpath) { + + $incpathreg = str_replace('/', '\/', $incpath); + $incpathreg = '/(^' . $incpathreg . '\/|\/' . $incpathreg . '\/)/'; + + $incorigpath = preg_replace($incpathreg, '', $incfiles[$k], 1); + + $newinc = "$pagepath/$incpath/$incorigpath"; + + $incfile = (@file_exists($newinc)) ? $newinc : $incfile; + + $incpatharr = explode('/', $incorigpath); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } else { + + $incpatharr = explode('/', $incfiles[$k]); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } + + } else $incpath = false; + + if (!preg_match('/\/$/', $incfile)) $neoCon[$incfile] = loadfile($incfile, $incpath, false); + + } + + return $neoCon; + + } else return $content; + } + } else return false; + + } + + function output() + { + + global $message; + + $script = ''; + echo $script; + + } + + function conArray($content) + { + + $conArray = false; + + foreach ($content as $con) { + + if (is_array($con)) $conArray = true; + + } + + return conArray; + + } + + function makeEdits($conpost) + { + + global $edit, $eles, $inc, $count; + + $commreg = '//'; + + preg_match_all($commreg, $conpost, $comments); + + $conpost = preg_replace($commreg, '', $conpost); + + $elereg = '/<[^>]*class\s*=\s*(?:\"|\'|)[^\"|\']*(\bneocms\b|\bneocmsRepeatArea\b)[^\"|\'|=]*?(?:\"|\'|)[^>]*>/'; + + preg_match_all($elereg, $conpost, $neocmseles); + + if ($neocmseles[0]) { + + $newsplice = ''; + + foreach ($neocmseles[0] as $neocmsele) { + + $splice = explode($neocmsele, $conpost, 2); + + $newsplice = $splice[0]; + + $post = $splice[1]; + + $rest = ''; + + preg_match_all("/^<([^>\s]*)\b/i", $neocmsele, $eleTag); + + $eleTag = $eleTag[1][0]; + + if (stristr($eleTag, 'img')) { + + if (isset($edit["editImg$count"])) { + + $editStr = array(); + + $editIncom = $edit["editImg$count"]; + $editIncom = explode(',', $editIncom); + foreach ($editIncom as $eikey => $eipost) { + $eipost = explode('::', $eipost); + $editStr[$eipost[0]] = $eipost[1]; + } + + $editContent = ''; + + if (isset($editStr['link']) && $editStr['link'] != '') { + + if (preg_match('/(]*>)$/', $newsplice)) { + + preg_match_all('/(]*href=(?:\"|\'))([^\"\s]*)((?:\"|\')[^>]*>)$/', $newsplice, $lastlink); + $newlink = $lastlink[1][0] . $editStr['link']; + if ($editStr['rel'] != '') $newlink .= '" rel="' . $editStr['rel']; + $newlink .= $lastlink[3][0]; + + $newsplice = preg_replace('/(]*>)$/', "$newlink", $newsplice); + + } else { + + $newsplice .= ']*>)$/', $newsplice)) $newsplice = preg_replace('/(]*>)$/', '', $newsplice); + if (preg_match('/^(<\/a>)/', $post)) $post = preg_replace('/^(<\/a>)/', '', $post); + + } + + $editContent .= '' . $editStr['alt'] . ']*>/i'; + + preg_match_all($eleTagReg, $post, $tags); + + $contents = preg_split($eleTagReg, $post); + + $track = 1; + + foreach ($tags[0] as $tag) { + + if (strpos($tag, ' 1) { + + foreach ($tags[0] as $tag) { + + if (isset($edit["editVid$count"])) $rest .= $contents[0]; + else $rest .= $tag . $contents[0]; + + array_shift($contents); + + } + + } else { + + if (isset($edit["editVid$count"])) $rest = $contents[0]; + else $rest = $tags[0][0] . $contents[0]; + + } + + } + + $neocmsele = preg_replace('/neocms\b|neocmsRepeatArea\b/', '$0--D0n3--', $neocmsele); + + if (isset($edit["edit$count"])) $newsplice .= $neocmsele . "\n" . $edit["edit$count"] . "\n" . $rest; + elseif (isset($edit["editImg$count"]) && stristr($eleTag, 'img')) $newsplice .= $post; + elseif (isset($edit["editVid$count"]) && (stristr($eleTag, 'embed') || stristr($eleTag, 'object'))) $newsplice .= "\n" . $edit["editVid$count"] . "\n" . $rest; + elseif (sizeof($splice) <= 1) $newsplice .= $post; + else $newsplice .= $neocmsele . $post; + + $conpost = $newsplice; + + $count++; + + $rest = ''; + } + + $newsplice = preg_replace('/--D0n3--/', '', $newsplice); + + } else $newsplice = $conpost; + + foreach ($comments[0] as $com) { + + $newsplice = preg_replace('//', $com, $newsplice, 1); + + } + + return $newsplice; + + } + + function editFile($content, $url) + { + + global $message, $includes, $edit, $inc; + + $fileedits = array(); + + if (is_array($content)) { + + foreach ($content as $conkey => $conpost) { + + if (is_array($conpost)) $content[$conkey] = editFile($conpost, $conkey); + else $content[$conkey] = makeEdits($conpost); + + } + + foreach ($content as $ckey => $cpost) { + + if (preg_match('/^(\d+)$/', $ckey)) { + + if (isset($includes[$url][0][$inc])) $fileedits[$url] .= $cpost . $includes[$url][0][$inc]; + else $fileedits[$url] .= $cpost; + $inc++; + } else $fileedits["$ckey"] = $cpost; + + } + } else $fileedits[$url] = makeEdits($content); + + $inc = 0; + + return $fileedits; + + } + + function cleanFilecon($files) + { + + global $filecon; + + foreach ($files as $fkey => $fpost) { + + if (is_array($fpost)) cleanFilecon($fpost); + else { + + if (!$filecon[$fkey]) $filecon[$fkey] = $fpost; + + } + + } + + } + + function flatten($ar) + { + $toflat = array($ar); + $res = array(); + + while (($r = array_shift($toflat)) !== NULL) { + foreach ($r as $v) { + if (is_array($v)) { + $toflat[] = $v; + } else { + $res[] = $v; + } + } + } + + return $res; + } + + $conArr = loadfile($pageurl, false, true); + + if (is_array($conArr)) { + $missing = array_search(false, $conArr); + if ($conArr[$missing] == '') $missing = false; + } elseif ($conArr) $missing = false; + + if ($missing === false) { + + cleanFilecon(editFile($conArr, $pageurl)); + + if (preg_match('/successfully/', $message)) { + + foreach ($filecon as $fkey => $fpost) { + + if ($fpost != '') { + + if (@file_exists($fkey)) { + + if ($ftpconn) { + + $doc = tmpfile(); + if (!$doc) { + $docp = tempnam(dirname(__FILE__) . '/../settings/tmp', 'Doc'); + chmod($docp, 0777); + $doc = fopen($docp, 'w+'); + } + $remotefile = ''; + + fwrite($doc, $fpost); + rewind($doc); + + $incs = flatten($includes); + + if (strstr($fkey, $_SERVER['DOCUMENT_ROOT'])) { + + $nfkey = explode($_SERVER['DOCUMENT_ROOT'], $fkey); + $nfkey = $nfkey[1]; + + if (in_array($nfkey, $incs)) $remotefile = $ftpwd . $nfkey; + else { + $path = urldissect($_SERVER['SCRIPT_NAME'], false, 3); + $fkey = explode('../../', $fkey, 2); + + $remotefile = $ftpwd . $path . $fkey[1]; + } + + } else { + + $path = urldissect($_SERVER['SCRIPT_NAME'], false, 3); + $fkey = explode('../../', $fkey, 2); + + $remotefile = $ftpwd . $path . $fkey[1]; + + } + + if (ftp_fput($ftpconn, $remotefile, $doc, FTP_BINARY)) echo "Uploaded: $remotefile!\n\n"; + else $message = 'Error: neocms publish this page: ' . $remotefile . ''; + + fclose($doc); + if (isset($docp)) unlink($docp); + + } elseif (is_writable($fkey)) { + + $doc = fopen($fkey, "w"); + fwrite($doc, $fpost); + fclose($doc); + + } else $message = "Error: You do not have permission to edit this page. Try saving your FTP info here."; + + } else $message = 'Error: neocms is unable find this page.'; + + } + + } + } + + } else $message = 'Error: neocms is unable find this page: ' . $missing . ''; + + output(); + + } else output(); + + if ($ftpconn) ftp_close($ftpconn); + } +} else { + $message = 'Error: neocms is unable find your session.'; + output(); +} + +?> diff --git a/cms/core/sessionConfiguration.php b/cms/core/sessionConfiguration.php new file mode 100644 index 0000000..80b7932 --- /dev/null +++ b/cms/core/sessionConfiguration.php @@ -0,0 +1,25 @@ +window.top.window.getGlobals("' . $getpath . '", "' . $gethtml . '", "' . $getfile . '", "' . $getfilepath . '", "' . $getexfolders . '", "' . $getimagepath . '");'; + echo $script; + + } + +} \ No newline at end of file diff --git a/cms/core/upload.php b/cms/core/upload.php new file mode 100644 index 0000000..79dd51a --- /dev/null +++ b/cms/core/upload.php @@ -0,0 +1,120 @@ +Error: There was an error uploading your image. Please try again."; + list($fileWidth, $fileHeight) = getimagesize($file['tmp_name']); + + if (preg_match('/(.jpg|.png|.gif)$/i', $fileName) && $fileSize < 5000000) { + + 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 { + $alert = "Error: You may only upload .jpg, .gif, or .png image files, under 5.0 MB in size."; + $fileName = ""; + } + + $script = ''; + echo $script; + + } else { + + $script = ''; + echo $script; + + } + + } else { + + $file = $_FILES['neoCMSUpload']; + + $uploaddir = ($_POST['neoCMSFolder']) ? '../..' . $_POST['neoCMSFolder'] : '../../'; + $uploaddir = ($_SESSION['neoCMSFilePath']) ? '../../' . $_SESSION['neoCMSFilePath'] : $uploaddir; + $uploadfile = $uploaddir . basename($file['name']); + + if (!@file_exists($uploadfile) || $_GET['over']) { + + $fileName = $file['name']; + $fileSize = $file['size']; + $alert = "Error: There was an error uploading your image. Please try again."; + + 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 = "Error: You do not have permission to upload files to this folder."; + $script = ''; + echo $script; + } + + } elseif (move_uploaded_file($file['tmp_name'], $uploadfile)) { + $alert = "Your file was successfully uploaded."; + } else { + $alert = "Error: You do not have permission to upload files to this folder."; + $fileName = ""; + } + } else { + $alert = "Error: You may not upload .html, .htm, .php, .js, or .css files, under 100 MB in size."; + $fileName = ""; + } + + $script = ''; + echo $script; + + } else { + + $script = ''; + echo $script; + + } + + } + + if ($ftpconn) ftp_close($ftpconn); + + } + +} + +?> \ No newline at end of file diff --git a/cms/core/urldissect.php b/cms/core/urldissect.php new file mode 100644 index 0000000..5bfca32 --- /dev/null +++ b/cms/core/urldissect.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/cms/functions/checkpath.php b/cms/functions/checkpath.php new file mode 100644 index 0000000..b93eedc --- /dev/null +++ b/cms/functions/checkpath.php @@ -0,0 +1,66 @@ + \ No newline at end of file diff --git a/cms/functions/cleaner.php b/cms/functions/cleaner.php new file mode 100644 index 0000000..b89dbca --- /dev/null +++ b/cms/functions/cleaner.php @@ -0,0 +1,111 @@ +/'; + $aspreg = '/<%(.|\n|\r)+?\%>/'; + $jsreg = '/]*>\s*[^<](.|\n)*?<\/\s*script>/'; + $prereg = '/]*>(.|\n)*?<\/\s*pre>/'; + $codereg = '/]*>(.|\n)*?<\/\s*code>/'; + $cssreg = '/]*>(.|\n)*?<\/\s*style>/'; + + $stufflen = strlen($stuff); + + try { + + //grab php + preg_match_all($phpreg, $stuff, $code['PHP']); + $stuff = preg_replace($phpreg, '----||PHPGO3SHERE||----', $stuff); + + //grab asp + preg_match_all($aspreg, $stuff, $code['ASP']); + $stuff = preg_replace($aspreg, '----||ASPGO3SHERE||----', $stuff); + + //grab on-page js + preg_match_all($jsreg, $stuff, $code['JS']); + $stuff = preg_replace($jsreg, '----||JSGO3SHERE||----', $stuff); + + //grab on-page CSS + preg_match_all($cssreg, $stuff, $code['CSS']); + $stuff = preg_replace($cssreg, '----||CSSGO3SHERE||----', $stuff); + + } catch (Exception $e) { + + $message = 'Error: There may be too much on page Javascript or CSS. Please try moving them to external files and/or validating your HTML.'; + output(); + + } + + $stuff = stripslashes($stuff); + $stuff = trim($stuff); + + //grab pre + preg_match_all($prereg, $stuff, $code['PRE']); + $stuff = preg_replace($prereg, '----||PREGO3SHERE||----', $stuff); + + //grab code + preg_match_all($codereg, $stuff, $code['CODE']); + $stuff = preg_replace($codereg, '----||CODEGO3SHERE||----', $stuff); + + function lower($matches) { + + } + + //fix uppercase tags + $stuff = preg_replace_callback('/<(\/|)[A-Z]+[A-Z0-9]*\b/', function($matches){return strtolower($matches[0]);}, $stuff); + + //fix attribute quotes + $stuff = preg_replace('/(<(?!meta)[^>]*\s[A-Za-z]+=)([^>\'\"\s]+)(\s*[^>]*)/', '$1"$2"$3', $stuff); + + // fix self-closing tags + if (preg_match('/XHTML/', $doctype)) { + $stuff = preg_replace("/(%]*[^\/%])(>)/i", "$1/>", $stuff); + $stuff = preg_replace("//", "
        ", $stuff); + } + + $nstuff = htmlentities($stuff, ENT_QUOTES, $encode); + if ($nstuff == '') $nstuff = htmlentities($stuff, ENT_QUOTES, 'ISO-8859-15'); + $stuff = $nstuff; + + $stuff = str_replace("<", "<", $stuff); + $stuff = str_replace(">", ">", $stuff); + $stuff = str_replace("&", '&', $stuff); + $stuff = str_replace("'", "'", $stuff); + $stuff = str_replace(""", '"', $stuff); + + // remove TinyMCE stuff + preg_match_all('/(?:<[^>]*)(_mce_[^=]+=(?:\"|\'|)[^\"]*(?:\"|\'|)\s*)/', $stuff, $mces); + foreach ($mces[1] as $mce) { + $stuff = str_replace($mce, "", $stuff); + } + + // add back original code + + $replace = array('CODE', 'PRE', 'CSS', 'JS', 'ASP', 'PHP'); + + foreach ($replace as $r) { + $rreg = '/\-\-\-\-\|\|' . $r . 'GO3SHERE\|\|\-\-\-\-/'; + $c = 0; + + preg_match_all($rreg, $stuff, $newcode); + foreach ($newcode[0] as $ncode) { + $stuff = preg_replace($rreg, $code[$r][0][$c], $stuff, 1); + $c++; + } + $c = 0; + + } + + // remove extra line breaks + $stuff = preg_replace("/\r\n/", "\n", $stuff); + + if ($stuff != '' || $stufflen == 0) return $stuff; + else $message = 'Error: Some characters couldn’t be recognized. Try switching to UTF-8 encoding and be sure all special characters are properly encoded.'; + +} + +?> \ No newline at end of file diff --git a/cms/functions/createsession.php b/cms/functions/createsession.php new file mode 100644 index 0000000..cd3f585 --- /dev/null +++ b/cms/functions/createsession.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/cms/functions/fileload.php b/cms/functions/fileload.php new file mode 100644 index 0000000..345d258 --- /dev/null +++ b/cms/functions/fileload.php @@ -0,0 +1,181 @@ +read())) { + + if (!preg_match($neocmspath, $path)) $entries[] = $entry; + + } + + $dir->close(); + + foreach ($entries as $entry) { + + $fullname = $path . $entry; + $pathname = str_replace('../..', '', $path); + + $exFolders = preg_replace('/,\s*/', '/|', $_SESSION['neoCMSExFolders']); + $exFolders = str_replace('-', '\-', $exFolders); + $exFolders = str_replace('.', '\.', $exFolders); + $exFolders = '/' . str_replace('/', '\/', $exFolders) . '\//'; + + if ($entry != '.' && $entry != '..' && is_dir($fullname) && is_readable($fullname) && (!preg_match($exFolders, $fullname) || $_SESSION['neoCMSExFolders'] == '')) findfiles($fullname, $pattern); + elseif ($entry != '.' && $entry != '..' && is_file($fullname) && preg_match($pattern, $entry)) { + + if (!in_array($pathname, $matches)) { + + if (preg_match('/\.html|\.htm|\.php|\.cfm|\.phtml|\.shtml|\.asp/', $fullname)) { + + $content = file_get_contents($fullname); + + if (checkContent($content)) $matches[] = $fullname; + + } else $matches[] = $fullname; + + } + + } + + } + + } + + function checkContent($content) + { + + global $type; + + if (stristr($content, '[^<]+ 0) { + + foreach ($matches as $match) { + + $fname = str_replace('../../', '', $match); + $flink = siteURL() . $fname; + + if (preg_match('/\.bmp|\.gif|\.jpeg|\.jpg|\.png/i', $fname)) { + + if (!strstr($imghtml, 'neoCMSImgUL')) $imghtml = '
          '; + + if (($_SESSION['neoCMSImagePath'] == null || $_SESSION['neoCMSImagePath'] == '') || strstr($fname, $_SESSION['neoCMSImagePath'])) $imghtml = str_replace('', '
        • ' . $fname . ' Thumbnail

          ' . $fname . '

        • ', $imghtml); + + } elseif (preg_match('/\.html|\.htm|\.php|\.phtml|\.cfm|\.shtml|\.asp/i', $fname)) { + + if (!strstr($pagehtml, 'neoCMSPagesUL')) $pagehtml = '
            '; + + $pagehtml = str_replace('', '
          • ' . $fname . '
          • ', $pagehtml); + + } else { + + if (!strstr($filehtml, 'neoCMSFileUL')) $filehtml = '
              '; + + if (($_SESSION['neoCMSFilePath'] == null || $_SESSION['neoCMSFilePath'] == '') || strstr($fname, $_SESSION['neoCMSFilePath'])) $filehtml = str_replace('', '
            • ' . $fname . '
            • ', $filehtml); + + } + + } + + $matches = $imghtml . $pagehtml . $filehtml; + + $script = ""; + echo $script; + + } else { + + $script = ''; + echo $script; + + } + + $endscript = ""; + echo $endscript; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/functions/folderload.php b/cms/functions/folderload.php new file mode 100644 index 0000000..d8e1fff --- /dev/null +++ b/cms/functions/folderload.php @@ -0,0 +1,111 @@ +read())) { + + if (!preg_match('/(\/neocms\-js\/|\/neocms\-images\/)/', $path)) $entries[] = $entry; + + } + + $dir->close(); + + foreach ($entries as $entry) { + + $fullname = $path . $entry; + $pathname = str_replace('../..', '', $path); + + $exFolders = preg_replace('/,\s*/', '|', $_SESSION['neoCMSExFolders']); + $exFolders = str_replace('-', '\-', $exFolders); + $exFolders = str_replace('.', '\.', $exFolders); + $exFolders = '/' . str_replace('/', '\/', $exFolders) . '/'; + + if ($entry != '.' && $entry != '..' && is_dir($fullname)) { + + if (preg_match($pathpatt, $path) && !in_array($pathname, $matches) && is_writable($path)) $matches[] = $pathname; + if (!preg_match($exFolders, $fullname) || $_SESSION['neoCMSExFolders'] == '') findfiles($fullname, $pattern, $pathpatt); + + } elseif (($entry == '.' || $entry == '..') && is_dir($fullname)) { + + if (preg_match($pathpatt, $path) && !in_array($pathname, $matches) && is_writable($path)) $matches[] = $pathname; + + } elseif (is_file($fullname) && preg_match($pattern, $entry)) { + + if (!in_array($pathname, $matches) && is_writable($path)) $matches[] = $pathname; + + } + + } + + } + + findfiles("../../$pathdefault", $pattern, $pathpatt); + + if (sizeof($matches) > 0) { + + foreach ($matches as $match) { + + $script = ''; + echo $script; + + } + + } else { + $script = ''; + echo $script; + } + + $endscript = ''; + echo $endscript; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/functions/forgotpassword.php b/cms/functions/forgotpassword.php new file mode 100644 index 0000000..d9e93eb --- /dev/null +++ b/cms/functions/forgotpassword.php @@ -0,0 +1,35 @@ +window.top.window.forgotReset("' . $getmessage . '");'; + echo $script; + + } +} + +?> \ No newline at end of file diff --git a/cms/functions/ftpclear.php b/cms/functions/ftpclear.php new file mode 100644 index 0000000..52a830e --- /dev/null +++ b/cms/functions/ftpclear.php @@ -0,0 +1,67 @@ +'; + + $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 = ''; + echo $savescript; + + } else { + $getmessage = 'Error: neocms could not find this page: ' . $remotefile . ''; + $savescript = ''; + echo $savescript; + } + + fclose($ftpdoc); + if (isset($ftpdocp)) unlink($ftpdocp); + } + + echo ''; + + } + +} + +?> \ No newline at end of file diff --git a/cms/functions/ftpconnect.php b/cms/functions/ftpconnect.php new file mode 100644 index 0000000..9c9c30d --- /dev/null +++ b/cms/functions/ftpconnect.php @@ -0,0 +1,34 @@ +Error: FTP is not enabled for your install of PHP. More info here."; + $savescript = ''; + echo $savescript; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/functions/ftpcreate.php b/cms/functions/ftpcreate.php new file mode 100644 index 0000000..6240809 --- /dev/null +++ b/cms/functions/ftpcreate.php @@ -0,0 +1,82 @@ +'; + + 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 = ''; + echo $savescript; + + } else { + $getmessage = "Error: There is an error in your FTP credentials. Please try entering them again."; + $savescript = ''; + echo $savescript; + } + + fclose($ftpdoc); + if (isset($ftpdocp)) unlink($ftpdocp); + } + + echo ''; + + } else { + + $getmessage = 'Error: All fields are required.'; + $savescript = ''; + echo $savescript; + + echo ''; + + } + + } + +} + +?> \ No newline at end of file diff --git a/cms/functions/ftpstart.php b/cms/functions/ftpstart.php new file mode 100644 index 0000000..61acbcb --- /dev/null +++ b/cms/functions/ftpstart.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/cms/functions/ftpvars.php b/cms/functions/ftpvars.php new file mode 100644 index 0000000..f7af05b --- /dev/null +++ b/cms/functions/ftpvars.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/cms/functions/getpage.php b/cms/functions/getpage.php new file mode 100644 index 0000000..6c95841 --- /dev/null +++ b/cms/functions/getpage.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/cms/functions/getpath.php b/cms/functions/getpath.php new file mode 100644 index 0000000..631505c --- /dev/null +++ b/cms/functions/getpath.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/cms/functions/getsaveprefs.php b/cms/functions/getsaveprefs.php new file mode 100644 index 0000000..00cce9b --- /dev/null +++ b/cms/functions/getsaveprefs.php @@ -0,0 +1,35 @@ +window.top.window.userBar("' . $getmessage . '");'; + echo $savescript; + + } + + $script = ''; + echo $script; + + } + +} \ No newline at end of file diff --git a/cms/functions/getsaveusers.php b/cms/functions/getsaveusers.php new file mode 100644 index 0000000..81766b5 --- /dev/null +++ b/cms/functions/getsaveusers.php @@ -0,0 +1,98 @@ + $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 = ''; + echo $adminscript; + + foreach ($users as $user) { + + $userscript = ''; + 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 = "Error: This account has already been created."; + elseif ($m == '4') $getmessage = "Account successfully deleted."; + elseif ($m == '5') $getmessage = "Error: There was an error deleting this account."; + else $getmessage = "Error: There was an error saving."; + + $savescript = ''; + echo $savescript; + + $_SESSION['neoCMSUserid'] = $admin['neoCMSUsername']; + } + + echo ''; + } + } +} + +?> \ No newline at end of file diff --git a/cms/functions/geturi.php b/cms/functions/geturi.php new file mode 100644 index 0000000..003f3b0 --- /dev/null +++ b/cms/functions/geturi.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/cms/functions/login.php b/cms/functions/login.php new file mode 100644 index 0000000..35607b4 --- /dev/null +++ b/cms/functions/login.php @@ -0,0 +1,49 @@ +window.top.window.location="../";'; + echo $script; + } + + } elseif (isset($_GET['error'])) { + + if ($_GET['error'] == 'login') $message = "Incorrect username or password"; + elseif ($_GET['error'] == 'domain') $message = "Domain not registered. Please contact."; + + $script = ''; + echo $script; + } + +} else { + + $script = ''; + echo $script; + +} + +?> diff --git a/cms/functions/logout.php b/cms/functions/logout.php new file mode 100644 index 0000000..a4f9618 --- /dev/null +++ b/cms/functions/logout.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/cms/functions/restore.php b/cms/functions/restore.php new file mode 100644 index 0000000..f8709fb --- /dev/null +++ b/cms/functions/restore.php @@ -0,0 +1,180 @@ +Error: There was an error restoring your page. Please try again.'; + + if (@file_exists($pageurl)) { + + function loadfile($url, $incpath, $inc) + { + + global $message, $pagepath; + + // read the file + + $doc = fopen($url, "r"); + $content = stream_get_contents($doc); + fclose($doc); + + $reginclude = '/(?:include\b|include_once\b|require\b|require_once\b)(?:\s*\(*[^;\?>]*)(?:\"|\')([^\"\'<>]*)(?:(\"|\')\)*(;|[\s\t\r\n]*\?>))/i'; // php include regexp + if (!preg_match($reginclude, $content)) $reginclude = '/(?:)/i'; // SSI regexp + + // read the backup + $pagename = (strstr($url, $_SERVER['DOCUMENT_ROOT'])) ? explode($_SERVER['DOCUMENT_ROOT'], $url) : explode('../../', $url); + $pagename = trim($pagename[1], '/'); + $pagename = str_ireplace('/', '-', $pagename); + + $pageext = explode('.', $pagename); + $pagename = preg_replace('/(\.php|\.asp|\.html|\.htm|\.phtml|\.shtml|\.cfm)/', '', $pagename); + $backup = dirname(__FILE__) . '/../backups/' . $pagename . '_Bak.' . $pageext[1]; + + if (@file_exists($backup)) { + + $backdoc = fopen($backup, "r"); + $backcontent = stream_get_contents($backdoc); + + fclose($backdoc); + + echo "File Found: $backup\n\n"; + + editfile($content, $backcontent, $url, $incpath, $inc); + + } + + if (preg_match($reginclude, $content)) { + + preg_match_all($reginclude, $content, $includes); + + foreach ($includes[1] as &$value) { + + if (@file_exists($_SERVER['DOCUMENT_ROOT'] . $value) && $value != '') { + + $incfile = $_SERVER['DOCUMENT_ROOT'] . $value; + $incpath = false; + + } elseif (!stristr($value, 'http://')) { + + $incfile = "$pagepath/$value"; + + if ($incpath) { + + $incpathreg = preg_replace('/\//', '\/', $incpath); + $incpathreg = '/(^' . $incpathreg . '\/|\/' . $incpathreg . '\/)/'; + + $incorigpath = preg_replace($incpathreg, '', $value, 1); + + $newinc = "$pagepath/$incpath/$incorigpath"; + + $incfile = (@file_exists($newinc)) ? $newinc : $incfile; + + $incpatharr = explode('/', $incorigpath); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } else { + + $incpatharr = explode('/', $value); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } + + } else $incpath = false; + + if (!preg_match('/\/$/', $incfile)) loadfile($incfile, $incpath, true); + + } + + } + } + + function editfile($content, $backcontent, $url, $incpath, $inc) + { + + global $ftpconn, $ftpwd; + + if ($content != $backcontent && ((!stristr($content, '[^<]+Error: neocms could not find this page: ' . $remotefile . ''; + + fclose($restdoc); + if (isset($restdocp)) unlink($restdocp); + + } elseif (is_writable($url)) { + //restores file + $restdoc = fopen($url, "w"); + fputs($restdoc, $backcontent); + fclose($restdoc); + } else $message = "Error: You do not have permission to edit this page. Try saving your FTP info here."; + + } + + } + + loadfile($pageurl, false, false); + + $message = 'Your page was successfully restored.'; + $script = ''; + echo $script; + + } else { + $message = 'Error: neocms could not find this page: ' . $url . ''; + $script = ''; + echo $script; + } + + if ($ftpconn) ftp_close($ftpconn); + + } +} + +?> \ No newline at end of file diff --git a/cms/functions/save.php b/cms/functions/save.php new file mode 100644 index 0000000..e3cab6f --- /dev/null +++ b/cms/functions/save.php @@ -0,0 +1,525 @@ + $post) { + + $post = thecleaner($post); + if (preg_match("/^edit/", $key)) $edit[$key] = $post; + + } + + } + + function loadfile($url, $incpath, $f) + { + + global $message, $includes, $pagepath, $ftpconn, $ftpwd, $doctype, $encode, $edit; + + $ssi = false; + + $pagename = (strstr($url, $_SERVER['DOCUMENT_ROOT'])) ? explode($_SERVER['DOCUMENT_ROOT'], $url) : explode('../../', $url); + $pagename = trim($pagename[1], '/'); + $pagename = str_ireplace('/', '-', $pagename); + $pagefile = $pagename; + + if (@file_exists($url)) { + + // read the file + $doc = fopen($url, "r"); + $content = stream_get_contents($doc); + fclose($doc); + + if ((!stristr($content, '[^<]+]*>/', $content)) { + preg_match_all('/]*>/', $content, $dtarr); + $doctype = $dtarr[0][0]; + } + if (preg_match('/(?:]*charset=\"*)([^\"<]+)/', $stuff)) { + preg_match_all($charreg, $stuff, $enc); + $encode = $enc[1][0]; + } + + if ($f) cleanpost(); + + $elereg = '/<[^>]*class=(?:\"|\'|)[^>]*(\bneocms\b|\bneocmsRepeatArea\b)[^>]*?(?:\"|\'|)[^>]*>/'; + $reginclude = '/(?:include\b|include_once\b|require\b|require_once\b)(?:\s*\(*[^;\?>]*)(?:\"|\')([^\"\'<>]*)(?:(\"|\')\)*(;|[\s\t\r\n]*\?>))/i'; // php include regexp + if (!preg_match($reginclude, $content)) $reginclude = '/(?:)/i'; // SSI regexp + + // create a backup + $pageext = explode('.', $pagename); + $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 = 'Error: neocms failed creating backup for: ' . $remotefile . ''; + + fclose($backdoc); + if (isset($backdocp)) unlink($backdocp); + + } elseif (is_writable($url)) { + + $backdoc = fopen($backup, "w+"); + fwrite($backdoc, $content); + fclose($backdoc); + + } else $message = 'Error: You do not have permission to edit this page: ' . $pagefile . ". Try saving your FTP info here."; + + // clean up content + + if (preg_match($reginclude, $content)) { + + preg_match_all($reginclude, $content, $includes[$url]); + + $incArr = preg_split($reginclude, $content); + $incfiles = $includes[$url][1]; + $neoCon = array(); + + foreach ($incArr as $k => $v) { + + $docroot = $_SERVER['DOCUMENT_ROOT']; + + if (@file_exists($docroot . $incfiles[$k]) && $incfiles[$k] != '') { + + $neoCon[$k] = $v; + + $incfile = $docroot . $incfiles[$k]; + $incpath = false; + + } elseif (!stristr($incfiles[$k], 'http://')) { + + $neoCon[$k] = $v; + + $incfile = "$pagepath/$incfiles[$k]"; + + if ($incpath) { + + $incpathreg = str_replace('/', '\/', $incpath); + $incpathreg = '/(^' . $incpathreg . '\/|\/' . $incpathreg . '\/)/'; + + $incorigpath = preg_replace($incpathreg, '', $incfiles[$k], 1); + + $newinc = "$pagepath/$incpath/$incorigpath"; + + $incfile = (@file_exists($newinc)) ? $newinc : $incfile; + + $incpatharr = explode('/', $incorigpath); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } else { + + $incpatharr = explode('/', $incfiles[$k]); + array_pop($incpatharr); + $incpath = (sizeof($incpatharr) > 0) ? $incpath . implode('/', $incpatharr) : false; + + } + + } else $incpath = false; + + if (!preg_match('/\/$/', $incfile)) $neoCon[$incfile] = loadfile($incfile, $incpath, false); + + } + + return $neoCon; + + } else return $content; + } + } else return false; + + } + + function output() + { + + global $message; + + $script = ''; + echo $script; + + } + + function conArray($content) + { + + $conArray = false; + + foreach ($content as $con) { + + if (is_array($con)) $conArray = true; + + } + + return conArray; + + } + + function makeEdits($conpost) + { + + global $edit, $eles, $inc, $count; + + $commreg = '//'; + + preg_match_all($commreg, $conpost, $comments); + + $conpost = preg_replace($commreg, '', $conpost); + + $elereg = '/<[^>]*class\s*=\s*(?:\"|\'|)[^\"|\']*(\bneocms\b|\bneocmsRepeatArea\b)[^\"|\'|=]*?(?:\"|\'|)[^>]*>/'; + + preg_match_all($elereg, $conpost, $neocmseles); + + if ($neocmseles[0]) { + + $newsplice = ''; + + foreach ($neocmseles[0] as $neocmsele) { + + $splice = explode($neocmsele, $conpost, 2); + + $newsplice = $splice[0]; + + $post = $splice[1]; + + $rest = ''; + + preg_match_all("/^<([^>\s]*)\b/i", $neocmsele, $eleTag); + + $eleTag = $eleTag[1][0]; + + if (stristr($eleTag, 'img')) { + + if (isset($edit["editImg$count"])) { + + $editStr = array(); + + $editIncom = $edit["editImg$count"]; + $editIncom = explode(',', $editIncom); + foreach ($editIncom as $eikey => $eipost) { + $eipost = explode('::', $eipost); + $editStr[$eipost[0]] = $eipost[1]; + } + + $editContent = ''; + + if (isset($editStr['link']) && $editStr['link'] != '') { + + if (preg_match('/(]*>)$/', $newsplice)) { + + preg_match_all('/(]*href=(?:\"|\'))([^\"\s]*)((?:\"|\')[^>]*>)$/', $newsplice, $lastlink); + $newlink = $lastlink[1][0] . $editStr['link']; + if ($editStr['rel'] != '') $newlink .= '" rel="' . $editStr['rel']; + $newlink .= $lastlink[3][0]; + + $newsplice = preg_replace('/(]*>)$/', "$newlink", $newsplice); + + } else { + + $newsplice .= ']*>)$/', $newsplice)) $newsplice = preg_replace('/(]*>)$/', '', $newsplice); + if (preg_match('/^(<\/a>)/', $post)) $post = preg_replace('/^(<\/a>)/', '', $post); + + } + + $editContent .= '' . $editStr['alt'] . ']*>/i'; + + preg_match_all($eleTagReg, $post, $tags); + + $contents = preg_split($eleTagReg, $post); + + $track = 1; + + foreach ($tags[0] as $tag) { + + if (strpos($tag, ' 1) { + + foreach ($tags[0] as $tag) { + + if (isset($edit["editVid$count"])) $rest .= $contents[0]; + else $rest .= $tag . $contents[0]; + + array_shift($contents); + + } + + } else { + + if (isset($edit["editVid$count"])) $rest = $contents[0]; + else $rest = $tags[0][0] . $contents[0]; + + } + + } + + $neocmsele = preg_replace('/neocms\b|neocmsRepeatArea\b/', '$0--D0n3--', $neocmsele); + + if (isset($edit["edit$count"])) $newsplice .= $neocmsele . "\n" . $edit["edit$count"] . "\n" . $rest; + elseif (isset($edit["editImg$count"]) && stristr($eleTag, 'img')) $newsplice .= $post; + elseif (isset($edit["editVid$count"]) && (stristr($eleTag, 'embed') || stristr($eleTag, 'object'))) $newsplice .= "\n" . $edit["editVid$count"] . "\n" . $rest; + elseif (sizeof($splice) <= 1) $newsplice .= $post; + else $newsplice .= $neocmsele . $post; + + $conpost = $newsplice; + + $count++; + + $rest = ''; + } + + $newsplice = preg_replace('/--D0n3--/', '', $newsplice); + + } else $newsplice = $conpost; + + foreach ($comments[0] as $com) { + + $newsplice = preg_replace('//', $com, $newsplice, 1); + + } + + return $newsplice; + + } + + function editFile($content, $url) + { + + global $message, $includes, $edit, $inc; + + $fileedits = array(); + + if (is_array($content)) { + + foreach ($content as $conkey => $conpost) { + + if (is_array($conpost)) $content[$conkey] = editFile($conpost, $conkey); + else $content[$conkey] = makeEdits($conpost); + + } + + foreach ($content as $ckey => $cpost) { + + if (preg_match('/^(\d+)$/', $ckey)) { + + if (isset($includes[$url][0][$inc])) $fileedits[$url] .= $cpost . $includes[$url][0][$inc]; + else $fileedits[$url] .= $cpost; + $inc++; + } else $fileedits["$ckey"] = $cpost; + + } + } else $fileedits[$url] = makeEdits($content); + + $inc = 0; + + return $fileedits; + + } + + function cleanFilecon($files) + { + + global $filecon; + + foreach ($files as $fkey => $fpost) { + + if (is_array($fpost)) cleanFilecon($fpost); + else { + + if (!$filecon[$fkey]) $filecon[$fkey] = $fpost; + + } + + } + + } + + function flatten($ar) + { + $toflat = array($ar); + $res = array(); + + while (($r = array_shift($toflat)) !== NULL) { + foreach ($r as $v) { + if (is_array($v)) { + $toflat[] = $v; + } else { + $res[] = $v; + } + } + } + + return $res; + } + + $conArr = loadfile($pageurl, false, true); + + if (is_array($conArr)) { + $missing = array_search(false, $conArr); + if ($conArr[$missing] == '') $missing = false; + } elseif ($conArr) $missing = false; + + if ($missing === false) { + + cleanFilecon(editFile($conArr, $pageurl)); + + if (preg_match('/successfully/', $message)) { + + foreach ($filecon as $fkey => $fpost) { + + if ($fpost != '') { + + if (@file_exists($fkey)) { + + if ($ftpconn) { + + $doc = tmpfile(); + if (!$doc) { + $docp = tempnam(dirname(__FILE__) . '/../settings/tmp', 'Doc'); + chmod($docp, 0777); + $doc = fopen($docp, 'w+'); + } + $remotefile = ''; + + fwrite($doc, $fpost); + rewind($doc); + + $incs = flatten($includes); + + if (strstr($fkey, $_SERVER['DOCUMENT_ROOT'])) { + + $nfkey = explode($_SERVER['DOCUMENT_ROOT'], $fkey); + $nfkey = $nfkey[1]; + + if (in_array($nfkey, $incs)) $remotefile = $ftpwd . $nfkey; + else { + $path = urldissect($_SERVER['SCRIPT_NAME'], false, 3); + $fkey = explode('../../', $fkey, 2); + + $remotefile = $ftpwd . $path . $fkey[1]; + } + + } else { + + $path = urldissect($_SERVER['SCRIPT_NAME'], false, 3); + $fkey = explode('../../', $fkey, 2); + + $remotefile = $ftpwd . $path . $fkey[1]; + + } + + if (ftp_fput($ftpconn, $remotefile, $doc, FTP_BINARY)) echo "Uploaded: $remotefile!\n\n"; + else $message = 'Error: neocms publish this page: ' . $remotefile . ''; + + fclose($doc); + if (isset($docp)) unlink($docp); + + } elseif (is_writable($fkey)) { + + $doc = fopen($fkey, "w"); + fwrite($doc, $fpost); + fclose($doc); + + } else $message = "Error: You do not have permission to edit this page. Try saving your FTP info here."; + + } else $message = 'Error: neocms is unable find this page.'; + + } + + } + } + + } else $message = 'Error: neocms is unable find this page: ' . $missing . ''; + + output(); + + } else output(); + + if ($ftpconn) ftp_close($ftpconn); + } +} else { + $message = 'Error: neocms is unable find your session.'; + output(); +} + +?> diff --git a/cms/functions/upload.php b/cms/functions/upload.php new file mode 100644 index 0000000..79dd51a --- /dev/null +++ b/cms/functions/upload.php @@ -0,0 +1,120 @@ +Error: There was an error uploading your image. Please try again."; + list($fileWidth, $fileHeight) = getimagesize($file['tmp_name']); + + if (preg_match('/(.jpg|.png|.gif)$/i', $fileName) && $fileSize < 5000000) { + + 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 { + $alert = "Error: You may only upload .jpg, .gif, or .png image files, under 5.0 MB in size."; + $fileName = ""; + } + + $script = ''; + echo $script; + + } else { + + $script = ''; + echo $script; + + } + + } else { + + $file = $_FILES['neoCMSUpload']; + + $uploaddir = ($_POST['neoCMSFolder']) ? '../..' . $_POST['neoCMSFolder'] : '../../'; + $uploaddir = ($_SESSION['neoCMSFilePath']) ? '../../' . $_SESSION['neoCMSFilePath'] : $uploaddir; + $uploadfile = $uploaddir . basename($file['name']); + + if (!@file_exists($uploadfile) || $_GET['over']) { + + $fileName = $file['name']; + $fileSize = $file['size']; + $alert = "Error: There was an error uploading your image. Please try again."; + + 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 = "Error: You do not have permission to upload files to this folder."; + $script = ''; + echo $script; + } + + } elseif (move_uploaded_file($file['tmp_name'], $uploadfile)) { + $alert = "Your file was successfully uploaded."; + } else { + $alert = "Error: You do not have permission to upload files to this folder."; + $fileName = ""; + } + } else { + $alert = "Error: You may not upload .html, .htm, .php, .js, or .css files, under 100 MB in size."; + $fileName = ""; + } + + $script = ''; + echo $script; + + } else { + + $script = ''; + echo $script; + + } + + } + + if ($ftpconn) ftp_close($ftpconn); + + } + +} + +?> \ No newline at end of file diff --git a/cms/functions/urldissect.php b/cms/functions/urldissect.php new file mode 100644 index 0000000..51a6d5e --- /dev/null +++ b/cms/functions/urldissect.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/cms/images/apple-touch-icon-precomposed.png b/cms/images/apple-touch-icon-precomposed.png new file mode 100644 index 0000000..f541d83 Binary files /dev/null and b/cms/images/apple-touch-icon-precomposed.png differ diff --git a/cms/images/embed.png b/cms/images/embed.png new file mode 100644 index 0000000..ce1c563 Binary files /dev/null and b/cms/images/embed.png differ diff --git a/cms/images/icon.png b/cms/images/icon.png new file mode 100644 index 0000000..417fccd Binary files /dev/null and b/cms/images/icon.png differ diff --git a/cms/images/loading.gif b/cms/images/loading.gif new file mode 100644 index 0000000..520b7e8 Binary files /dev/null and b/cms/images/loading.gif differ diff --git a/cms/images/neocms_sprite1.png b/cms/images/neocms_sprite1.png new file mode 100644 index 0000000..745e2b2 Binary files /dev/null and b/cms/images/neocms_sprite1.png differ diff --git a/cms/images/prompt.gif b/cms/images/prompt.gif new file mode 100644 index 0000000..9e1c6f2 Binary files /dev/null and b/cms/images/prompt.gif differ diff --git a/cms/images/uploading.gif b/cms/images/uploading.gif new file mode 100644 index 0000000..4567fe9 Binary files /dev/null and b/cms/images/uploading.gif differ diff --git a/cms/index.php b/cms/index.php new file mode 100644 index 0000000..dabaa59 --- /dev/null +++ b/cms/index.php @@ -0,0 +1,77 @@ + + + + + + + + + + neoCMS + + + + + + + + + + + + + + + + +
              + +
              +
              + + +

              neocms

              + + +
              +
              + + + + + \ No newline at end of file diff --git a/cms/js/codemirror/css/csscolors.css b/cms/js/codemirror/css/csscolors.css new file mode 100644 index 0000000..42010a2 --- /dev/null +++ b/cms/js/codemirror/css/csscolors.css @@ -0,0 +1,47 @@ +.editbox { + margin: .4em; + padding: 0; + font-family: monospace; + font-size: 10pt; + color: black; +} + +pre.code, .editbox { + color: #666666; +} + +.editbox p { + margin: 0; +} + +span.css-at { + color: #770088; +} + +span.css-unit { + color: #228811; +} + +span.css-value { + color: #770088; +} + +span.css-identifier { + color: black; +} + +span.css-important { + color: #0000FF; +} + +span.css-colorcode { + color: #004499; +} + +span.css-comment { + color: #AA7700; +} + +span.css-string { + color: #AA2222; +} diff --git a/cms/js/codemirror/css/jscolors.css b/cms/js/codemirror/css/jscolors.css new file mode 100644 index 0000000..17773b3 --- /dev/null +++ b/cms/js/codemirror/css/jscolors.css @@ -0,0 +1,55 @@ +.editbox { + margin: .4em; + padding: 0; + font-family: monospace; + font-size: 10pt; + color: black; +} + +pre.code, .editbox { + color: #666666; +} + +.editbox p { + margin: 0; +} + +span.js-punctuation { + color: #666666; +} + +span.js-operator { + color: #666666; +} + +span.js-keyword { + color: #770088; +} + +span.js-atom { + color: #228811; +} + +span.js-variable { + color: black; +} + +span.js-variabledef { + color: #0000FF; +} + +span.js-localvariable { + color: #004499; +} + +span.js-property { + color: black; +} + +span.js-comment { + color: #AA7700; +} + +span.js-string { + color: #AA2222; +} diff --git a/cms/js/codemirror/css/xmlcolors.css b/cms/js/codemirror/css/xmlcolors.css new file mode 100644 index 0000000..8cb95bc --- /dev/null +++ b/cms/js/codemirror/css/xmlcolors.css @@ -0,0 +1,51 @@ +.editbox { + margin: .4em; + padding: 0; + font-family: monospace; + font-size: 10pt; + color: black; +} + +.editbox p { + margin: 0; +} + +span.xml-tagname { + color: #A0B; +} + +span.xml-attribute { + color: #281; +} + +span.xml-punctuation { + color: black; +} + +span.xml-attname { + color: #00F; +} + +span.xml-comment { + color: #A70; +} + +span.xml-cdata { + color: #48A; +} + +span.xml-processing { + color: #999; +} + +span.xml-entity { + color: #A22; +} + +span.xml-error { + color: #F00; +} + +span.xml-text { + color: black; +} diff --git a/cms/js/codemirror/js/codemirror.js b/cms/js/codemirror/js/codemirror.js new file mode 100644 index 0000000..329f296 --- /dev/null +++ b/cms/js/codemirror/js/codemirror.js @@ -0,0 +1,474 @@ +/* CodeMirror main module + * + * Implements the CodeMirror constructor and prototype, which take care + * of initializing the editor frame, and providing the outside interface. + */ + +// The CodeMirrorConfig object is used to specify a default +// configuration. If you specify such an object before loading this +// file, the values you put into it will override the defaults given +// below. You can also assign to it after loading. +var CodeMirrorConfig = window.CodeMirrorConfig || {}; + +var CodeMirror = (function () { + function setDefaults(object, defaults) { + for (var option in defaults) { + if (!object.hasOwnProperty(option)) + object[option] = defaults[option]; + } + } + + function forEach(array, action) { + for (var i = 0; i < array.length; i++) + action(array[i]); + } + + // These default options can be overridden by passing a set of + // options to a specific CodeMirror constructor. See manual.html for + // their meaning. + setDefaults(CodeMirrorConfig, { + stylesheet: "", + path: "", + parserfile: [], + basefiles: ["util.js", "stringstream.js", "select.js", "undo.js", "editor.js", "tokenize.js"], + iframeClass: null, + passDelay: 200, + passTime: 50, + lineNumberDelay: 200, + lineNumberTime: 50, + continuousScanning: false, + saveFunction: null, + onChange: null, + undoDepth: 50, + undoDelay: 800, + disableSpellcheck: true, + textWrapping: true, + readOnly: false, + width: "", + height: "300px", + autoMatchParens: false, + parserConfig: null, + tabMode: "indent", // or "spaces", "default", "shift" + reindentOnLoad: false, + activeTokens: null, + cursorActivity: null, + lineNumbers: false, + indentUnit: 2 + }); + + function addLineNumberDiv(container) { + var nums = document.createElement("DIV"), + scroller = document.createElement("DIV"); + nums.style.position = "absolute"; + nums.style.height = "100%"; + if (nums.style.setExpression) { + try { + nums.style.setExpression("height", "this.previousSibling.offsetHeight + 'px'"); + } catch (e) { + } // Seems to throw 'Not Implemented' on some IE8 versions + } + nums.style.top = "0px"; + nums.style.overflow = "hidden"; + container.appendChild(nums); + scroller.className = "CodeMirror-line-numbers"; + nums.appendChild(scroller); + return nums; + } + + function CodeMirror(place, options) { + // Backward compatibility for deprecated options. + if (options.dumbTabs) options.tabMode = "spaces"; + else if (options.normalTab) options.tabMode = "default"; + + // Use passed options, if any, to override defaults. + this.options = options = options || {}; + setDefaults(options, CodeMirrorConfig); + + var frame = this.frame = document.createElement("IFRAME"); + if (options.iframeClass) frame.className = options.iframeClass; + frame.frameBorder = 0; + frame.src = "javascript:false;"; + frame.style.border = "0"; + frame.style.width = '100%'; + frame.style.height = '100%'; + // display: block occasionally suppresses some Firefox bugs, so we + // always add it, redundant as it sounds. + frame.style.display = "block"; + + var div = this.wrapping = document.createElement("DIV"); + div.style.position = "relative"; + div.className = "CodeMirror-wrapping"; + div.style.width = options.width; + div.style.height = options.height; + + if (place.appendChild) place.appendChild(div); + else place(div); + div.appendChild(frame); + if (options.lineNumbers) this.lineNumbers = addLineNumberDiv(div); + + // Link back to this object, so that the editor can fetch options + // and add a reference to itself. + frame.CodeMirror = this; + this.win = frame.contentWindow; + + if (typeof options.parserfile == "string") + options.parserfile = [options.parserfile]; + if (typeof options.stylesheet == "string") + options.stylesheet = [options.stylesheet]; + + var html = [""]; + // Hack to work around a bunch of IE8-specific problems. + html.push(""); + forEach(options.stylesheet, function (file) { + html.push(""); + }); + forEach(options.basefiles.concat(options.parserfile), function (file) { + html.push(" + + + + + +
              + +
              + +

              neocms

              +
              +

              1.01
              + Copyright **NAME HERE**

              +

              neoCMS is developed by **NAME HERE**.

              +
              +
              +
              + +
              + Login +
                +

              1. + +

                Required

              2. +

              3. + +

                Required

              4. +
              5. + +

                Forgot your password?

                +

              6. +
              +
              +

              Submit your username to receive an
              email with your new password.

              + +

              Back to login

              +

              +
              +
              + +
              +
              + +
              + +
              + + + + + \ No newline at end of file diff --git a/cms/settings/acct.php b/cms/settings/acct.php new file mode 100644 index 0000000..94adb4c --- /dev/null +++ b/cms/settings/acct.php @@ -0,0 +1,75 @@ + + + + + + + neoCMS Settings :: User Info + + + + + + + + + + +
              +
              +
              +

              +
                +
              • +
              • +
              +
                + +
              • +
              +
              +
              +

              Add New User Only the account owner has administrative privileges +

              +
              +
              +

              New User

              +
                +
              • Please enter a name
              • +
              • Please enter a valid email
              • +
              • Please enter a username
              • +
              • “Medium” or “strong” required. +
              • +
              • n/a “Medium” or “strong” required. +
              • +
              • Must match password
              • +
              • save or cancel
              • +
              +
              +
              +
              + + \ No newline at end of file diff --git a/cms/settings/dashcheck.php b/cms/settings/dashcheck.php new file mode 100644 index 0000000..ce055b4 --- /dev/null +++ b/cms/settings/dashcheck.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/cms/settings/dashfoot.php b/cms/settings/dashfoot.php new file mode 100644 index 0000000..021cd4f --- /dev/null +++ b/cms/settings/dashfoot.php @@ -0,0 +1,11 @@ +
              +
              +
              +

              Thanks for using neoCMS™

              +

              © Neogate Technologies

              +
              + + + + + \ No newline at end of file diff --git a/cms/settings/dashnav.php b/cms/settings/dashnav.php new file mode 100644 index 0000000..1db5bcf --- /dev/null +++ b/cms/settings/dashnav.php @@ -0,0 +1,29 @@ +
              +
              + +

              NeoCMS

              + +
              +
              +
              +
              + +
              +
              +
              + +
              + +
              \ No newline at end of file diff --git a/cms/settings/ftpinfo.php b/cms/settings/ftpinfo.php new file mode 100644 index 0000000..ea2dac7 --- /dev/null +++ b/cms/settings/ftpinfo.php @@ -0,0 +1,56 @@ + + + + + + + neoCMS Settings :: FTP Info + + + + + + + + + + +
              +
              + +

              Please Note: FTP information is not required for most installations of + neocms. If you are encountering file permission issues, save your FTP info here and try publishing/uploading + again. neocms will write your FTP information to an unreadable file on this server.

              + +
              + +

              Your FTP Info

              +
                +
              • Please enter your server – no “ftp.” +
              • +
              • Please your FTP username +
              • +
              • Please enter your FTP password +
              • +
              • Please enter the path to your site +
              • +
              +
              +

              saveClear all FTP + info

              +
              +
              + + + \ No newline at end of file diff --git a/cms/settings/index.php b/cms/settings/index.php new file mode 100644 index 0000000..fd465e6 --- /dev/null +++ b/cms/settings/index.php @@ -0,0 +1,79 @@ + + + + + + + neoCMS Settings :: Preferences + + + + + + + + + + +
              +
              +
              +

              Your neocms file path

              +
                +
              • +
              +

              This is where your neocms files are located. This is also the path you’ll follow to login to + your site’s neocms account to begin editing your site content. Note: + neocms discovers this based on what you name your neocms folder.

              +
              +
              +

              HTML Editing

              + +

              Set this preference to “on” if you want users to be able to directly edit the HTML + markup, or “off” if you do not want users to be able to edit the HTML.

              +
              +
              +

              Exclude Folders

              +

              Enter a comma separated list of folder names or paths you do not want listed in the neocms file + browser. Do not use a “/” at the end fo the path. Ex: “wordpress, .svn, + functions/important”

              +
                +
              • +
              +
              +
              +

              File Uploads

              + +

              Set this preference to “on” if you want users to be able to upload files, or “off” + if you do not want users to upload files. There is a 100MB limit on all uploads.

              +
                +
              • +

                To specify a file folder, enter the relative path here. Leave it blank if you want neocms to + auto-discover folders.

                + +
              • +
              +
              +
              +

              Image Uploads

              + +

              To specify an image folder, enter the relative path here. Leave it blank if you want neocms to + auto-discover folders.

              + +
                +
              • +
              +
              +

              save

              +
              +
              + + \ No newline at end of file diff --git a/cms/templates/deflist-editor.html b/cms/templates/deflist-editor.html new file mode 100644 index 0000000..a8d1a38 --- /dev/null +++ b/cms/templates/deflist-editor.html @@ -0,0 +1,26 @@ +
              +
              +
              +
              +
              +
              +
              +

              +
              +

              A "definition list" is a series of terms and definitions. More than one definition may be associated + with a single term.

              +
              +
              +
              +
              + done + cancel +
              +
              +
              +
              +
              +
              +
              +
              \ No newline at end of file diff --git a/cms/templates/editor.html b/cms/templates/editor.html new file mode 100644 index 0000000..a6c54a5 --- /dev/null +++ b/cms/templates/editor.html @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/cms/templates/file-browser.html b/cms/templates/file-browser.html new file mode 100644 index 0000000..d52ca1d --- /dev/null +++ b/cms/templates/file-browser.html @@ -0,0 +1,10 @@ +
              + cancel +

              Loading…

              + +
              +
              \ No newline at end of file diff --git a/cms/templates/html-editor.html b/cms/templates/html-editor.html new file mode 100644 index 0000000..6c4b3fe --- /dev/null +++ b/cms/templates/html-editor.html @@ -0,0 +1,12 @@ +
              +

              Maximize this windowEdit HTML

              +
              + done + cancel +
              +
              + +
              +
              \ No newline at end of file diff --git a/cms/templates/image-editor.html b/cms/templates/image-editor.html new file mode 100644 index 0000000..ce7fa65 --- /dev/null +++ b/cms/templates/image-editor.html @@ -0,0 +1,38 @@ +
              +

              Edit Image

              +
              +

              Upload A New Image

              +

              First select the folder you want to upload to:

              +
              + +

              Then, upload an image from your computer:

              + +
              +
              +

              Or Choose An Existing Image

              +

              To use an image that already exists on the web, enter the URL of the image below:

              + +

              « apply

              +
              +
              +
                +
              • +
              • +
              • browse +
              • +
              • +
              +
              + done + cancel +
              +
              \ No newline at end of file diff --git a/cms/templates/link-editor.html b/cms/templates/link-editor.html new file mode 100644 index 0000000..0ad46ad --- /dev/null +++ b/cms/templates/link-editor.html @@ -0,0 +1,18 @@ +
              +

              Edit Link

              +
              + +
              +
              \ No newline at end of file diff --git a/cms/templates/prompt.html b/cms/templates/prompt.html new file mode 100644 index 0000000..b598f3c --- /dev/null +++ b/cms/templates/prompt.html @@ -0,0 +1,8 @@ +
              +

              +

              +
              + + cancel +
              +
              \ No newline at end of file diff --git a/cms/templates/table-editor.html b/cms/templates/table-editor.html new file mode 100644 index 0000000..7e24065 --- /dev/null +++ b/cms/templates/table-editor.html @@ -0,0 +1,44 @@ +
              +

              Insert Table

              +
              + + + + + + + + + + + +
                
                
              +
              +
              +

              Table Options

              +
              +
                +
              • +
              • +
              +
                +
              • +
              • +
              +
                +
              • +
              • +
              +
              +
              +
              + insert + cancel +
              +
              \ No newline at end of file diff --git a/cms/templates/upload.html b/cms/templates/upload.html new file mode 100644 index 0000000..00d6fba --- /dev/null +++ b/cms/templates/upload.html @@ -0,0 +1,24 @@ +
              +

              Upload A File

              +

              To upload a file, first select the folder you want to upload to:

              +
              +
                +
              • + +
              • +
              • +

                Then, select the file from your computer:

                + +
              • +
              • + done + cancel +
              • +
              +
              +
              \ No newline at end of file diff --git a/cms/templates/video-editor.html b/cms/templates/video-editor.html new file mode 100644 index 0000000..93583c0 --- /dev/null +++ b/cms/templates/video-editor.html @@ -0,0 +1,15 @@ +
              +

              Insert Video

              +
              +

              Video Embed

              +

              Edit the embed code, or paste here to replace with a new video.

              +
              + + « apply +
              +
              +
              + done + cancel +
              +
              \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..1555012 --- /dev/null +++ b/index.html @@ -0,0 +1,127 @@ + + + + Default page + + + + + + + + + + + +
              +

              You Are All Set to Go!

              +

              All you need to do is add the class neocms to any div which contains editable content!

              +

              Update cms/core.php to manage credentials

              + +
              + + \ No newline at end of file