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();
 }
 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 __construct()
 {
     $aData = (new Newsletter())->sendMessages();
     if (!$aData['status']) {
         \PFBC\Form::setError('form_msg', Form::errorSendingEmail());
     } else {
         \PFBC\Form::setSuccess('form_msg', nt('%n% newsletters were sent successfully!', '%n% newsletter has been sent successfully', $aData['nb_mail_sent']));
     }
 }
 protected function send()
 {
     $iNum = (new BirthdayCore())->sendMails();
     if ($iNum == 0) {
         echo t('No birthday today.');
     } else {
         echo nt('%n% email sent.', '%n% emails sent.', $iNum);
     }
 }
 /**
  * Get the link to comments.
  *
  * @param integer $iId
  * @param string $sTable
  * @return void
  */
 public static function link($iId, $sTable)
 {
     $oCommentModel = new CommentCoreModel();
     $iCommentNumber = $oCommentModel->total($iId, $sTable);
     unset($oCommentModel);
     echo '<p><a href="', Uri::get('comment', 'comment', 'add', "{$sTable},{$iId}"), '">', t('Add a comment'), '</a>';
     if ($iCommentNumber > 0) {
         $sCommentTxt = nt('Read Comment', 'Read the Comments', $iCommentNumber);
         echo ' - ', t('OR'), ' -  <a href="', Uri::get('comment', 'comment', 'read', $sTable . ',' . $iId), '">', $sCommentTxt, ' (', $iCommentNumber, ')</a> <a href="', Uri::get('xml', 'rss', 'xmlrouter', 'comment-' . $sTable . ',' . $iId), '"><img src="', PH7_URL_STATIC, PH7_IMG, 'icon/small-feed.png" alt="', t('RSS Feed'), '" /></a>';
     }
     echo '</p>';
 }
