コード例 #1
0
 private function installOrUpgrade($pkg, $fromVersion)
 {
     $at = AttributeType::getByHandle('handle_https');
     if (!is_object($at)) {
         $at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
     }
     $akc = AttributeKeyCategory::getByHandle('collection');
     if (is_object($akc)) {
         if (!$akc->hasAttributeKeyTypeAssociated($at)) {
             $akc->associateAttributeKeyType($at);
         }
     }
     if (empty($fromVersion)) {
         $ak = CollectionAttributeKey::getByHandle('handle_https');
         if (!is_object($ak)) {
             $hhh = Loader::helper('https_handling', 'handle_https');
             /* @var $hhh HttpsHandlingHelper */
             $httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
             if (!$httpDomain) {
                 $httpDomain = 'http://' . $hhh->getRequestDomain();
             }
             $httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
             if (!$httpsDomain) {
                 $httpsDomain = 'https://' . $hhh->getRequestDomain();
             }
             $ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
         }
     }
 }
コード例 #2
0
ファイル: group.php プロジェクト: Zyqsempai/amanet
 public function filterByKeywords($kw)
 {
     static $reverseLookup = array();
     $db = Loader::db();
     $locale = Localization::activeLocale();
     if (!array_key_exists($locale, $reverseLookup)) {
         $reverseLookup[$locale] = false;
         if (Localization::activeLocale() != 'en_US' || ENABLE_TRANSLATE_LOCALE_EN_US) {
             $limit = defined('GROUPNAME_REVERSELOOKUP_LIMIT') ? GROUPNAME_REVERSELOOKUP_LIMIT : 100;
             $count = $db->GetOne('select count(*) from Groups');
             if ($count > 0 && $count <= $limit) {
                 $reverseLookup[$locale] = array();
                 $rs = $db->Query('select gID, gName, gDescription from Groups');
                 while ($row = $rs->FetchRow()) {
                     $reverseLookup[$locale][$row['gID']] = array('name' => tc('GroupName', $row['gName']), 'description' => tc('GroupDescription', $row['gDescription']));
                 }
                 $rs->Close();
             }
         }
     }
     if ($reverseLookup[$locale]) {
         $foundIDs = array();
         foreach ($reverseLookup[$locale] as $gID => $gTranslated) {
             if (stripos($gTranslated['name'], $kw) !== false || stripos($gTranslated['description'], $kw) !== false) {
                 $foundIDs[] = $gID;
             }
         }
         if (count($foundIDs)) {
             $this->filter(false, '(Groups.gID in (' . implode(', ', $foundIDs) . '))');
             return;
         }
     }
     $this->filter(false, "(Groups.gName like " . $db->qstr('%' . $kw . '%') . " or Groups.gDescription like " . $db->qstr('%' . $kw . '%') . ")");
 }
コード例 #3
0
ファイル: MainController.php プロジェクト: barricade86/raui
 public function actionAdmin()
 {
     $this->getMaxSorter();
     $this->getMinSorter();
     Yii::app()->user->setFlash('warning', Yii::t('module_lang', 'moduleAdminHelp', array('{link}' => CHtml::link(tc('Currency'), array('/currency/backend/main/admin')))));
     parent::actionAdmin();
 }
コード例 #4
0
 public function getServiceLink(Page $c = null)
 {
     if (!is_object($c)) {
         $c = \Page::getCurrentPage();
     }
     if (is_object($c) && !$c->isError()) {
         $url = urlencode($c->getCollectionLink(true));
         switch ($this->getHandle()) {
             case 'facebook':
                 return "https://www.facebook.com/sharer/sharer.php?u={$url}";
             case 'twitter':
                 return "https://www.twitter.com/intent/tweet?url={$url}";
             case 'linkedin':
                 $title = urlencode($c->getCollectionName());
                 return "https://www.linkedin.com/shareArticle?mini-true&url={$url}&title={$title}";
             case 'pinterest':
                 return "https://www.pinterest.com/pin/create/button?url={$url}";
             case 'google_plus':
                 return "https://plus.google.com/share?url={$url}";
             case 'reddit':
                 return "https://www.reddit.com/submit?url={$url}";
             case 'print':
                 return "javascript:window.print();";
             case 'email':
                 $body = rawurlencode(t("Check out this article on %s:\n\n%s\n%s", tc('SiteName', Config::get('concrete.site')), $c->getCollectionName(), urldecode($url)));
                 $subject = rawurlencode(t('Thought you\'d enjoy this article.'));
                 return "mailto:?body={$body}&subject={$subject}";
         }
     }
 }
