Example #1
0
 public function show($id)
 {
     // Получаем ряд
     $id = intval($id);
     $this->nId = $id;
     try {
         // Получаем детей
         $aChild = Sitemap::selectChild($id);
         if ($id != 0) {
             $aRow = Sitemap_Sample::get($id);
         } else {
             $aRow = null;
         }
         /*$aData = array();
         		foreach ($aChild as $row)
         		{
         			$aData[] = $row['id'];
         		}*/
         $aData = $aChild;
         //
         $this->formatDesign($aRow);
         // Выводим форму сортировки
         print UParser::parsePHPFile(LIB_PATH . 'sitemap/controller/tpl/order.tpl', array('szTitle' => $this->szTitle, 'aBegin' => $this->aBegin, 'id' => $id, 'back' => $this->back, 'aData' => $aData));
         $this->output();
     } catch (SiteMapException $e) {
         $this->addError(_msg('Ряд не найден в бд'));
         $this->jump('./');
     }
 }
Example #2
0
 public function generate()
 {
     $fullGrantList = $this->getAllGrantsMap();
     $grantList = ACL::selectAllGrantsForEntity($this->entity);
     $tpl = __DIR__ . DIRECTORY_SEPARATOR . 'form.tpl';
     $parseData = array('name' => $this->szName, 'grantList' => $grantList, 'fullGrantList' => $fullGrantList);
     return UParser::parsePHPFile($tpl, $parseData);
 }
Example #3
0
 public function getAdminFormValue()
 {
     //
     //
     //
     $strings = \CMS_Strings::getInstance();
     $aParse = array('lang' => $strings->language, 'aTableHeader' => $this->fieldInfo['columns'], 'aData' => $this->aValue, 'szName' => $this->szFieldName, 'szComment' => '');
     return UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'table/admin-form.tpl', $aParse);
 }
Example #4
0
 /**
  * Генерирует html-представление контрола
  */
 public function generate()
 {
     $values = array();
     foreach ($this->values as $key => $row) {
         $values[] = array($key, $row);
     }
     $aParse = array('name' => $this->szName, 'title' => $this->title, 'values' => $values);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/key_value_list.tpl', $aParse);
 }
Example #5
0
 public function generate()
 {
     // Проверяем есть ли адрес скрипта
     if (empty($this->url)) {
         throw new Exception('Url not defined');
     }
     $parseData = array('name' => $this->szName, 'values' => $this->values, 'url' => $this->url);
     return UParser::parsePHPFile(dirname(__FILE__) . '/tpl/links_to_many.tpl', $parseData);
 }
Example #6
0
 public function generate()
 {
     $parseData = array('name' => $this->id, 'value' => $this->src, 'imageInfo' => array('size' => 0, 'width' => 0, 'height' => 0));
     if (!empty($this->src) && file_exists(WEBROOT_PATH . $this->src)) {
         $path = WEBROOT_PATH . $this->src;
         $imageInfo = getimagesize($path);
         $parseData['imageInfo'] = array('size' => $this->format_bytes($path), 'width' => $imageInfo[0], 'height' => $imageInfo[1]);
     }
     return UParser::parsePHPFile(dirname(__FILE__) . '/tpl/image.tpl', $parseData);
 }
 protected function action()
 {
     $token = $this->generateToken();
     $this->request->tokenRepository->insert($token);
     $email = $this->request->user->email->getValue();
     $parseData = ['user' => $this->request->user->getParseData(), 'token' => $token->getParseData()];
     $content = UParser::parsePHPCode($this->request->emailTemplate, $parseData);
     $subject = UParser::parsePHPCode($this->request->subjectTemplate, $parseData);
     $this->request->mailer->send([$email], $subject, $content);
 }
Example #8
0
 /**
  * @desc Выводит форму для редактирования даты
  * @return
  */
 function getFormValue()
 {
     // Выдираем текущий год, месяц и день
     $aDate = preg_split('#[ \\:\\-]#', $this->aValue);
     // Подготавливаем массив для парсинга
     $aParse = array('current_year' => $aDate[0], 'current_month' => $aDate[1], 'current_day' => $aDate[2], 'current_hour' => $aDate[3], 'current_minute' => $aDate[4], 'fieldname' => $this->szFieldName, 'value' => $aDate[0] . '-' . intval($aDate[1]) . '-' . $aDate[2] . ' ' . intval($aDate[3]) . ':' . intval($aDate[4]));
     // Парсим
     $szResult = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'datetime/form.tpl', $aParse);
     return $szResult;
 }
