Example #1
0
 public function process()
 {
     global $base_path, $msg;
     global $empty_pwd, $ext_pwd;
     global $action;
     global $callback_func;
     global $callback_url, $new_tab;
     global $popup_header;
     $this->callback_func = $callback_func;
     $this->callback_url = $callback_url;
     $this->new_tab = $new_tab;
     switch ($action) {
         case 'check_auth':
             //On tente la connexion
             // si paramétrage authentification particulière
             $empty_pwd = true;
             $ext_auth = false;
             if (file_exists($base_path . '/includes/ext_auth.inc.php')) {
                 $file_orig = "empr.php";
                 require_once $base_path . '/includes/ext_auth.inc.php';
             }
             $log_ok = connexion_empr();
             print $popup_header;
             if ($log_ok) {
                 //réussie, on poursuit le tout...
                 $this->success_callback();
             } else {
                 print $this->get_form($msg['auth_failed']);
             }
             break;
         case 'get_form':
         default:
             print $popup_header;
             if (!$_SESSION['user_code']) {
                 print $this->get_form();
             } else {
                 $this->success_callback();
             }
             break;
     }
 }
Example #2
0
File: avis.php Project: hogsim/PMB
}
// par défaut, on suppose que le droit donné par le statut est Ok
$allow_avis = 1;
$allow_tag = 1;
if (($todo == 'liste' || !$todo) && $opac_avis_allow == 3) {
    //consultation possible sans authentification
    $log_ok = 1;
} else {
    //Vérification de la session
    $empty_pwd = true;
    $ext_auth = false;
    // si paramétrage authentification particulière et pour le re-authentification ntlm
    if (file_exists($base_path . '/includes/ext_auth.inc.php')) {
        require_once $base_path . '/includes/ext_auth.inc.php';
    }
    $log_ok = connexion_empr();
}
$allow_avis_ajout = true;
// on a tout vérifié mais si tout est libre alors on force le log_ok à 1
if ($opac_avis_allow == 3) {
    $log_ok = 1;
    $allow_avis = 1;
}
if ($opac_avis_allow == 1 && !$log_ok) {
    $allow_avis_ajout = false;
}
// La consultation d'avis est autorisé mais son statut bloque...
if ($opac_avis_allow > 0 && $allow_avis == 0) {
    $log_ok = 1;
    $allow_avis = 1;
    $allow_avis_ajout = false;
function verif_validation_compte()
{
    global $dbh, $msg;
    global $login, $cle_validation, $form_access_compte;
    global $opac_websubscribe_empr_status, $opac_websubscribe_valid_limit;
    $opac_websubscribe_empr_status_array = explode(",", $opac_websubscribe_empr_status);
    $ret = array();
    $rqt = "select id_empr, if(date_add(empr_creation, INTERVAL {$opac_websubscribe_valid_limit} HOUR)>=sysdate(),1,0) as not_depasse, empr_password, cle_validation, empr_subscription_action from empr where empr_login ='******' and empr_statut='" . $opac_websubscribe_empr_status_array[0] . "' ";
    $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . "<br /><br />{$rqt}");
    if (pmb_mysql_num_rows($res) > 0) {
        // trouvé !
        $obj = pmb_mysql_fetch_object($res);
        if ($obj->not_depasse) {
            // validation pas dépassée
            if ($obj->cle_validation == $cle_validation) {
                $subscription_action = unserialize($obj->empr_subscription_action);
                $suite = get_html_subscription_action($subscription_action);
                $rqt = "update empr set cle_validation='', empr_subscription_action= '', empr_statut='" . $opac_websubscribe_empr_status_array[1] . "' where empr_login='******' ";
                $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . "<br /><br />{$rqt}");
                $ret[0] = PBINSC_OK;
                if ($suite) {
                    //on connecte avec une mini feinte...
                    global $emprlogin;
                    $emprlogin = $login;
                    global $encrypted_password;
                    $encrypted_password = $obj->empr_password;
                    $log_ok = connexion_empr();
                    if ($log_ok) {
                        $ret[1] = str_replace("!!form_access_compte!!", $suite, $msg[subs_ok_validation]);
                    } else {
                        $form_access_compte = str_replace("!!login!!", $login, $form_access_compte);
                        $form_access_compte = str_replace("!!encrypted_password!!", $obj->empr_password, $form_access_compte);
                        $ret[1] = str_replace("!!form_access_compte!!", $form_access_compte, $msg[subs_ok_validation]);
                    }
                } else {
                    $form_access_compte = str_replace("!!login!!", $login, $form_access_compte);
                    $form_access_compte = str_replace("!!encrypted_password!!", $obj->empr_password, $form_access_compte);
                    $ret[1] = str_replace("!!form_access_compte!!", $form_access_compte, $msg[subs_ok_validation]);
                }
                return $ret;
            } else {
                // login Ok mais clé pas valide
                $rqt = "delete from empr where empr_login='******' ";
                $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . "<br /><br />{$rqt}");
                $ret[0] = PBINSC_CLE;
                $ret[1] = $msg[subs_pb_cle];
                return $ret;
            }
        } else {
            // dépassée
            $rqt = "delete from empr where empr_login='******' ";
            $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . "<br /><br />{$rqt}");
            $ret[0] = PBINSC_INVALID;
            $ret[1] = $msg[subs_pb_invalid];
            return $ret;
        }
    }
    // n'existe même pas !
    $ret[0] = PBINSC_INCONNUE;
    $ret[1] = str_replace("!!login!!", $login, $msg[subs_pb_inconnue]);
    return $ret;
}