Add old log remover and repair islogin function error
This commit is contained in:
		@@ -11,21 +11,28 @@ class LogRecordType{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class LogKeeper
 | 
					class LogKeeper
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	function purge($days){
 | 
						function cleaningDir ($dir, $seconds) {
 | 
				
			||||||
		$todayFileName = date ("Y-m-d").'.log';
 | 
							$todayFileName = date ("Y-m-d").'.log';
 | 
				
			||||||
		$seconds = $days * 86400;
 | 
							$logFiles = scandir ($dir);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		$logFiles = scandir('../logs/');
 | 
					 | 
				
			||||||
		foreach ($logFiles as $key => $file) {
 | 
							foreach ($logFiles as $key => $file) {
 | 
				
			||||||
			if (in_array ($file,array (".", "..", ".gitkeep", $todayFileName)))
 | 
								if (in_array ($file,array (".", "..", ".gitkeep", $todayFileName)))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (filemtime($file) > $seconds) {
 | 
								if (!is_dir($dir . $file)) {
 | 
				
			||||||
				unlink('../logs/'.$file);
 | 
									if (strtotime(str_replace(".log", "", $file)) < (strtotime("now") - $seconds)) {
 | 
				
			||||||
 | 
										unlink ($dir . $file);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									$this->cleaningDir ($path . $file . "/", $seconds);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						function purge ($days) {
 | 
				
			||||||
 | 
							$seconds = $days * 86400;
 | 
				
			||||||
 | 
							$this->cleaningDir ('../logs/', $seconds);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class LogManager
 | 
					class LogManager
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ class Ajax extends Template
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	function __construct()
 | 
						function __construct()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		global $userManager;
 | 
							$userManager = new UserManager();
 | 
				
			||||||
		global $lang;
 | 
							global $lang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$userManager->isLogin()){
 | 
							if (!$userManager->isLogin()){
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,8 +3,8 @@ class Automation extends Template
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	function __construct()
 | 
						function __construct()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		global $userManager;
 | 
							$userManager = new UserManager();
 | 
				
			||||||
		global $langMng;
 | 
							global $lang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$userManager->isLogin()){
 | 
							if (!$userManager->isLogin()){
 | 
				
			||||||
			header('Location: ' . BASEURL . 'login');
 | 
								header('Location: ' . BASEURL . 'login');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,8 +18,8 @@ class Log extends Template
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	function __construct()
 | 
						function __construct()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		global $userManager;
 | 
							$userManager = new UserManager();
 | 
				
			||||||
		global $langMng;
 | 
							global $lang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$userManager->isLogin()){
 | 
							if (!$userManager->isLogin()){
 | 
				
			||||||
			header('Location: ' . BASEURL . 'login');
 | 
								header('Location: ' . BASEURL . 'login');
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ class Login extends Template
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	function __construct()
 | 
						function __construct()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		global $userManager;
 | 
							$userManager = new UserManager();
 | 
				
			||||||
		global $lang;
 | 
							global $lang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($userManager->isLogin()){
 | 
							if ($userManager->isLogin()){
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,8 +4,8 @@ class Setting extends Template
 | 
				
			|||||||
	function __construct()
 | 
						function __construct()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		global $userManager;
 | 
							$userManager = new UserManager();
 | 
				
			||||||
		global $langMng;
 | 
							global $lang;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$userManager->isLogin()){
 | 
							if (!$userManager->isLogin()){
 | 
				
			||||||
			header('Location: ' . BASEURL . 'login');
 | 
								header('Location: ' . BASEURL . 'login');
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user