Example #9
0
 public function generate()
 {
     if (!empty($this->value)) {
         $urlInfo = Sitemap_Sample::get($this->value);
     } else {
         $urlInfo = array();
     }
     $parseData = array('name' => $this->szName, 'filter' => $this->filter, 'urlInfo' => $urlInfo);
     return UParser::parsePHPFile(LIB_PATH . 'sitemap/control/select.once.tpl', $parseData);
 }
Example #10
0
 /**
  * @desc
  * @return
  */
 public function getAdminFormValue()
 {
     // �������� ������ ��������
     $aParse = array();
     $aParse['value'] = $this->aValue;
     $aParse['name'] = $this->szFieldName;
     $aParse['id'] = $this->document->id->getValue();
     // ������
     $szResult = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'file/form.tpl', $aParse);
     // ���������� ���������
     return $szResult;
 }
Example #11
0
 public function generate()
 {
     $parseData = array('name' => $this->szName);
     if (!empty($this->currentUserId)) {
         try {
             $user = new UserAccount($this->currentUserId);
             $parseData['currentUser'] = $user->getParseData();
         } catch (Exception $e) {
         }
     }
     return UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'tpl/userselect.tpl', $parseData);
 }
Example #12
0
 public function generate()
 {
     // Получаем сайтмап данные
     $displayValues = array();
     foreach ($this->values as $id) {
         $sitemap = Sitemap_Sample::get($id);
         if (!empty($sitemap)) {
             $displayValues[] = array($sitemap['id'], $sitemap['name'], $sitemap['full_url']);
         }
     }
     $parseData = array('name' => $this->szName, 'values' => $displayValues);
     return UParser::parsePHPFile(LIB_PATH . 'sitemap/control/select.tpl', $parseData);
 }
Example #13
0
 public function main()
 {
     $aType = call_user_func([$this->typeName, 'getFieldsInfo']);
     $szIndex = call_user_func([$this->typeName, 'getIndexKey']);
     $sql = sprintf('select `%s`, `%s` as name, `%s` from `%s` where %s order by `%s` ', $szIndex, $this->fieldName, $this->fieldOrder, $aType['table'], $this->fieldCondition, $this->fieldOrder);
     $aData = \Extasy\ORM\DB::query($sql);
     foreach ($aData as $key => $value) {
         foreach ($value as $key2 => $value2) {
             $aData[$key][$key2] = str_replace("\n", '', $value2);
         }
     }
     print UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'order.tpl', array('szTitle' => $this->szTitle, 'aBegin' => $this->aBegin, 'type' => $this->typeName, 'back' => $this->back, 'aHidden' => $this->aHidden, 'aData' => $aData));
     $this->output();
 }
 protected function action()
 {
     $token = $this->request->tokenRepository->getByHash($this->request->hash);
     $user = $this->request->usersRepository->get($token->id->getValue());
     $password = Password::generatePassword();
     $user->password = $password;
     $this->request->usersRepository->update($user);
     $this->request->tokenRepository->delete($token);
     //
     $parseData = ['user' => $user->getParseData(), 'password' => $password];
     $subject = UParser::parsePHPCode($this->request->subjectTemplate, $parseData);
     $content = UParser::parsePHPCode($this->request->emailTemplate, $parseData);
     $this->request->mailer->send([$user->email->getValue()], $subject, $content);
     $this->request->tokenRepository->delete($token);
 }
Example #15
0
 public static function send($email)
 {
     CMSLog::addMessage(self::LogName, sprintf('Email - "%s"', $email));
     self::validateLoginAttempts($email);
     //
     $aAccount = self::lookForEmail($email);
     //
     $schema = CConfig::getSchema(self::EmailConfigName);
     $values = $schema->getValues();
     //
     $szContent = UParser::parsePHPCode($values['request_content'], $aAccount);
     //
     Email_Controller::send($aAccount['email'], $values['request_subject'], $szContent);
     //
 }
Example #16
0
 public function exec($source, $initData = null)
 {
     $auth = CMSDesign::getInstance();
     $initData = json_decode($initData, true);
     if (!empty($initData)) {
         $source = $initData . $source;
     }
     if (!$auth->isSuperAdmin(UsersLogin::getCurrentUser())) {
         print 'Only system administrator can use this feature';
         die;
     } else {
         print UParser::parsePHPCode($source, array());
     }
     die;
 }
