function edit($id = null)
 {
     $this->permission(3);
     if ($id === null || !is_numeric($id)) {
         $this->redirect('cockpit/configuration');
         return false;
     }
     $this->loadModel('Configuration');
     $d['id'] = $id;
     $this->set($d);
     if ($this->request->data) {
         $key = $this->request->data->keyword;
         $this->request->data->value = $this->request->data->{$key};
         unset($this->request->data->{$key});
         $id = $this->Configuration->save($this->request->data);
         if (!is_numeric($id)) {
             $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, ErrorsTranslate::getLabel(DB) . '/id:' . $id);
             $this->Session->setAlert(ErrorsTranslate::getLabel(DB) . $id, DANGER);
             $this->redirect('cockpit/configuration/edit/' . $d['id']);
             return false;
         }
         $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, dashboardTranslate::getLabel('updatedConfig') . '/id:' . $id);
         $this->redirect('cockpit/configuration');
         return false;
     } else {
         $this->request->data = $this->Configuration->findFirst(array('conditions' => array('id' => $id)));
     }
 }
Beispiel #2
0
 function form()
 {
     if ($this->request->data) {
         $this->loadModel('Contact');
         $mail = new PHPMailer();
         $mail->From = $this->request->data->mail;
         $mail->FromName = $this->request->data->name;
         $message = $this->request->data->content;
         if ($this->request->data->sendcopy == 1) {
             $mail->AddAddress($this->request->data->mail);
             $message .= "<div><div dir=\"ltr\"><div><span style=\"color:rgb(11,83,148)\">Bien à vous,<i><b><br></b></i></span></div><div><span style=\"color:rgb(11,83,148)\"><i><b><br>WebPassions</b><br></i></span></div><div><span style=\"color:rgb(11,83,148)\">Lorge Vivian<br></span></div><div><span style=\"color:rgb(11,83,148)\"><i>0479/95.98.45</i><br></span></div><span style=\"color:rgb(11,83,148)\"><a target=\"_blank\" href=\"http://www.webpassions.be\"><i>http://www.webpassions.be</i></a></span><br><div><br><div><img width=\"96\" height=\"28\" src=\"http://www.webpassions.be/signature.png\"><br><br><br></div></div></div></div>";
         }
         $mail->IsHTML(true);
         $mail->CharSet = 'UTF-8';
         $mail->AddAddress($_SESSION['cmscontact']);
         $mail->AddReplyTo($_SESSION['cmscontact']);
         $mail->Subject = $_SESSION['cmscontactcategory'][$this->request->data->subject];
         $mail->Body = $message;
         if (!$mail->Send()) {
             $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, ErrorsTranslate::getLabel('sendError') . $mail->ErrorInfo);
             $this->Session->setAlert(ErrorsTranslate::getLabel('sendError') . $mail->ErrorInfo, DANGER);
         } else {
             $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, DashboardTranslate::getLabel('sendContact'));
             $this->Session->setAlert(DashboardTranslate::getLabel('sendContact'), SUCCESS);
         }
         unset($mail);
     }
 }
Beispiel #3
0
 function changePassword()
 {
     $this->layout = 'site_cockpit';
     if ($this->request->data) {
         $this->loadModel(USER);
         $data = $this->request->data;
         $data->newpassword = sha1($data->newpassword);
         $data->verifypassword = sha1($data->verifypassword);
         $user = $this->User->findFirst(array('conditions' => array('login' => $data->login)));
         if (empty($user)) {
             $this->logger->LogError($this->request->controller, $this->request->action, EMPTYSTRING, ErrorsTranslate::getLabel('loginnotfound'));
             $this->Session->setAlert(ErrorsTranslate::getLabel('loginnotfound'), DANGER);
             $this->redirect('user/changePassword');
             return false;
         } else {
             if ($data->newpassword != $data->verifypassword) {
                 $this->logger->LogError($this->request->controller, $this->request->action, $user->login, ErrorsTranslate::getLabel('differentPwd'));
                 $this->Session->setAlert(ErrorsTranslate::getLabel('differentPwd'), DANGER);
                 $this->redirect('user/changePassword');
                 return false;
             } else {
                 $this->logger->LogInfo($this->request->controller, $this->request->action, $user->login, UserTranslate::getLabel('pwdchanged'));
                 $this->Session->setAlert(UserTranslate::getLabel('pwdchanged'), SUCCESS);
                 $user->password = $data->newpassword;
                 $this->User->save($user);
                 $this->redirect('user/login');
                 return false;
             }
         }
         unset($this->request->data->newpassword);
         unset($this->request->data->verifypassword);
         $this->redirect('user/login');
     }
 }