Пример #6
0
 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 msgList()
 {
     $this->iTotalMails = $this->oMailModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalMails, 20);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oAllMsg = $this->oMailModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     if (empty($oAllMsg)) {
         $this->displayPageNotFound(t('No messages found!'));
     } else {
         $this->design->addJs(PH7_STATIC . PH7_JS, 'divShow.js');
         $this->sTitle = t('Email List');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Mail Result!', '%n% Mails Result!', $this->iTotalMails);
         $this->view->msgs = $oAllMsg;
         $this->output();
     }
 }
 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 index()
 {
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalVisitors, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $this->iTotalVisitors = $this->oVisitorModel->get($this->httpRequest->get('looking'), true, SearchCoreModel::LAST_VISIT, SearchCoreModel::DESC, null, null);
     $oVisitor = $this->oVisitorModel->get($this->httpRequest->get('looking'), false, SearchCoreModel::LAST_VISIT, SearchCoreModel::DESC, $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     $this->view->user_views_setting = UserCore::auth() ? $this->oUserModel->getPrivacySetting($this->session->get('member_id'))->userSaveViews : '';
     if (empty($oVisitor)) {
         $this->sTitle = t('No Visitors found for the profile of "%0%"', $this->sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->error = t('Not found visitor.');
     } else {
         $this->sTitle = t('%0%\'s Visitors:', $this->sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $sVisitorTxt = nt('%n% Visitor', '%n% Visitors', $this->iTotalVisitors);
         $this->view->visitor_number = $sVisitorTxt;
         $this->view->visitors = $oVisitor;
     }
     $this->output();
 }
 public function showPostByProfile()
 {
     $sUsername = $this->httpRequest->get('username');
     $this->view->username = $sUsername;
     $iId = (new UserCoreModel())->getId(null, $sUsername);
     $this->iTotalTopics = $this->oForumModel->totalTopics(null, $iId);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalTopics, 20);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $this->view->topic_number = nt('%n% Topic:', '%n% Topics:', $this->iTotalTopics);
     $oTopics = $this->oForumModel->getPostByProfile($iId, 1, $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     if (empty($oTopics)) {
         $this->sTitle = t('No found the forum post of %0%.', $sUsername);
         $this->_notFound(false);
         // Because the Ajax blocks profile, we can not put HTTP error code 404, so the attribute is "false"
     } else {
         $this->sTitle = t('%0%\'s Forum Posts', $sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->topics = $oTopics;
     }
     $this->output();
 }
Пример #11
0
 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));
 }
Пример #12
0
 /**
  * @desc Count Comment with a HTML text.
  * @param integer $iId
  * @param string $sTable
  * @return string
  */
 public static function count($iId, $sTable)
 {
     $iCommentNumber = (new CommentCoreModel())->total($iId, $sTable);
     return nt('%n% Comment', '%n% Comments', $iCommentNumber);
 }
 public function __construct()
 {
     parent::__construct();
     $this->_aFile = $_FILES['csv_file'];
     $sExtFile = $this->file->getFileExt($this->_aFile['name']);
     $sDelimiter = $this->httpRequest->post('delimiter');
     $sEnDelimiter = $this->httpRequest->post('enclosure');
     if ($sExtFile != 'csv' && $sExtFile != 'txt') {
         $sErrMsg = static::ERR_BAD_FILE;
     } elseif (!($rHandler = @fopen($this->_aFile['tmp_name'], 'rb'))) {
         $sErrMsg = static::ERR_BAD_FILE;
     } elseif (!($aFileData = @fgetcsv($rHandler, 0, $sDelimiter, $sEnDelimiter)) || !is_array($aFileData)) {
         $sErrMsg = static::ERR_BAD_FILE;
     }
     if (!empty($sErrMsg) && $sErrMsg == static::ERR_BAD_FILE) {
         $this->_removeTmpFile();
         \PFBC\Form::setError('form_import_user', t('Wrong file! Please select a valid CSV file containing data members.'));
         return;
         // Stop execution of the method.
     }
     /**
      * Default value...
      */
     $aGenderList = ['male', 'female', 'couple'];
     $sFiveChars = Various::genRnd($this->_aFile['name'], 5);
     $aTmpData = ['email' => 'pierrehenrysoriasanz' . $sFiveChars . '@hizup' . $sFiveChars . '.com', 'username' => 'Hizup' . $sFiveChars, 'password' => Various::genRnd(), 'first_name' => 'Alex' . $sFiveChars, 'last_name' => 'Rolli' . $sFiveChars, 'sex' => $aGenderList[mt_rand(0, 2)], 'match_sex' => $aGenderList[mt_rand(0, 2)], 'birth_date' => date('Y') - mt_rand(20, 40) . '-' . mt_rand(1, 12) . '-' . mt_rand(1, 28), 'country' => 'US', 'city' => 'Virginia', 'state' => 'Doswell', 'zip_code' => '23047', 'description' => 'Hi all!<br />How are you today?<br /> Bye ;)', 'website' => '', 'social_network_site' => '', 'ip' => Ip::get()];
     foreach ($aFileData as $sKey => $sVal) {
         // Clean the text to make comparisons easier...
         $sVal = strtolower(trim(str_replace(array('-', '_', ' '), '', $sVal)));
         // Test comparisons of strings and adding values in an array "$aTmpData"
         if ($sVal == 'username' || $sVal == 'login' || $sVal == 'user' || $sVal == 'nickname') {
             $aTmpData['username'] = $sKey;
         }
         if ($sVal == 'name' || $sVal == 'firstname') {
             $aTmpData['first_name'] = $sKey;
         }
         if ($sVal == 'lastname' || $sVal == 'surname') {
             $aTmpData['last_name'] = $sKey;
         }
         if ($sVal == 'matchsex' || $sVal == 'looking' || $sVal == 'lookingfor') {
             $aTmpData['match_sex'] = $sKey;
         }
         if ($sVal == 'sex' || $sVal == 'gender') {
             $aTmpData['sex'] = $sKey;
         }
         if ($sVal == 'email' || $sVal == 'mail') {
             $aTmpData['email'] = $sKey;
         }
         if ($sVal == 'desc' || $sVal == 'description' || $sVal == 'descriptionme' || $sVal == 'generaldescription' || $sVal == 'about' || $sVal == 'aboutme' || $sVal == 'bio' || $sVal == 'biography' || $sVal == 'comment') {
             $aTmpData['description'] = $sKey;
         }
         if ($sVal == 'country' || $sVal == 'countryid') {
             $aTmpData['country'] = $sKey;
         }
         if ($sVal == 'city' || $sVal == 'town') {
             $aTmpData['city'] = $sKey;
         }
         if ($sVal == 'state' || $sVal == 'district' || $sVal == 'province' || $sVal == 'region') {
             $aTmpData['state'] = $sKey;
         }
         if ($sVal == 'zip' || $sVal == 'zipcode' || $sVal == 'postal' || $sVal == 'postalcode') {
             $aTmpData['zip_code'] = $sKey;
         }
         if ($sVal == 'website' || $sVal == 'site' || $sVal == 'url') {
             $aTmpData['website'] = $sKey;
         }
         if ($sVal == 'birthday' || $sVal == 'birthdate' || $sVal == 'dateofbirth') {
             $aTmpData['birth_date'] = $this->dateTime->get($sKey)->date('Y-m-d');
         }
     }
     $iRow = 0;
     $oUser = new UserCore();
     $oUserModel = new UserCoreModel();
     $oExistsModel = new ExistsCoreModel();
     $oValidate = new Validate();
     while (($aFileData = fgetcsv($rHandler, 0, $sDelimiter, $sEnDelimiter)) !== false) {
         $aData[$iRow] = $aTmpData;
         // Set data by the default contents
         $sEmail = trim($aFileData[$aTmpData['email']]);
         if ($oValidate->email($sEmail) && !$oExistsModel->email($sEmail)) {
             $sUsername = trim($aFileData[$aTmpData['username']]);
             $sFirstName = trim($aFileData[$aTmpData['first_name']]);
             $sLastName = trim($aFileData[$aTmpData['last_name']]);
             $aData[$iRow]['username'] = $oUser->findUsername($sUsername, $sFirstName, $sLastName);
             $aData[$iRow]['first_name'] = $sFirstName;
             $aData[$iRow]['last_name'] = $sLastName;
             $aData[$iRow]['sex'] = trim($aFileData[$aTmpData['sex']]);
             $aData[$iRow]['match_sex'] = array(trim($aFileData[$aTmpData['match_sex']]));
             $aData[$iRow]['email'] = $sEmail;
             $aData[$iRow]['description'] = trim($aFileData[$aTmpData['description']]);
             $aData[$iRow]['country'] = trim($aFileData[$aTmpData['country']]);
             $aData[$iRow]['city'] = trim($aFileData[$aTmpData['city']]);
             $aData[$iRow]['state'] = trim($aFileData[$aTmpData['state']]);
             $aData[$iRow]['zip_code'] = trim($aFileData[$aTmpData['zip_code']]);
             $aData[$iRow]['website'] = trim($aFileData[$aTmpData['website']]);
             $aData[$iRow]['birth_date'] = trim($aFileData[$aTmpData['birth_date']]);
             $oUserModel->add(escape($aData[$iRow], true));
             $iRow++;
         }
     }
     $this->_removeTmpFile();
     unset($oUser, $oUserModel, $oExistsModel, $oValidate, $aTmpData, $aData);
     fclose($rHandler);
     Header::redirect(Uri::get(PH7_ADMIN_MOD, 'user', 'browse'), nt('%n% User has been successfully added.', '%n% Users has been successfully added.', $iRow));
 }
 public function result()
 {
     $this->iTotalGames = $this->oGameModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalGames, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oSearch = $this->oGameModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     $this->setMenuVars();
     if (empty($oSearch)) {
         $this->sTitle = t('Sorry, Your search returned no results!');
         $this->_notFound();
     } else {
         $this->sTitle = t('Game - Your search returned');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Game Result!', '%n% Games Result!', $this->iTotalGames);
         $this->view->meta_description = t('Search - Free Games for Gamers, Flash Games, Free Online Games');
         $this->view->meta_keywords = t('search,game,free,flash,game site,flash game,games,gaming,online game');
         $this->view->games = $oSearch;
     }
     $this->manualTplInclude('index.tpl');
     $this->output();
 }
Пример #15
0
 /**
  * Lists all media items that are outstanding, for the user to add
  * meta data such as title/description
  *
  * @return string
  */
 public function outstandingSection()
 {
     $this->setTitle(t('Manage uploaded files'));
     try {
         $category = $this->_model()->getCategory($this->_input->get('cid'));
         $resource = 'media-cat_upload_' . $category['id'];
         if (!$this->_acl->resourceExists($resource) || !$this->_acl->check($resource)) {
             throw new Module_NoPermission();
         }
         $cid = (int) $category['id'];
     } catch (Input_KeyNoExist $e) {
         $cid = null;
     } catch (Media_CategoryNoExist $e) {
         $this->_event->error(t('Media category does not exist'));
         $cid = null;
     }
     /**
      * Work out which URL to redirect back to, since if we've come from
      * the 'config' cntrlr, we want to redirect back to that always.
      */
     if (empty($_SESSION['previous_url']) || !empty($_SESSION['media']['fromConfigCntrlr'])) {
         $redirectUrl = $this->_router->makeUrl('media', 'config');
     } else {
         $parsedPreviousUrl = new Router_Url($_SESSION['previous_url']);
         if ($parsedPreviousUrl->module == 'media' && $parsedPreviousUrl->controller == 'config') {
             $_SESSION['media']['fromConfigCntrlr'] = true;
             $redirectUrl = $this->_router->makeUrl('media', 'config');
         } else {
             $redirectUrl = new Router_Url('media');
             if (isset($category['identifier'])) {
                 $redirectUrl->controller('cat')->section($category['identifier']);
             }
         }
     }
     // Get all outstanding media items
     $outstanding = $this->_model()->getOutstandingItems($cid);
     if (($count = count($outstanding)) == 0) {
         $this->_event->error(t('There are currently no outstanding media items'));
         return zula_redirect($redirectUrl);
     } else {
         $form = new View_form('manage/outstanding.html', 'media');
         $form->addElement('media/cid', $cid, 'cid', new Validator_Confirm($cid));
         $form->addElement('media/item', null, t('Items'), array(new Validator_Is('array'), new Validator_Length($count, $count)));
         if ($form->hasInput() && $form->isValid()) {
             /**
              * Update the title and description for all provided media items
              * however the ids must match the selecting outstanding items.
              */
             $validItemIds = array_keys($outstanding);
             // Validate the provided values
             $validatorName = new Validator_Length(1, 255);
             $validatorDesc = new Validator_Length(0, 1000);
             $successCount = 0;
             foreach ($form->getValues('media/item') as $key => $item) {
                 if (in_array($key, $validItemIds)) {
                     $valid = true;
                     if (($errorMsg = $validatorName->validate($item['name'])) !== true) {
                         $valid = false;
                         $this->_event->error(sprintf($errorMsg, t('Titles')));
                     }
                     if (($errorMsg = $validatorDesc->validate($item['desc'])) !== true) {
                         $valid = false;
                         $this->_event->error(sprintf($errorMsg, t('Descriptions')));
                     }
                     if ($valid) {
                         $this->_model()->editItem($key, $item['name'], $item['desc']);
                         unset($outstanding[$key]);
                         ++$successCount;
                     }
                 }
             }
             // Redirect back to the correct location
             if ($successCount > 0) {
                 $langStr = nt('Completed upload for 1 media item', 'Completed upload for %d media items', $successCount);
                 $this->_event->success(sprintf($langStr, $successCount));
             }
             if ($successCount == $count) {
                 unset($_SESSION['media']['fromConfigCntrlr']);
                 return zula_redirect($redirectUrl);
             }
         }
         $form->assign(array('CID' => $cid, 'OUTSTANDING' => $outstanding));
         return $form->getOutput();
     }
 }
 /**
  * @param array $aFiles
  * @param string $sDelimiter Delimiter Field delimiter (one character).
  * @param string $sEnclosure Enclosure Field enclosure (one character).
  * @return void
  */
 public function __construct(array $aFiles, $sDelimiter, $sEnclosure)
 {
     parent::__construct();
     $this->_aFile = $aFiles;
     $sExtFile = $this->file->getFileExt($this->_aFile['name']);
     if ($sExtFile != 'csv' && $sExtFile != 'txt') {
         $this->_iErrType = static::ERR_BAD_FILE;
     } elseif ($this->_aFile['error'] == UPLOAD_ERR_INI_SIZE) {
         $this->_iErrType = static::ERR_TOO_LARGE;
     } elseif (!($rHandler = @fopen($this->_aFile['tmp_name'], 'rb'))) {
         $this->_iErrType = static::ERR_INVALID;
     } elseif (!($this->_aFileData = @fgetcsv($rHandler, 0, $sDelimiter, $sEnclosure)) || !is_array($this->_aFileData)) {
         $this->_iErrType = static::ERR_INVALID;
     }
     if (!empty($this->_iErrType)) {
         $this->_removeTmpFile();
         $this->_aRes = ['status' => false, 'msg' => $this->getErrMsg()];
     } else {
         $this->setDefVals();
         foreach ($this->_aFileData as $sKey => $sVal) {
             // Clean the text to make comparisons easier...
             $sVal = strtolower(trim(str_replace(['-', '_', ' '], '', $sVal)));
             // Test comparisons of strings and adding values in an array "ImportUser::$_aTmpData"
             if ($sVal == 'username' || $sVal == 'login' || $sVal == 'user' || $sVal == 'nickname') {
                 $this->_aTmpData['username'] = $sKey;
             }
             if ($sVal == 'name' || $sVal == 'firstname' || $sVal == 'forname') {
                 $this->_aTmpData['first_name'] = $sKey;
             }
             if ($sVal == 'lastname' || $sVal == 'surname') {
                 $this->_aTmpData['last_name'] = $sKey;
             }
             if ($sVal == 'matchsex' || $sVal == 'looking' || $sVal == 'lookingfor') {
                 $this->_aTmpData['match_sex'] = $sKey;
             }
             if ($sVal == 'sex' || $sVal == 'gender') {
                 $this->_aTmpData['sex'] = $sKey;
             }
             if ($sVal == 'email' || $sVal == 'mail') {
                 $this->_aTmpData['email'] = $sKey;
             }
             if ($sVal == 'desc' || $sVal == 'description' || $sVal == 'descriptionme' || $sVal == 'generaldescription' || $sVal == 'about' || $sVal == 'aboutme' || $sVal == 'bio' || $sVal == 'biography' || $sVal == 'comment') {
                 $this->_aTmpData['description'] = $sKey;
             }
             if ($sVal == 'country' || $sVal == 'countryid') {
                 $this->_aTmpData['country'] = $sKey;
             }
             if ($sVal == 'city' || $sVal == 'town') {
                 $this->_aTmpData['city'] = $sKey;
             }
             if ($sVal == 'state' || $sVal == 'district' || $sVal == 'province' || $sVal == 'region') {
                 $this->_aTmpData['state'] = $sKey;
             }
             if ($sVal == 'zip' || $sVal == 'zipcode' || $sVal == 'postal' || $sVal == 'postalcode' || $sVal == 'eircode') {
                 $this->_aTmpData['zip_code'] = $sKey;
             }
             if ($sVal == 'website' || $sVal == 'site' || $sVal == 'url') {
                 $this->_aTmpData['website'] = $sKey;
             }
             if ($sVal == 'birthday' || $sVal == 'birthdate' || $sVal == 'dateofbirth') {
                 $this->_aTmpData['birth_date'] = $sKey;
             }
         }
         $iRow = 0;
         $oUserModel = new UserCoreModel();
         $oExistsModel = new ExistsCoreModel();
         $oValidate = new Validate();
         while (($this->_aFileData = fgetcsv($rHandler, 0, $sDelimiter, $sEnclosure)) !== false) {
             $sEmail = trim($this->_aFileData[$this->_aTmpData['email']]);
             if ($oValidate->email($sEmail) && !$oExistsModel->email($sEmail)) {
                 $this->setData($iRow);
                 $oUserModel->add(escape($this->_aData[$iRow], true));
                 $iRow++;
             }
         }
         $this->_removeTmpFile();
         fclose($rHandler);
         unset($rHandler, $oUserModel, $oExistsModel, $oValidate, $this->_aTmpData, $this->_aFileData, $this->_aData);
         $this->_aRes = ['status' => true, 'msg' => nt('%n% user has been successfully added.', '%n% users has been successfully added.', $iRow)];
     }
 }
 /**
  * Get stats from the benchmark.
  *
  * @return void HTML output.
  */
 public function stat()
 {
     $iCountQueries = Db::queryCount();
     $sRequest = nt('Query', 'Queries', $iCountQueries);
     $sMicrotime = microtime(true) - Registry::getInstance()->start_time;
     $sTime = Benchmark::readableElapsedTime($sMicrotime);
     $iMemory = Benchmark::readableSize(memory_get_usage(true));
     echo t('Queries time: %0% | %1% %2% | Generated in %3% | Memory allocated: %4%', Db::time(), $iCountQueries, $sRequest, $sTime, $iMemory);
 }
Пример #18
0
 public function result()
 {
     $this->iTotalNotes = $this->oNoteModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null, $this->iApproved);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalNotes, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oSearch = $this->oNoteModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage(), $this->iApproved);
     $this->setMenuVars();
     if (empty($oSearch)) {
         $this->sTitle = t('Sorry, Your search returned no results!');
         $this->notFound();
     } else {
         $this->sTitle = t('Dating Social Note - Your search returned');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Note Result!', '%n% Notes Result!', $this->iTotalNotes);
         $this->view->meta_description = t('Search - Dating Social Community Note');
         $this->view->meta_keywords = t('search,note,dating,social network,community,news');
         $this->view->posts = $oSearch;
     }
     $this->manualTplInclude('index.tpl');
     $this->output();
 }
 public function result()
 {
     $this->iTotalVideos = $this->oVideoModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalVideos, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oSearch = $this->oVideoModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     if (empty($oSearch)) {
         $this->sTitle = t('Sorry, Your search returned no results!');
         $this->_notFound();
     } else {
         $this->sTitle = t('Dating Social Video - Your search returned');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Video Result!', '%n% Videos Result!', $this->iTotalVideos);
         $this->view->meta_description = t('Search - %site_name% is a Dating Social Video Community!');
         $this->view->meta_keywords = t('search,video,dating,social network,community,music,movie,news,video sharing');
         $this->view->album = $oSearch;
     }
     $this->manualTplInclude('album.tpl');
     $this->output();
 }
