public static function display() { $oForm = new \PFBC\Form('form_update_admin_ads', 500); $oForm->configure(array('action' => '')); $oForm = new \PFBC\Form('form_banner_ads', 500); $oPage = new Page(); $oAdsModel = new AdsCoreModel(); $oPage->getTotalPages($oAdsModel->total('AdsAffiliates'), 10); $oAds = $oAdsModel->get(null, $oPage->getFirstItem(), $oPage->getNbItemsByPage(), 'AdsAffiliates'); unset($oPage, $oAdsModel); $oSysVar = new SysVar(); foreach ($oAds as $oRow) { // Begin ads div tags $oForm->addElement(new \PFBC\Element\HTMLExternal('<div id="ad_' . $oRow->adsId . '">')); $oForm->addElement(new \PFBC\Element\Hidden('id_ads', $oRow->adsId)); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h2>' . $oRow->name . '</h2>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p>' . t('Preview Banner:') . '</p>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<div>' . $oSysVar->parse($oRow->code) . '</div>')); $oForm->addElement(new \PFBC\Element\Textarea(t('Banner:'), 'code', array('readonly' => 'readonly', 'onclick' => 'this.select()', 'value' => $oSysVar->parse($oRow->code)))); // End ads div tags $oForm->addElement(new \PFBC\Element\HTMLExternal('</div>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<br /><hr /><br />')); } $oForm->render(); }
public function index() { $iTotalAds = (new AdsCoreModel())->total('AdsAffiliates'); $oPage = new Page(); $this->view->total_pages = $oPage->getTotalPages($iTotalAds, 10); $this->view->current_page = $oPage->getCurrentPage(); unset($oPage); $this->sTitle = t('Banners'); $this->view->page_title = $this->sTitle; $this->view->h1_title = $this->sTitle; $this->view->h3_title = nt('%n% Banner', '%n% Banners', $iTotalAds); $this->output(); }
public function ads() { $oPage = new Page(); $sTable = AdsCore::getTable(); $iTotalAds = (new AdsCoreModel())->total($sTable); $this->view->total_pages = $oPage->getTotalPages($iTotalAds, 10); $this->view->current_page = $oPage->getCurrentPage(); unset($oPage, $sTable); // Add JS file for the ads form $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'common.js'); $this->sTitle = t('Advertisement Settings'); $this->view->page_title = $this->sTitle; $this->view->h1_title = $this->sTitle; $this->view->h4_title = t('%0% Banners', $iTotalAds); $this->output(); }
public static function display() { if (isset($_POST['submit_update_ads'])) { if (\PFBC\Form::isValid($_POST['submit_update_ads'])) { new UpdateAdsFormProcess(); } Framework\Url\Header::redirect(); } $oPage = new Page(); $oAdsModel = new AdsCoreModel(); $sTable = AdsCore::getTable(); $sCSRFToken = (new Framework\Security\CSRF\Token())->generate('ads'); $oPage->getTotalPages($oAdsModel->total($sTable), 10); $oAds = $oAdsModel->get(null, $oPage->getFirstItem(), $oPage->getNbItemsByPage(), $sTable); unset($oPage, $oAdsModel); $oSysVar = new SysVar(); foreach ($oAds as $oRow) { $oForm = new \PFBC\Form('form_update_ads', 500); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_update_ads', 'form_update_ads')); $oForm->addElement(new \PFBC\Element\Token('update_ads')); // Begin ads div tags $oForm->addElement(new \PFBC\Element\HTMLExternal('<div id="ad_' . $oRow->adsId . '">')); $oForm->addElement(new \PFBC\Element\Hidden('id_ads', $oRow->adsId)); $oForm->addElement(new \PFBC\Element\Textbox(t('Title:'), 'title', array('value' => $oRow->name, 'required' => 1, 'validation' => new \PFBC\Validation\Str(2, 40)))); $oForm->addElement(new \PFBC\Element\HTMLExternal('<p>' . t('Preview Ad:') . '</p>')); $oForm->addElement(new \PFBC\Element\HTMLExternal($oSysVar->parse($oRow->code))); // ID textarea form was generated with "mt_rand" because it is faster than "uniqid" // See also this discussion we asked: http://stackoverflow.com/questions/9152600/uniqid-versus-mt-rand-php-function $oForm->addElement(new \PFBC\Element\Textarea(t('Advertisement:'), 'code', array('id' => mt_rand(), 'value' => $oSysVar->parse($oRow->code), 'required' => 1))); // mt_rand() function for generate an ID different if it causes problems in the display. $oForm->addElement(new \PFBC\Element\Button(t('Update'), 'submit', array('id' => mt_rand()))); if (AdsCore::getTable() == 'Ads') { // This feature is not available for affiliate banners $oForm->addElement(new \PFBC\Element\HTMLExternal(t('Views: %0% | Clicks: %1%', $oRow->views, $oRow->clicks) . ' | ')); } $oForm->addElement(new \PFBC\Element\HTMLExternal('<a class="medium_button" href="javascript:void(0)" onclick="ads(\'delete\',' . $oRow->adsId . ',\'' . $sCSRFToken . '\')">' . t('Delete') . '</a> | ')); if ($oRow->active == 1) { $oForm->addElement(new \PFBC\Element\HTMLExternal('<a class="medium_button" href="javascript:void(0)" onclick="ads(\'deactivate\',' . $oRow->adsId . ',\'' . $sCSRFToken . '\')">' . t('Deactivate') . '</a>')); } else { $oForm->addElement(new \PFBC\Element\HTMLExternal('<a class="medium_button" href="javascript:void(0)" onclick="ads(\'activate\',' . $oRow->adsId . ',\'' . $sCSRFToken . '\')">' . t('Activate') . '</a>')); } // End ads div tags $oForm->addElement(new \PFBC\Element\HTMLExternal('</div>')); $oForm->render(); } }
public function index() { // Add Stylesheet tooltip $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'tooltip.css'); if ($this->httpRequest->getExists('country')) { // Get the country and city, limited to 50 characters and remove hyphens in too automatically insert the url. $this->registry->country = str_replace('-', ' ', substr($this->str->upperFirst($this->httpRequest->get('country')), 0, 50)); $this->registry->city = $this->httpRequest->getExists('city') ? str_replace('-', ' ', substr($this->str->upperFirst($this->httpRequest->get('city')), 0, 50)) : ''; // Set parameters Google Map $oMap = new Map(); $oMap->setCenter($this->registry->country . ' ' . $this->registry->city); $oMap->setSize('800px', '690px'); $oMap->setDivId('map'); $oMap->setZoom(12); $oMap->addMarkerByAddress($this->registry->country . ' ' . $this->registry->city, t('Meet new people here!')); $oMap->generate(); $this->view->map = $oMap->getMap(); unset($oMap); $sCountryCode = $this->getCountryCode(); // For User Model $this->view->userDesignModel = new UserDesignCoreModel(); $this->view->country_code = $sCountryCode; $this->view->city = $this->registry->city; // Pagination $oPage = new Page(); $iTotalUsers = (new UserCoreModel())->getGeoProfiles($sCountryCode, $this->registry->city, true, null, null, null); $this->view->total_pages = $oPage->getTotalPages($iTotalUsers, 20); $this->view->current_page = $oPage->getCurrentPage(); $this->view->first_user = $oPage->getFirstItem(); $this->view->nb_user_by_page = $oPage->getNbItemsByPage(); // SEO Meta $this->view->page_title = t('Free online dating in %0% %1%, meet people, find friends. Single men & women in %2% %3%', $this->registry->country, $this->registry->city, $this->registry->country, $this->registry->city); $this->view->meta_description = t('Free online dating in %0% with single women & men. Personals, meet people & find friends in %1% on internet dating site. Find sweet love or sex dating and flirt in %2%, %3% with %site_name%', $this->registry->country, $this->registry->country, $this->registry->country, $this->registry->city); $this->view->meta_keywords = t('meeting woman, meeting man, %0%, %1%, meet people, networking, friends, communicate, meet online, online community, clubs, announces meeting, free dating, dating, %2% dating, communication, matrimonial meeting, sharing photos, flirt, finding friends, classifieds, personals, online, social networking', $this->registry->country, $this->registry->city, $this->registry->country); $this->view->h1_title = t('Meet new people in %0% %1%', '<span class="pH1">' . $this->registry->country . '</span>', '<span class="pH1">' . $this->registry->city . '</span>'); $sMemberTxt = nt('%n% member', '%n% members', $iTotalUsers); $this->view->h3_title = t('%0% lives near %1% %2%', $sMemberTxt, $this->registry->country, $this->registry->city); } else { // Not found page Framework\Http\Http::setHeadersByCode(404); $this->view->error = t('Error, country is empty.'); } $this->output(); }
public function read() { // Adding JavaScript file for Ajax Comment $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'comment.js'); $this->sTitle = t('Read Comment'); $this->view->page_title = $this->sTitle; $this->view->meta_description = $this->sTitle; $this->view->h1_title = $this->sTitle; $this->view->h4_title = CommentCore::count($this->iId, $this->sTable); $oPage = new Page(); $this->view->total_pages = $oPage->getTotalPages($this->oCommentModel->total($this->iId, $this->sTable), 15); $this->view->current_page = $oPage->getCurrentPage(); $oComment = $this->oCommentModel->read($this->iId, 1, $oPage->getFirstItem(), $oPage->getNbItemsByPage(), $this->sTable); unset($oPage); if (!empty($oComment)) { $this->view->avatarDesign = new AvatarDesignCore(); // Avatar Design Class $this->view->member_id = $this->session->get('member_id'); $this->view->csrf_token = (new Framework\Security\CSRF\Token())->generate('comment'); $this->view->comment = $oComment; } else { $this->_notFound(); } $this->output(); }
public function browse() { $this->iTotalAdmins = $this->oAdminModel->searchAdmin($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null); $oPage = new Page(); $this->view->total_pages = $oPage->getTotalPages($this->iTotalAdmins, 15); $this->view->current_page = $oPage->getCurrentPage(); $oSearch = $this->oAdminModel->searchAdmin($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $oPage->getFirstItem(), $oPage->getNbItemsByPage()); unset($oPage); if (empty($oSearch)) { $this->design->setRedirect(Uri::get(PH7_ADMIN_MOD, 'admin', 'browse')); $this->displayPageNotFound(t('Sorry, Your search returned no results!')); } else { // Adding the JS form file $this->design->addJs(PH7_STATIC . PH7_JS, 'form.js'); // Assigns variables for views $this->view->designSecurity = new Framework\Layout\Html\Security(); // Security Design Class $this->view->dateTime = $this->dateTime; // Date Time Class $this->sTitle = t('Browse Admins'); $this->view->page_title = $this->sTitle; $this->view->h2_title = $this->sTitle; $this->view->h3_title = nt('%n% Admin', '%n% Admins', $this->iTotalAdmins); $this->view->browse = $oSearch; } $this->output(); }
public function browse() { $oSubscriptionModel = new SubscriptionModel(); $iTotal = $this->oSubscriptionModel->browse($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null); $oPage = new Page(); $this->view->total_pages = $oPage->getTotalPages($iTotal, 30); $this->view->current_page = $oPage->getCurrentPage(); $oBrowse = $this->oSubscriptionModel->browse($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $oPage->getFirstItem(), $oPage->getNbItemsByPage()); unset($oPage); if (empty($oBrowse)) { $this->design->setRedirect(Uri::get('newsletter', 'admin', 'browse')); $this->displayPageNotFound(t('Sorry, Your search returned no results!')); } else { // Adding the static files $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'browse.css'); $this->design->addJs(PH7_STATIC . PH7_JS, 'form.js'); // Assigns variables for views $this->view->designSecurity = new Framework\Layout\Html\Security(); // Security Design Class $this->view->dateTime = $this->dateTime; // Date Time Class $this->sTitle = t('Browse Subscribers'); $this->view->page_title = $this->sTitle; $this->view->h2_title = $this->sTitle; $this->view->h3_title = nt('%n% Subscriber', '%n% Subscribers', $iTotal); $this->view->browse = $oBrowse; } $this->output(); }
/** * For better SEO optimization for multilingual sites. Ref: https://support.google.com/webmasters/answer/189077 * * @return void */ public function regionalUrls() { $sCurrentPage = Page::cleanDynamicUrl('l'); $aLangs = (new File())->getDirList(PH7_PATH_APP_LANG); echo '<link rel="alternate" hreflang="x-default" href="', PH7_URL_ROOT, '">'; // For pages that are not specifically targeted foreach ($aLangs as $sLang) { // Retrieve only the first two characters $sAbbrLang = substr($sLang, 0, 2); echo '<link rel="alternate" hreflang="', $sAbbrLang, '" href="', $sCurrentPage, $sLang, '" />'; } unset($aLangs, $sCurrentPage); }
public function langList() { $sCurrentPage = \PH7\Framework\Navigation\Page::cleanDynamicUrl('l'); $oLangs = (new Lang())->getInfos(); foreach ($oLangs as $sLang) { if ($sLang->langId === PH7_LANG_NAME) { continue; } // Retrieve only the first two characters $sAbbrLang = substr($sLang->langId, 0, 2); echo '<a href="', $sCurrentPage, $sLang->langId, '" hreflang="', $sAbbrLang, '"><img src="', PH7_URL_STATIC, PH7_IMG, 'flag/s/', $sAbbrLang, '.gif" alt="', t($sAbbrLang), '" title="', t($sAbbrLang), '" /></a> '; } unset($oLangs); }
public function index() { // CSRF Token $this->view->csrf_token = (new Framework\Security\CSRF\Token())->generate('report'); // Security Design Class $this->view->designSecurity = new Framework\Layout\Html\Security(); // Adding the JS files for the report and form. $this->design->addJs(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL . PH7_TPL_MOD_NAME . PH7_SH . PH7_JS, 'common.js'); $this->design->addJs(PH7_STATIC . PH7_JS, 'form.js'); $this->sTitle = t('Report'); $this->view->page_title = $this->sTitle; $this->view->h2_title = $this->sTitle; $oPage = new Page(); $this->view->total_pages = $oPage->getTotalPages($this->oReportModel->totalReports(), 15); $this->view->current_page = $oPage->getCurrentPage(); $this->view->reports = $this->oReportModel->get(null, $oPage->getFirstItem(), $oPage->getNbItemsByPage()); unset($oPage); $this->output(); }
public function result() { error_reporting(0); $iGroupId = $this->httpRequest->get('group_id', 'int'); $iBan = $this->httpRequest->get('ban', 'int'); $sWhere = $this->httpRequest->get('where'); $sWhat = $this->httpRequest->get('what'); if ($sWhere !== 'all' && $sWhere !== 'username' && $sWhere !== 'email' && $sWhere !== 'firstName' && $sWhere !== 'lastName' && $sWhere !== 'ip') { \PFBC\Form::setError('form_admin_search', 'Invalid argument.'); HeaderUrl::redirect(Uri::get(PH7_ADMIN_MOD, 'user', 'search')); } else { $this->iTotalUsers = $this->oAdminModel->searchUser($sWhat, $sWhere, $iGroupId, $iBan, true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null); $this->view->total_users = $this->iTotalUsers; $oPage = new Page(); $this->view->total_pages = $oPage->getTotalPages($this->iTotalUsers, 15); $this->view->current_page = $oPage->getCurrentPage(); $oSearch = $this->oAdminModel->searchUser($sWhat, $sWhere, $iGroupId, $iBan, false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $oPage->getFirstItem(), $oPage->getNbItemsByPage()); unset($oPage); if (empty($oSearch)) { $this->design->setRedirect(Uri::get(PH7_ADMIN_MOD, 'user', 'search')); $this->displayPageNotFound('Empty search result. Please try again with wider or new search parameters.'); } else { // Adding the static files $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'browse.css'); $this->design->addJs(PH7_STATIC . PH7_JS, 'form.js'); $this->sTitle = t('Users - Your search returned'); $this->view->page_title = $this->sTitle; $this->view->h1_title = $this->sTitle; $this->view->h3_title = nt('%n% User Result!', '%n% Users Result!', $this->iTotalUsers); $this->view->browse = $oSearch; } $this->manualTplInclude('browse.tpl'); $this->output(); } }
public function stat() { $iCountQueries = Db::queryCount(); $sRequest = nt('Request', 'Requests', $iCountQueries); echo t('Time of the request: %0% | %1% %2% | Page executed in %3% seconds | Amount of memory allocated: %4%', Db::time(), $iCountQueries, $sRequest, Page::time(Registry::getInstance()->start_time, microtime(true)), memory_get_usage(true)); }