diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9c71b3d..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/cms/.idea/ diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..38d9885 --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4bc7011 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# NeoCMS +## Version 2.0 + +Version 2.0 is a complete rewrite to ensure we support the latest jQuery and TinyMCE GPL version. + +To install: + +* Drop in the CMS folder into a static website +* Drop in the uploads folder into the static website +* Edit credentials in /cms/init.php for any users that are required +* Update editable divs to contain the class 'editable' +* It _should_ then just work by visiting /cms/ and logging in + +## Requirements + +* PHP 8 on Linux. None of that Windows Server crap + +## Known Bugs +* Templating (New Page) not yet implemented +* File (not images) uploads need to be implemented +* Not completely tested + +If any issues arise, raise it as a bug in the issues page on GitHub \ No newline at end of file diff --git a/cms/backups/nothing.txt b/cms/backups/nothing.txt deleted file mode 100644 index e69de29..0000000 diff --git a/cms/config.php b/cms/config.php deleted file mode 100644 index 5f4b131..0000000 --- a/cms/config.php +++ /dev/null @@ -1,15 +0,0 @@ - ["password" => "password", "isAdmin" => 1], - "user" => ["password" => "password", "isAdmin" => 0], -]; - -$companyName = "CHANGEME IN CONFIG"; - - -$versionInfo = "1.0.0"; \ No newline at end of file diff --git a/cms/controller/index.php b/cms/controller/index.php new file mode 100644 index 0000000..8bee8ac --- /dev/null +++ b/cms/controller/index.php @@ -0,0 +1,14 @@ +saveContent($_POST['uri'], $_POST['content']); + die("Page Updated."); + } else { + die('Unable to save page'); + } + break; +} \ No newline at end of file diff --git a/cms/core/checkpath.php b/cms/core/checkpath.php deleted file mode 100644 index d8b06f7..0000000 --- a/cms/core/checkpath.php +++ /dev/null @@ -1,64 +0,0 @@ -/'; - $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 recognised. 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 deleted file mode 100644 index 5bc9533..0000000 --- a/cms/core/createsession.php +++ /dev/null @@ -1,29 +0,0 @@ - 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; - - } - - } - -} - - - - -function findfiles($path, $pattern) -{ - $matches = []; - $path = rtrim(str_replace("\\", "/", $path), '/') . '/'; - - $entries = array(); - $dir = dir($path); - $neocmspath = "/\/" . $_SESSION['neoCMSPath'] . "\//"; - while (false !== ($entry = $dir->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; - } - - } - } -return $matches; -} - -function checkContent($content) -{ - - global $type; - - if (stristr($content, '[^<]+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/getpage.php b/cms/core/getpage.php deleted file mode 100644 index b01b544..0000000 --- a/cms/core/getpage.php +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 77b90ef..0000000 --- a/cms/core/logout.php +++ /dev/null @@ -1,12 +0,0 @@ -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) - { - - - if ($content != $backcontent && ((!stristr($content, '[^<]+Error: You do not have permission to edit this page."; - - } - - } - - 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; - } - - } -} diff --git a/cms/core/save.php b/cms/core/save.php deleted file mode 100644 index 81e16e6..0000000 --- a/cms/core/save.php +++ /dev/null @@ -1,455 +0,0 @@ - $post) { - - $post = thecleaner($post); - if (preg_match("/^edit/", $key)) $edit[$key] = $post; - - } - - } - - function loadfile($url, $incpath, $f) - { - - global $message, $includes, $pagepath, $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 (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 . "."; - - // 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 (is_writable($fkey)) { - - $doc = fopen($fkey, "w"); - fwrite($doc, $fpost); - fclose($doc); - - } else $message = "Error: You do not have permission to edit this page."; - - } else $message = 'Error: neocms is unable find this page.'; - - } - - } - } - - } else $message = 'Error: neocms is unable find this page: ' . $missing . ''; - - output(); - - } else output(); - } -} else { - $message = 'Error: neocms is unable find your session.'; - output(); -} - -?> diff --git a/cms/core/sessionConfiguration.php b/cms/core/sessionConfiguration.php deleted file mode 100644 index d754623..0000000 --- a/cms/core/sessionConfiguration.php +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 320af0a..0000000 --- a/cms/core/upload.php +++ /dev/null @@ -1,90 +0,0 @@ -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."; - } - - } 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 (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; - - } - - } - - } - -} diff --git a/cms/core/urldissect.php b/cms/core/urldissect.php deleted file mode 100644 index 5bfca32..0000000 --- a/cms/core/urldissect.php +++ /dev/null @@ -1,19 +0,0 @@ - 'Invalid file type.']); + exit; + } + + // Set the upload directory + $upload_dir = '../uploads/'; + + // Ensure the upload directory exists + if (!is_dir($upload_dir)) { + mkdir($upload_dir, 0777, true); + } + + // Generate a unique name for the image + $extension = pathinfo($file['name'], PATHINFO_EXTENSION); + $filename = uniqid() . '.' . $extension; + + // Set the target file path + $target_file = $upload_dir . $filename; + + // Move the uploaded file to the target directory + if (move_uploaded_file($file['tmp_name'], $target_file)) { + // Return a JSON response with the image location + $location = $target_file; + echo json_encode(['location' => $location]); + } else { + // Return an error response + http_response_code(500); + echo json_encode(['error' => 'Failed to move uploaded file.']); + } +} else { + // No file was uploaded + http_response_code(400); + echo json_encode(['error' => 'No file uploaded.']); +} \ No newline at end of file diff --git a/cms/images/apple-touch-icon-precomposed.png b/cms/images/apple-touch-icon-precomposed.png deleted file mode 100644 index f541d83..0000000 Binary files a/cms/images/apple-touch-icon-precomposed.png and /dev/null differ diff --git a/cms/images/embed.png b/cms/images/embed.png deleted file mode 100644 index ce1c563..0000000 Binary files a/cms/images/embed.png and /dev/null differ diff --git a/cms/images/icon.png b/cms/images/icon.png deleted file mode 100644 index 417fccd..0000000 Binary files a/cms/images/icon.png and /dev/null differ diff --git a/cms/images/loading.gif b/cms/images/loading.gif deleted file mode 100644 index 520b7e8..0000000 Binary files a/cms/images/loading.gif and /dev/null differ diff --git a/cms/images/neocms_sprite1.png b/cms/images/neocms_sprite1.png deleted file mode 100644 index 745e2b2..0000000 Binary files a/cms/images/neocms_sprite1.png and /dev/null differ diff --git a/cms/images/prompt.gif b/cms/images/prompt.gif deleted file mode 100644 index 9e1c6f2..0000000 Binary files a/cms/images/prompt.gif and /dev/null differ diff --git a/cms/images/uploading.gif b/cms/images/uploading.gif deleted file mode 100644 index 4567fe9..0000000 Binary files a/cms/images/uploading.gif and /dev/null differ diff --git a/cms/img/logo.png b/cms/img/logo.png new file mode 100644 index 0000000..0772902 Binary files /dev/null and b/cms/img/logo.png differ diff --git a/cms/img/welcomeLogo.png b/cms/img/welcomeLogo.png new file mode 100644 index 0000000..22d553b Binary files /dev/null and b/cms/img/welcomeLogo.png differ diff --git a/cms/index.php b/cms/index.php index dabaa59..94357b3 100644 --- a/cms/index.php +++ b/cms/index.php @@ -1,77 +1,64 @@ - - - + + - - - - - neoCMS + NeoCMS + + + + + + - - - - - - - - - - - + + + + -
        +
        +
        + + +
        + Logged in as: getLoggedinUser(); ?> +
        +
        + +
        + +