Beispiel #4
0
 function delete($id = null)
 {
     $this->permission(3);
     if ($id === null || !is_numeric($id)) {
         $this->redirect('cockpit/user');
         return false;
     }
     $this->loadModel(USER);
     $d['id'] = $id;
     $this->set($d);
     if ($this->request->data) {
         $this->request->data->logicaldelete = 1;
         $id = $this->User->save($this->request->data);
         if (!is_numeric($id)) {
             $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, ErrorsTranslate::getLabel(DB) . '/id:' . $id);
             $this->Session->setAlert(ErrorsTranslate::getLabel(DB) . $id, DANGER);
             $this->redirect('cockpit/user');
             return false;
         }
         $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, UserTranslate::getLabel('deleted') . '/id:' . $id);
         $this->Session->setAlert(UserTranslate::getLabel('deleted'), SUCCESS);
         $this->redirect('cockpit/user');
     } else {
         $this->request->data = $this->User->findFirst(array('fields' => DBUtils::$table[USER] . ', UserRole.category', 'conditions' => array('User.id' => $id), 'join' => array('userrole as UserRole' => 'UserRole.id=User.category')));
     }
 }
Beispiel #5
0
 function view($id = null)
 {
     if ($id === null || !is_numeric($id)) {
         $this->layout = 'site_home';
         return false;
     } else {
         $this->loadModel(PAGE);
         $d[PAGE] = $this->Page->findFirst(array('conditions' => array('online' => 1, 'logicaldelete' => 0, 'id' => $id)));
         if (empty($d[PAGE])) {
             $this->e404(ErrorsTranslate::getLabel('pagenotfound'));
         }
         $this->set($d);
     }
 }
Beispiel #6
0
 function online($id = null)
 {
     if ($id === null || !is_numeric($id)) {
         $this->redirect('cockpit/employe');
         return false;
     }
     $this->loadModel(EMPLOYE);
     $this->request->data = $this->Employe->findFirst(array('fields' => DBUtils::$tableExtend[EMPLOYE], 'conditions' => array('Employe.id' => $id)));
     $this->request->data->online = $this->request->data->online == 1 ? 0 : 1;
     $id = $this->Employe->save($this->request->data);
     if (!is_numeric($id)) {
         $this->logger->LogError($this->request->controller, $this->request->action, $_SESSION[USER]->login, ErrorsTranslate::getLabel(DB) . '/id:' . $id);
         $this->Session->setAlert(ErrorsTranslate::getLabel(DB) . $id, DANGER);
         return false;
     }
     if ($this->request->data->online == 1) {
         $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, EmployeTranslate::getLabel('onlineUpdated') . '/id:' . $id);
         $this->Session->setAlert(EmployeTranslate::getLabel('onlineUpdated'), SUCCESS);
     } else {
         $this->logger->LogInfo($this->request->controller, $this->request->action, $_SESSION[USER]->login, EmployeTranslate::getLabel('offlineUpdated') . '/id:' . $id);
         $this->Session->setAlert(EmployeTranslate::getLabel('offlineUpdated'), SUCCESS);
     }
     $this->redirect('cockpit/employe');
 }
Beispiel #7
0
<?php

$title_for_layout = ErrorsTranslate::getLabel('pagenotfound');
?>

<div class="text-justify">

    <h2>
        <?php 
echo ErrorsTranslate::getLabel('pagenotfound');
?>
        <br/><br/>
        <small class="DANGER"><?php 
echo ErrorsTranslate::getLabel('e404');
?>
</small>
    </h2>

    <p><?php 
echo $message;
?>
</p>

</div>
Beispiel #8
0
 protected function permission($category)
 {
     if ($this->Session->user('category') < $category) {
         $this->Session->setAlert(ErrorsTranslate::getLabel('right'), DANGER);
         $this->redirect('cockpit/dashboard');
         return false;
     }
     return true;
 }