コード例 #5
0
ファイル: HAjax.php プロジェクト: alexjkitty/estate
 public static function jsonOk($msg = 'Success', $params = array())
 {
     $msg = $msg == 'Success' ? tc('Success') : $msg;
     $params = CMap::mergeArray(array('status' => self::STATUS_OK, 'msg' => $msg), $params);
     echo CJSON::encode($params);
     Yii::app()->end();
 }
コード例 #6
0
ファイル: MainController.php プロジェクト: alexjkitty/estate
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $model->scenario = 'update';
     $this->performAjaxValidation($model);
     if (isset($_POST[$this->modelName])) {
         $model->attributes = $_POST[$this->modelName];
         if (isset($_POST[$this->modelName]['password']) && $_POST[$this->modelName]['password']) {
             if (demo()) {
                 Yii::app()->user->setFlash('error', tc('Sorry, this action is not allowed on the demo server.'));
                 unset($model->password, $model->salt);
                 $this->redirect(array('update', 'id' => $model->id));
             } else {
                 $model->scenario = 'changePass';
             }
         } else {
             unset($model->password, $model->salt);
         }
         if ($model->validate()) {
             if ($model->scenario == 'changePass') {
                 $model->setPassword();
             }
             if ($model->save(false)) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     $this->render('update', array('model' => $model));
 }
コード例 #7
0
ファイル: MainController.php プロジェクト: barricade86/raui
 public function actionIndex()
 {
     $model = $this->loadModel(Yii::app()->user->id);
     if (isset($_POST[$this->modelName])) {
         $model->scenario = 'changeAdminPass';
         $model->old_password = $_POST[$this->modelName]['old_password'];
         if ($model->validatePassword($model->old_password)) {
             if (demo()) {
                 Yii::app()->user->setFlash('error', tc('Sorry, this action is not allowed on the demo server.'));
                 $this->redirect(array('index'));
             }
             $model->attributes = $_POST[$this->modelName];
             if ($model->validate()) {
                 $model->setPassword();
                 $model->save(false);
                 Yii::app()->user->setFlash('success', Yii::t('module_usercpanel', 'Your password successfully changed.'));
                 $this->redirect(array('index'));
             }
         } else {
             Yii::app()->user->setFlash('error', Yii::t('module_adminpass', 'Wrong admin password! Try again.'));
             $this->redirect(array('index'));
         }
     }
     $this->render('index', array('model' => $model));
 }
コード例 #8
0
ファイル: MainController.php プロジェクト: barricade86/raui
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     if (isset($_POST["{$this->modelName}"])) {
         $model->attributes = $_POST["{$this->modelName}"];
         $newImage = isset($_FILES['Themes']) && $_FILES['Themes']['name']['upload_img'];
         if ($newImage) {
             // delete old image
             $model->delImage();
             $model->scenario = 'upload';
         }
         if ($model->validate()) {
             if ($newImage) {
                 $model->upload = CUploadedFile::getInstance($model, 'upload_img');
                 $model->bg_image = md5(uniqid()) . '.' . $model->upload->extensionName;
             }
             if ($model->save()) {
                 if ($newImage) {
                     $model->upload->saveAs(Yii::getPathOfAlias($model->path) . '/' . $model->bg_image);
                     Yii::app()->user->setFlash('success', tt('Image successfully added', 'themes'));
                 } else {
                     Yii::app()->user->setFlash('success', tc('Success'));
                 }
                 $this->refresh();
             }
         }
     }
     $this->render('update', array('model' => $model));
 }
コード例 #9
0
 public function setUp()
 {
     parent::setUp();
     $g1 = Group::add(tc("GroupName", "Guest"), tc("GroupDescription", "The guest group represents unregistered visitors to your site."), false, false, GUEST_GROUP_ID);
     $g2 = Group::add(tc("GroupName", "Registered Users"), tc("GroupDescription", "The registered users group represents all user accounts."), false, false, REGISTERED_GROUP_ID);
     $g3 = Group::add(tc("GroupName", "Administrators"), "", false, false, ADMIN_GROUP_ID);
 }
コード例 #10
0
ファイル: controller.php プロジェクト: ronlobo/concrete5
		public function label($customText = false) {
			if ($customText == false) {
				$text = tc('AttributeKeyName', $this->attributeKey->getAttributeKeyName());
			} else {
				$text = $customText;
			}
			print Loader::helper('form')->label($this->field('value'), $text);
		}
