============================== '; $logfileContent = str_replace($newLogfilePHP,'',file_get_contents($pth['file']['log'])); if ($fh = fopen($pth['file']['log'], "w")) { fwrite($fh,$newLogfilePHP . $m . $logfileContent); fclose($fh); } } function loginforms() { global $adm, $cf, $print, $hjs, $tx, $onload, $f, $o, $u, $s; if ($f == 'login') { $cf['meta']['robots'] = "noindex"; $onload.= "self.focus();document.login.passwd.focus();"; $f = $tx['menu']['login']; $o.= '
' . $tx['login']['wrong_password'] . '
' . ucfirst($tx['filetype']['backup']) . ' ' . $fn . ' ' . $tx['result']['created'] . '
'; $fl = array(); $fd = opendir('./backups/cmsimple/'); while (($p = readdir($fd)) == true) { if (preg_match("/\d{3}\_content.php/", $p) || preg_match("/\d{3}\_content.htm/", $p)) // 4.5 $fl[] = $p; } if ($fd == true) closedir($fd); sort($fl, SORT_STRING); $v = count($fl) - $cf['backup']['numberoffiles']; for ($i = 0; $i < $v; $i++) { if (unlink('./backups/cmsimple/' . '/' . $fl[$i])) $o .= '' . ucfirst($tx['filetype']['backup']) . ' ' . $fl[$i] . ' ' . $tx['result']['deleted'] . '
'; else e('cntdelete', 'backup', $fl[$i]); } } else { e('cntsave', 'backup', $fn); } // SAVE function for pagedata.php added if (file_exists($pth['folder']['content'] . 'pagedata.php')) { $fn = $backupDate . '_pagedata.php'; if (copy($pth['file']['pagedata'], './backups/cmsimple/' . $fn)) { $o .= '' . ucfirst($tx['filetype']['backup']) . ' ' . $fn . ' ' . $tx['result']['created'] . '
'; $fl = array(); $fd = opendir('./backups/cmsimple/'); while (($p = readdir($fd)) == true) { if (preg_match("/\d{3}\_pagedata.php/", $p)) $fl[] = $p; } if ($fd == true) closedir($fd); sort($fl, SORT_STRING); $v = count($fl) - $cf['backup']['numberoffiles']; for ($i = 0; $i < $v; $i++) { if (unlink('./backups/cmsimple/' . $fl[$i])) $o .= '' . ucfirst($tx['filetype']['backup']) . ' ' . $fl[$i] . ' ' . $tx['result']['deleted'] . '
'; else e('cntdelete', 'backup', $fl[$i]); } } else { e('cntsave', 'backup', $fn); } } // END save function for pagedata.php $adm = false; setcookie('status', '', 0); setcookie('passwd', '', 0); $o .= '' . $tx['login']['loggedout'] . '
'; } // SETTING FUNCTIONS AS PERMITTED if ($adm) { if ($edit) setcookie('mode'.$sn, 'edit', 0); if ($normal) setcookie('mode'.$sn, '', 0); if (gc('mode'.$sn) == 'edit' && !$normal) $edit = true; } else { if (gc('status') != '') setcookie('status', '', 0); if (gc('passwd') != '') setcookie('passwd', '', 0); if (gc('mode'.$sn) == 'edit') setcookie('mode'.$sn, '', 0); } // DELETE OLD BACKUPS FROM CONTENT FOLDER if($login && $adm) { // create backup folders, if not exists if(!is_dir('./backups/')) { mkdir('./backups/', 0777, true); chmod('./backups/', 0777); } if(!is_dir('./backups/cmsimple/')) { mkdir('./backups/cmsimple/', 0777, true); chmod('./backups/cmsimple/', 0777); } // new backups array if(count(scandir('./backups/cmsimple/')) > 0) { $nbf = opendir('./backups/cmsimple/'); while(($newBackupFile = readdir($nbf)) == true) { if(preg_match("/_content.php/", $newBackupFile) || preg_match("/_pagedata.php/", $newBackupFile)) { $newBackups[] = $newBackupFile; } } } // delete old backups if(isset($newBackups) && count($newBackups) > 10) { $delobf = opendir($pth['folder']['content']); while(($oldBackupFile = readdir($delobf)) == true) { if(preg_match("/_content.php/", $oldBackupFile) || preg_match("/\d{3}\_content.htm/", $oldBackupFile) || preg_match("/_pagedata.php/", $oldBackupFile)) { unlink($pth['folder']['content'] . $oldBackupFile); } } } } ?>