public function post() { $oPost = $this->oForumModel->getTopic(strstr($this->httpRequest->get('forum_name'), '-', true), $this->httpRequest->get('forum_id', 'int'), strstr($this->httpRequest->get('topic_name'), '-', true), $this->httpRequest->get('topic_id', 'int'), null, 1, 0, 1); $this->view->total_pages = $this->oPage->getTotalPages($this->oForumModel->totalMessages($this->httpRequest->get('topic_id', 'int')), 10); $this->view->current_page = $this->oPage->getCurrentPage(); $oMessages = $this->oForumModel->getMessage($this->httpRequest->get('topic_id', 'int'), null, null, 1, $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage()); if (empty($oPost)) { $this->sTitle = t('Topic Not Found!'); $this->_notFound(); } else { // Adding the RSS link $this->view->header = '<link rel="alternate" type="application/rss+xml" title="' . t('Latest Forum Posts') . '" href="' . Uri::get('xml', 'rss', 'xmlrouter', 'forum-post,' . $oPost->topicId) . '" />'; $this->sTitle = t('%0% | %1% - Forum', $this->str->upperFirst($this->httpRequest->get('forum_name')), $this->str->escape(Ban::filterWord($oPost->title), true)); $this->view->page_title = $this->sTitle; $this->view->meta_description = t('%0% Topics - Discussions Forums', substr($this->str->escape(Ban::filterWord($oPost->message), true), 0, 150)); // Generates beautiful meta keywords for good SEO $this->view->meta_keywords = t('%0%,%1%,forum,discussion,dating forum,social forum', str_replace(' ', ',', $this->httpRequest->get('forum_name')), substr(str_replace(' ', ',', Ban::filterWord($oPost->title, false)), 0, 250)); $this->view->h1_title = $this->sTitle; $this->view->dateTime = $this->dateTime; $this->view->post = $oPost; $this->view->messages = $oMessages; // Set Topics Views Statistics Framework\Analytics\Statistic::setView($oPost->topicId, 'ForumsTopics'); } $this->output(); }
/** * @param string $sValue * @return boolean */ public function isValid($sValue) { if ($this->isNotApplicable($sValue) || $this->oValidate->email($sValue)) { if (!Ban::isBankAccount($sValue)) { if (!(new ExistsCoreModel())->bankAccount($sValue, $this->sTable)) { return true; } else { $this->message = t('Error: Another account with the same bank account already exists. Please choose another.'); } } else { $this->message = t('Sorry, This bank account is not supported by our payment system.'); } } else { $this->message = t('Error: Your bank account is incorrect!'); } return false; }
protected function showCommentProfile() { $this->_mContents = $this->_oWallModel->getCommentProfile(null, 0, 20); if (!$this->_mContents) { echo '<p class="alert-message error">', t('Unable to retrieve information over the wall.'), '</p>'; } else { foreach ($this->_mContents as $oRow) { echo '<p>'; $this->_oAvatarDesign->get($oRow->username, $oRow->firstName, $oRow->sex, 32, 'Members'); echo '</p><p>', Framework\Parse\User::atUsernameToLink(escape($this->str->extract(Framework\Security\Ban\Ban::filterWord($oRow->comment), 0, 80))), '</p> <p class="small"><a href="', Uri::get('comment', 'comment', 'read', "profile,{$oRow->recipient}"), '#', $oRow->commentId, '">', t('Read more'), '</a> • ', t('Posted on: %0%', $this->dateTime->get($oRow->createdDate)->dateTime()); if (!empty($oRow->updatedDate)) { echo ' • ', t('Last Edited %0%', $this->dateTime->get($oRow->updatedDate)->dateTime()); } echo '<br /><br /></p>'; } } }
public function read($sUsername, $sPostId) { if (isset($sUsername, $sPostId)) { $iProfileId = (new UserCoreModel())->getId(null, $sUsername); $oPost = $this->oNoteModel->readPost($sPostId, $iProfileId, $this->iApproved); if (!empty($oPost->postId) && $this->str->equals($sPostId, $oPost->postId)) { $aVars = ['page_title' => Ban::filterWord($oPost->pageTitle, false), 'meta_description' => Ban::filterWord($oPost->metaDescription, false), 'meta_keywords' => Ban::filterWord($oPost->metaKeywords, false), 'slogan' => Ban::filterWord($oPost->slogan, false), 'meta_author' => Ban::filterWord($oPost->metaAuthor, false), 'meta_robots' => Ban::filterWord($oPost->metaRobots, false), 'meta_copyright' => Ban::filterWord($oPost->metaCopyright, false), 'h1_title' => Ban::filterWord($oPost->title), 'categories' => $this->oNoteModel->getCategory($oPost->noteId, 0, 300), 'dateTime' => $this->dateTime, 'post' => $oPost]; $this->view->assigns($aVars); // Set Notes Post Views Statistics Framework\Analytics\Statistic::setView($oPost->noteId, 'Notes'); } else { $this->sTitle = t('Note Not Found'); $this->notFound(); } } else { Header::redirect(Uri::get('note', 'main', 'index')); } $this->output(); }
public function post() { $oComment = $this->oCommentModel->get($this->iId, 1, $this->sTable); if (!empty($oComment)) { $this->sTitle = t('Read this comment of <span class="pH1">%0%</span>', $oComment->firstName); $this->view->page_title = $this->sTitle; $this->view->meta_description = t('Read comment of %0%, %1%. %2%', $oComment->firstName, $oComment->username, substr(Ban::filterWord($oComment->comment, false), 0, 150)); $this->view->meta_keywords = t('comment,%0%', str_replace(' ', ',', substr(Ban::filterWord($oComment->comment, false), 0, 250))); $this->view->h1_title = $this->sTitle; $this->view->avatarDesign = new AvatarDesignCore(); // Avatar Design Class $this->view->member_id = $this->session->get('member_id'); $this->view->com = $oComment; } else { $this->_notFound(); // Modified the message error $this->view->error = t('No comments yet, please return to the <a href="%0%">previous page</a>.', 'javascript:history.back();'); } $this->output(); }
/** * Validate Email. * * @param string $sEmail * @param boolean $bRealHost Checks whether the Email Host is valid. Default FALSE * @return boolean */ public function email($sEmail, $bRealHost = false) { $sEmail = filter_var($sEmail, FILTER_SANITIZE_EMAIL); if ($bRealHost) { $sEmailHost = substr(strrchr($sEmail, '@'), 1); // This function now works with Windows since version PHP 5.3, so we mustn't include the PEAR NET_DNS library. if (!(checkdnsrr($sEmailHost, 'MX') && checkdnsrr($sEmailHost, 'A'))) { return false; } } return filter_var($sEmail, FILTER_VALIDATE_EMAIL) && $this->_oStr->length($sEmail) <= PH7_MAX_EMAIL_LENGTH && !Ban::isEmail($sEmail); }
public function video() { // Adding the JS Video Player file. $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'Video.js'); $oVideo = $this->oVideoModel->video($this->iProfileId, $this->httpRequest->get('album_id', 'int'), $this->httpRequest->get('video_id', 'int'), 1, 0, 1); if (empty($oVideo)) { $this->sTitle = t('No video found or is still in pending approval.'); $this->_notFound(); } else { $this->sTitle = t('Watch Video of <a href="%0%">%1%</a>', $this->sUsernameLink, $this->str->upperFirst($this->sUsername)); $sTitle = Ban::filterWord($oVideo->title, false); $this->view->page_title = t('Video of %0%, %1%', $oVideo->firstName, $sTitle); $this->view->meta_description = t('Video of %0%, %1%, %2%', $oVideo->firstName, $sTitle, substr(Ban::filterWord($oVideo->description, false), 0, 100)); $this->view->meta_keywords = t('video,movie,videos,video sharing,music,gallery,%0%,%1%,%2%', str_replace(' ', ',', $sTitle), $oVideo->firstName, $oVideo->username); $this->view->h1_title = $this->sTitle; $this->view->video = $oVideo; //Set Video Statistics Framework\Analytics\Statistic::setView($oVideo->videoId, 'Videos'); } $this->output(); }
/** * Run Router! * * @access public * @return void */ public function runRouter() { // It displays the banishment if a banned IP address is found. if (Ban::isIp(Ip::get())) { \PH7\Framework\Page\Page::banned(); } // The maintenance page is not displayed for the module "Admin" hen and the administrator is logged. if (DbConfig::getSetting('siteStatus') === DbConfig::MAINTENANCE_SITE && !\PH7\AdminCore::auth() && $this->oRegistry->module !== PH7_ADMIN_MOD) { \PH7\Framework\Page\Page::maintenance(3600); // 1 hour for the duration time of the Service Unavailable HTTP status. } $this->_pathInitialize(); /***** FULL PATH OF MODULE FILE *****/ $this->oRegistry->path_module_controller = $this->oRegistry->path_module_controllers . $this->oRegistry->controller . '.php'; /***** FOR FILE CONFIG .INI OF MODULE *****/ $this->oConfig->load($this->oRegistry->path_module . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE); define('PH7_DEFAULT_TPL_MOD', $this->oConfig->values['module']['default_theme']); $this->_templateInitialize(); if (is_file($this->oRegistry->path_module_controller)) { // For additional options modules if (is_file($this->oRegistry->path_module . 'Bootstrap.php')) { require_once $this->oRegistry->path_module . 'Bootstrap.php'; } // Include Bootstrap Module if there exists require_once $this->oRegistry->path_module_controller; $sController = 'PH7\\' . $this->oRegistry->controller; $oCtrl = new $sController(); if ((new \ReflectionClass($oCtrl))->hasMethod($this->oRegistry->action)) { if ((new \ReflectionMethod($oCtrl, $this->oRegistry->action))->isPublic()) { // And finally there is more to perform the action call_user_func_array(array($oCtrl, $this->oRegistry->action), $this->getRequestParameter()); } else { $this->notFound('The <b>' . $this->oRegistry->action . '</b> method is not public!', 1); } } else { $this->notFound('The method <b>' . $this->oRegistry->action . '</b> of controller does not exist', 1); } unset($oCtrl); // Destruction of the object and minimize CPU resources } else { $this->notFound('The <b>' . $this->oRegistry->controller . '</b> controller of the <b>' . $this->oRegistry->module . '</b> module is not found.<br />File: <b>' . $this->oRegistry->path_module . '</b>', 1); } }
public function photo() { $oPicture = $this->oPictureModel->photo($this->iProfileId, $this->httpRequest->get('album_id', 'int'), $this->httpRequest->get('picture_id', 'int'), 1, 0, 1); if (empty($oPicture)) { $this->sTitle = t('Photo not found or in pending approval.'); $this->_notFound(); } else { $this->sTitle = t('Photo of <a href="%0%">%1%</a>', $this->sUsernameLink, $this->str->upperFirst($this->sUsername)); $sTitle = Ban::filterWord($oPicture->title, false); $this->view->page_title = t('Photo of %0%, %1%', $oPicture->firstName, $sTitle); $this->view->meta_description = t('Photo of %0%, %1%, %2%', $oPicture->firstName, $sTitle, substr(Ban::filterWord($oPicture->description, false), 0, 100)); $this->view->meta_keywords = t('picture,photo,pictures,photos,album,albums,picture album,photo album,gallery,%0%,%1%,%2%', str_replace(' ', ',', $sTitle), $oPicture->firstName, $oPicture->username); $this->view->h1_title = $this->sTitle; $this->view->picture = $oPicture; //Set Photo Statistics Framework\Analytics\Statistic::setView($oPicture->pictureId, 'Pictures'); } $this->output(); }
public function index() { $oUserModel = new UserModel(); // Add the style sheet for the Tabs Menu $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'tabs.css'); // Add the JavaScript file for the Ajax Friend $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'friend.js'); // Set the Profile username $this->sUsername = $this->httpRequest->get('username', 'string'); // Set the Profile ID and Visitor ID $this->iProfileId = $oUserModel->getId(null, $this->sUsername); $this->iVisitorId = (int) $this->session->get('member_id'); // Read the Profile information $oUser = $oUserModel->readProfile($this->iProfileId); if (!empty($oUser->username) && $this->str->equalsIgnoreCase($this->sUsername, $oUser->username)) { // The administrators can view all profiles and profile visits are not saved. if (!AdminCore::auth()) { $this->_initPrivacy($oUserModel, $this->iProfileId, $this->iVisitorId); } // Gets the Profile background $this->view->img_background = $oUserModel->getBackground($this->iProfileId, 1); $oFields = $oUserModel->getInfoFields($this->iProfileId); unset($oUserModel); $sFirstName = !empty($oUser->firstName) ? $this->str->escape($this->str->upperFirst($oUser->firstName), true) : ''; $sLastName = !empty($oUser->lastName) ? $this->str->escape($this->str->upperFirst($oUser->lastName), true) : ''; $sMiddleName = !empty($oFields->middleName) ? $this->str->escape($this->str->upperFirst($oFields->middleName), true) : ''; $sCountry = !empty($oFields->country) ? $oFields->country : ''; $sCity = !empty($oFields->city) ? $this->str->escape($this->str->upperFirst($oFields->city), true) : ''; $sState = !empty($oFields->state) ? $this->str->escape($this->str->upperFirst($oFields->state), true) : ''; $sDescription = !empty($oFields->description) ? Emoticon::init(Ban::filterWord($oFields->description)) : ''; // Age $this->view->birth_date = $this->dateTime->get($oUser->birthDate)->date(); $aAge = explode('-', $oUser->birthDate); $iAge = (new Framework\Math\Measure\Year($aAge[0], $aAge[1], $aAge[2]))->get(); // Links of the Menubar $iNbFriend = FriendModel::totalFriends($this->iProfileId); $sNbFriend = $iNbFriend > 0 ? ' (' . $iNbFriend . ')' : ''; $sFriendTxt = $iNbFriend <= 1 ? $iNbFriend == 1 ? t('Friend:') : t('No Friends') : t('Friends:'); if ($this->sUserAuth) { $iNbMutFriend = (new FriendModel())->get($this->iVisitorId, $this->iProfileId, null, true, null, null, null, null); $sNbMutFriend = $iNbMutFriend > 0 ? ' (' . $iNbMutFriend . ')' : ''; $sMutFriendTxt = $iNbMutFriend <= 1 ? $iNbMutFriend == 1 ? t('Mutual Friend:') : t('No Mutual Friends') : t('Mutuals Friends:'); } $sMailLink = $this->sUserAuth ? Uri::get('mail', 'main', 'compose', $this->sUsername) : Uri::get('user', 'signup', 'step1', '?' . Url::httpBuildQuery(array('msg' => t('You need to free register for send a message to %0%.', $sFirstName), 'ref' => 'profile', 'a' => 'mail', 'u' => $this->sUsername, 'f_n' => $sFirstName, 's' => $oUser->sex)), false); $sMessengerLink = $this->sUserAuth ? 'javascript:void(0)" onclick="Messenger.chatWith(\'' . $this->sUsername . '\')' : Uri::get('user', 'signup', 'step1', '?' . Url::httpBuildQuery(array('msg' => t('You need to free register for talk to %0%.', $sFirstName), 'ref' => 'profile', 'a' => 'messenger', 'u' => $this->sUsername, 'f_n' => $sFirstName, 's' => $oUser->sex)), false); $sBefriendLink = $this->sUserAuth ? 'javascript:void(0)" onclick="friend(\'add\',' . $this->iProfileId . ',\'' . (new Framework\Security\CSRF\Token())->generate('friend') . '\')' : Uri::get('user', 'signup', 'step1', '?' . Url::httpBuildQuery(array('msg' => t('Free Sign up for %site_name% to become friend with %0%.', $sFirstName), 'ref' => 'profile', 'a' => 'befriend&', 'u' => $this->sUsername, 'f_n' => $sFirstName, 's' => $oUser->sex)), false); $this->view->page_title = t('Meet %0%, A beautiful %1% looking some %2% - %3% years - %4% - %5% %6%', $sFirstName, t($oUser->sex), t($oUser->matchSex), $iAge, t($sCountry), $sCity, $sState); $this->view->meta_description = t('Meet %0% %1% | %2% - %3%', $sFirstName, $sLastName, $this->sUsername, substr($sDescription, 0, 100)); $this->view->h1_title = t('Meet <span class="pH1">%0%</span> on <span class="pH0">%site_name%</span>', $sFirstName); $this->view->h2_title = t('A <span class="pH1">%0%</span> of <span class="pH3">%1% years</span>, from <span class="pH2">%2%, %3% %4%</span>', t($oUser->sex), $iAge, t($sCountry), $sCity, $sState); $this->view->avatarDesign = new AvatarDesignCore(); // Avatar Design Class // Member Menubar $this->view->friend_link = $sFriendTxt . $sNbFriend; if ($this->sUserAuth) { $this->view->mutual_friend_link = $sMutFriendTxt . $sNbMutFriend; } $this->view->mail_link = $sMailLink; $this->view->messenger_link = $sMessengerLink; $this->view->befriend_link = $sBefriendLink; // Set parameters Google Map $oMap = new Map(); $oMap->setCenter($sCity . ' ' . $sState . ' ' . t($sCountry)); $oMap->setSize('600px', '300px'); $oMap->setDivId('profileMap'); $oMap->setZoom(12); $oMap->addMarkerByAddress($sCity . ' ' . $sState . ' ' . t($sCountry), t('Meet %0% near here!', $this->sUsername)); $oMap->generate(); $this->view->map = $oMap->getMap(); unset($oMap); $this->view->id = $this->iProfileId; $this->view->username = $this->sUsername; $this->view->first_name = $sFirstName; $this->view->last_name = $sLastName; $this->view->middle_name = $sMiddleName; $this->view->sex = $oUser->sex; $this->view->match_sex = $oUser->matchSex; $this->view->match_sex_search = str_replace(array('[code]', ','), '&sex%5B%5D=', '[code]' . $oUser->matchSex); $this->view->age = $iAge; $this->view->country = t($sCountry); $this->view->country_code = $sCountry; $this->view->city = $sCity; $this->view->state = $sState; $this->view->description = nl2br($sDescription); $this->view->join_date = VDate::textTimeStamp($oUser->joinDate); $this->view->last_activity = VDate::textTimeStamp($oUser->lastActivity); $this->view->fields = $oFields; $this->view->is_logged = $this->sUserAuth; $this->view->is_himself_profile = $this->str->equals($this->iVisitorId, $this->iProfileId); // Stat Profile Statistic::setView($this->iProfileId, 'Members'); } else { $this->_notFound(); } $this->output(); }
/** * Check if the site has been banned for the visitor. * Displays the banishment page if a banned IP address is found. * * @return void If banned, exit the script after displaying the ban page. */ private final function _checkBanStatus() { if (Ban::isIp(Ip::get())) { \PH7\Framework\Page\Page::banned(); } }