Пример #20
0
 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 mutual()
 {
     $this->iTotalFriends = $this->oFriendModel->get($this->iMemberId, $this->iId, $this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalFriends, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oFriend = $this->oFriendModel->get($this->iMemberId, $this->iId, $this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     if (empty($oFriend)) {
         $this->sTitle = t('No Mutual Friend found on the profile of "%0%"', $this->sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->error = t('No Mutual Friend found!');
     } else {
         $this->sTitle = t('%0%\'s Mutual Friends:', $this->sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->friend_number = nt('%n% Mutual Friend', '%n% Mutuals Friends', $this->iTotalFriends);
         $this->view->friends = $oFriend;
     }
     $this->view->action = 'mutual';
     $this->manualTplInclude('index.tpl');
     $this->output();
 }
 protected function cleanData()
 {
     $iCleanMsg = (int) DbConfig::getSetting('cleanMsg');
     $iCleanComment = (int) DbConfig::getSetting('cleanComment');
     // If the option is enabled
     if ($iCleanMsg > 0) {
         $rStmt = Db::getInstance()->prepare('DELETE FROM' . Db::prefix('Messages') . 'WHERE (sendDate < NOW() - INTERVAL :cleanMsg DAY)');
         $rStmt->bindValue(':cleanMsg', $iCleanMsg, \PDO::PARAM_INT);
         if ($rStmt->execute()) {
             echo nt('Deleted %n% message... OK!', 'Deleted %n% messages... OK!', $rStmt->rowCount()) . '<br />';
         }
     }
     // If the option is enabled
     if ($iCleanComment > 0) {
         $aCommentMod = ['Blog', 'Note', 'Picture', 'Video', 'Game', 'Profile'];
         foreach ($aCommentMod as $sSuffixTable) {
             $rStmt = Db::getInstance()->prepare('DELETE FROM' . Db::prefix('Comments' . $sSuffixTable) . 'WHERE (updatedDate < NOW() - INTERVAL :cleanComment DAY)');
             $rStmt->bindValue(':cleanComment', $iCleanComment, \PDO::PARAM_INT);
             if ($rStmt->execute()) {
                 echo t('Deleted %0% %1% comment(s) ... OK!', $rStmt->rowCount(), $sSuffixTable) . '<br />';
             }
         }
     }
 }
Пример #23
0
 public function result()
 {
     $sType = $this->httpRequest->get('where');
     $this->iTotalMails = $this->oMailModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null, $this->_iProfileId, $sType);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalMails, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oSearch = $this->oMailModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage(), $this->_iProfileId, $sType);
     if (empty($oSearch)) {
         $this->sTitle = t('Search Not Found!');
         $this->_notFound();
     } else {
         $this->sTitle = t('Mail | Message - Your search returned');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Mail Result!', '%n% Mails Result!', $this->iTotalMails);
         $this->view->msgs = $oSearch;
     }
     $this->manualTplInclude('msglist.inc.tpl');
     $this->output();
 }