$this->setLog("\n current Time is :" . date("H:i:s", time()));
$this->setLog("\n timeout set to: " . date("H:i:s", $_SESSION['pas_event_garbage_timeout']));
if (is_array($mydb_paramkeys) && !empty($mydb_eventkey)) {
    if (is_array($mydb_paramkeys[$mydb_eventkey])) {
        foreach ($mydb_paramkeys[$mydb_eventkey] as $varname => $varvalue) {
            $GLOBALS[$varname] = $varvalue;
            $this->addParam($varname, $varvalue);
            $this->setLog("\n Restoring vars :" . $varname . "=" . $varvalue);
        }
    }
    // $this->setLog("\n event referer:".$GLOBALS['pas_event_referer']);
    unset($_SESSION['mydb_paramkeys'][$mydb_eventkey]);
    //session_register("mydb_paramkeys") ;
    $this->setLog("\n\n-" . $_SESSION['pas_event_garbage_timeout'] + $cfg_event_param_garbage_interval . " < " . time());
    if ($_SESSION['pas_event_garbage_timeout'] + $cfg_event_param_garbage_interval < time()) {
        $old_paramkeys = $_SESSION['mydb_paramkeys'];
        $this->setLog("\n Running events param garbage collector");
        foreach ($old_paramkeys as $key => $a_params) {
            if ($a_params['pas_event_timestamp'] + $cfg_event_param_garbage_time_out > time()) {
                $new_paramkeys[$key] = $a_params;
                $this->setLog("\n Keep event:" . $key . " at:" . date("Y/m/d - H:i:s", $a_params['pas_event_timestamp']));
            }
        }
        $_SESSION['mydb_paramkeys'] = $new_paramkeys;
        $_SESSION['pas_event_garbage_timeout'] = time();
    }
} else {
    $disperr->addParam("message", "This event requires mydb_paramkeys from the session and mydb_eventkey as parameter");
    $this->setDisplayNext($disperr);
}
$this->setLogRun($logrun);
 function eventCheckUsernamePassword(EventControler $evctl)
 {
     /**   Event CheckUsernamePassword
      *
      * To test if passwords matches and there is not already a login and password
      * To work the uniq id of the table must be named as id<table name>.
      * If its a new record the uniqid must be an empty string else a integer..
      * If not it sets the doSave param at "no" to block the save and
      * Call the message page.
      * @package RadriaEvents
      * @author Philippe Lewicki <*****@*****.**>
      * @param array accessfield array with the name of the password and login fields
      * Option :
      * @param string errorpage page to display the errors
      * @copyright SQLFusion
      */
     /*
     $strMissingField  = "Vous devez avoir 1 login et 1 mot de passe" ;
     $strErrorPasswordNotMatch = "Les mots de passe saisie ne correspondent pas ";
     $strErrorLoginAlreadyUsed = "Loggin deja utilise, Vous devez choisir un autre login";
     */
     global $strMissingField, $strErrorPasswordNotMatch, $strErrorLoginAlreadyUsed;
     if (!isset($strMissingField)) {
         $strMissingField = "You need a login and password in the form";
     }
     if (!isset($strErrorPasswordNotMatch)) {
         $strErrorPasswordNotMatch = "The password entries do not match";
     }
     if (!isset($strErrorLoginAlreadyUsed)) {
         $strErrorLoginAlreadyUsed = "The username is already in use";
     }
     $accessfield = $evctl->accessfield;
     $fields = $evctl->fields;
     $fieldrepeatpass = $evctl->fieldrepeatpass;
     $errorpage = $evctl->errorpage;
     $this->setLog("\n Check login & password:"******"\n Repeat pass:"******"Cancel") {
         if (strlen($errorpage) > 0) {
             $dispError = new Display($errorpage);
         } else {
             $dispError = new Display($evctl->getMessagePage());
         }
         $dispError->addParam("message", "");
         if (is_array($accessfield)) {
             if (!isset($table)) {
                 $table = "users";
             }
             $nbraccess = count($accessfield);
             if ($nbraccess != 2) {
                 $dispError->editParam("message", $strMissingField);
             }
             $passwordfield = $accessfield["password"];
             $loginfield = $accessfield["login"];
             $this->setLog("\n Verify pass:"******"message", $strErrorPasswordNotMatch);
             }
             if (get_magic_quotes_gpc()) {
                 $primarykey = stripslashes($primarykey);
             }
             if (strlen($primarykey) > 0) {
                 $queryverif = "select * from " . $table . " where " . $loginfield . "='" . $fields[$loginfield] . "' AND NOT(" . $primarykey . ")";
             } else {
                 $queryverif = "select * from " . $table . " where " . $loginfield . "='" . $fields[$loginfield] . "'";
             }
             $qVerif = new SqlQuery($evctl->getDbCon());
             $rverif = $qVerif->query($queryverif);
             if ($qVerif->getNumRows()) {
                 $dispError->editParam("message", $strErrorLoginAlreadyUsed);
             }
         }
         $error = $dispError->getParam("message");
         if (strlen($error) > 0) {
             $_SESSION["in_page_message"] = $error;
             $evctl->setDisplayNext($dispError);
             $evctl->updateParam("doSave", "no");
             // echo "supposed to be no from here " ;
         }
     }
 }
