function fetch($option = '') { // build the signup page require_once PATH_CORE . '/classes/template.class.php'; $this->templateObj = new template($this->db); $this->templateObj->registerTemplates(MODULE_ACTIVE, 'signup'); $referid = $this->page->fetchReferral(); if ($referid !== false) { $this->page->recordReferral($referid, 'referToSite'); } $this->page->recordSrc(); $inside .= '<div id="col_left"><!-- begin left side -->'; $this->session->syncFacebookData($this->session->fbId); // members should never see the signup page more than once! if ($this->session->isMember && !isset($_GET['force'])) { $this->facebook->redirect(URL_CANVAS . '?p=team'); } require_once PATH_FACEBOOK . '/classes/account.class.php'; $account = new account($this->db, $this->session); if (isset($_GET['debug'])) { $account->debug = $_GET['debug']; } // if ($this->debug) echo '$_POST:<pre>'.print_r($_POST,true).'</pre>'; if (isset($_GET['step']) && $_GET['step'] == 'submit') { $fdata = $account->validateFormData(); //if ($this->debug) echo '<pre>'.print_r($fdata,true).'</pre>'; // TODO: structure for all data, and a validation/error indicator structure // use two assoc arrays, walk through them when building/rebuilding form to note errors //... if ($fdata->result) { $fdata = $account->processFormUpdateDatabase($fdata); } if (!$fdata->result) { $inside .= $account->buildSignupForm($fdata, $fdata->alert); } else { // success $this->session->u->load($this->session->u->userid); // refresh session data $msg .= "postSignup: User {$this->session->u->name}:{$this->session->u->userid} signup successful..."; $msg .= $this->postSignup($fdata->email); //$this->db->log($msg); $this->facebook->redirect(URL_CANVAS . '?p=team&newsignup=1'); // } } else { // is this a redirect from a chat request if (isset($_GET['next'])) { $arArg = parse_url(urldecode($_GET['next'])); $targetLink = $arArg['query']; if (stristr($targetLink, '&chat') !== false) { $inside .= $this->page->buildMessage('error', 'Welcome to ' . SITE_TITLE, 'We\'d like you sign up but it is not required for reading and chatting. If you prefer just to read the story, <a href="' . URL_CANVAS . '?' . $targetLink . '">click here</a>. '); } } if (isset($_GET['test']) && $_GET['test'] == 'blank') { $fdata = $account->initFormDataBlank(); } else { $fdata = $account->initFormData(); } $inside .= $this->templateObj->templates['heading']; $inside .= $account->buildSignupForm($fdata); } $inside .= '<!-- end left side --></div><div id="col_right">'; // whyPost side panel $inside .= $this->templateObj->templates['intro']; $inside .= $this->templateObj->templates['whyJoin']; $inside .= '</div> <!-- end right side -->'; if ($this->page->isAjax) { return $inside; } if (file_exists(PATH_SITE_IMAGES . 'bg_banner.gif')) { $code = '<img src="' . URL_CALLBACK . '?p=cache&simg=bg_banner.gif" alt="' . SITE_TITLE . ' header"/><br /><br />'; } $code .= $this->page->constructPage('signup', $inside, '', false); return $code; }
function fetchAccountSettings() { require_once PATH_FACEBOOK . '/classes/account.class.php'; $account = new account($this->db, $this->page->session); if (isset($_GET['debug'])) { $account->debug = $_GET['debug']; } if ($account->debug) { echo '$_POST:<pre>' . print_r($_POST, true) . '</pre>'; } if (isset($_GET['step']) && $_GET['step'] == 'submit') { $fdata = $account->validateFormData(false); // validate for existing account if ($this->debug) { echo '<pre>' . print_r($fdata, true) . '</pre>'; } if ($fdata->result) { $fdata = $account->processFormUpdateDatabase($fdata); } if (!$fdata->result) { $code .= $account->buildAccountSettingsForm($fdata, $fdata->alert); } else { // success -- just redisplay w/ updated data $code .= "Update successful..."; $this->facebook->redirect(URL_CANVAS . '?p=account&message=success'); } } else { $fdata = $account->initFormDataFromDatabase($this->page->session->userid); $fdata->researchImportance = $this->page->session->ui->researchImportance; $code .= '<h5>Please update your account settings below.</h5>'; /* if ($this->page->session->u->ncUid==0) { $code.=$this->page->buildMessage('error','Please verify your email address','We do not have a record of you verifying your email address. Please look in your email and spam folder for a verification request link. If you can\'t find one, <a href="#" onclick="requestVerify();return false;">request another here</a>.'); } */ $code .= $account->buildAccountSettingsForm($fdata); } return $code; }