public static function display() { if (isset($_POST['submit_admin_edit_account'])) { if (\PFBC\Form::isValid($_POST['submit_admin_edit_account'])) { new EditFormProcess(); } Framework\Url\Header::redirect(); } $oHR = new Http(); // Prohibit other administrators to edit the Root Administrator (ID 1) $iProfileId = $oHR->getExists('profile_id') && $oHR->get('profile_id', 'int') !== 1 ? $oHR->get('profile_id', 'int') : (new Session())->get('admin_id'); $oAdmin = (new AdminModel())->readProfile($iProfileId, 'Admins'); $oForm = new \PFBC\Form('form_admin_edit_account', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_admin_edit_account', 'form_admin_edit_account')); $oForm->addElement(new \PFBC\Element\Token('edit_account')); if ($oHR->getExists('profile_id') && $oHR->get('profile_id', 'int') !== 1) { $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center"><a class="s_button" href="' . Uri::get(PH7_ADMIN_MOD, 'admin', 'browse') . '">' . t('Return to back admins browse') . '</a></p>')); } unset($oHR); $oForm->addElement(new \PFBC\Element\Textbox(t('Username:'******'username', array('value' => $oAdmin->username, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Email(t('Login Email:'), 'mail', array('value' => $oAdmin->email, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('First Name:'), 'first_name', array('value' => $oAdmin->firstName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\Textbox(t('Last Name:'), 'last_name', array('value' => $oAdmin->lastName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\Radio(t('Sex:'), 'sex', array('male' => t('Male'), 'female' => t('Female')), array('value' => $oAdmin->sex, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Timezone('Time Zone:', 'time_zone', array('value' => $oAdmin->timeZone, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public static function display() { if (isset($_POST['submit_bank_account'])) { if (\PFBC\Form::isValid($_POST['submit_bank_account'])) { new BankFormProcess(); } Framework\Url\Header::redirect(); } $oHR = new Http(); $iProfileId = AdminCore::auth() && !Affiliate::auth() && $oHR->getExists('profile_id') ? $oHR->get('profile_id', 'int') : (new Session())->get('affiliate_id'); $oAff = (new AffiliateModel())->readProfile($iProfileId, 'Affiliates'); $oForm = new \PFBC\Form('form_bank_account', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_bank_account', 'form_bank_account')); $oForm->addElement(new \PFBC\Element\Token('bank_account')); if (AdminCore::auth() && !Affiliate::auth() && $oHR->getExists('profile_id')) { $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center"><a class="s_button" href="' . Uri::get('affiliate', 'admin', 'browse') . '">' . t('Return to back affiliates browse') . '</a></p>')); } unset($oHR); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h2 class="underline">' . t('Bank Information:') . '</h2>')); $sHtmlPayPalIcon = '<a href="http://paypal.com" target="_blank"><img src="' . PH7_URL_STATIC . PH7_IMG . 'icon/paypal_small.gif" alt="PayPal" title="PayPal"></a><br />'; $oForm->addElement(new \PFBC\Element\Email($sHtmlPayPalIcon . t('Your Bank Account:'), 'bank_account', array('id' => 'email_paypal', 'onblur' => 'CValid(this.value,this.id)', 'description' => t('Your Bank Account (PayPal Email Address).'), 'title' => t('Your Bank Account.'), 'value' => $oAff->bankAccount, 'validation' => new \PFBC\Validation\BankAccount(), 'required' => 1))); $oForm->addElement(new \PFBC\Element\HtmlExternal('<span class="input_error email_paypal"></span>')); $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
public static function display() { if (isset($_POST['submit_user_edit_account'])) { if (\PFBC\Form::isValid($_POST['submit_user_edit_account'])) { new EditFormProcess(); } Framework\Url\Header::redirect(); } $bAdminLogged = AdminCore::auth() && !User::auth(); // Check if the admin is logged. $oUserModel = new UserModel(); $oHR = new Http(); $iProfileId = $bAdminLogged && $oHR->getExists('profile_id') ? $oHR->get('profile_id', 'int') : (new Session())->get('member_id'); $oUser = $oUserModel->readProfile($iProfileId); // Birth Date with the date format for the date picker $sBirthDate = (new CDateTime())->get($oUser->birthDate)->date('m/d/Y'); $oForm = new \PFBC\Form('form_user_edit_account'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_user_edit_account', 'form_user_edit_account')); $oForm->addElement(new \PFBC\Element\Token('edit_account')); if ($bAdminLogged && $oHR->getExists('profile_id')) { $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center"><a class="m_button" href="' . Uri::get(PH7_ADMIN_MOD, 'user', 'browse') . '">' . t('Back to Browse Users') . '</a></p>')); $oGroupId = (new AdminCoreModel())->getMemberships(); $aGroupName = array(); foreach ($oGroupId as $oId) { // Retrieve only the activated memberships if ($oId->enable == 1) { $aGroupName[$oId->groupId] = $oId->name; } } $oForm->addElement(new \PFBC\Element\Select(t('Membership Group:'), 'group_id', $aGroupName, array('value' => $oUser->groupId, 'required' => 1))); unset($aGroupName); } unset($oHR); $oForm->addElement(new \PFBC\Element\Textbox(t('First Name:'), 'first_name', array('id' => 'str_first_name', 'onblur' => 'CValid(this.value,this.id,2,20)', 'value' => $oUser->firstName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_first_name"></span>')); $oForm->addElement(new \PFBC\Element\Textbox(t('Last Name:'), 'last_name', array('id' => 'str_last_name', 'onblur' => 'CValid(this.value,this.id,2,20)', 'value' => $oUser->lastName, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_last_name"></span>')); $oForm->addElement(new \PFBC\Element\Textbox(t('Username:'******'username', array('description' => t('For site security, you cannot change your username.'), 'disabled' => 'disabled', 'value' => $oUser->username))); $oForm->addElement(new \PFBC\Element\Email(t('Email:'), 'mail', array('description' => t('For site security and to avoid spam, you cannot change your email address.'), 'disabled' => 'disabled', 'value' => $oUser->email))); $oForm->addElement(new \PFBC\Element\Radio(t('Gender:'), 'sex', array('female' => t('Female'), 'male' => t('Male'), 'couple' => t('Couple')), array('value' => $oUser->sex, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Checkbox(t('Interested in:'), 'match_sex', array('male' => t('Male'), 'female' => t('Female'), 'couple' => t('Couple')), array('value' => Form::getVal($oUser->matchSex), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Date(t('Date of birth:'), 'birth_date', array('id' => 'birth_date', 'onblur' => 'CValid(this.value, this.id)', 'value' => $sBirthDate, 'validation' => new \PFBC\Validation\BirthDate(), 'required' => 1))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error birth_date"></span>')); // Generate dynamic fields $oFields = $oUserModel->getInfoFields($iProfileId); foreach ($oFields as $sColumn => $sValue) { $oForm = (new DynamicFieldCoreForm($oForm, $sColumn, $sValue))->generate(); } $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script><script src="' . PH7_URL_STATIC . PH7_JS . 'geo/autocompleteCity.js"></script>')); $oForm->render(); }
public static function display() { if (isset($_POST['submit_picture'])) { if (\PFBC\Form::isValid($_POST['submit_picture'])) { new PictureFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $oHttpRequest = new Http(); $iAlbumIdVal = $oHttpRequest->getExists('album_id') ? $oHttpRequest->get('album_id') : null; // Album ID Value unset($oHttpRequest); $oAlbumId = (new PictureModel())->getAlbumsName((new Session())->get('member_id')); $aAlbumName = array(); foreach ($oAlbumId as $iId) { $aAlbumName[$iId->albumId] = $iId->name; } $oForm = new \PFBC\Form('form_picture', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_picture', 'form_picture')); $oForm->addElement(new \PFBC\Element\Token('picture')); $oForm->addElement(new \PFBC\Element\Select(t('Choose your album - OR - <a href="%0%">Add a new Album</a>', Uri::get('picture', 'main', 'addalbum')), 'album_id', $aAlbumName, array('value' => $iAlbumIdVal, 'required' => 1))); unset($aAlbumName); $oForm->addElement(new \PFBC\Element\Hidden('album_title', @$iId->name)); // Bad title! Thank you for finding a solution and send it by email $oForm->addElement(new \PFBC\Element\Textbox(t('Name of your photo(s):'), 'title', array('validation' => new \PFBC\Validation\Str(2, 40)))); $oForm->addElement(new \PFBC\Element\File(t('Your picture(s)'), 'photos[]', array('description' => '<span class="bold">' . t('Tip:') . '</span> ' . t('You can select multiple photos at once by clicking multiple files while holding down the "CTRL" key.'), 'multiple' => 'multiple', 'accept' => 'image/*', 'required' => 1))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="pfbc-label"><em><span class="bold">' . t('Note:') . '</span> ' . t('Please be patient while downloading pictures, this may take time (especially if you download a lot of photos at once).') . '</em></p>')); $oForm->addElement(new \PFBC\Element\Textarea(t('Description of your photo:'), 'description', array('validation' => new \PFBC\Validation\Str(2, 200)))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
/** * Gets Ads Table. * * @return string The Table. */ public static function getTable() { $oHttpRequest = new Http(); $sTable = $oHttpRequest->getExists('ads_type') && $oHttpRequest->get('ads_type') == 'affiliate' ? 'AdsAffiliates' : 'Ads'; unset($oHttpRequest); return $sTable; }
public static function display() { if (isset($_POST['submit_aff_edit_account'])) { if (\PFBC\Form::isValid($_POST['submit_aff_edit_account'])) { new EditFormProcess(); } Framework\Url\Header::redirect(); } $bAdminLogged = AdminCore::auth() && !Affiliate::auth(); // Check if the admin is logged. $oAffModel = new AffiliateModel(); $oHR = new Http(); $iProfileId = $bAdminLogged && $oHR->getExists('profile_id') ? $oHR->get('profile_id', 'int') : (new Session())->get('affiliate_id'); $oAff = $oAffModel->readProfile($iProfileId, 'Affiliates'); // Birth date with the date format for the date picker $sBirthDate = (new CDateTime())->get($oAff->birthDate)->date('m/d/Y'); $oForm = new \PFBC\Form('form_aff_edit_account', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_aff_edit_account', 'form_aff_edit_account')); $oForm->addElement(new \PFBC\Element\Token('edit_account')); if ($bAdminLogged && $oHR->getExists('profile_id')) { $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="center"><a class="m_button" href="' . Uri::get('affiliate', 'admin', 'browse') . '">' . t('Back to Browse Affiliates') . '</a></p>')); } unset($oHR); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h2 class="underline">' . t('Global Information:') . '</h2>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p class="error">' . t('Attention all your information must be complete, candid and valid.') . '</p>')); $oForm->addElement(new \PFBC\Element\Textbox(t('Your First Name:'), 'first_name', array('id' => 'str_first_name', 'onblur' => 'CValid(this.value,this.id,2,20)', 'value' => $oAff->firstName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_first_name"></span>')); $oForm->addElement(new \PFBC\Element\Textbox(t('Your Last Name:'), 'last_name', array('id' => 'str_last_name', 'onblur' => 'CValid(this.value,this.id,2,20)', 'value' => $oAff->lastName, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 20)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_last_name"></span>')); $oForm->addElement(new \PFBC\Element\Textbox(t('Username:'******'username', array('description' => t('For site security, you cannot change your username.'), 'disabled' => 'disabled', 'value' => $oAff->username))); $oForm->addElement(new \PFBC\Element\Email(t('Your Email:'), 'mail', array('description' => t('For site security and to avoid spam, you cannot change your email address.'), 'disabled' => 'disabled', 'value' => $oAff->email))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error phone"></span>')); $oForm->addElement(new \PFBC\Element\Radio(t('Your Sex:'), 'sex', array('male' => t('Male'), 'female' => t('Female')), array('value' => $oAff->sex, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Date(t('Your Date of birth:'), 'birth_date', array('id' => 'birth_date', 'onblur' => 'CValid(this.value, this.id)', 'value' => $sBirthDate, 'validation' => new \PFBC\Validation\BirthDate(), 'required' => 1))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error birth_date"></span>')); // Generate dynamic fields $oFields = $oAffModel->getInfoFields($iProfileId, 'AffiliatesInfo'); foreach ($oFields as $sColumn => $sValue) { $oForm = (new DynamicFieldCoreForm($oForm, $sColumn, $sValue))->generate(); } $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
/** * Output Advertisement. * * @static * @param object $oData Db query. * @return string */ public static function output($oData) { // Stat Advertisement Shows \PH7\Framework\Analytics\Statistic::setView($oData->adsId, 'Ads'); // Advertisement Clicks $oHttpRequest = new Mvc\Request\Http(); if ($oHttpRequest->getExists(static::PARAM_URL) && $oHttpRequest->get(static::PARAM_URL) == $oData->adsId) { Mvc\Model\Ads::setClick($oData->adsId); } unset($oHttpRequest); return (new \PH7\Framework\Parse\SysVar())->parse($oData->code); }
public static function display() { $oHttpRequest = new Http(); $sUsername = $oHttpRequest->get('username'); $sAction = $oHttpRequest->getExists('action') ? 'mutual' : 'index'; unset($oHttpRequest); $oForm = new \PFBC\Form('form_search', 500); $oForm->configure(array('action' => Uri::get('user', 'friend', $sAction, $sUsername) . PH7_SH, 'method' => 'get')); $oForm->addElement(new \PFBC\Element\Search(t('Search a Friend of "%0%"', $sUsername), 'looking', array('title' => t('Enter its First Name, Last Name, Username, Email address or ID of your Friend.')))); $oForm->addElement(new \PFBC\Element\Select(t('Browse By:'), 'order', array(SearchCoreModel::USERNAME => t('Username'), SearchCoreModel::FIRST_NAME => t('First Name'), SearchCoreModel::LAST_NAME => t('Last Name'), SearchCoreModel::EMAIL => t('Email'), SearchCoreModel::LATEST => t('Latest'), SearchCoreModel::LAST_ACTIVITY => t('Last Activity'), SearchCoreModel::VIEWS => t('Popular'), SearchCoreModel::RATING => t('Rated')))); $oForm->addElement(new \PFBC\Element\Select(t('Direction:'), 'sort', array(SearchCoreModel::ASC => t('Ascending'), SearchCoreModel::DESC => t('Descending')))); $oForm->addElement(new \PFBC\Element\Button(t('Search'), 'submit', array('icon' => 'search'))); $oForm->render(); }
/** * Constructor. * * @param object \PH7\Framework\Session\Session $oSession * @param object \PH7\Framework\Mvc\Request\Http $oHttpRequest * @param object \PH7\Framework\Registry\Registry $oRegistry * @return void */ public function __construct(Session $oSession, HttpRequest $oHttpRequest, Registry $oRegistry) { parent::__construct(); /*** Import the libraries ***/ Import::lib('Service.Google.OAuth.Google_Client'); Import::lib('Service.Google.OAuth.contrib.Google_Oauth2Service'); $oClient = new \Google_Client(); $oClient->setApplicationName($oRegistry->site_name); $this->_setConfig($oClient); $oOauth = new \Google_Oauth2Service($oClient); if ($oHttpRequest->getExists('code')) { $oClient->authenticate(); $oSession->set('token', $oClient->getAccessToken()); $this->sUrl = Uri::get('connect', 'main', 'home'); } if ($oSession->exists('token')) { $oClient->setAccessToken($oSession->get('token', false)); } if ($oClient->getAccessToken()) { // User info is ok? Here we will be connect the user and/or adding the login and registering routines... $oUserModel = new UserCoreModel(); // Get information of user $aUserData = $oOauth->userinfo->get(); if (!($iId = $oUserModel->getId($aUserData['email']))) { // Add User if it does not exist in our database $this->add(escape($aUserData, true), $oUserModel); // Add User Avatar if (!empty($aUserData['picture'])) { $this->setAvatar($aUserData['picture']); } $this->oDesign->setFlashMsg(t('You have now been registered! %0%', (new Registration())->sendMail($this->_aUserInfo, true)->getMsg())); $this->sUrl = Uri::get('connect', 'main', 'register'); } else { // Login $this->setLogin($iId, $oUserModel); $this->sUrl = Uri::get('connect', 'main', 'home'); } // Add the access token $oSession->set('token', $oClient->getAccessToken()); unset($oUserModel); } else { $this->sUrl = $oClient->createAuthUrl(); } unset($oClient, $oOauth); }
public static function display() { if (isset($_POST['submit_video'])) { if (\PFBC\Form::isValid($_POST['submit_video'])) { new VideoFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $oHttpRequest = new Http(); $iAlbumIdVal = $oHttpRequest->getExists('album_id') ? $oHttpRequest->get('album_id') : null; // Album ID Value unset($oHttpRequest); $oAlbumId = (new VideoModel())->getAlbumsName((new Session())->get('member_id')); $aAlbumName = array(); foreach ($oAlbumId as $iId) { $aAlbumName[$iId->albumId] = $iId->name; } $oForm = new \PFBC\Form('form_video', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_video', 'form_video')); $oForm->addElement(new \PFBC\Element\Token('video')); $oForm->addElement(new \PFBC\Element\Select(t('Choose your album - OR - <a href="%0%">Add a new Album</a>', Uri::get('video', 'main', 'addalbum')), 'album_id', $aAlbumName, array('value' => $iAlbumIdVal, 'required' => 1))); unset($aAlbumName); $oForm->addElement(new \PFBC\Element\Hidden('album_title', @$iId->name)); // Bad title! Thank you for finding a solution and send it by email $oForm->addElement(new \PFBC\Element\Textbox(t('Name of your video(s):'), 'title', array('validation' => new \PFBC\Validation\Str(2, 40)))); $oForm->addElement(new \PFBC\Element\Select('Video type:', 'type', array(t('Choose...'), 'embed' => t('Embed Code'), 'regular' => t('Regular')), array('required' => 1))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<div class="hidden" id="regular">')); $oForm->addElement(new \PFBC\Element\File(t('Video:'), 'video', array('description' => '<span class="bold">' . t('Note:') . '</span> ' . t('Please be patient while downloading video, this may take time (especially if you download a long video).') . '</em>', 'multiple' => 'multiple', 'accept' => 'video/*'))); $oForm->addElement(new \PFBC\Element\Checkbox('', 'agree', array('1' => t('I have the right to distribute this Video')))); $oForm->addElement(new \PFBC\Element\HTMLExternal('</div><div class="hidden" id="embed">')); $oForm->addElement(new \PFBC\Element\Textbox(t('Embed Code:'), 'embed_code', array('description' => t('Example: %0%', DbConfig::getSetting('defaultVideo')), 'title' => t('Video from Youtube, Vimeo, DailyMotion or MetaCafe.'), 'validation' => new \PFBC\Validation\Url()))); $oForm->addElement(new \PFBC\Element\HTMLExternal('</div>')); $oForm->addElement(new \PFBC\Element\Textarea(t('Description of your video:'), 'description', array('validation' => new \PFBC\Validation\Str(2, 200)))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'form.js"></script>')); $oForm->render(); }
* @author Pierre-Henry Soria <*****@*****.**> * @copyright (c) 2012-2016, Pierre-Henry Soria. All Rights Reserved. * @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. * @package PH7 / App / System / Core / Asset / Ajax / Popup */ namespace PH7; defined('PH7') or exit('Restricted access'); use PH7\Framework\Mvc\Request\Http, PH7\Framework\Layout\Html\Design, PH7\Framework\Url\Url, PH7\Framework\Mvc\Router\Uri, PH7\Framework\Url\Header; if (AdminCore::auth() || UserCore::auth() || AffiliateCore::auth()) { $oHttpRequest = new Http(); $oDesign = new Design(); $oDesign->htmlHeader(); $oDesign->usefulHtmlHeader(); echo '<div class="center">'; if ($oHttpRequest->getExists(array('mod', 'ctrl', 'act', 'id'))) { $sLabel = $oHttpRequest->get('label'); $sMod = $oHttpRequest->get('mod'); $sCtrl = $oHttpRequest->get('ctrl'); $sAct = $oHttpRequest->get('act'); $mId = $oHttpRequest->get('id'); ConfirmCoreForm::display(array('label' => Url::decode($sLabel), 'module' => $sMod, 'controller' => $sCtrl, 'action' => $sAct, 'id' => $mId)); } else { echo '<p>' . t('Bad parameters in the URL!') . '</p>'; } echo '</div>'; $oDesign->htmlFooter(); unset($oHttpRequest, $oDesign); } else { Header::redirect(Uri::get('user', 'signup', 'step1'), t('You must be registered to report an abuse.')); }