예제 #1
0
 public function __construct()
 {
     $this->confirmation_code = \FA\Legacy\Utilities::uuid();
     $this->ip = $_SERVER['REMOTE_ADDR'];
     $this->created_at = time();
     $this->is_used = false;
 }
예제 #2
0
 public function indexAction()
 {
     $form = new \FA\Form($this->current_module_config->forms->recover);
     if ($_POST && $form->isValid($_POST)) {
         $data = $form->getValues();
         $data['email'] = mb_strtolower($data['email'], 'UTF-8');
         $user = User::getRepository()->findOneBy(array('username' => $data['username'], 'email' => $data['email']));
         if ($user instanceof User) {
             $user->lostpw = \FA\Legacy\Utilities::uuid();
             $user->save();
             \FA\Messenger::send(array('to' => $user->email, 'subject' => 'Password Recovery Code', 'template' => 'account_recover', 'vars' => array('id' => $user->id, 'code' => $user->lostpw)));
             $this->alert('<b>A password recovery link has been sent to your e-mail address.</b><br>Click the link in the e-mail to reset your password.', 'green');
             return $this->redirectHome();
         } else {
             $form->addError('username', 'We could not locate an account with this username and e-mail address in our system. Please try again!');
         }
     }
     $this->view->setVar('title', 'Forgot My Password');
     return $this->renderForm($form);
 }
예제 #3
0
 /**
  * Format a date according to a user's "fuzzy dates" preference.
  *
  * @param $timestamp
  * @return string
  */
 public function formatDate($timestamp)
 {
     $date_full = date($this->settings['Long_Date_Format'], $timestamp);
     $date_fuzzy = Legacy\Utilities::age($timestamp, false, false, false, ' ago', 'raw_output');
     if ($this->user->getVariable('date_format') == 'full') {
         return '<span title="' . $date_fuzzy . '" class="popup_date">' . $date_full . '</span>';
     } else {
         return '<span title="' . $date_full . '" class="popup_date">' . $date_fuzzy . '</span>';
     }
 }
예제 #4
0
 /**
  * Returns the Level Width of the comment
  * LEGACY
  *
  * @return integer
  */
 public function getLevelWidth()
 {
     return \FA\Legacy\Utilities::levpercent($this->getParentDepth());
 }
예제 #5
0
파일: User.php 프로젝트: einstein95/FAOpen
 public function getSpeciesName()
 {
     $di = \Phalcon\Di::getDefault();
     $config = $di['config'];
     $species_raw = $config->fa->species->toArray();
     $species = \FA\Legacy\Utilities::reverseArray($species_raw);
     if (isset($species[$this->species])) {
         return $species[$this->species];
     } else {
         return NULL;
     }
 }
예제 #6
0
 public function setThumbnail($new_path)
 {
     // Delete existing file (if exists).
     if (!empty($this->thumbnail)) {
         @unlink(self::getFilePath($this->thumbnail));
     }
     $this->thumbnail = self::cleanUpBasePath($new_path);
     $this->thumbnail_uuid = \FA\Legacy\Utilities::uuid();
 }
예제 #7
0
<?php

/**
 * Master Submission Edit Form
 */
use Entity\Upload;
use FA\Legacy\Utilities as FAUtils;
$di = \Phalcon\Di::getDefault();
$config = $di['config'];
return array('id' => 'browse_filters', 'method' => 'post', 'elements' => array('category' => array('select', array('label' => 'Category', 'options' => FAUtils::reverseArray($config->fa->categories->toArray()))), 'theme' => array('select', array('label' => 'Theme', 'options' => FAUtils::reverseArray($config->fa->art_types->toArray()))), 'species' => array('select', array('label' => 'Species', 'options' => FAUtils::reverseArray($config->fa->species->toArray()))), 'gender' => array('select', array('label' => 'Gender', 'options' => FAUtils::reverseArray($config->fa->genders->toArray()))), 'rating' => array('multiCheckbox', array('label' => 'Rating', 'default' => Upload::RATING_GENERAL, 'options' => array(Upload::RATING_GENERAL => 'General', Upload::RATING_MATURE => 'Mature', Upload::RATING_ADULT => 'Adult'))), 'page' => array('hidden', array('default' => 1)), 'submit' => array('submit', array('type' => 'submit', 'label' => 'Apply Filters', 'helper' => 'formButton', 'class' => 'btn btn-default'))));
예제 #8
0
<?php