Exemple #3
0
 /**
  * Process to the next page based on the $urlNext
  * @access public
  */
 function doForward()
 {
     global $globalevents;
     if (strlen($this->getUrlNext()) == 0) {
         if (strlen($this->getParam("event_referer") > 0)) {
             $this->setUrlNext($this->getParam("event_referer"));
         } elseif (strlen($_SERVER['HTTP_REFERER']) > 0) {
             $this->setUrlNext($_SERVER['HTTP_REFERER']);
         } else {
             $disp = new Display($this->getMessagePage());
             $disp->addParam("message", "No redirection set for this event. Please click back and try again");
         }
     }
     if ($this->getUniqueUrl()) {
         if (ereg("uniqid", $this->getUrlNext())) {
             $this->urlNext = ereg_replace("uniqid=.*", "uniqid=" . uniqid(rand()), $this->getUrlNext());
         } elseif (ereg("\\?", $this->getUrlNext())) {
             $this->urlNext .= "&uniqid=" . uniqid(rand());
         } else {
             $this->urlNext .= "?uniqid=" . uniqid(rand());
         }
     }
     $this->setLog("\n Forward to URL:" . $this->getUrlNext());
     header("Location: " . $this->getUrlNext());
     exit;
 }
Exemple #4
0
 /**   Event FieldType::eventCheckUnique
  *
  * Check that all the field set as required are field in.
  * If not it sets the doSave param at "no" to block the save and
  * call the message page.
  * <br>- param array fields that contains the content of the fields to check
  * <br>- param array required indexed on fields name and contains value "yes"
  * <br>Option:
  * <br>- param string errorpage page to display the error message
  */
 function eventCheckUnique(EventControler $evctl)
 {
     $this->setLog("\n Check Unique , table:" . $this->unique_table_name . " message:" . $this->unique_message);
     if (strlen($this->unique_message) > 0) {
         $validate_message = $this->unique_message;
     } elseif (strlen($this->label) > 0) {
         $validate_message = $this->label . _(" must be unique");
     }
     if ($evctl->submitbutton != _("Cancel") && strlen($this->unique_table_name) > 0) {
         $field_name = $this->getFieldName();
         if ($evctl->unique[$field_name] == "yes") {
             $q_check = new SqlQuery($this->getDbCon());
             $q_check->query("select {$field_name} from " . $this->unique_table_name . " where {$field_name} = '" . $q_check->quote($evctl->fields[$field_name]) . "'");
             if ($q_check->getNumRows() > 0) {
                 if (strlen($evctl->errorpage) > 0) {
                     $urlerror = $evctl->errorpage;
                 } else {
                     $urlerror = $evctl->getMessagePage();
                 }
                 $disp = new Display($urlerror);
                 $disp->addParam("message", $validate_message);
                 $_SESSION['in_page_message'] = $validate_message;
                 $this->setLog("\n Validate message:" . $_SESSION['in_page_message']);
                 $evctl->setDisplayNext($disp);
                 $evctl->updateParam("doSave", "no");
             }
         }
     }
 }