Example #17
0
 public function getAdminFormValue()
 {
     // Данные для парсинга
     $aParse = array();
     $aParse['name'] = $this->szFieldName;
     $szPath = $this->getPath();
     if (!empty($this->aValue) && file_exists($szPath)) {
         $aInfo = @getimagesize($szPath);
         //
         $aParse['value'] = $this->aValue;
     } else {
         $aParse['value'] = '';
     }
     //
     $szResult = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'simple_image/form.tpl', $aParse);
     return $szResult;
 }
Example #18
0
 /**
  * (non-PHPdoc)
  * @see \Extasy\Columns\BaseColumn::getAdminFormValue()
  */
 public function getAdminFormValue($onlyResizes = false)
 {
     static $librariesLoaded = false;
     $nId = $this->document->id->getValue();
     if (!empty($nId)) {
         $baseUrl = \Extasy\CMS::getFilesHttpRoot() . $this->getSrc();
         $filePath = \Extasy\CMS::getFilesPath() . $this->getSrc();
         $aPlaceholder = array();
         $aParse = array();
         if ($this->imageExists()) {
             $aSize = getimagesize($filePath);
             $aParse[] = array('url' => $baseUrl, 'size_x' => $aSize[0], 'size_y' => $aSize[1], 'basename' => 'default');
             // Если передан массив images
             $bIsArray = isset($this->fieldInfo['images']) && is_array($this->fieldInfo['images']);
             if ($bIsArray) {
                 foreach ($this->fieldInfo['images'] as $key => $value) {
                     $value = explode('x', $value);
                     if (sizeof($value) == 1) {
                         $w = $h = $value[0];
                     } else {
                         list($w, $h) = $value;
                     }
                     $imageUrl = imageHelper::getTimthumbUrl($baseUrl, $w, $h) . '&rand=' . rand();
                     $aParse[] = array('size_x' => $w, 'size_y' => $h, 'url' => $imageUrl, 'basename' => $key);
                 }
             }
             // setup thumbnail
             $aPlaceholder['thumbnailSrc'] = imageHelper::getTimthumbUrl($baseUrl, self::thumbWidth, self::thumbHeight) . '&rand=' . rand();
         } else {
             $aSize = null;
         }
         $aPlaceholder['aList'] = $aParse;
     }
     $aPlaceholder['name'] = $this->szFieldName;
     $aPlaceholder['value'] = $this->aValue;
     $aPlaceholder['librariesLoaded'] = $librariesLoaded;
     $aPlaceholder['required'] = !empty($this->fieldInfo['required']);
     $aPlaceholder['title'] = !empty($this->fieldInfo['title']) ? $this->fieldInfo['title'] : '';
     if ($onlyResizes) {
         $template = __DIR__ . DIRECTORY_SEPARATOR . 'image/resizes.tpl';
     } else {
         $template = __DIR__ . DIRECTORY_SEPARATOR . 'image/formAdmin.tpl';
     }
     $szResult = UParser::parsePHPFile($template, $aPlaceholder);
     $librariesLoaded = true;
     return $szResult;
 }
Example #19
0
 public function getAdminViewValue()
 {
     $parseVariables = array('name' => $this->szFieldName, 'status' => $this->status, 'loadTime' => $this->loadTime, 'errorMessage' => $this->errorMessage);
     return UParser::parsePHPFile(dirname(__FILE__) . '/tpl/resultView.tpl', $parseVariables);
 }
Example #20
0
 public function authProc()
 {
     if (!headers_sent()) {
         header('Content-Type: text/html; charset= utf-8');
     }
     $register = new SystemRegister('System/Front-end');
     $techMessage = $register->technical_message->value;
     $template = __DIR__ . DIRECTORY_SEPARATOR . 'login.tpl';
     //
     print UParser::parsePHPFile($template, array('techMessage' => $techMessage));
 }
Example #21
0
 public function generate()
 {
     $aParse = array('id' => $this->szName . '_id', 'name' => $this->szName, 'value' => $this->szValue);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/file_select.tpl', $aParse);
 }
Example #22
0
 /**
  *
  * Enter description here ...
  */
 protected function showAlerts()
 {
     $processAlerts = function ($key, $path) {
         $result = '';
         $messages = !empty($_SESSION[$key]) ? $_SESSION[$key] : [];
         $_SESSION[$key] = [];
         foreach ($messages as $row) {
             $result .= UParser::parsePHPFile($path, array('message' => $row));
         }
         return $result;
     };
     $messages = $processAlerts('__page_alert', VIEW_PATH . 'blocks/Alerts/message.tpl');
     $messages .= $processAlerts(self::ErrorKey, VIEW_PATH . 'blocks/Alerts/error.tpl');
     $this->insertIntoResponse($messages);
 }
