AnonSec Team
Server IP : 10.2.73.233  /  Your IP : 216.73.216.59
Web Server : Apache/2.4.59 (Debian)
System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/ifk/web/protected/Layouts/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ifk/web/protected/Layouts/AdminLayout.php
<?php

class AdminLayout extends TTemplateControl
{

	public function onLoad($param) {
		parent::onLoad($param);
		if ($this->User->getRole() == 0) {
			$message = "";
			$purgedPapers = $this->performCleaning_Papers();
			if ($purgedPapers > 0)
				$message .= "Usunięto <b>$purgedPapers</b> pustych rekordów książek";
			
			if (strlen($message)>0)
				$this->messageInfo("<b>Automatyczne czyszczenie bazy danych:</b>&nbsp;".$message);
	
		}
	}

	public function moveTo($param) {
		$param = $param->getCommandParameter();
		$commands = explode(';', $param);
		$request = array();
		for($i=1; $i<count($commands); $i++) {
			list($par_name, $par_value) = explode(',', $commands[$i]);
			$request[$par_name] = $par_value;
		};
		
		$this->Response->redirect($this->Service->constructUrl("Admin.".$commands[0], $request));
	}

	public function adminLogout() {
		$authManager=$this->Application->getModule('auth');
		$authManager->logout();
		$this->Response->Redirect("/");
	}
	
	public function messageSuccess($message_body) {
		$this->successMessage->Text = TPropertyValue::ensureString($message_body);
		$this->successPanel->Visible= true;
	} 
	
	public function messageError($message_body) {
		$this->errorMessage->Text = TPropertyValue::ensureString($message_body);
		$this->errorPanel->Visible= true;
	}
	
	public function messageWarning($message_body) {
		$this->warningMessage->Text = TPropertyValue::ensureString($message_body);
		$this->warningPanel->Visible= true;
	}
	
	public function messageInfo($message_body) {
		$this->infoMessage->Text = TPropertyValue::ensureString($message_body);
		$this->infoPanel->Visible= true;
	}

	public function performCleaning_Papers() {
		
		$crit = new TActiveRecordCriteria();
		$crit->Condition = "LENGTH(title)<2 AND DATE_SUB(CURDATE(), INTERVAL 1 DAY)>=added_date";
		
		$books = KPaper::finder()->findAll($crit);
		//return count($books);
		
		return 0;
	}

}

?>

AnonSec - 2021