コード例 #11
0
ファイル: CustomCCaptcha.php プロジェクト: barricade86/raui
 public function registerClientScriptJQuerySimpleCaptchaImage()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->getBaseUrl(true) . '/common/js/antispam/jquerySimpleCCaptcha/jquery.simpleCaptcha.css');
     Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl(true) . '/common/js/antispam/jquerySimpleCCaptcha/jquery.simpleCaptcha.js');
     $cs = Yii::app()->clientScript;
     $id = $this->imageOptions['id'];
     $js = "";
     $js .= "\n\$(document).ready(function() {\n\t\t\tvar parentBlockTmp = \$('#" . $this->imageOptions['id'] . "').parent();\n\t\t\t//var verifyCodeInput = \$(parentBlockTmp).find('input[type=text]');\n\t\t\tvar verifyCodeInput = \$(parentBlockTmp).find('input[id\$=\"_verifyCode\"]');\n\n\t\t\tif (verifyCodeInput && typeof verifyCodeInput !== 'undefined') {\n\t\t\t\tverifyCodeInput.hide();\n\t\t\t}\n\n\t\t\t\$('#" . $this->imageOptions['id'] . "')\n\t\t\t\t.simpleCaptcha({\n\t\t\t\t\tnumImages: 4,\n\t\t\t\t\tintroText: '" . tc('jquerySimpleCaptchaIntroText') . "',\n\t\t\t\t\tallowRefresh : false,\n\t\t\t\t\tscriptPath: '" . $this->getController()->createUrl('/antispam/jquerysimpleccaptcha/renderimages') . "',\n\t\t\t\t\tlanguage : '" . Yii::app()->language . "',\n\t\t\t\t\tverifyCodeInput : verifyCodeInput\n\t\t\t\t});\n\n\t\t});\n";
     $cs->registerScript('Yii.CCaptcha#' . $id, $js);
 }
コード例 #12
0
ファイル: attributes.php プロジェクト: ronlobo/concrete5
 public function __construct()
 {
     parent::__construct();
     $otypes = AttributeType::getList('file');
     $types = array();
     foreach ($otypes as $at) {
         $types[$at->getAttributeTypeID()] = tc('AttributeTypeName', $at->getAttributeTypeName());
     }
     $this->set('types', $types);
 }