Example #23
0
 public function getControl()
 {
     $strings = CMS_Strings::getInstance();
     $aParse = array('lang' => $strings->language, 'aTableHeader' => $this->aTableHeader, 'aData' => unserialize($this->szContent), 'szName' => $this->szName, 'szComment' => $this->szComment);
     return UParser::parsePHPFile(CONFIG_PATH . 'plugins/array_list/form.tpl', $aParse);
 }
Example #24
0
 public function generate()
 {
     $parseData = array('name' => $this->szName, 'id' => !empty($this->szId) ? $this->szId : 'checkbox_' . $this->szName, 'checked' => $this->szChecked, 'value' => $this->szValue, 'labelTitle' => $this->szTitle);
     $result = UParser::parsePHPFile(CONTROL_PATH . 'tpl/checkbox.tpl', $parseData);
     return $result;
 }
Example #25
0
 public function getAdminFormValue()
 {
     $tpl = __DIR__ . DIRECTORY_SEPARATOR . 'password/admin-form.tpl';
     $parseData = array('name' => $this->szFieldName, 'forceInput' => empty($this->aValue));
     return UParser::parsePHPFile($tpl, $parseData);
 }
Example #26
0
 public function generate()
 {
     $szResult = '<select class="%s" size="%s" name="%s" id="%s" style="%s">';
     $szResult = sprintf($szResult, $this->class, $this->nSize, $this->szName, !empty($this->szId) ? $this->szId : $this->szName, $this->szStyle);
     $szTemplateOptGroup = '<optgroup label="%s">%s</optgroup>';
     if (!is_array($this->aValues)) {
         throw new Exception('Select control values list must be an arrray');
     }
     if ($this->bUseGroups) {
         foreach ($this->aValues as $row) {
             // Если перед нами группа, то добавляем её
             if (isset($row['options'])) {
                 $szOptions = '';
                 foreach ($row['options'] as $opt) {
                     $szOptions .= self::createOption($opt[$this->valueField], $opt[$this->titleField], $this->nCurrent);
                 }
                 // Если хотя бы одна опция была вставлена в группу, то группа подается на вывод
                 if (!empty($szOptions)) {
                     $szResult .= sprintf($szTemplateOptGroup, htmlspecialchars($row['group-title']), $szOptions);
                 }
             } else {
                 // Просто вставляем код <otpion>
                 $szResult .= self::createOption($row[$this->valueField], $row[$this->titleField], $this->nCurrent);
             }
         }
     } else {
         foreach ($this->aValues as $row) {
             $szResult .= self::createOption($row[$this->valueField], $row[$this->titleField], $this->nCurrent);
         }
     }
     $szResult .= '</select>';
     if (!empty($this->required)) {
         $selector = '#' . (!empty($this->szId) ? $this->szId : $this->szName);
         $errorMsg = $this->required;
         $szResult .= \Faid\UParser::parsePHPFile(__DIR__ . '/tpl/select.tpl', ['selector' => $selector, 'errorMsg' => $errorMsg]);
     }
     return $szResult;
 }
Example #27
0
 public function getFormValue()
 {
     // формируем массив парсинга
     $aParse = array('szFieldName' => $this->szFieldName, 'szFontFile' => $this->szFontFile, 'szValue' => $this->aValue, 'szView' => $this->getViewValue());
     // шаблон
     $szContent = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'graphical_text/form.tpl', $aParse);
     return $szContent;
 }
Example #28
0
 public function generate()
 {
     $parseData = array('name' => $this->szName, 'content' => $this->szContent, 'title' => !empty($this->title) ? $this->title : $this->szName, 'required' => $this->required);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/htmlarea-light.tpl', $parseData);
 }
Example #29
0
 public function generate()
 {
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/php_source.tpl', array('name' => $this->szName, 'phpSource' => $this->phpSource, 'initData' => $this->initData));
 }
Example #30
0
 /**
  * Генерирует результат
  */
 protected static function generate()
 {
     $aParse = array('aMessage' => self::$aDebug, 'aAlert' => self::$aAlert);
     return UParser::parsePHPFile(dirname(__FILE__) . '/template.tpl', $aParse);
 }