function eventAutoSignIn(EventControler $eventControler)
 {
     if ($eventControler->doSave == "yes") {
         $this->setLog("\n (User) Registration Sign on " . date("Y/m/d H:i:s"));
         $fields = $eventControler->fields;
         $auth_username = $fields[$this->getUsernameField()];
         $auth_password = $fields[$this->getPasswordField()];
         $goto = $eventControler->goto;
         if (strlen($auth_username) > 0 && strlen($auth_password) > 0) {
             $this->setLog("\n(" . $this->getObjectName() . ") table:" . $this->getTable());
             $this->query("select * from `" . $this->getTable() . "` \n                            where `" . $this->getUsernameField() . "`='" . $this->quote($auth_username) . "' \n                            and `" . $this->getPasswordField() . "`='" . $this->quote($auth_password) . "'");
             $this->setLog("\n(User) Query executed for sign on:" . $this->sql_query);
             if ($this->getNumrows() == 1) {
                 $userdata = array();
                 $userdata['id'] = $this->iduser;
                 $userdata['firstname'] = $this->firstname;
                 $userdata['lastname'] = $this->lastname;
                 $userdata['email'] = $this->email;
                 $userdata['username'] = $this->{$this->getUsernameField()};
                 if ($this->isadmin) {
                     $userdata['isadmin'] = 1;
                 }
                 $userdata['user_table'] = $user_table;
                 $_SESSION['userdata'] = $userdata;
                 if (!$this->isPersistent()) {
                     $this->sessionPersistent("do_" . $this->getObjectName(), "signout.php", 36000);
                 }
             }
             $do_login_audit = new LoginAudit();
             $do_login_audit->do_login_audit();
             $eventControler->setUrlNext($eventControler->goto);
         }
     }
 }
示例#2
0
 /**
  * eventUpgrade
  */
 function eventUpgrade(EventControler $evctl)
 {
     $evctl->setUrlNext("index.php");
 }
