コード例 #1
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeInit(sfWebRequest $request)
 {
     //Check if kernel init went fine:
     $this->status = $this->getContext()->get('KernelStatus');
     $this->getContext()->getUser()->setAttribute('relativeUrlRoot', $request->getRelativeUrlRoot());
     //Add the log entry corresponding to the Kernel status:
     $log_ok = $this->getContext()->get('Kernel')->addLogIf(empty($this->status), array('info' => 'Application startup successful', 'error' => 'Application startup failed.'));
     //Check if error occured while logging:
     if (!$log_ok) {
         $this->status['log'] = 'Log files are unreachable, please check permissions on the log directory.';
     }
     //Edit the databases.yml file:
     ParametersConfiguration::editYaml();
     //Redirect to the localized homepage if everything went fine:
     $usersAuth = new usersAuth();
     /*Depending on the user Type (disconnected, admin, viewer), a redirection is done*/
     if ($usersAuth->isAdmin()) {
         $this->redirectIf(empty($this->status), '@localized_homepage');
     } else {
         if ($usersAuth->isViewer()) {
             $this->redirectIf(empty($this->status), '@localized_homepage');
         } else {
             $this->redirectIf(empty($this->status), '@authentification');
         }
     }
 }
コード例 #2
0
ファイル: layout.php プロジェクト: xmasclaux/OpenGenepi
?>
</li>
        </ul>
        <p>
            <?php 
echo __('For further information') . __(': ') . '<a href="http://www.opengenepi.org"><b>' . 'http://www.opengenepi.org' . '</b></a>' . '.';
?>
        </p>
    </div>

    <div id="ban"></div>

    <div id="menus">
            <div id="configurationAndUserName">
                <?php 
$usersAuth = new usersAuth();
if ($usersAuth->isAdmin()) {
    //if the user is an admin, the whole configuration menu
    ?>
                    <div id="configurationMenu">
                        <span>
                            <a href="<?php 
    echo url_for('auth/disconnect');
    ?>
">
                                <?php 
    echo image_tag('exit.png', array('class' => 'config_picture', 'title' => __('Disconnect')));
    ?>
                            </a>
                        </span>
                        <span>
コード例 #3
0
 public function executeSecure(sfWebRequest $request)
 {
     /*The user is disconnected*/
     $usersAuth = new usersAuth();
     $checked = $usersAuth->disconnect();
     /*A log line is added*/
     $this->getContext()->get('Kernel')->addLog("error", "Login \"" . $usersAuth->getLogin() . "\" tried to access to a forbidden address.");
     /* A flash message is set*/
     $this->getUser()->setFlash('error', 'You tried to access to a fordidden page.', true);
     /*The user is redirected to the index page */
     $this->redirect('auth/index');
 }