/** * Update the Affiliate Commission. * * @param integer $iAffId Affiliate ID * @param object \PH7\Framework\Config\Config $oConfig * @param object \PH7\Framework\Registry\Registry $oRegistry * @return void */ public static function updateJoinCom($iAffId, Config $oConfig, Registry $oRegistry) { if ($iAffId < 1) { return; } // If there is no valid ID, we stop the method. // Load the Affiliate config file $oConfig->load(PH7_PATH_SYS_MOD . 'affiliate' . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE); $sType = $oRegistry->module == 'newsletter' ? 'newsletter' : ($oRegistry->module == 'affiliate' ? 'affiliate' : 'user'); $iAffCom = $oConfig->values['module.setting']['commission.join_' . $sType . '_money']; if ($iAffCom > 0) { (new AffiliateCoreModel())->updateUserJoinCom($iAffId, $iAffCom); } }
public static function display() { if (isset($_POST['submit_msg'])) { if (\PFBC\Form::isValid($_POST['submit_msg'])) { new MsgFormProcess(); } Framework\Url\Header::redirect(); } $oForumsId = (new ForumModel())->getForum(); $aForumsName = array(); foreach ($oForumsId as $oId) { $aForumsName[$oId->forumId] = $oId->name; } $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_msg', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_msg', 'form_msg')); $oForm->addElement(new \PFBC\Element\Token('msg')); $oForm->addElement(new \PFBC\Element\Select(t('Forum:'), 'forum', $aForumsName, array('value' => (new Http())->get('forum_id')))); $oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>')); $oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('required' => 1, 'validation' => new \PFBC\Validation\Str(4)))); if (DbConfig::getSetting('isCaptchaForum')) { $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:')))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></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_membership'])) { if (\PFBC\Form::isValid($_POST['submit_membership'])) { new MembershipFormProcess(); } Framework\Url\Header::redirect(); } $oForm = new \PFBC\Form('form_membership', 600); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_membership', 'form_membership')); $oForm->addElement(new \PFBC\Element\Token('membership')); $oForm->addElement(new \PFBC\Element\Textbox(t('Name:'), 'name', array('required' => 1, 'validation' => new \PFBC\Validation\Str(2, 64)))); $oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('required' => 1, 'validation' => new \PFBC\Validation\Str(5, 255)))); $aPerms = (include dirname(__DIR__) . PH7_DS . PH7_CONFIG . 'perms.inc.php'); foreach ($aPerms as $sKey => $sVal) { $sLabel = (new Str())->upperFirstWords(str_replace('_', ' ', $sKey)); $oForm->addElement(new \PFBC\Element\Select($sLabel, 'perms[' . $sKey . ']', array(1 => t('Yes'), 0 => t('No')), array('value' => $sVal))); } unset($aPerms); $oForm->addElement(new \PFBC\Element\Number(t('Price:'), 'price', array('description' => t('Currency: %0%. 0 = Free. To change the currency, please <a href="%1%">go to settings</a>.', Config::getInstance()->values['module.setting']['currency'], Uri::get('payment', 'admin', 'config')), 'step' => '0.01', 'required' => 1))); $oForm->addElement(new \PFBC\Element\Number(t('Expiration Days:'), 'expiration_days', array('description' => t('0 = Unlimited'), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Radio(t('Active:'), 'enable', array(1 => t('Enabled'), 0 => t('Disabled')), array('value' => 1, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button(t('Add'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_edit_membership'])) { if (\PFBC\Form::isValid($_POST['submit_edit_membership'])) { new EditMembershipFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $oMembership = (new PaymentModel())->getMemberships((new Http())->get('group_id', 'int')); $oForm = new \PFBC\Form('form_edit_membership', 600); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit_membership', 'form_edit_membership')); $oForm->addElement(new \PFBC\Element\Token('membership')); $oForm->addElement(new \PFBC\Element\Textbox(t('Name:'), 'name', array('value' => $oMembership->name, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 64)))); $oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('value' => $oMembership->description, 'required' => 1, 'validation' => new \PFBC\Validation\Str(5, 255)))); $aDefPerms = (include dirname(__DIR__) . '/config/perms.inc.php'); $aDbPerms = unserialize($oMembership->permissions); $aPerms = array_merge($aDefPerms, $aDbPerms); // Update new permissions from perms.inc.php file foreach ($aPerms as $sKey => $sVal) { $sLabel = (new Str())->upperFirstWords(str_replace('_', ' ', $sKey)); $oForm->addElement(new \PFBC\Element\Select($sLabel, 'perms[' . $sKey . ']', array(1 => t('Yes'), 0 => t('No')), array('value' => $sVal))); } unset($aPerms); $oForm->addElement(new \PFBC\Element\Number(t('Price:'), 'price', array('description' => t('Currency: %0%. 0 = Free. To change the currency, please <a href="%1%">go to settings</a>.', Config::getInstance()->values['module.setting']['currency'], Uri::get('payment', 'admin', 'config')), 'value' => $oMembership->price, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Number(t('Expiration Days:'), 'expiration_days', array('description' => t('0 = Unlimited'), 'value' => $oMembership->expirationDays, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Radio(t('Active:'), 'enable', array(1 => t('Enabled'), 0 => t('Disabled')), array('value' => $oMembership->enable, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button(t('Update'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_edit'])) { if (\PFBC\Form::isValid($_POST['submit_edit'])) { new AdminEditFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $oHttpRequest = new Http(); $oGameModel = new GameModel(); $iGameId = $oHttpRequest->get('id', 'int'); $oGame = $oGameModel->get(strstr($oHttpRequest->get('title'), '-', true), $iGameId, 0, 1); $oCategoriesData = $oGameModel->getCategory(null, 0, 500); $aCategoriesName = array(); foreach ($oCategoriesData as $oId) { $aCategoriesName[$oId->categoryId] = $oId->name; } unset($oHttpRequest, $oGameModel); $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; if (!empty($oGame) && (new Str())->equals($iGameId, $oGame->gameId)) { $oForm = new \PFBC\Form('form_edit', 650); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit', 'form_edit')); $oForm->addElement(new \PFBC\Element\Token('edit')); $oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('value' => $oGame->categoryId, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Name of the Game:'), 'name', array('value' => $oGame->name, 'pattern' => $sTitlePattern, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Title of the Game:'), 'title', array('value' => $oGame->title, 'validation' => new \PFBC\Validation\Str(2, 120), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Description:'), 'description', array('value' => $oGame->description, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Keywords:'), 'keywords', array('value' => $oGame->keywords, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); } else { echo '<p class="center bold">' . t('Game Not Found!') . '</p>'; } }
public static function display() { if (isset($_POST['submit_game'])) { if (\PFBC\Form::isValid($_POST['submit_game'])) { new AdminFormProcess(); } Framework\Url\Header::redirect(); } $oCategoriesData = (new GameModel())->getCategory(null, 0, 500); $aCategoriesName = array(); foreach ($oCategoriesData as $oId) { $aCategoriesName[$oId->categoryId] = $oId->name; } unset($oCategoriesData); $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_game'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_game', 'form_game')); $oForm->addElement(new \PFBC\Element\Token('game')); $oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Name of the Game:'), 'name', array('pattern' => $sTitlePattern, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Title of the Game:'), 'title', array('validation' => new \PFBC\Validation\Str(2, 120), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Description:'), 'description', array('validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Keywords:'), 'keywords', array('validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1))); $oForm->addElement(new \PFBC\Element\File(t('Thumbnail of the Game:'), 'thumb', array('accept' => 'image/*', 'required' => 1))); $oForm->addElement(new \PFBC\Element\File(t('File of the Game:'), 'file', array('accept' => 'application/x-shockwave-flash', 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }
public function __construct() { $this->_sYuiCompressorPath = realpath(__DIR__) . '/Compiler/YUICompressor-2.4.7.jar'; $this->_sClosureCompilerPath = realpath(__DIR__) . '/Compiler/ClosureCompiler.jar'; $this->_sTmpFilePath = PH7_PATH_TMP . PH7_DS . uniqid() . '.tmp'; $this->_bJavaCompiler = (bool) Config::getInstance()->values['cache']['enable.static.minify_use_java_compiler']; }
public static function display() { if (isset($_POST['submit_forum'])) { if (\PFBC\Form::isValid($_POST['submit_forum'])) { new ForumFormProcess(); } Framework\Url\Header::redirect(); } $oCategoriesData = (new ForumModel())->getCategory(); $aCategoriesName = array(); foreach ($oCategoriesData as $oId) { $aCategoriesName[$oId->categoryId] = $oId->title; } unset($oCategoriesData); $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_forum', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_forum', 'form_forum')); $oForm->addElement(new \PFBC\Element\Token('forum')); $oForm->addElement(new \PFBC\Element\Select(t('Category Name:'), 'category_id', $aCategoriesName, array('value' => (new Http())->get('category_id'), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Forum Name:'), 'name', array('id' => 'str_name', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_name"></span>')); $oForm->addElement(new \PFBC\Element\Textarea(t('Description:'), 'description', array('id' => 'str_description', 'required' => 1, 'onblur' => 'CValid(this.value,this.id,4,255)', 'validation' => new \PFBC\Validation\Str(4, 255)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_description"></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 function render() { $this->attributes['type'] = 'tel'; // Phone type $this->attributes['pattern'] = Config::getInstance()->values['validate']['phone.pattern']; $this->validation[] = new \PFBC\Validation\Phone(); parent::render(); }
public function __construct() { $this->_oFile = new File(); $this->_oHttpRequest = new HttpRequest(); $this->_bCaching = (bool) Config::getInstance()->values['cache']['enable.static.caching']; $this->_bCompressor = (bool) Config::getInstance()->values['cache']['enable.static.compressor']; $this->_bGzipContent = (bool) Config::getInstance()->values['cache']['enable.static.gzip']; $this->_bDataUri = (bool) Config::getInstance()->values['cache']['enable.static.data_uri']; $this->_bIsGzip = $this->isGzip(); }
public function __construct() { $this->_oHttpRequest = new Http(); $this->_oFile = new F\File(); $this->_oConfig = Config::getInstance(); $this->_sHtml = ''; // Default HTML contents $this->_sVerNumber = '...'; // Default value of the version number upgrade $this->_prepare(); // Preparation and verification for software upgrade }
/** * @constructor * @param array $aFile Example: $_FILES['video'] * @return void * @throws \PH7\Framework\File\Exception If FFmpeg is not installed. */ public function __construct($aFile) { $this->oFile = new F\File(); $this->sFfmpegPath = Config::getInstance()->values['video']['handle.ffmpeg_path']; if (!file_exists($this->sFfmpegPath)) { throw new F\File\Exception('FFmpeg is not installed on your server, please install and configure the path in "~/YOUR-PROTECTED-FOLDER/app/configs/config.ini"'); } $this->aFile = $aFile; $this->sType = $this->oFile->getFileExt($this->aFile['name']); /** Attributes for the PH7\Framework\File\Upload abstract class **/ $this->sMaxSize = Config::getInstance()->values['video']['upload.max_size']; $this->iFileSize = (int) $this->aFile['size']; }
/** * @return void */ public function __construct() { parent::__construct(); // Import the library Import::lib('Service.Twitter.tmhOAuth'); Import::lib('Service.Twitter.tmhUtilities'); $this->_oTwOAuth = new \tmhOAuth(Config::getInstance()->values['module.api']['twitter.consumer_key'], Config::getInstance()->values['module.api']['twitter.consumer_secret_key']); // determine the authentication status // default to 0 $this->_iState = 0; if (isset($_COOKIE['access_token'], $_COOKIE['access_token_secret'])) { // 2 (authenticated) if the cookies are set $this->_iState = 2; } elseif (isset($_SESSION['authstate'])) { // otherwise use value stored in session $this->_iState = (int) $_SESSION['authstate']; } if ($this->_iState == 1) { // if we are in the process of authentication we continue $this->auth(); } elseif ($this->_iState == 2 && !$this->auth()) { // verify authentication, clearing cookies if it fails $this->endSession(); } if ($this->auth()) { $aProfile = $this->_oTwOAuth->extract_params($this->_oTwOAuth->response['response']); if (empty($aProfile['error'])) { // User info is ok? Here we will be connect the user and/or adding the login and registering routines... $oUserModel = new UserCoreModel(); if (!($iId = $oUserModel->getId($aProfile['email']))) { // Add User if it does not exist in our database $this->add(escape($aProfile, true), $oUserModel); // Add User Avatar $this->setAvatar($aProfile); $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'); } unset($oUserModel); } else { // For testing purposes, if there was an error, let's kill the script $this->oDesign->setFlashMsg(t('Oops! An error has occurred. Please try again later.')); $this->sUrl = Uri::get('connect', 'main', 'index'); } } else { $this->sUrl = Uri::get('connect', 'main', 'index'); } }
/** * Makes a SQL contents backup. * * @access public * @return object this */ public function back() { $this->_sSql = "#################### Database Backup ####################\n" . '# ' . Kernel::SOFTWARE_NAME . ' ' . Kernel::SOFTWARE_VERSION . ', Build ' . Kernel::SOFTWARE_BUILD . "\r\n" . '# Database name: ' . Config::getInstance()->values['database']['name'] . "\r\n" . '# Created on ' . (new CDateTime())->get()->dateTime() . "\r\n" . "#########################################################\r\n\r\n"; $aTables = $aColumns = $aValues = array(); $oAllTables = Db::showTables(); while ($aRow = $oAllTables->fetch()) { $aTables[] = $aRow[0]; } unset($oAllTables); $oDb = Db::getInstance(); // Loop through tables foreach ($aTables as $sTable) { $oResult = $oDb->query('SHOW CREATE TABLE ' . $sTable); $iNum = (int) $oResult->rowCount(); if ($iNum > 0) { $aRow = $oResult->fetch(); $this->_sSql .= "#\n# Table: {$sTable}\r\n#\r\n\r\n"; $this->_sSql .= "DROP TABLE IF EXISTS {$sTable};\r\n\r\n"; $sValue = $aRow[1]; /*** Clean up statement ***/ $sValue = str_replace('`', '', $sValue); /*** Table structure ***/ $this->_sSql .= $sValue . ";\r\n\r\n"; unset($aRow); } unset($oResult); $oResult = $oDb->query('SELECT * FROM ' . $sTable); $iNum = (int) $oResult->rowCount(); if ($iNum > 0) { while ($aRow = $oResult->fetch()) { foreach ($aRow as $sColumn => $sValue) { if (!is_numeric($sColumn)) { if (!is_numeric($sValue) && !empty($sValue)) { $sValue = Db::getInstance()->quote($sValue); } $sValue = str_replace(array("\r", "\n"), array('', '\\n'), $sValue); $aColumns[] = $sColumn; $aValues[] = $sValue; } } $this->_sSql .= 'INSERT INTO ' . $sTable . ' (' . implode(', ', $aColumns) . ') VALUES(\'' . implode('\', \'', $aValues) . "');\n"; unset($aColumns, $aValues); } $this->_sSql .= "\r\n\r\n"; unset($aRow); } unset($oResult); } unset($oDb); return $this; }
public function __construct() { $this->_oConfig = Config::getInstance(); $oCookie = new Cookie(); // Check a template name has been entered and if it exceeds the maximum length (49 characters). if (!empty($_REQUEST['tpl']) && strlen($_REQUEST['tpl']) < 50) { $this->_sUserTpl = $_REQUEST['tpl']; $oCookie->set('site_tpl', $this->_sUserTpl, 60 * 60 * 48); } else { if ($oCookie->exists('site_tpl')) { $this->_sUserTpl = $oCookie->get('site_tpl'); } } unset($oCookie); }
public static function checkGroup() { $oSession = new Framework\Session\Session(); if (!$oSession->exists('member_group_id')) { $oSession->regenerateId(); $oSession->set('member_group_id', '1'); // Visitor's group } unset($oSession); $rStmt = Db::getInstance()->prepare('SELECT permissions FROM' . Db::prefix('Memberships') . 'WHERE groupId = :groupId LIMIT 1'); $rStmt->bindParam(':groupId', $_SESSION[Framework\Config\Config::getInstance()->values['session']['prefix'] . 'member_group_id'], \PDO::PARAM_INT); $rStmt->execute(); $oFetch = $rStmt->fetch(\PDO::FETCH_OBJ); Db::free($rStmt); return Framework\CArray\ObjArr::toObject(unserialize($oFetch->permissions)); }
public function __construct() { $this->_oConfig = Config::getInstance(); $oCookie = new Cookie(); // Check a template name has been entered and if it meets the required length. if (!empty($_REQUEST['l']) && strlen($_REQUEST['l']) == 5) { $this->_sUserLang = $_REQUEST['l']; $oCookie->set(static::COOKIE_NAME, $this->_sUserLang, 60 * 60 * 48); } else { if ($oCookie->exists(static::COOKIE_NAME)) { $this->_sUserLang = $oCookie->get(static::COOKIE_NAME); } else { $this->_sUserLang = (new \PH7\Framework\Navigation\Browser())->getLanguage(); } } unset($oCookie); }
public static function display() { if (isset($_POST['submit_category'])) { if (\PFBC\Form::isValid($_POST['submit_category'])) { new CategoryFormProcess(); } Framework\Url\HeaderUrl::redirect(); } $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_category', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_category', 'form_category')); $oForm->addElement(new \PFBC\Element\Token('category')); $oForm->addElement(new \PFBC\Element\Textbox(t('Category Name:'), 'title', array('id' => 'str_category', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_category"></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(); }
/** * @return void */ public function __construct() { parent::__construct(); Import::lib('Service.Facebook.Facebook'); // Import the library $oFb = new \Facebook(array('appId' => Config::getInstance()->values['module.api']['facebook.id'], 'secret' => Config::getInstance()->values['module.api']['facebook.secret_key'])); $sUserId = $oFb->getUser(); if ($sUserId) { try { // Proceed knowing you have a logged in user who's authenticated. $aProfile = $oFb->api('/me'); } catch (\FacebookApiException $oE) { Framework\Error\CException\PH7Exception::launch($oE); $sUserId = null; } if ($aProfile) { // User info is ok? Here we will be connect the user and/or adding the login and registering routines... $oUserModel = new UserCoreModel(); if (!($iId = $oUserModel->getId($aProfile['email']))) { // Add User if it does not exist in our database $this->add(escape($aProfile, true), $oUserModel); // Add User Avatar $this->setAvatar($sUserId); $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'); } unset($oUserModel); } else { // For testing purposes, if there was an error, let's kill the script $this->oDesign->setFlashMsg(t('Oops! An error has occurred. Please try again later.')); $this->sUrl = Uri::get('connect', 'main', 'index'); } } else { // There's no active session, let's generate one $this->sUrl = $oFb->getLoginUrl(array('scope' => 'email,user_birthday,user_relationships,user_relationship_details,user_hometown,user_location,user_interests,user_about_me,user_likes,user_website')); } unset($oFb); }
public static function display() { if (isset($_POST['submit_add_field'])) { if (\PFBC\Form::isValid($_POST['submit_add_field'])) { new AddFieldFormProcess(); } Framework\Url\Header::redirect(); } $sFieldPattern = Config::getInstance()->values['module.setting']['field.pattern']; $oForm = new \PFBC\Form('form_add_field', 550); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_add_field', 'form_add_field')); $oForm->addElement(new \PFBC\Element\Token('add_field')); $oForm->addElement(new \PFBC\Element\Select(t('Field Type:'), 'type', array('textbox' => t('Text Box'), 'number' => t('Number')), array('required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Field Name:'), 'name', array('description' => t('Field Name must contain 2-30 alphanumeric characters ([a-z], [A-Z], [0-9] and [_], [-]).'), 'pattern' => $sFieldPattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sFieldPattern)))); $oForm->addElement(new \PFBC\Element\Number(t('Length Field:'), 'length', array('required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Default Field Value'), 'value', array('validation' => new \PFBC\Validation\Str(2, 120)))); $oForm->addElement(new \PFBC\Element\Button(t('Add'))); $oForm->render(); }
public static function display() { if (isset($_POST['submit_edit_field'])) { if (\PFBC\Form::isValid($_POST['submit_edit_field'])) { new EditFieldFormProcess(); } Framework\Url\Header::redirect(); } $sFieldPattern = Config::getInstance()->values['module.setting']['field.pattern']; $oForm = new \PFBC\Form('form_edit_field', 550); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit_field', 'form_edit_field')); $oForm->addElement(new \PFBC\Element\Token('edit_field')); $oForm->addElement(new \PFBC\Element\Select(t('Field Type:'), 'type', array('textbox' => t('Text Box'), 'number' => t('Number')), array('value' => 'textbox', 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Field Name:'), 'name', array('description' => t('Field Name must contain 2-30 alphanumeric characters ([a-z], [A-Z], [0-9] and [_], [-]). After you can translate this language key in <span class="italic underline">%0%</span>', PH7_PATH_APP_LANG . PH7_LANG_NAME . PH7_DS . 'language.php'), 'value' => (new Http())->get('name'), 'pattern' => $sFieldPattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sFieldPattern)))); $oForm->addElement(new \PFBC\Element\Number(t('Length Field:'), 'length', array('description' => t('Length of the field in numeric number (e.g., 250).'), 'value' => 255, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Default Field Value'), 'value', array('description' => t('The value by default of the field (optional).'), 'validation' => new \PFBC\Validation\Str(2, 120)))); $oForm->addElement(new \PFBC\Element\Button(t('Edit'))); $oForm->render(); }
public static function step1($iWidth = 300) { if ((new Session())->exists('mail_step1')) { Header::redirect(Uri::get('user', 'signup', 'step2')); } if (isset($_POST['submit_join_user'])) { if (\PFBC\Form::isValid($_POST['submit_join_user'])) { (new JoinFormProcess())->step1(); } Header::redirect(); } $oForm = new \PFBC\Form('form_join_user', $iWidth); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_join_user', 'form_join_user')); $oForm->addElement(new \PFBC\Element\Token('join')); // Load the Connect config file Config::getInstance()->load(PH7_PATH_SYS_MOD . 'connect' . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE); if (Config::getInstance()->values['module.setting']['enable']) { $oForm->addElement(new \PFBC\Element\HTMLExternal('<div class="center"><a href="' . Uri::get('connect', 'main', 'index') . '" target="_blank" class="m_button">' . t('Universal Login') . '</a></div>')); } $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)', 'title' => t('Enter your first name.'), '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\Username(t('Username:'******'username', array('description' => PH7_URL_ROOT . '<strong><span class="your-user-name">' . t('your-user-name') . '</span><span class="username"></span></strong>' . PH7_PAGE_EXT, 'id' => 'username', 'title' => t('This username will be used for your site url.'), 'required' => 1, 'validation' => new \PFBC\Validation\Username()))); $oForm->addElement(new \PFBC\Element\Email(t('Your Email:'), 'mail', array('id' => 'email', 'onblur' => 'CValid(this.value, this.id,\'guest\')', 'title' => t('Enter your valid email address.'), 'required' => 1, 'validation' => new \PFBC\Validation\CEmail('guest')))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error email"></span>')); $oForm->addElement(new \PFBC\Element\Password(t('Your Password:'******'password', array('id' => 'password', 'onkeyup' => 'checkPassword(this.value)', 'onblur' => 'CValid(this.value, this.id)', 'title' => t('Your password. It will be used for logging in to the site. This storage is secure, because we are using an encrypted format.'), 'required' => 1, 'validation' => new \PFBC\Validation\Password()))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error password"></span>')); if (DbConfig::getSetting('isCaptchaUserSignup')) { $oForm->addElement(new \PFBC\Element\CCaptcha(t('Captcha:'), 'captcha', array('id' => 'ccaptcha', 'onkeyup' => 'CValid(this.value, this.id)', 'description' => t('Enter the code above:')))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error ccaptcha"></span>')); } $oForm->addElement(new \PFBC\Element\Checkbox(t('Terms of Service'), 'terms', array(1 => '<em>' . t('I have read and accept to the %0%.', '<a href="' . Uri::get('page', 'main', 'terms') . '" rel="nofollow" target="_blank">' . t('Terms of Service') . '</a>') . '</em>'), array('id' => 'terms', 'onblur' => 'CValid(this.checked, this.id)', 'required' => 1))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error terms-0"></span>')); $oForm->addElement(new \PFBC\Element\Button(t('I sign up for free!'), 'submit', array('icon' => 'heart'))); // JavaScript Files $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'signup.js"></script><script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
public function __construct() { $this->config = Config::getInstance(); $this->str = new Str(); $this->file = new File(); $this->httpRequest = new Http(); $this->browser = new Browser(); $this->registry = Registry::getInstance(); /** * @internal The "_checkLicense" method cannot be declare more than one time. The "Kernel.class.php" file is included many times in the software, so we need to check that with a constant. */ if (!defined('PH7_CHECKED_LIC')) { define('PH7_CHECKED_LIC', 1); // OK, now we have checked the license key $this->_checkLicense(); } //** Temporary code. In the near future, pH7CMS will be usable without mod_rewrite if (!Server::isRewriteMod()) { $sModRewriteMsg = t('<span style="font-weight:bold;color:red"><a href="%0%">pH7CMS</a> requires Apache "mod_rewrite".</span><br /> Please install it so that pH7CMS can works.<br /> Click <a href="%1%" target="_blank">here</a> if you want to get more information on how to install the rewrite module.<br /><br /> After doing this, please <a href="%2%">retry</a>.', self::SOFTWARE_WEBSITE, 'http://software.hizup.com/doc/en/how-to-install-rewrite-module', PH7_URL_ROOT); Page::message($sModRewriteMsg); } //*/ }
public static function display() { if (isset($_POST['submit_edit_msg'])) { if (\PFBC\Form::isValid($_POST['submit_edit_msg'])) { new EditMsgFormProcess(); } Framework\Url\Header::redirect(); } $oHttpRequest = new Http(); $oMsg = (new ForumModel())->getTopic(strstr($oHttpRequest->get('forum_name'), '-', true), $oHttpRequest->get('forum_id'), strstr($oHttpRequest->get('topic_name'), '-', true), $oHttpRequest->get('topic_id'), (new Session())->get('member_id'), 1, 0, 1); unset($oHttpRequest); $sTitlePattern = Config::getInstance()->values['module.setting']['url_title.pattern']; $oForm = new \PFBC\Form('form_edit_msg', '100%'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_edit_msg', 'form_edit_msg')); $oForm->addElement(new \PFBC\Element\Token('edit_msg')); $oForm->addElement(new \PFBC\Element\Textbox(t('Subject:'), 'title', array('value' => $oMsg->title, 'id' => 'str_title', 'onblur' => 'CValid(this.value,this.id,2,60)', 'pattern' => $sTitlePattern, 'required' => 1, 'validation' => new \PFBC\Validation\RegExp($sTitlePattern)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<span class="input_error str_title"></span>')); $oForm->addElement(new \PFBC\Element\CKEditor(t('Message:'), 'message', array('value' => $oMsg->message, 'required' => 1, 'validation' => new \PFBC\Validation\Str(4)))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->addElement(new \PFBC\Element\HTMLExternal('<script src="' . PH7_URL_STATIC . PH7_JS . 'validate.js"></script>')); $oForm->render(); }
/** * Validate international phone numbers in EPP format. * * @param string $sNumber * @return boolean */ public function phone($sNumber) { return preg_match('#^' . \PH7\Framework\Config\Config::getInstance()->values['validate']['phone.pattern'] . '$#', $sNumber); }
/** * Checks the Post ID. * * @param string $sPostId * @return boolean */ public function checkPostId($sPostId) { return preg_match('#^' . Config::getInstance()->values['module.setting']['post_id.pattern'] . '$#', $sPostId) && !(new BlogModel())->postIdExists($sPostId); }
/** * Class constructor * * @return void */ public function __construct() { $this->bCompressor = (bool) Config::getInstance()->values['cache']['enable.static.compressor']; }
public function __construct() { $this->_oFile = new File(); $this->_bEnabled = (bool) Config::getInstance()->values['cache']['enable.general.cache']; }
/** * Set Configuration of Microsoft OAuth API. * * @return void */ private function _setConfig() { $this->_oClient->server = 'Microsoft'; $this->_oClient->redirect_uri = Uri::get('connect', 'main', 'login', 'google'); $this->_oClient->client_id = Config::getInstance()->values['module.api']['microsoft.client_id']; $this->_oClient->client_secret = Config::getInstance()->values['module.api']['microsoft.client_secret_key']; }
/** * Set Configuration of OAuth API. * * @param object \Google_Client $oClient * @return void */ private function _setConfig(\Google_Client $oClient) { $oClient->setClientId(Config::getInstance()->values['module.api']['google.client_id']); $oClient->setClientSecret(Config::getInstance()->values['module.api']['google.client_secret_key']); $oClient->setRedirectUri(Uri::get('connect', 'main', 'login', 'google')); $oClient->setDeveloperKey(Config::getInstance()->values['module.api']['google.developer_key']); }