示例#3
0
 /**
  * saveWebForm()
  * this will check if contact exists with firname, lastname, name and email 
  * If exist add to it, if doesn't exists create a new one.
  */
 function eventAddContact(EventControler $event_controler)
 {
     //$fields = $_REQUEST['fields'];
     $fields = $event_controler->fields;
     $this->setLog("\n eventAddContact, creating new contact from form, using " . count($fields) . " fields. (" . date("Y/m/d H:i:s") . ")");
     //$dropcode = $_POST['dropcode'];
     if (isset($this->iduser)) {
         $do_contact = new Contact();
         $do_contact->iduser = $this->iduser;
         $do_contact->add();
         $this->setLog("\n new contact:" . $do_contact->idcontact . " for user:"******"\n new contact:" . $do_contact->idcontact . " for user:"******"\n Processing field:" . $field_name . " with value:" . $field_value);
         if (isset($this->idwebformuser)) {
             $do_webform_fields = new WebFormUserField();
             $do_webform_fields->query("SELECT wfu.name, wff.class as class_name, wff.variable, wff.variable_type, wfu.required \n\t\t                                FROM webformfields as wff, webformuserfield as wfu \n                                  WHERE wff.name=wfu.name\n                                  AND wfu.name = '" . $field_name . "'\n                                  AND wfu.idwebformuser= "******"SELECT wfu.name, wff.class as class_name, wff.variable, wff.variable_type, wfu.required \n                                  FROM webformfields as wff, webformuserfield as wfu \n                                  WHERE wff.name=wfu.name\n                                  AND wfu.name = '" . $field_name . "'\n                                  AND wfu.idwebformuser= "******"\n Field information class:" . $do_webform_fields->class_name . " Variable:" . $do_webform_fields->variable);
         $this->setLog("\n rows:" . $do_webform_fields->getNumRows());
         if ($do_webform_fields->getNumRows() == 1) {
             if ($do_webform_fields->class_name == "Contact") {
                 $this->setLog("\n     Updating contact");
                 $do_contact->{$do_webform_fields->variable} = $field_value;
                 $do_contact->update();
             } else {
                 $update = false;
                 if (is_object(${'sub_' . $do_webform_fields->class_name})) {
                     if (${'sub_' . $do_webform_fields->class_name}->getType() == $do_webform_fields->variable_type) {
                         $update = true;
                     }
                 }
                 if ($update) {
                     $this->setLog("\n     Updating class:" . $do_webform_fields->class_name);
                     $obj = ${'sub_' . $do_webform_fields->class_name};
                     $obj->{$do_webform_fields->variable} = $field_value;
                     $obj->update();
                 } else {
                     $class_name = $do_webform_fields->class_name;
                     ${'sub_' . $class_name} = new $class_name();
                     $obj = ${'sub_' . $class_name};
                     $obj->{$do_webform_fields->variable} = $field_value;
                     if (method_exists($obj, "setType") && strlen($do_webform_fields->variable_type) > 0) {
                         $obj->setType($do_webform_fields->variable_type);
                     }
                     $obj->idcontact = $do_contact->getPrimaryKeyValue();
                     $obj->iduser = $event_controler->uid;
                     $obj->add();
                 }
             }
         }
     }
     if (isset($this->iduser)) {
         $contact_view = new ContactView();
         $contact_view->setUser($this->iduser);
         $contact_view->addFromContact($do_contact);
     } else {
         $contact_view = new ContactView();
         $contact_view->setUser($event_controler->uid);
         $contact_view->addFromContact($do_contact);
     }
     if (isset($this->tags)) {
         $tags = explode(",", $this->tags);
         foreach ($tags as $tag) {
             $tag = trim($tag);
             $do_tag = new Tag();
             $do_tag->addNew();
             $do_tag->addTagAssociation($do_contact->getPrimaryKeyValue(), $tag, "contact", $this->iduser);
             $contact_view->addTag($tag);
         }
         if (strlen($this->urlnext) > 0) {
             $event_controler->setUrlNext($this->urlnext);
         } else {
             $event_controler->setUrlNext($GLOBALS['cfg_ofuz_site_http_base'] . 'web_form_thankyou.php');
         }
         $event_controler->addParam("do_contact", $do_contact);
     } else {
         $sql = "SELECT * FROM {$this->table} WHERE idwebformuser={$event_controler->fid}";
         $this->query($sql);
         while ($this->fetch()) {
             $tags = $this->getData("tags");
             $urlnext = $this->getData("urlnext");
         }
         $tags = explode(",", $tags);
         foreach ($tags as $tag) {
             $tag = trim($tag);
             $do_tag = new Tag();
             $do_tag->addNew();
             $do_tag->addTagAssociation($do_contact->getPrimaryKeyValue(), $tag, "contact", $this->iduser);
             $contact_view->addTag($tag);
         }
         if (strlen($urlnext) > 0) {
             $event_controler->setUrlNext($urlnext);
         } else {
             $url = $GLOBALS['cfg_ofuz_site_http_base'] . 'web_form_thankyou.php';
             //$event_controler->setUrlNext($url);
             //header("location:$url");
             $err_disp = new Display($url);
             $event_controler->setDisplayNext($err_disp);
             $event_controler->doForward();
         }
         //$event_controler->addParam("do_contact", $do_contact);
     }
 }
示例#4
0
 *
 * @package registration
 * @author Jay Link
 * @version 1.3
 */
//session_start();
require_once 'config.php';
require_once 'Zend/OpenId/Consumer.php';
$eventControler = new EventControler($GLOBALS['conx']);
$eventControler->setLogRun(true);
$eventControler->setMyDbPath($cfg_local_mydbdir);
$eventControler->setMessagePage("message.php");
$eventControler->setCheckReferer(false);
//echo $_SESSION['openid_userclass'];
if (!isset($_SESSION['openid_userclass'])) {
    $eventControler->setUrlNext("index.php");
    $eventControler->doForward();
    exit;
} else {
    $cur_userclass = $_SESSION['openid_userclass'];
}
$eventControler->setLog("\n--- OpenId Call back --");
$eventControler->setLog("\n userclass:" . $_SESSION['openid_userclass']);
$eventControler->setLog("\n openid_mode:" . $_GET['openid_mode']);
$events = array();
$events[50] = $cur_userclass . "->eventCheckOpenIdCallBack";
$events[40] = "mydb.gotoPage";
if (isset($_GET['openid_mode'])) {
    $eventControler->addParam("goto", "sess_test2.php");
    $eventControler->listenEvents($events);
    $eventControler->doForward();
示例#5
0
 /**
  * New User Registration with Google Account
  * @param $evtcl -- Object
  * @return Void
  */
 function eventRegGoogleUser(EventControler $evtcl)
 {
     if ($evtcl->google_openid_identity && $evtcl->google_openid_identity != '') {
         if ($evtcl->firstname == '' || $evtcl->lastname == '' || $evtcl->email == '') {
             $err_disp = new Display($evtcl->err_page);
             $msg = "All the fields are required for your registration with Ofuz.";
             $err_disp->addParam("message", $msg);
             $evtcl->setDisplayNext($err_disp);
         } else {
             $this->firstname = $evtcl->firstname;
             $this->lastname = $evtcl->lastname;
             $this->google_openid_identity = $evtcl->google_openid_identity;
             $this->email = $evtcl->email;
             $this->plan = 'free';
             $this->status = 'active';
             $this->add();
             $this->iduser = $this->getPrimaryKeyValue();
             $this->setSessionVariable();
             $text = '';
             $text .= "Hi " . $this->firstname . "\r\n";
             $text .= 'Welcome to Ofuz. Thanks for logging in with your Google Account. You can login to ofuz with your Google Account, also you will not need any username and password for login to ofuz, all you need to login with \'Sign in with Google\' button. How ever you can set one username as well from the setting and at any point of time can use the general login instead of facebook connect.<br /><br />';
             $text .= 'Thank You !<br /> Ofuz Team';
             $do_template = new EmailTemplate();
             $do_template->senderemail = "*****@*****.**";
             $do_template->sendername = "Ofuz";
             $do_template->subject = "Welcome To Ofuz";
             $do_template->bodytext = $text;
             $do_template->bodyhtml = $do_template->bodytext;
             $this->sendMessage($do_template);
             $evtcl->setUrlNext("welcome_to_ofuz.php");
         }
     } else {
         $err_disp = new Display($evtcl->err_page);
         $msg = _('Sorry! It seems like you are not connected to Google. Please try again.');
         $err_disp->addParam("message", $msg);
         $evtcl->setDisplayNext($err_disp);
     }
 }