/**
 * Master Submission Edit Form
 */
use Entity\Upload;
use FA\Legacy\Utilities as FAUtils;
$di = \Phalcon\Di::getDefault();
$config = $di['config'];
return array('method' => 'post', 'enctype' => 'multipart/form-data', 'groups' => array('files' => array('legend' => 'Select Files to Submit', 'elements' => array('submission' => array('file', array('label' => 'File to Submit', 'maxSize' => '10M', 'description' => 'If you do not want to replace the existing uploaded file, leave this field empty.')), 'rebuild_thumbnail' => array('radio', array('label' => 'Rebuild the thumbnail from this file', 'description' => 'If you select "Yes" to this option (and don\'t upload a custom thumbnail below), a new one will be generated for this submission based on the new file you upload above, replacing any existing thumbnail.', 'options' => array(0 => 'No', 1 => 'Yes'), 'default' => 0, 'required' => true)), 'thumbnail' => array('file', array('label' => 'Custom Thumbnail', 'allowedTypes' => array('image/jpeg', 'image/gif', 'image/png'), 'description' => 'If you would like to use a custom thumbnail image for this submission, upload it here. It will automatically be scaled down to the correct size.')))), 'metadata' => array('legend' => 'Submission Details', 'elements' => array('title' => array('text', array('label' => 'Title', 'maxlength' => 60, 'class' => 'full-width', 'required' => true)), 'description' => array('textarea', array('label' => 'Description', 'maxlength' => 65535, 'class' => 'full-width full-height', 'required' => true)), 'rating' => array('radio', array('label' => 'Rating', 'default' => 0, 'options' => array(Upload::RATING_GENERAL => '<b>General:</b> Suitable for all-ages.', Upload::RATING_MATURE => '<b>Mature:</b> Gore, violence or tasteful/artistic nudity or mature themes.', Upload::RATING_ADULT => '<b>Adult:</b> Explicit or imagery otherwise geared towards adult audiences.'), 'required' => true)), 'category' => array('select', array('label' => 'Category', 'options' => FAUtils::reverseArray($config->fa->categories->toArray()), 'layout' => 'col50')), 'theme' => array('select', array('label' => 'Theme', 'options' => FAUtils::reverseArray($config->fa->art_types->toArray()), 'layout' => 'col50')), 'species' => array('select', array('label' => 'Species', 'options' => FAUtils::reverseArray($config->fa->species->toArray()), 'layout' => 'col50')), 'gender' => array('select', array('label' => 'Gender', 'options' => FAUtils::reverseArray($config->fa->genders->toArray()), 'layout' => 'col50')), 'keywords' => array('textarea', array('label' => 'Keywords', 'description' => 'Separate keywords using spaces (e.g. "fox lion male men friends fishing"). Keywords helps user find your submission in the search engine. Per site policy, keywords must be related directly to the content of your submission. Misleading or abusive keywords are not permitted.', 'class' => 'full-width', 'maxlength' => 65535)))), 'settings' => array('legend' => 'Site Settings', 'elements' => array('lock_comments' => array('radio', array('label' => 'Disable Comments', 'default' => 0, 'options' => array(0 => 'No', 1 => 'Yes'))), 'is_scrap' => array('radio', array('label' => 'Put in "Scraps" Section', 'default' => 0, 'options' => array(0 => 'No', 1 => 'Yes'))))), 'submit_grp' => array('elements' => array('csrf' => array('csrf'), 'submit' => array('submit', array('type' => 'submit', 'label' => 'Submit', 'helper' => 'formButton', 'class' => 'btn btn-default'))))));