Example #1
0
// Load smarty
$smarty = getSmarty($arrConf['mainTheme']);
//- 1) SUBMIT. Si se hizo submit en el formulario de ingreso
//-            autentico al usuario y lo ingreso a la sesion
if (isset($_POST['submit_login']) and !empty($_POST['input_user'])) {
    $pass_md5 = md5(trim($_POST['input_pass']));
    if ($pACL->authenticateUser($_POST['input_user'], $pass_md5)) {
        session_regenerate_id(TRUE);
        $_SESSION['elastix_user'] = trim($_POST['input_user']);
        $_SESSION['elastix_pass'] = $pass_md5;
        //fue necesario incluir esto aqui porque cuando te logueas en la interfaz
        //de usario final haces uso de esta variable
        $_SESSION['elastix_pass2'] = $_POST['input_pass'];
        header("Location: index.php");
        writeLOG("audit.log", "LOGIN {$_POST['input_user']}: Web Interface login successful. Accepted password for {$_POST['input_user']} from {$_SERVER['REMOTE_ADDR']}.");
        update_theme();
        exit;
    } else {
        $user = urlencode(substr($_POST['input_user'], 0, 20));
        if (!$pACL->getIdUser($_POST['input_user'])) {
            // not exists user?
            writeLOG("audit.log", "LOGIN {$user}: Authentication Failure to Web Interface login. Invalid user {$user} from {$_SERVER['REMOTE_ADDR']}.");
        } else {
            writeLOG("audit.log", "LOGIN {$user}: Authentication Failure to Web Interface login. Failed password for {$user} from {$_SERVER['REMOTE_ADDR']}.");
        }
        // Debo hacer algo aquĆ­?
    }
}
// 2) Autentico usuario
if (isset($_SESSION['elastix_user']) && isset($_SESSION['elastix_pass']) && $pACL->authenticateUser($_SESSION['elastix_user'], $_SESSION['elastix_pass'])) {
    $idUser = $pACL->getIdUser($_SESSION['elastix_user']);
/** main entry point for update wizard (called from /program/main_admin.php)
 *
 * This routine takes care of executing update routines for both the core
 * program and modules, themes, etc. It is called automagically whenever
 * the core program version in the database is different from the version
 * in the file {@lnk version.php} (see also {@link main_admin()}).
 *
 * It can also be called manually via 'job=update'. When no specific
 * task is specified, this routine shows the overview of versions for
 * core, modules, themes, etc. Whenever a component is NOT up to date,
 * an [Update] button is displayed. If a component IS up to date, we
 * simply display the word 'OK'. This implies that when everything is up
 * to date, the overview simply displays a list of OK's and the user
 * is 'free to go'.
 *
 * The actual updates for modules, themes, etc. is done via the various
 * subsystems themselves, e.g. by calling htmlpage_upgrade() in the file
 * /program/modules/htmlpage/htmlpage_install.php. The updates for the
 * core program are actually performed from this file right here, see
 * {@link update_core_2010120800()} below for an example.
 *
 * Note that we give a core update high priority: if the core
 * is not up to date, nothing will work, except updating the core.
 *
 * @param object &$output collects the html output
 * @return void results are returned as output in $output
 */
function job_update(&$output)
{
    global $CFG, $WAS_SCRIPT_NAME, $USER;
    $output->set_helptopic('update');
    $task = get_parameter_string('task', TASK_UPDATE_OVERVIEW);
    if ($task == TASK_UPDATE_OVERVIEW) {
        update_show_overview($output);
    } elseif ($task == TASK_UPDATE_CORE) {
        update_core($output);
        update_show_overview($output);
    } elseif (intval($CFG->version) != intval(WAS_VERSION)) {
        $output->add_message(t('update_core_warnning_core_goes_first', 'admin'));
        update_show_overview($output);
    } else {
        $key = get_parameter_string('key', '');
        switch ($task) {
            case TASK_INSTALL_LANGUAGE:
                install_language($output, $key);
                update_show_overview($output);
                break;
            case TASK_UPDATE_LANGUAGE:
                update_language($output, $key);
                update_show_overview($output);
                break;
            case TASK_INSTALL_MODULE:
                install_module($output, $key);
                update_show_overview($output);
                break;
            case TASK_UPDATE_MODULE:
                update_module($output, $key);
                update_show_overview($output);
                break;
            case TASK_INSTALL_THEME:
                install_theme($output, $key);
                update_show_overview($output);
                break;
            case TASK_UPDATE_THEME:
                update_theme($output, $key);
                update_show_overview($output);
                break;
            default:
                $s = utf8_strlen($task) <= 50 ? $task : utf8_substr($task, 0, 44) . ' (...)';
                $message = t('task_unknown', 'admin', array('{TASK}' => htmlspecialchars($s)));
                $output->add_message($message);
                logger('tools: unknown task: ' . htmlspecialchars($s));
                update_show_overview($output);
                break;
        }
    }
}
 /**
  * Procedimiento para borrar los tpl temporales de smarty
  *
  * @param   $documentRoot        ruta del document root de la aplicacion
  * 
  * @return  bool    true or false si refresco o no
  */
 function smartyRefresh($documentRoot = '')
 {
     if ($documentRoot == '') {
         global $arrConf;
         $documentRoot = $arrConf['basePath'];
     }
     update_theme();
     return true;
 }