コード例 #13
0
ファイル: Type.php プロジェクト: ngreimel/kovent
 /** Returns the display name for this access entity type (localized and escaped accordingly to $format)
  * @param string $format = 'html'
  *    Escape the result in html format (if $format is 'html').
  *    If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getAccessEntityTypeDisplayName($format = 'html')
 {
     $value = tc('PermissionAccessEntityTypeName', $this->getAccessEntityTypeName());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #14
0
ファイル: option.php プロジェクト: ngreimel/kovent
 /** Returns the display name for this select option value (localized and escaped accordingly to $format)
  * @param string $format = 'html'
  *	Escape the result in html format (if $format is 'html').
  *	If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getSelectAttributeOptionDisplayValue($format = 'html')
 {
     $value = tc('SelectAttributeValue', $this->getSelectAttributeOptionValue(false));
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #15
0
 /** Returns the display name for this tree (localized and escaped accordingly to $format)
  * @param  string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getTreeDisplayName($format = 'html')
 {
     $value = tc('TreeName', $this->topicTreeName);
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #16
0
ファイル: Set.php プロジェクト: meixelsberger/concrete5-5.7.0
 /** Returns the display name for this instance (localized and escaped accordingly to $format)
  * @param string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getBlockTypeSetDisplayName($format = 'html')
 {
     $value = tc('BlockTypeSetName', $this->btsName);
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #17
0
 /** Returns the display name for this tree (localized and escaped accordingly to $format)
  * @param  string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
  *
  * @return string
  */
 public function getTreeDisplayName($format = 'html')
 {
     $value = tc('TreeName', 'File Manager');
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #18
0
ファイル: TemplateFile.php プロジェクト: ceko/concrete5-1
 /** Returns the display name for this template file (localized and escaped accordingly to $format)
  * @param string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getTemplateFileDisplayName($format = 'html')
 {
     $displayName = tc('TemplateFileName', $this->name);
     switch ($format) {
         case 'html':
             return h($displayName);
         case 'text':
         default:
             return $displayName;
     }
 }
コード例 #19
0
ファイル: key.php プロジェクト: Zyqsempai/amanet
 /** Returns the display description for this permission key (localized and escaped accordingly to $format)
  * @param string $format = 'html'
  *	Escape the result in html format (if $format is 'html').
  *	If $format is 'text' or any other value, the display description won't be escaped.
  * @return string
  */
 public function getPermissionKeyDisplayDescription($format = 'html')
 {
     $value = tc('PermissionKeyDescription', $this->getPermissionKeyDescription());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #20
0
ファイル: Workflow.php プロジェクト: WillemAnchor/concrete5
 /**
  * Returns the display name for this workflow (localized and escaped accordingly to $format)
  * @param string $format = 'html'
  *    Escape the result in html format (if $format is 'html').
  *    If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getWorkflowDisplayName($format = 'html')
 {
     $value = tc('WorkflowName', $this->getWorkflowName());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #21
0
 public function getPageTypeComposerFormLayoutSetControlDisplayDescription($format = 'html')
 {
     $value = tc('PageTypeComposerFormLayoutSetControlDescription', $this->getPageTypeComposerFormLayoutSetControlDescription());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #22
0
ファイル: Type.php プロジェクト: digideskio/concrete5
 /** Returns the display name for this instance (localized and escaped accordingly to $format)
  * @param string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getPageTypePublishTargetTypeDisplayName($format = 'html')
 {
     $value = tc('PageTypePublishTargetTypeName', $this->ptPublishTargetTypeName);
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #23
0
 /** Returns the display name for this tree (localized and escaped accordingly to $format)
  * @param  string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
  *
  * @return string
  */
 public function getTreeDisplayName($format = 'html')
 {
     $value = tc('TreeName', 'Express Entries Tree');
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #24
0
ファイル: Type.php プロジェクト: ceko/concrete5-1
 public function getPageTypeComposerControlTypeDisplayName($format = 'html')
 {
     $value = tc('PageTypeComposerControlTypeName', $this->getPageTypeComposerControlTypeName());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #25
0
ファイル: StorageLocation.php プロジェクト: ceko/concrete5-1
 /** Returns the display name for this storage location (localized and escaped accordingly to $format)
  * @param string $format = 'html'
  *    Escape the result in html format (if $format is 'html').
  *    If $format is 'text' or any other value, the display name won't be escaped.
  * @return string
  */
 public function getDisplayName($format = 'html')
 {
     $value = tc('StorageLocationName', $this->getName());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #26
0
ファイル: key.php プロジェクト: ojalehto/concrete5-legacy
 /** Returns the display name for this attribute (localized and escaped accordingly to $format)
  * @param string $format = 'html'
  *	Escape the result in html format (if $format is 'html').
  *	If $format is 'text' or any other value, the display name won't be escaped. 
  * @return string
  */
 public function getAttributeKeyDisplayName($format = 'html')
 {
     $value = tc('AttributeKeyName', $this->getAttributeKeyName());
     switch ($format) {
         case 'html':
             return h($value);
         case 'text':
         default:
             return $value;
     }
 }
コード例 #27
0
ファイル: Topic.php プロジェクト: ngreimel/kovent
 public function getTreeNodeDisplayName($format = 'html')
 {
     $name = Core::make('helper/text')->unhandle($this->getTreeNodeName());
     $name = tc($this->getTreeNodeTranslationContext(), $name);
     switch ($format) {
         case 'html':
             return h($name);
         case 'text':
         default:
             return $name;
     }
 }
コード例 #28
0
ファイル: Topic.php プロジェクト: ppiedaderawnet/concrete5
 public function getTreeNodeDisplayName($format = 'html')
 {
     $name = $this->getTreeNodeName();
     $name = tc($this->getTreeNodeTranslationContext(), $name);
     switch ($format) {
         case 'html':
             return h($name);
         case 'text':
         default:
             return $name;
     }
 }
コード例 #29
0
 public function run()
 {
     Yii::import('application.modules.apartments.helpers.apartmentsHelper');
     $this->widgetTitle = tc('Special offers');
     $this->criteria = new CDbCriteria();
     $this->criteria->addCondition('is_special_offer = 1');
     $result = apartmentsHelper::getApartments(param('countListitng' . User::getModeListShow(), 6), $this->usePagination, 0, $this->criteria);
     if ($this->count) {
         $result['count'] = $this->count;
     }
     $this->render('widgetApartments_list', $result);
 }
コード例 #30
0
ファイル: UserAds.php プロジェクト: barricade86/raui
 public static function returnStatusHtml($data, $tableId, $onclick = 0, $ignore = 0)
 {
     if ($ignore && $data->id == $ignore) {
         return '';
     }
     $name = tc('Inactive');
     if ($data->active == Apartment::STATUS_MODERATION) {
         $name = tc('Awaiting moderation');
     } elseif ($data->active == Apartment::STATUS_ACTIVE) {
         $name = tc('Active');
     }
     return '<div align="center">' . $name . '</div>';
 }