Esempio n. 1
0
 public function view()
 {
     $this->requireAsset('javascript', 'jquery');
     $ml = Section::getList();
     $c = \Page::getCurrentPage();
     $al = Section::getBySectionOfSite($c);
     $languages = [];
     $locale = null;
     if ($al !== null) {
         $locale = $al->getLanguage();
     }
     if (!$locale) {
         $locale = \Localization::activeLocale();
         $al = Section::getByLocale($locale);
     }
     foreach ($ml as $m) {
         $languages[$m->getCollectionID()] = $m->getLanguageText($m->getLocale());
     }
     $this->set('languages', $languages);
     $this->set('languageSections', $ml);
     $this->set('activeLanguage', $al ? $al->getCollectionID() : null);
     $dl = $this->app->make('multilingual/detector');
     $this->set('defaultLocale', $dl->getPreferredSection());
     $this->set('locale', $locale);
     $this->set('cID', $c->getCollectionID());
 }
Esempio n. 2
0
	public function do_update($pkgHandle = false) {
		$tp = new TaskPermission();
		if ($tp->canInstallPackages()) { 
			if ($pkgHandle) {
				$tests = Package::testForInstall($pkgHandle, false);
				if (is_array($tests)) {
					$tests = Package::mapError($tests);
					$this->set('error', $tests);
				} else {
					$p = Package::getByHandle($pkgHandle);
					$currentLocale = Localization::activeLocale();
					if ($currentLocale != 'en_US') {
						// Prevent the database records being stored in wrong language
						Localization::changeLocale('en_US');
					}
					try {
						$p->upgradeCoreData();
						if ($currentLocale != 'en_US') {
							Localization::changeLocale($currentLocale);
						}
						$p->upgrade();
						$this->set('message', t('The package has been updated successfully.'));
					} catch(Exception $e) {
						$this->set('error', $e);
					}
				}
			}
		}
		$this->view();
	}
Esempio n. 3
0
	protected function testAndRunInstall() {
		if (file_exists(DIR_CONFIG_SITE . '/site_install_user.php')) {
			require(DIR_CONFIG_SITE . '/site_install.php');
			@include(DIR_CONFIG_SITE . '/site_install_user.php');
			if (defined('ACTIVE_LOCALE') && Localization::activeLocale() !== ACTIVE_LOCALE) {
				Localization::changeLocale(ACTIVE_LOCALE);
			}
			$e = Loader::helper('validation/error');
			$e = $this->validateDatabase($e);
			if ($e->has()) {
				$this->set('error', $e);
			} else {
				$this->addHeaderItem(Loader::helper('html')->css('jquery.ui.css'));
				$this->addHeaderItem(Loader::helper('html')->javascript('jquery.ui.js'));
				if (defined('INSTALL_STARTING_POINT') && INSTALL_STARTING_POINT) { 
					$spl = Loader::startingPointPackage(INSTALL_STARTING_POINT);
				} else {
					$spl = Loader::startingPointPackage('standard');
				}
				$this->set('installPackage', $spl->getPackageHandle());
				$this->set('installRoutines', $spl->getInstallRoutines());
				$this->set('successMessage', t('Congratulations. concrete5 has been installed. You have been logged in as <b>%s</b> with the password you chose. If you wish to change this password, you may do so from the users area of the dashboard.', USER_SUPER, $uPassword));
			}
		}
	}
Esempio n. 4
0
 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 . '%') . ")");
 }
 public function deliverQueryObject()
 {
     $query = parent::deliverQueryObject();
     $u = new User();
     if ($u->isLoggedIn()) {
         $uID = $u->getUserID();
     } else {
         $uID = -1;
     }
     if ($uID != -1) {
         // $query->leftJoin('p', 'UserPageFavorites', 'fav', 'p.cID = fav.cID');
         // $query->addSelect('fav.uID IS NOT NULL as favorite');
         // $query->leftJoin('p', 'UserPageFavorites', 'fav', 'p.pID = fav.pID and fav.uID = '.(int)$u->getUserID());
         $relation = Database::get()->createQueryBuilder();
         $relation->select('mpRelationID')->from('MultilingualPageRelations', 'mppr')->leftJoin('mppr', 'UserPageFavorites', 'fav', 'mppr.CID = fav.cID WHERE fav.uID = :uID')->setParameter('uID', (int) $uID);
         //     // ->
         // andWhere('fav.uID = :uID');
         $query->leftJoin('p', 'MultilingualPageRelations', 'mmpr2', 'p.cID = mmpr2.cID');
         $query->addSelect('mmpr2.mpRelationID');
         // $query->andWhere("mmpr2.mpRelationID in (" . $relation . ")");
         $query->addSelect(' mmpr2.mpRelationID in (' . $relation . ') as favorite');
         $query->andWhere("mmpr2.mpLocale = :loc");
         $query->setParameter('uID', (int) $uID);
         $query->setParameter('loc', \Localization::activeLocale());
         if ($this->onlyFavorites) {
             // Does this slow the query or what
             $query->andWhere('mmpr2.mpRelationID in (' . $relation . ')');
         }
         // var_dump(\Localization::activeLocale());
         // echo $query->getSql();
     }
     return $query;
 }
 public function getMembers()
 {
     // get locale
     $locale = \Localization::activeLocale();
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $al = Section::getBySectionOfSite($c);
         if (is_object($al)) {
             $locale = $al->getLocale();
         }
     }
     // fix for sorting
     if ($locale == 'en_US') {
         $locale = 'en';
     }
     $params = array('limit' => 100, 'member_of' => $this->parentId, 'sort' => '1058', 'l' => $locale);
     // build URL with params
     $uh = \Core::make('helper/url');
     $url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/org/members';
     $url = $uh->buildQuery($url, $params);
     // fetch JSON
     $data = \Core::make("helper/file")->getContents($url);
     $data = json_decode($data, true);
     return $data;
 }
 public function __construct()
 {
     Loader::library('3rdparty/Zend/Locale');
     $countries = Zend_Locale::getTranslationList('territory', Localization::activeLocale(), 2);
     // unset invalid countries
     unset($countries['SU'], $countries['ZZ'], $countries['IM'], $countries['JE'], $countries['VD']);
     asort($countries, SORT_LOCALE_STRING);
     $this->countries = $countries;
 }
Esempio n. 8
0
 /** Returns the Zend_Locale instance for the current locale.
  * @return Zend_Locale
  */
 protected function getZendLocale()
 {
     static $zl;
     $locale = Localization::activeLocale();
     if (!isset($zl) || $locale != $zl->toString()) {
         $zl = new Zend_Locale($locale);
     }
     return $zl;
 }
Esempio n. 9
0
 public function __construct()
 {
     Loader::library('3rdparty/Zend/Locale');
     $countries = Zend_Locale::getTranslationList('territory', Localization::activeLocale(), 2);
     unset($countries['FX'], $countries['IM'], $countries['JE'], $countries['NT'], $countries['PU'], $countries['ZZ'], $countries['CS'], $countries['CT'], $countries['DD'], $countries['PC'], $countries['PZ'], $countries['SU'], $countries['VD'], $countries['YD']);
     $countriesFromEvent = Events::fire('on_get_countries_list', $countries);
     if (is_array($countriesFromEvent)) {
         $countries = $countriesFromEvent;
     } else {
         asort($countries, SORT_LOCALE_STRING);
     }
     $this->countries = $countries;
 }
Esempio n. 10
0
 /**
  * Get the localized site name.
  *
  * @param string $locale
  *
  * @return string
  */
 protected function getSiteNameForLocale($locale)
 {
     static $names = array();
     if (!isset($names[$locale])) {
         $prevLocale = \Localization::activeLocale();
         if ($prevLocale !== $locale) {
             \Localization::changeLocale($locale);
         }
         $names[$locale] = tc('SiteName', $this->app->make('config')->get('concrete.site'));
         if ($prevLocale !== $locale) {
             \Localization::changeLocale($prevLocale);
         }
     }
     return $names[$locale];
 }
Esempio n. 11
0
 /** 
  * Takes a "field" and grabs all the corresponding disparate fields from $_POST and translates into a timestamp
  * @param string $field The name of the field to translate
  * @param array $arr = null The array containing the value. If null (default) we'll use $_POST
  * @return string|false $dateTime In case of success returns the timestamp (in the format 'Y-m-d H:i:s' or 'Y-m-d'), otherwise returns false ($field value is not in the array) or '' (if $field value is empty).
  * If $field has both date and time, the resulting value will be converted fro user timezone to system timezone.
  * If $field has only date and not time, no timezone conversion will occur. 
  */
 public function translate($field, $arr = null)
 {
     if ($arr == null) {
         $arr = $_POST;
     }
     /* @var $dateHelper DateHelper */
     $dateHelper = Loader::helper('date');
     if (isset($arr[$field . '_dt'])) {
         $value = $arr[$field . '_dt'];
         if (strlen(trim($value)) === 0) {
             return '';
         }
         $format = defined('CUSTOM_DATE_APP_GENERIC_MDY') ? CUSTOM_DATE_APP_GENERIC_MDY : t('n/j/Y');
         $h = is_numeric($arr[$field . '_h']) ? $arr[$field . '_h'] : '00';
         $m = is_numeric($arr[$field . '_m']) ? $arr[$field . '_m'] : '00';
         if (isset($arr[$field . '_a'])) {
             if ($arr[$field . '_a'] === 'AM') {
                 $a = $dateHelper->date('A', mktime(1));
             } else {
                 $a = $dateHelper->date('A', mktime(13));
             }
             $value .= " {$h}:{$m} {$a}";
             $format .= ' h:i A';
         } else {
             $value .= " {$h}:{$m}";
             $format .= ' H:i';
         }
         $d = new Zend_Date();
         $d->setTimezone($dateHelper->getTimezone('user'));
         $d->set($value, $format, Localization::activeLocale());
         return $dateHelper->formatCustom('Y-m-d H:i:s', $d, 'system');
     } elseif (isset($arr[$field])) {
         $value = $arr[$field];
         if (strlen(trim($value)) === 0) {
             return '';
         }
         $format = defined('CUSTOM_DATE_APP_GENERIC_MDY') ? CUSTOM_DATE_APP_GENERIC_MDY : t('n/j/Y');
         $d = new Zend_Date();
         $d->setTimezone($dateHelper->getTimezone('system'));
         $d->set($value, $format, Localization::activeLocale());
         return $dateHelper->formatCustom('Y-m-d', $d, 'system');
     } else {
         return false;
     }
 }
Esempio n. 12
0
 /** Takes text and converts it to an ASCII-only string (characters with code between 32 and 127, plus \t, \n and \r).
  * @param string $text The text to be converted.
  * @param string $locale='' The locale for the string. If not specified we consider the current locale.
  * @return string
  */
 public function asciify($text, $locale = '')
 {
     if (!strlen($locale)) {
         $locale = \Localization::activeLocale();
     }
     $language = substr($locale, 0, strcspn($locale, '_'));
     $text = \URLify::downcode($text, $language);
     if (preg_match('/[^\\t\\r\\n\\x20-\\x7e]/', $text)) {
         if (function_exists('iconv')) {
             $t = @iconv(APP_CHARSET, 'US-ASCII//IGNORE//TRANSLIT', $text);
             if (is_string($t)) {
                 $text = $t;
             }
         }
         $text = preg_replace('/[^\\t\\r\\n\\x20-\\x7e]/', '', $text);
     }
     return $text;
 }
Esempio n. 13
0
 public function reset()
 {
     $locale = Localization::activeLocale();
     if ($locale === $this->locale) {
         return;
     }
     $this->locale = $locale;
     $this->stateProvinces['GB'] = $this->stateProvinces['UK'];
     $stateProvincesFromEvent = Events::fire('on_get_states_provinces_list', $this->stateProvinces);
     if (is_array($stateProvincesFromEvent)) {
         $this->stateProvinces = $stateProvincesFromEvent;
     } else {
         foreach (array_keys($this->stateProvinces) as $country) {
             if (!in_array($country, $this->sortedCountries)) {
                 asort($this->stateProvinces[$country]);
             }
         }
     }
 }
 public function getMember()
 {
     // get locale
     $locale = \Localization::activeLocale();
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $al = Section::getBySectionOfSite($c);
         if (is_object($al)) {
             $locale = $al->getLocale();
         }
     }
     // build URL with params
     $uh = \Core::make('helper/url');
     $url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/org/members/' . $this->memberId;
     $url = $uh->buildQuery($url, array('l' => $locale));
     // fetch JSON
     $data = \Core::make("helper/file")->getContents($url);
     $data = json_decode($data, true);
     return $data;
 }
 public function getSkills($sort = 'name_asc')
 {
     // get locale
     $locale = \Localization::activeLocale();
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $al = Section::getBySectionOfSite($c);
         if (is_object($al)) {
             $locale = $al->getLocale();
         }
     }
     // fix for sorting
     if ($locale == 'en_US') {
         $locale = 'en';
     }
     // defaults
     $params = array('limit' => 100, 'sort' => $sort, 'l' => $locale);
     // build URL with params
     $url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/events/' . $this->eventId . '/skills';
     $url .= '?';
     $url .= http_build_query($params);
     // block settings
     if ($this->sectorId) {
         $url .= '&';
         $url .= http_build_query(array('sector' => $this->sectorId));
     }
     if ($this->types) {
         $skillTypes = explode(',', $this->types);
         foreach ($skillTypes as $skillType) {
             $url .= '&';
             $url .= http_build_query(array('type' => $skillType));
         }
     }
     // fetch JSON
     $data = \Core::make("helper/file")->getContents($url);
     $data = json_decode($data, true);
     return $data;
 }
 /**
  * Returns the list of States/Provinces for some countries (States/Provinces are sorted alphabetically).
  *
  * @return array Returns an array whose keys are the country codes and the values are arrays (with keys: State/Province code, values: State/Province names)
  */
 public function getAll()
 {
     $locale = \Localization::activeLocale();
     if (!isset($this->localizedStatesProvinces[$locale])) {
         $provinces = array('US' => array('AK' => tc('US State', 'Alaska'), 'AL' => tc('US State', 'Alabama'), 'AR' => tc('US State', 'Arkansas'), 'AZ' => tc('US State', 'Arizona'), 'CA' => tc('US State', 'California'), 'CO' => tc('US State', 'Colorado'), 'CT' => tc('US State', 'Connecticut'), 'DC' => tc('US State', 'Washington, DC'), 'DE' => tc('US State', 'Delaware'), 'FL' => tc('US State', 'Florida'), 'GA' => tc('US State', 'Georgia'), 'HI' => tc('US State', 'Hawaii'), 'IA' => tc('US State', 'Iowa'), 'ID' => tc('US State', 'Idaho'), 'IL' => tc('US State', 'Illinois'), 'IN' => tc('US State', 'Indiana'), 'KS' => tc('US State', 'Kansas'), 'KY' => tc('US State', 'Kentucky'), 'LA' => tc('US State', 'Louisiana'), 'MA' => tc('US State', 'Massachusetts'), 'MD' => tc('US State', 'Maryland'), 'ME' => tc('US State', 'Maine'), 'MI' => tc('US State', 'Michigan'), 'MN' => tc('US State', 'Minnesota'), 'MO' => tc('US State', 'Missouri'), 'MS' => tc('US State', 'Mississippi'), 'MT' => tc('US State', 'Montana'), 'NC' => tc('US State', 'North Carolina'), 'ND' => tc('US State', 'North Dakota'), 'NE' => tc('US State', 'Nebraska'), 'NH' => tc('US State', 'New Hampshire'), 'NJ' => tc('US State', 'New Jersey'), 'NM' => tc('US State', 'New Mexico'), 'NV' => tc('US State', 'Nevada'), 'NY' => tc('US State', 'New York'), 'OH' => tc('US State', 'Ohio'), 'OK' => tc('US State', 'Oklahoma'), 'OR' => tc('US State', 'Oregon'), 'PA' => tc('US State', 'Pennsylvania'), 'RI' => tc('US State', 'Rhode Island'), 'SC' => tc('US State', 'South Carolina'), 'SD' => tc('US State', 'South Dakota'), 'TN' => tc('US State', 'Tennessee'), 'TX' => tc('US State', 'Texas'), 'UT' => tc('US State', 'Utah'), 'VA' => tc('US State', 'Virginia'), 'VT' => tc('US State', 'Vermont'), 'WA' => tc('US State', 'Washington'), 'WI' => tc('US State', 'Wisconsin'), 'WV' => tc('US State', 'West Virginia'), 'WY' => tc('US State', 'Wyoming')), 'CA' => array('AB' => tc('Canadian Province', 'Alberta'), 'BC' => tc('Canadian Province', 'British Columbia'), 'MB' => tc('Canadian Province', 'Manitoba'), 'NB' => tc('Canadian Province', 'New Brunswick'), 'NF' => tc('Canadian Province', 'Newfoundland'), 'NT' => tc('Canadian Province', 'Northwest Territories'), 'NS' => tc('Canadian Province', 'Nova Scotia'), 'NU' => tc('Canadian Province', 'Nunavut'), 'ON' => tc('Canadian Province', 'Ontario'), 'PE' => tc('Canadian Province', 'Prince Edward Island'), 'QC' => tc('Canadian Province', 'Quebec'), 'SK' => tc('Canadian Province', 'Saskatchewan'), 'YT' => tc('Canadian Province', 'Yukon')), 'AU' => array('ACT' => tc('Australian State', 'Australian Capital Territory'), 'NSW' => tc('Australian State', 'New South Wales'), 'NT' => tc('Australian State', 'Northern Territory'), 'QLD' => tc('Australian State', 'Queensland'), 'SA' => tc('Australian State', 'South Australia'), 'TAS' => tc('Australian State', 'Tasmania'), 'VIC' => tc('Australian State', 'Victoria'), 'WA' => tc('Australian State', 'Western Australia')), 'DE' => array('BB' => tc('German State', 'Brandenburg'), 'BE' => tc('German State', 'Berlin'), 'BW' => tc('German State', 'Baden-Württemberg'), 'BY' => tc('German State', 'Bavaria'), 'HB' => tc('German State', 'Bremen'), 'HE' => tc('German State', 'Hesse'), 'HH' => tc('German State', 'Hamburg'), 'MV' => tc('German State', 'Mecklenburg-Vorpommern'), 'NI' => tc('German State', 'Lower Saxony'), 'NW' => tc('German State', 'North Rhine-Westphalia'), 'RP' => tc('German State', 'Rhineland-Palatinate'), 'SH' => tc('German State', 'Schleswig-Holstein'), 'SL' => tc('German State', 'Saarland'), 'SN' => tc('German State', 'Saxony'), 'ST' => tc('German State', 'Saxony-Anhalt'), 'TH' => tc('German State', 'Thuringia')), 'FR' => array('01' => tc('French Department', 'Ain'), '02' => tc('French Department', 'Aisne'), '03' => tc('French Department', 'Allier'), '04' => tc('French Department', 'Alpes-de-Haute-Provence'), '05' => tc('French Department', 'Hautes-Alpes'), '06' => tc('French Department', 'Alpes-Maritimes'), '07' => tc('French Department', 'Ardèche'), '08' => tc('French Department', 'Ardennes'), '09' => tc('French Department', 'Ariège'), '10' => tc('French Department', 'Aube'), '11' => tc('French Department', 'Aude'), '12' => tc('French Department', 'Aveyron'), '13' => tc('French Department', 'Bouches-du-Rhône'), '14' => tc('French Department', 'Calvados'), '15' => tc('French Department', 'Cantal'), '16' => tc('French Department', 'Charente'), '17' => tc('French Department', 'Charente-Maritime'), '18' => tc('French Department', 'Cher'), '19' => tc('French Department', 'Corrèze'), '2A' => tc('French Department', 'Corse-du-Sud'), '2B' => tc('French Department', 'Haute-Corse'), '21' => tc('French Department', 'Côte-d\'Or'), '22' => tc('French Department', 'Côtes-d\'Armor'), '23' => tc('French Department', 'Creuse'), '24' => tc('French Department', 'Dordogne'), '25' => tc('French Department', 'Doubs'), '26' => tc('French Department', 'Drôme'), '27' => tc('French Department', 'Eure'), '28' => tc('French Department', 'Eure-et-Loir'), '29' => tc('French Department', 'Finistère'), '30' => tc('French Department', 'Gard'), '31' => tc('French Department', 'Haute-Garonne'), '32' => tc('French Department', 'Gers'), '33' => tc('French Department', 'Gironde'), '34' => tc('French Department', 'Hérault'), '35' => tc('French Department', 'Ille-et-Vilaine'), '36' => tc('French Department', 'Indre'), '37' => tc('French Department', 'Indre-et-Loire'), '38' => tc('French Department', 'Isère'), '39' => tc('French Department', 'Jura'), '40' => tc('French Department', 'Landes'), '41' => tc('French Department', 'Loir-et-Cher'), '42' => tc('French Department', 'Loire'), '43' => tc('French Department', 'Haute-Loire'), '44' => tc('French Department', 'Loire-Atlantique'), '45' => tc('French Department', 'Loiret'), '46' => tc('French Department', 'Lot'), '47' => tc('French Department', 'Lot-et-Garonne'), '48' => tc('French Department', 'Lozère'), '49' => tc('French Department', 'Maine-et-Loire'), '50' => tc('French Department', 'Manche'), '51' => tc('French Department', 'Marne'), '52' => tc('French Department', 'Haute-Marne'), '53' => tc('French Department', 'Mayenne'), '54' => tc('French Department', 'Meurthe-et-Moselle'), '55' => tc('French Department', 'Meuse'), '56' => tc('French Department', 'Morbihan'), '57' => tc('French Department', 'Moselle'), '58' => tc('French Department', 'Nièvre'), '59' => tc('French Department', 'Nord'), '60' => tc('French Department', 'Oise'), '61' => tc('French Department', 'Orne'), '62' => tc('French Department', 'Pas-de-Calais'), '63' => tc('French Department', 'Puy-de-Dôme'), '64' => tc('French Department', 'Pyrénées-Atlantiques'), '65' => tc('French Department', 'Hautes-Pyrénées'), '66' => tc('French Department', 'Pyrénées-Orientales'), '67' => tc('French Department', 'Bas-Rhin'), '68' => tc('French Department', 'Haut-Rhin'), '69' => tc('French Department', 'Rhône'), '69M' => tc('French Department', 'Metropolis of Lyon'), '70' => tc('French Department', 'Haute-Saône'), '71' => tc('French Department', 'Saône-et-Loire'), '72' => tc('French Department', 'Sarthe'), '73' => tc('French Department', 'Savoie'), '74' => tc('French Department', 'Haute-Savoie'), '75' => tc('French Department', 'Paris'), '76' => tc('French Department', 'Seine-Maritime'), '77' => tc('French Department', 'Seine-et-Marne'), '78' => tc('French Department', 'Yvelines'), '79' => tc('French Department', 'Deux-Sèvres'), '80' => tc('French Department', 'Somme'), '81' => tc('French Department', 'Tarn'), '82' => tc('French Department', 'Tarn-et-Garonne'), '83' => tc('French Department', 'Var'), '84' => tc('French Department', 'Vaucluse'), '85' => tc('French Department', 'Vendée'), '86' => tc('French Department', 'Vienne'), '87' => tc('French Department', 'Haute-Vienne'), '88' => tc('French Department', 'Vosges'), '89' => tc('French Department', 'Yonne'), '90' => tc('French Department', 'Territoire de Belfort'), '91' => tc('French Department', 'Essonne'), '92' => tc('French Department', 'Hauts-de-Seine'), '93' => tc('French Department', 'Seine-Saint-Denis'), '94' => tc('French Department', 'Val-de-Marne'), '95' => tc('French Department', 'Val-d\'Oise'), '971' => tc('French Department', 'Guadeloupe'), '972' => tc('French Department', 'Martinique'), '973' => tc('French Department', 'Guyane'), '974' => tc('French Department', 'La Réunion'), '976' => tc('French Department', 'Mayotte')), 'GB' => array('ANGLES' => tc('British Region', 'Anglesey'), 'ANGUS' => tc('British Region', 'Angus'), 'ARBERD' => tc('British Region', 'Aberdeenshire'), 'ARGYLL' => tc('British Region', 'Argyllshire'), 'AYRSH' => tc('British Region', 'Ayrshire'), 'BANFF' => tc('British Region', 'Banffshire'), 'BEDS' => tc('British Region', 'Bedfordshire'), 'BERKS' => tc('British Region', 'Berkshire'), 'BERWICK' => tc('British Region', 'Berwickshire'), 'BRECK' => tc('British Region', 'Brecknockshire'), 'BUCKS' => tc('British Region', 'Buckinghamshire'), 'BUTE' => tc('British Region', 'Buteshire'), 'CAERN' => tc('British Region', 'Caernarfonshire'), 'CAITH' => tc('British Region', 'Caithness'), 'CAMBS' => tc('British Region', 'Cambridgeshire'), 'CARDIG' => tc('British Region', 'Cardiganshire'), 'CARMA' => tc('British Region', 'Carmathenshire'), 'CHESH' => tc('British Region', 'Cheshire'), 'CLACKM' => tc('British Region', 'Clackmannanshire'), 'CORN' => tc('British Region', 'Cornwall'), 'CROMART' => tc('British Region', 'Cromartyshire'), 'CUMB' => tc('British Region', 'Cumberland'), 'DENBIG' => tc('British Region', 'Denbighshire'), 'DERBY' => tc('British Region', 'Derbyshire'), 'DEVON' => tc('British Region', 'Devon'), 'DORSET' => tc('British Region', 'Dorset'), 'DUMFR' => tc('British Region', 'Dumfriesshire'), 'DUNBART' => tc('British Region', 'Dunbartonshire'), 'DURHAM' => tc('British Region', 'Durham'), 'EASTL' => tc('British Region', 'East Lothian'), 'ESSEX' => tc('British Region', 'Essex'), 'FIFE' => tc('British Region', 'Fife'), 'FLINTS' => tc('British Region', 'Flintshire'), 'GLAMO' => tc('British Region', 'Glamorgan'), 'GLOUS' => tc('British Region', 'Gloucestershire'), 'HANTS' => tc('British Region', 'Hampshire'), 'HEREF' => tc('British Region', 'Herefordshire'), 'HERTS' => tc('British Region', 'Hertfordshire'), 'HUNTS' => tc('British Region', 'Huntingdonshire'), 'INVERN' => tc('British Region', 'Inverness-shire'), 'KENT' => tc('British Region', 'Kent'), 'KINCARD' => tc('British Region', 'Kincardineshire'), 'KINROSS' => tc('British Region', 'Kinross-shire'), 'KIRKCUD' => tc('British Region', 'Kircudbrightshire'), 'LANARK' => tc('British Region', 'Lanarkshire'), 'LANCS' => tc('British Region', 'Lancashire'), 'LEICS' => tc('British Region', 'Leicestershire'), 'LINCS' => tc('British Region', 'Lincolnshire'), 'LONDON' => tc('British Region', 'London'), 'MERION' => tc('British Region', 'Merioneth'), 'MERSEYSIDE' => tc('British Region', 'Merseyside'), 'MIDDLE' => tc('British Region', 'Middlesex'), 'MIDLOTH' => tc('British Region', 'Midlothian'), 'MONMOUTH' => tc('British Region', 'Monmouthshire'), 'MONTG' => tc('British Region', 'Mongtomeryshire'), 'MORAY' => tc('British Region', 'Morayshire'), 'NAIRN' => tc('British Region', 'Nairnshire'), 'NHANTS' => tc('British Region', 'Northamptonshire'), 'NORF' => tc('British Region', 'Norfolk'), 'NOTTS' => tc('British Region', 'Nottinghamshire'), 'NTHUMB' => tc('British Region', 'Northumberland'), 'ORKNEY' => tc('British Region', 'Orkeny'), 'OXON' => tc('British Region', 'Oxfordshire'), 'PEEBLESS' => tc('British Region', 'Peeblesshire'), 'PEMBR' => tc('British Region', 'Pembrokeshire'), 'PERTH' => tc('British Region', 'Perthshire'), 'RADNOR' => tc('British Region', 'Radnorshire'), 'RENFREW' => tc('British Region', 'Renfrewshire'), 'ROSSSH' => tc('British Region', 'Ross-shire'), 'ROXBURGH' => tc('British Region', 'Roxburghshire'), 'RUTL' => tc('British Region', 'Rutland'), 'SELKIRK' => tc('British Region', 'Selkirkshire'), 'SHETLAND' => tc('British Region', 'Shetland'), 'SHROPS' => tc('British Region', 'Shropshire'), 'SOM' => tc('British Region', 'Somerset'), 'STAFFS' => tc('British Region', 'Staffordshire'), 'STIRLING' => tc('British Region', 'Stirlingshire'), 'SUFF' => tc('British Region', 'Suffolk'), 'SURREY' => tc('British Region', 'Surrey'), 'SUSS' => tc('British Region', 'Sussex'), 'SUTHER' => tc('British Region', 'Sutherland'), 'WARKS' => tc('British Region', 'Warwickshire'), 'WESTL' => tc('British Region', 'West Lothian'), 'WESTMOR' => tc('British Region', 'Westmorland'), 'WIGTOWN' => tc('British Region', 'Wigtownshire'), 'WILTS' => tc('British Region', 'Wiltshire'), 'WORCES' => tc('British Region', 'Worcestershire'), 'YORK' => tc('British Region', 'Yorkshire')), 'IE' => array('CO ANTRIM' => tc('Irish County', 'County Antrim'), 'CO ARMAGH' => tc('Irish County', 'County Armagh'), 'CO CARLOW' => tc('Irish County', 'County Carlow'), 'CO CAVAN' => tc('Irish County', 'County Cavan'), 'CO CLARE' => tc('Irish County', 'County Clare'), 'CO CORK' => tc('Irish County', 'County Cork'), 'CO DERRY' => tc('Irish County', 'County Londonderry'), 'CO DONEGAL' => tc('Irish County', 'County Donegal'), 'CO DOWN' => tc('Irish County', 'County Down'), 'CO DUBLIN' => tc('Irish County', 'County Dublin'), 'CO FERMANAGH' => tc('Irish County', 'County Fermanagh'), 'CO GALWAY' => tc('Irish County', 'County Galway'), 'CO KERRY' => tc('Irish County', 'County Kerry'), 'CO KILDARE' => tc('Irish County', 'County Kildare'), 'CO KILKENNY' => tc('Irish County', 'County Kilkenny'), 'CO LAOIS' => tc('Irish County', 'County Laois'), 'CO LEITRIM' => tc('Irish County', 'County Leitrim'), 'CO LIMERICK' => tc('Irish County', 'County Limerick'), 'CO LONGFORD' => tc('Irish County', 'County Longford'), 'CO LOUTH' => tc('Irish County', 'County Louth'), 'CO MAYO' => tc('Irish County', 'County Mayo'), 'CO MEATH' => tc('Irish County', 'County Meath'), 'CO MONAGHAN' => tc('Irish County', 'County Monaghan'), 'CO OFFALY' => tc('Irish County', 'County Offaly'), 'CO ROSCOMMON' => tc('Irish County', 'County Roscommon'), 'CO SLIGO' => tc('Irish County', 'County Sligo'), 'CO TIPPERARY' => tc('Irish County', 'County Tipperary'), 'CO TYRONE' => tc('Irish County', 'County Tyrone'), 'CO WATERFORD' => tc('Irish County', 'County Waterford'), 'CO WESTMEATH' => tc('Irish County', 'County Westmeath'), 'CO WEXFORD' => tc('Irish County', 'County Wexford'), 'CO WICKLOW' => tc('Irish County', 'County Wicklow')), 'NL' => array('DR' => tc('Dutch Province', 'Drente'), 'FL' => tc('Dutch Province', 'Flevoland'), 'FR' => tc('Dutch Province', 'Fryslân'), 'GL' => tc('Dutch Province', 'Gelderland'), 'GR' => tc('Dutch Province', 'Groningen'), 'LB' => tc('Dutch Province', 'Limburg'), 'NB' => tc('Dutch Province', 'North Brabant'), 'NH' => tc('Dutch Province', 'North Holland'), 'OV' => tc('Dutch Province', 'Overijssel'), 'UT' => tc('Dutch Province', 'Utrecht'), 'ZH' => tc('Dutch Province', 'South Holland'), 'ZL' => tc('Dutch Province', 'Zeeland')), 'BR' => array('AC' => tc('Brazilian State', 'Acre'), 'AL' => tc('Brazilian State', 'Alagoas'), 'AM' => tc('Brazilian State', 'Amazonas'), 'AP' => tc('Brazilian State', 'Amapá'), 'BA' => tc('Brazilian State', 'Bahia'), 'CE' => tc('Brazilian State', 'Ceará'), 'DF' => tc('Brazilian State', 'Distrito Federal'), 'ES' => tc('Brazilian State', 'Espirito Santo'), 'FN' => tc('Brazilian State', 'Fernando de Noronha'), 'GO' => tc('Brazilian State', 'Goiás'), 'MA' => tc('Brazilian State', 'Maranhão'), 'MG' => tc('Brazilian State', 'Minas Gerais'), 'MS' => tc('Brazilian State', 'Mato Grosso do Sul'), 'MT' => tc('Brazilian State', 'Mato Grosso'), 'PA' => tc('Brazilian State', 'Pará'), 'PB' => tc('Brazilian State', 'Paraíba'), 'PE' => tc('Brazilian State', 'Pernambuco'), 'PI' => tc('Brazilian State', 'Piauí'), 'PR' => tc('Brazilian State', 'Paraná'), 'RJ' => tc('Brazilian State', 'Rio de Janeiro'), 'RN' => tc('Brazilian State', 'Rio Grande do Norte'), 'RO' => tc('Brazilian State', 'Rondônia'), 'RR' => tc('Brazilian State', 'Roraima'), 'RS' => tc('Brazilian State', 'Rio Grande do Sul'), 'SC' => tc('Brazilian State', 'Santa Catarina'), 'SE' => tc('Brazilian State', 'Sergipe'), 'SP' => tc('Brazilian State', 'São Paulo'), 'TO' => tc('Brazilian State', 'Tocantins')), 'IT' => array('AG' => tc('Italian Provinces', 'Agrigento'), 'AL' => tc('Italian Provinces', 'Alessandria'), 'AN' => tc('Italian Provinces', 'Ancona'), 'AO' => tc('Italian Provinces', 'Aosta'), 'AP' => tc('Italian Provinces', 'Ascoli Piceno'), 'AQ' => tc('Italian Provinces', 'L\'Aquila'), 'AR' => tc('Italian Provinces', 'Arezzo'), 'AT' => tc('Italian Provinces', 'Asti'), 'AV' => tc('Italian Provinces', 'Avellino'), 'BA' => tc('Italian Provinces', 'Bari'), 'BG' => tc('Italian Provinces', 'Bergamo'), 'BI' => tc('Italian Provinces', 'Biella'), 'BL' => tc('Italian Provinces', 'Belluno'), 'BN' => tc('Italian Provinces', 'Benevento'), 'BO' => tc('Italian Provinces', 'Bologna'), 'BR' => tc('Italian Provinces', 'Brindisi'), 'BS' => tc('Italian Provinces', 'Brescia'), 'BT' => tc('Italian Provinces', 'Barletta-Andria-Trani'), 'BZ' => tc('Italian Provinces', 'South Tyrol'), 'CA' => tc('Italian Provinces', 'Cagliari'), 'CB' => tc('Italian Provinces', 'Campobasso'), 'CE' => tc('Italian Provinces', 'Caserta'), 'CH' => tc('Italian Provinces', 'Chieti'), 'CI' => tc('Italian Provinces', 'Carbonia-Iglesias'), 'CL' => tc('Italian Provinces', 'Caltanissetta'), 'CN' => tc('Italian Provinces', 'Cuneo'), 'CO' => tc('Italian Provinces', 'Como'), 'CR' => tc('Italian Provinces', 'Cremona'), 'CS' => tc('Italian Provinces', 'Cosenza'), 'CT' => tc('Italian Provinces', 'Catania'), 'CZ' => tc('Italian Provinces', 'Catanzaro'), 'EN' => tc('Italian Provinces', 'Enna'), 'FC' => tc('Italian Provinces', 'Forlì-Cesena'), 'FE' => tc('Italian Provinces', 'Ferrara'), 'FG' => tc('Italian Provinces', 'Foggia'), 'FI' => tc('Italian Provinces', 'Florence'), 'FM' => tc('Italian Provinces', 'Fermo'), 'FR' => tc('Italian Provinces', 'Frosinone'), 'GE' => tc('Italian Provinces', 'Genoa'), 'GO' => tc('Italian Provinces', 'Gorizia'), 'GR' => tc('Italian Provinces', 'Grosseto'), 'IM' => tc('Italian Provinces', 'Imperia'), 'IS' => tc('Italian Provinces', 'Isernia'), 'KR' => tc('Italian Provinces', 'Crotone'), 'LC' => tc('Italian Provinces', 'Lecco'), 'LE' => tc('Italian Provinces', 'Lecce'), 'LI' => tc('Italian Provinces', 'Livorno'), 'LO' => tc('Italian Provinces', 'Lodi'), 'LT' => tc('Italian Provinces', 'Latina'), 'LU' => tc('Italian Provinces', 'Lucca'), 'MB' => tc('Italian Provinces', 'Monza and Brianza'), 'MC' => tc('Italian Provinces', 'Macerata'), 'ME' => tc('Italian Provinces', 'Messina'), 'MI' => tc('Italian Provinces', 'Milan'), 'MN' => tc('Italian Provinces', 'Mantua'), 'MO' => tc('Italian Provinces', 'Modena'), 'MS' => tc('Italian Provinces', 'Massa and Carrara'), 'MT' => tc('Italian Provinces', 'Matera'), 'NA' => tc('Italian Provinces', 'Naples'), 'NO' => tc('Italian Provinces', 'Novara'), 'NU' => tc('Italian Provinces', 'Nuoro'), 'OG' => tc('Italian Provinces', 'Ogliastra'), 'OR' => tc('Italian Provinces', 'Oristano'), 'OT' => tc('Italian Provinces', 'Olbia-Tempio'), 'PA' => tc('Italian Provinces', 'Palermo'), 'PC' => tc('Italian Provinces', 'Piacenza'), 'PD' => tc('Italian Provinces', 'Padua'), 'PE' => tc('Italian Provinces', 'Pescara'), 'PG' => tc('Italian Provinces', 'Perugia'), 'PI' => tc('Italian Provinces', 'Pisa'), 'PN' => tc('Italian Provinces', 'Pordenone'), 'PO' => tc('Italian Provinces', 'Prato'), 'PR' => tc('Italian Provinces', 'Parma'), 'PT' => tc('Italian Provinces', 'Pistoia'), 'PU' => tc('Italian Provinces', 'Pesaro and Urbino'), 'PV' => tc('Italian Provinces', 'Pavia'), 'PZ' => tc('Italian Provinces', 'Potenza'), 'RA' => tc('Italian Provinces', 'Ravenna'), 'RC' => tc('Italian Provinces', 'Reggio Calabria'), 'RE' => tc('Italian Provinces', 'Reggio Emilia'), 'RG' => tc('Italian Provinces', 'Ragusa'), 'RI' => tc('Italian Provinces', 'Rieti'), 'RM' => tc('Italian Provinces', 'Rome'), 'RN' => tc('Italian Provinces', 'Rimini'), 'RO' => tc('Italian Provinces', 'Rovigo'), 'SA' => tc('Italian Provinces', 'Salerno'), 'SI' => tc('Italian Provinces', 'Siena'), 'SO' => tc('Italian Provinces', 'Sondrio'), 'SP' => tc('Italian Provinces', 'La Spezia'), 'SR' => tc('Italian Provinces', 'Syracuse'), 'SS' => tc('Italian Provinces', 'Sassari'), 'SV' => tc('Italian Provinces', 'Savona'), 'TA' => tc('Italian Provinces', 'Taranto'), 'TE' => tc('Italian Provinces', 'Teramo'), 'TN' => tc('Italian Provinces', 'Trento'), 'TO' => tc('Italian Provinces', 'Turin'), 'TP' => tc('Italian Provinces', 'Trapani'), 'TR' => tc('Italian Provinces', 'Terni'), 'TS' => tc('Italian Provinces', 'Trieste'), 'TV' => tc('Italian Provinces', 'Treviso'), 'UD' => tc('Italian Provinces', 'Udine'), 'VA' => tc('Italian Provinces', 'Varese'), 'VB' => tc('Italian Provinces', 'Verbano-Cusio-Ossola'), 'VC' => tc('Italian Provinces', 'Vercelli'), 'VE' => tc('Italian Provinces', 'Venice'), 'VI' => tc('Italian Provinces', 'Vicenza'), 'VR' => tc('Italian Provinces', 'Verona'), 'VS' => tc('Italian Provinces', 'Medio Campidano'), 'VT' => tc('Italian Provinces', 'Viterbo'), 'VV' => tc('Italian Provinces', 'Vibo Valentia')), 'JP' => array('01' => tc('Japanese Prefecture', 'Hokkaido'), '02' => tc('Japanese Prefecture', 'Aomori'), '03' => tc('Japanese Prefecture', 'Iwate'), '04' => tc('Japanese Prefecture', 'Miyagi'), '05' => tc('Japanese Prefecture', 'Akita'), '06' => tc('Japanese Prefecture', 'Yamagata'), '07' => tc('Japanese Prefecture', 'Fukushima'), '08' => tc('Japanese Prefecture', 'Ibaraki'), '09' => tc('Japanese Prefecture', 'Tochigi'), '10' => tc('Japanese Prefecture', 'Gunma'), '11' => tc('Japanese Prefecture', 'Saitama'), '12' => tc('Japanese Prefecture', 'Chiba'), '13' => tc('Japanese Prefecture', 'Tokyo'), '14' => tc('Japanese Prefecture', 'Kanagawa'), '15' => tc('Japanese Prefecture', 'Niigata'), '16' => tc('Japanese Prefecture', 'Toyama'), '17' => tc('Japanese Prefecture', 'Ishikawa'), '18' => tc('Japanese Prefecture', 'Fukui'), '19' => tc('Japanese Prefecture', 'Yamanashi'), '20' => tc('Japanese Prefecture', 'Nagano'), '21' => tc('Japanese Prefecture', 'Gifu'), '22' => tc('Japanese Prefecture', 'Shizuoka'), '23' => tc('Japanese Prefecture', 'Aichi'), '24' => tc('Japanese Prefecture', 'Mie'), '25' => tc('Japanese Prefecture', 'Shiga'), '26' => tc('Japanese Prefecture', 'Kyoto'), '27' => tc('Japanese Prefecture', 'Osaka'), '28' => tc('Japanese Prefecture', 'Hyogo'), '29' => tc('Japanese Prefecture', 'Nara'), '30' => tc('Japanese Prefecture', 'Wakayama'), '31' => tc('Japanese Prefecture', 'Tottori'), '32' => tc('Japanese Prefecture', 'Shimane'), '33' => tc('Japanese Prefecture', 'Okayama'), '34' => tc('Japanese Prefecture', 'Hiroshima'), '35' => tc('Japanese Prefecture', 'Yamaguchi'), '36' => tc('Japanese Prefecture', 'Tokushima'), '37' => tc('Japanese Prefecture', 'Kagawa'), '38' => tc('Japanese Prefecture', 'Ehime'), '39' => tc('Japanese Prefecture', 'Kochi'), '40' => tc('Japanese Prefecture', 'Fukuoka'), '41' => tc('Japanese Prefecture', 'Saga'), '42' => tc('Japanese Prefecture', 'Nagasaki'), '43' => tc('Japanese Prefecture', 'Kumamoto'), '44' => tc('Japanese Prefecture', 'Oita'), '45' => tc('Japanese Prefecture', 'Miyazaki'), '46' => tc('Japanese Prefecture', 'Kagoshima'), '47' => tc('Japanese Prefecture', 'Okinawa')), 'CH' => array('AG' => tc('Swiss Canton', 'Aargau'), 'AI' => tc('Swiss Canton', 'Appenzell I. Rh.'), 'AR' => tc('Swiss Canton', 'Appenzell A. Rh.'), 'BE' => tc('Swiss Canton', 'Bern'), 'BL' => tc('Swiss Canton', 'Basel-Landschaft'), 'BS' => tc('Swiss Canton', 'Basel-Stadt'), 'FR' => tc('Swiss Canton', 'Fribourg'), 'GE' => tc('Swiss Canton', 'Geneva'), 'GL' => tc('Swiss Canton', 'Glarus'), 'GR' => tc('Swiss Canton', 'Graubünden'), 'JU' => tc('Swiss Canton', 'Jura'), 'LU' => tc('Swiss Canton', 'Lucerne'), 'NE' => tc('Swiss Canton', 'Neuchâtel'), 'NW' => tc('Swiss Canton', 'Nidwalden'), 'OW' => tc('Swiss Canton', 'Obwalden'), 'SG' => tc('Swiss Canton', 'St. Gallen'), 'SH' => tc('Swiss Canton', 'Schaffhausen'), 'SO' => tc('Swiss Canton', 'Solothurn'), 'SZ' => tc('Swiss Canton', 'Schwyz'), 'TG' => tc('Swiss Canton', 'Thurgau'), 'TI' => tc('Swiss Canton', 'Ticino'), 'UR' => tc('Swiss Canton', 'Uri'), 'VD' => tc('Swiss Canton', 'Vaud'), 'VS' => tc('Swiss Canton', 'Valais'), 'ZG' => tc('Swiss Canton', 'Zug'), 'ZH' => tc('Swiss Canton', 'Zurich')));
         $comparer = new \Punic\Comparer($locale);
         foreach (array_keys($provinces) as $country) {
             switch ($locale . '@' . $country) {
                 case 'ja_JP@JP':
                     break;
                 default:
                     $comparer->sort($provinces[$country], true);
                     break;
             }
         }
         $provinces['UK'] = $provinces['GB'];
         $event = new \Symfony\Component\EventDispatcher\GenericEvent();
         $event->setArgument('provinces', $provinces);
         $event = Events::dispatch('on_get_states_provinces_list', $event);
         $this->localizedStatesProvinces[$locale] = $event->getArgument('provinces');
     }
     return $this->localizedStatesProvinces[$locale];
 }
Esempio n. 17
0
 public function get_environment_info()
 {
     $activeLocale = Localization::activeLocale();
     if ($activeLocale != 'en_US') {
         Localization::changeLocale('en_US');
     }
     $maxExecutionTime = ini_get('max_execution_time');
     set_time_limit(5);
     $environmentMessage = "# concrete5 Version\n" . APP_VERSION . "\n\n";
     $environmentMessage .= "# concrete5 Packages\n";
     $pla = PackageList::get();
     $pl = $pla->getPackages();
     $packages = array();
     foreach ($pl as $p) {
         if ($p->isPackageInstalled()) {
             $packages[] = $p->getPackageName() . ' (' . $p->getPackageVersion() . ')';
         }
     }
     if (count($packages) > 0) {
         natcasesort($packages);
         $environmentMessage .= implode(', ', $packages);
         $environmentMessage .= ".\n";
     } else {
         $environmentMessage .= "None\n";
     }
     $environmentMessage .= "\n";
     // overrides
     $environmentMessage .= "# concrete5 Overrides\n";
     $fh = Loader::helper('file');
     $overrides = array();
     $ovBlocks = $fh->getDirectoryContents(DIR_FILES_BLOCK_TYPES);
     $ovControllers = $fh->getDirectoryContents(DIR_FILES_CONTROLLERS);
     $ovElements = $fh->getDirectoryContents(DIR_FILES_ELEMENTS);
     $ovHelpers = $fh->getDirectoryContents(DIR_HELPERS);
     $ovJobs = $fh->getDirectoryContents(DIR_FILES_JOBS);
     $ovCSS = $fh->getDirectoryContents(DIR_BASE . '/' . DIRNAME_CSS);
     $ovJS = $fh->getDirectoryContents(DIR_BASE . '/' . DIRNAME_JAVASCRIPT);
     $ovLng = $fh->getDirectoryContents(DIR_BASE . '/' . DIRNAME_LANGUAGES);
     $ovLibs = $fh->getDirectoryContents(DIR_LIBRARIES);
     $ovMail = $fh->getDirectoryContents(DIR_FILES_EMAIL_TEMPLATES);
     $ovModels = $fh->getDirectoryContents(DIR_MODELS);
     $ovSingle = $fh->getDirectoryContents(DIR_FILES_CONTENT);
     $ovThemes = $fh->getDirectoryContents(DIR_FILES_THEMES);
     $ovTools = $fh->getDirectoryContents(DIR_FILES_TOOLS);
     foreach ($ovBlocks as $ovb) {
         $overrides[] = DIRNAME_BLOCKS . '/' . $ovb;
     }
     foreach ($ovControllers as $ovb) {
         $overrides[] = DIRNAME_CONTROLLERS . '/' . $ovb;
     }
     foreach ($ovElements as $ovb) {
         $overrides[] = DIRNAME_ELEMENTS . '/' . $ovb;
     }
     foreach ($ovHelpers as $ovb) {
         $overrides[] = DIRNAME_HELPERS . '/' . $ovb;
     }
     foreach ($ovJobs as $ovb) {
         $overrides[] = DIRNAME_JOBS . '/' . $ovb;
     }
     foreach ($ovJS as $ovb) {
         $overrides[] = DIRNAME_JAVASCRIPT . '/' . $ovb;
     }
     foreach ($ovCSS as $ovb) {
         $overrides[] = DIRNAME_CSS . '/' . $ovb;
     }
     foreach ($ovLng as $ovb) {
         $overrides[] = DIRNAME_LANGUAGES . '/' . $ovb;
     }
     foreach ($ovLibs as $ovb) {
         $overrides[] = DIRNAME_LIBRARIES . '/' . $ovb;
     }
     foreach ($ovMail as $ovb) {
         $overrides[] = DIRNAME_MAIL_TEMPLATES . '/' . $ovb;
     }
     foreach ($ovModels as $ovb) {
         $overrides[] = DIRNAME_MODELS . '/' . $ovb;
     }
     foreach ($ovSingle as $ovb) {
         $overrides[] = DIRNAME_PAGES . '/' . $ovb;
     }
     foreach ($ovThemes as $ovb) {
         $overrides[] = DIRNAME_THEMES . '/' . $ovb;
     }
     foreach ($ovTools as $ovb) {
         $overrides[] = DIRNAME_TOOLS . '/' . $ovb;
     }
     if (count($overrides) > 0) {
         $environmentMessage .= implode(', ', $overrides);
         $environmentMessage .= "\n";
     } else {
         $environmentMessage .= "None\n";
     }
     $environmentMessage .= "\n";
     print $environmentMessage;
     // cache
     $environmentMessage = "# concrete5 Cache Settings\n";
     $environmentMessage .= sprintf("Block Cache - %s\n", ENABLE_BLOCK_CACHE ? 'On' : 'Off');
     $environmentMessage .= sprintf("Overrides Cache - %s\n", ENABLE_OVERRIDE_CACHE ? 'On' : 'Off');
     $environmentMessage .= sprintf("Full Page Caching - %s\n", FULL_PAGE_CACHE_GLOBAL == 'blocks' ? 'On - If blocks on the particular page allow it.' : (FULL_PAGE_CACHE_GLOBAL == 'all' ? 'On - In all cases.' : 'Off'));
     if (FULL_PAGE_CACHE_GLOBAL) {
         $environmentMessage .= sprintf("Full Page Cache Lifetime - %s\n", FULL_PAGE_CACHE_LIFETIME == 'default' ? sprintf('Every %s (default setting).', Loader::helper('date')->describeInterval(CACHE_LIFETIME)) : (FULL_PAGE_CACHE_LIFETIME == 'forever' ? 'Only when manually removed or the cache is cleared.' : sprintf('Every %s minutes.', Config::get('FULL_PAGE_CACHE_LIFETIME_CUSTOM'))));
     }
     $environmentMessage .= "\n";
     print $environmentMessage;
     $environmentMessage = "# Server Software\n" . $_SERVER['SERVER_SOFTWARE'] . "\n\n";
     $environmentMessage .= "# Server API\n" . php_sapi_name() . "\n\n";
     $environmentMessage .= "# PHP Version\n" . PHP_VERSION . "\n\n";
     $environmentMessage .= "# PHP Extensions\n";
     if (function_exists('get_loaded_extensions')) {
         $gle = @get_loaded_extensions();
         natcasesort($gle);
         $environmentMessage .= implode(', ', $gle);
         $environmentMessage .= ".\n";
     } else {
         $environmentMessage .= "Unable to determine\n";
     }
     print $environmentMessage;
     ob_start();
     phpinfo();
     $phpinfo = array('phpinfo' => array());
     if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
         foreach ($matches as $match) {
             if (strlen($match[1])) {
                 $phpinfo[$match[1]] = array();
             } else {
                 if (isset($match[3])) {
                     $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
                 } else {
                     $phpinfo[end(array_keys($phpinfo))][] = $match[2];
                 }
             }
         }
     }
     $environmentMessage = "\n# PHP Settings\n";
     $environmentMessage .= "max_execution_time - {$maxExecutionTime}\n";
     foreach ($phpinfo as $name => $section) {
         foreach ($section as $key => $val) {
             if (preg_match('/.*max_execution_time*/', $key)) {
                 continue;
             }
             if (!preg_match('/.*limit.*/', $key) && !preg_match('/.*safe.*/', $key) && !preg_match('/.*max.*/', $key)) {
                 continue;
             }
             if (is_array($val)) {
                 $environmentMessage .= "{$key} - {$val['0']}\n";
             } else {
                 if (is_string($key)) {
                     $environmentMessage .= "{$key} - {$val}\n";
                 } else {
                     $environmentMessage .= "{$val}\n";
                 }
             }
         }
     }
     print $environmentMessage;
     exit;
 }
Esempio n. 18
0
 public function cacheInterfaceItems()
 {
     $u = new User();
     if ($u->isRegistered()) {
         $ch = Loader::helper('concrete/dashboard');
         $_SESSION['dashboardMenus'][Localization::activeLocale()] = $ch->getDashboardAndSearchMenus();
     }
 }
Esempio n. 19
0
 public function view()
 {
     parent::view();
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $nh = Loader::helper('navigation');
     $av = Loader::helper('concrete/avatar');
     $valt = Loader::helper('validation/token');
     $imgHelper = Loader::helper('image');
     /* If no page is passed to edit, create a new page.
      */
     $load = $_REQUEST['load'];
     if (empty($load)) {
         // Find the parent page this should go under
         $cityPage = ($parentCID = $_REQUEST['parentCID']) ? Page::getByID($parentCID) : ($ui->getAttribute('home_city') ?: Page::getByPath('/canada/toronto'));
         $c = $this->getUnstartedWalk($u, $cityPage);
     } else {
         $c = Page::getByPath($load);
         $cityPage = Page::getByID($c->getCollectionParentID());
     }
     $walk_ward = trim((string) $c->getAttribute('walk_wards'));
     $city_wards = $cityPage->getAttribute('city_wards');
     if ($city_wards) {
         $wards = array_map(function ($ward) use($walk_ward) {
             if ($ward->value == $walk_ward) {
                 $ward->selected = true;
             }
             return $ward;
         }, $city_wards->getOptions());
     } else {
         $wards = null;
     }
     // Set the language based on a trail to the city
     /* Set the city language to the first one matched, recursing from where we are */
     $crumbs = $nh->getTrailToCollection($c);
     $crumbs[] = $c;
     // Must check the current page first
     foreach ($crumbs as $crumb) {
         if ($lang = (string) $crumb->getAttribute('lang')) {
             Localization::changeLocale($lang);
             break;
         }
     }
     // Load our city
     $latlng = explode(',', $cityPage->getAttribute('latlng'));
     // If you don't have a lat and a lng, final resort is Toronto. It's at least better than being 400km off the coast of Nigeria.
     if (count((array) $latlng) !== 2) {
         $latlng = [43.653226, -79.3831843];
     }
     // Instantiate as models, for JSON serialization
     $city = new City($cityPage);
     $walk = new Walk($c);
     // Build data needed by frontend
     $this->addToJanesWalk(['city' => $city, 'form' => ['valt' => $valt->generate('upload')], 'walk' => ['name' => (string) $walk, 'data' => $walk, 'url' => $nh->getCollectionURL($c)], 'locale' => ['name' => Localization::activeLocale(), 'translation' => Localization::getActiveTranslateJsonURL()]]);
     // Set the view name
     $this->bodyData['pageViewName'] = 'CreateWalkView';
     $this->set('u', $u);
     $this->set('ui', $ui);
     $this->set('owner', UserInfo::getByID($c->getCollectionUserID()));
     $this->set('nh', $nh);
     $this->set('av', $av);
     $this->set('load', $load);
     $this->set('c', $c);
     $this->set('city', $city);
     $this->set('country', $city->country);
     $this->set('ui_cityorganizer', $city->city_organizer);
     $this->set('imgHelper', $imgHelper);
     $this->set('wards', $wards);
     $this->set('is_nyc', $is_nyc);
     $this->set('lat', $latlng[0]);
     $this->set('lng', $latlng[1]);
     $this->set('bodyData', $this->bodyData);
     // Load JS we need in the form
     $html = Loader::helper('html');
     // Set default stylesheets for libs
     $this->addHeaderItem($html->css('jquery.ui.css'));
     // Set libs we'll need on the page
     $this->addFooterItem(Loader::helper('html')->javascript('jquery.ui.js'));
 }
Esempio n. 20
0
	/** 
	 * Subsitute for the native date() function that adds localized date support
	 * This uses Zend's Date Object {@link http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.phpformats}
	 * @param string $mask
	 * @param int $timestamp
	 * @return string
	 */
	public function date($mask,$timestamp=false) {
		$loc = Localization::getInstance();
		if ($timestamp === false) {
			$timestamp = time();
		}
		
		if ($loc->getLocale() == 'en_US') {
			return date($mask, $timestamp);			
		}		

		$locale = new Zend_Locale(Localization::activeLocale());
		Zend_Date::setOptions(array('format_type' => 'php'));
		$cache = Cache::getLibrary();
		if (is_object($cache)) {
			Zend_Date::setOptions(array('cache'=>$cache));
		} 
		$date = new Zend_Date($timestamp, false, $locale);

		return $date->toString($mask);
	}
Esempio n. 21
0
echo CONCRETE5_ENV === 'dev' ? '' : '.min';
?>
.js"></script>
    <script src="/js/jwglobal.js"></script>
<?php 
Loader::element('header_required');
?>
    <script type="text/javascript" src="/concrete/js/jquery.ui.js"></script>
    <script type="text/javascript">var CCM_THEME_PATH = '<?php 
echo $this->getThemePath();
?>
';window.fbAsyncInit = function () {FB.init({appId: '544710848887303', status: true, xfbml: true }); };(function (d, s, id) {var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/en_US/all.js'; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
</head>
<body
    lang="<?php 
echo Localization::activeLocale();
?>
"
    class="<?php 
echo join((array) $bodyData['classes'], ' ');
?>
"
    data-pageViewName="<?php 
echo $bodyData['pageViewName'];
?>
"
    style="background-image:url(<?php 
echo $bodyData['bg'];
?>
)"
>
Esempio n. 22
0
		/**
		 * installs a block type
		 * @param string $btHandle
		 * @param BlockType $bt
		 * @param string $dir
		 * @param int $btID
		 * @param string $dirDbXml
		 */
		protected function doInstallBlockType($btHandle, $bt, $dir, $btID = 0, $dirDbXml) {
			$db = Loader::db();
			$env = Environment::get();
			$env->clearOverrideCache();
			
			if (file_exists($dir . '/' . $btHandle . '/' . FILENAME_BLOCK_CONTROLLER)) {
				$class = $bt->getBlockTypeClass();
				
				$path = $dirDbXml . '/' . $btHandle;
				if (!class_exists($class)) {
					require_once($dir . '/' . $btHandle . '/' . FILENAME_BLOCK_CONTROLLER);
				}
				
				if (!class_exists($class)) {
					throw new Exception(t("%s not found. Please check that the block controller file contains the correct class name.", $class));
				}
				$bta = new $class;
				
				//Attempt to run the subclass methods (install schema from db.xml, etc.)
				$r = $bta->install($path);

				//Validate
				if ($r === false) {
					return t('Error: Block Type cannot be installed because no db.xml file can be found. Either create a db.xml file for this block type, or remove the $btTable variable from its controller.');
				} else if (!$r->result && $r->message) {
					return $r->message;
				} else if (!$r->result && !$r->message) {
					return t('Error: Block Type cannot be installed due to an unknown database error. Please check that the db.xml file for this block type is formatted correctly.');
				} else if ($message = BlockType::validateInstalledDatabaseTable($bta->getBlockTypeDatabaseTable())) {
					$db->Execute('DROP TABLE IF EXISTS ' . $bta->getBlockTypeDatabaseTable());
					return $message;
				}
				
				$currentLocale = Localization::activeLocale();
				if ($currentLocale != 'en_US') {
					// Prevent the database records being stored in wrong language
					Localization::changeLocale('en_US');
				}

				//Install the block
				$btd = new BlockTypeDB();
				$btd->btHandle = $btHandle;
				$btd->btName = $bta->getBlockTypeName();
				$btd->btDescription = $bta->getBlockTypeDescription();
				$btd->btActiveWhenAdded = $bta->isActiveWhenAdded();
				$btd->btCopyWhenPropagate = $bta->isCopiedWhenPropagated();
				$btd->btIncludeAll = $bta->includeAll();
				$btd->btIsInternal = $bta->isBlockTypeInternal();
				$btd->btInterfaceHeight = $bta->getInterfaceHeight();
				$btd->btInterfaceWidth = $bta->getInterfaceWidth();
				$btd->pkgID = $bt->getPackageID();
				if ($currentLocale != 'en_US') {
					Localization::changeLocale($currentLocale);
				}
				
				if ($btID > 0) {
					$btd->btID = $btID;
					$btDisplayOrder = $db->GetOne('select btDisplayOrder from BlockTypes where btID = ?', array($btID));
					if (!$btDisplayOrder) {
						$btDisplayOrder = 0;
					}
					$btd->btDisplayOrder = $btDisplayOrder;
					$r = $btd->Replace();
				} else {
					if ($bta->isBlockTypeInternal()) {
						$btd->btDisplayOrder = 0;
					} else {
						$btMax = $db->GetOne('select max(btDisplayOrder) from BlockTypes');
						if ($btMax < 1 && $btMax !== '0') {
							$btd->btDisplayOrder = 0;
						} else {
							$btd->btDisplayOrder = $btMax + 1;
						}
					}

					$r = $btd->save();
				}
				
				// now we remove the block type from cache
				$ca = new Cache();
				$ca->delete('blockTypeByID', $btID);
				$ca->delete('blockTypeByHandle', $btHandle);
				$ca->delete('blockTypeList', false);		 	

				if (!$r) {
					return $db->ErrorMsg();
				}
			} else {
				return t("No block found with the handle %s.", $btHandle);
			}
		}
Esempio n. 23
0
 /**
  * Convert a date to a Zend_Date instance.
  * @param string|DateTime|Zend_Date|int $value It can be:<ul>
  *	<li>the special value 'now' (default) to return the current date/time</li>
  *	<li>a DateTime instance</li>
  *	<li>a Zend_Date instance</li>
  *	<li>a string parsable by strtotime (the current system timezone is used)</li>
  *	<li>a timestamp</li>
  * </ul>
  * @param string $timezone The timezone to set. Special values are:<ul>
  *	<li>'system' (default) for the current system timezone</li>
  *	<li>'user' for the user's timezone</li>
  *	<li>'app' for the app's timezone</li>
  *	<li>Other values: one of the PHP supported time zones (see http://us1.php.net/manual/en/timezones.php )</li>
  * </ul>
  * @return Zend_Date|null Returns the Zend_Date instance (or null if $value couldn't be parsed)
  */
 public function toZendDate($value = 'now', $timezone = 'system')
 {
     $zendDate = null;
     if (is_int($value)) {
         $zendDate = new Zend_Date($value, Zend_Date::TIMESTAMP);
     } elseif ($value instanceof DateTime) {
         $zendDate = new Zend_Date($value->format(DATE_ATOM), DATE_ATOM);
         $zendDate->setTimeZone($value->format('e'));
     } elseif (is_a($value, 'Zend_Date')) {
         $zendDate = clone $value;
     } elseif (is_string($value) && strlen($value)) {
         if ($value === 'now') {
             $zendDate = new Zend_Date();
         } elseif (is_numeric($value)) {
             $zendDate = new Zend_Date($value, Zend_Date::TIMESTAMP);
         } else {
             $timestamp = @strtotime($value);
             if ($timestamp !== false) {
                 $zendDate = new Zend_Date($timestamp, Zend_Date::TIMESTAMP);
             }
         }
     }
     if (is_null($zendDate)) {
         return null;
     }
     $zendDate->setLocale(Localization::activeLocale());
     $zendDate->setTimezone($this->getTimezone($timezone));
     return $zendDate;
 }
Esempio n. 24
0
 public function install_package($package)
 {
     $tp = new TaskPermission();
     if ($tp->canInstallPackages()) {
         $p = Loader::package($package);
         if (is_object($p)) {
             if (!$p->showInstallOptionsScreen() || Loader::helper('validation/token')->validate('install_options_selected')) {
                 $tests = Package::testForInstall($package);
                 if (is_array($tests)) {
                     $tests = Package::mapError($tests);
                     $this->set('error', $tests);
                 } else {
                     $currentLocale = Localization::activeLocale();
                     if ($currentLocale != 'en_US') {
                         // Prevent the database records being stored in wrong language
                         Localization::changeLocale('en_US');
                     }
                     try {
                         $u = new User();
                         $pkg = $p->install($this->post());
                         if ($u->isSuperUser() && $p->allowsFullContentSwap() && $this->post('pkgDoFullContentSwap')) {
                             $p->swapContent($this->post());
                         }
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                         $pkg = Package::getByHandle($p->getPackageHandle());
                         $this->redirect('/dashboard/extend/install', 'package_installed', $pkg->getPackageID());
                     } catch (Exception $e) {
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                         if ($p->showInstallOptionsScreen()) {
                             $this->set('showInstallOptionsScreen', true);
                             $this->set('pkg', $p);
                         }
                         $this->set('error', $e);
                     }
                 }
             } else {
                 $this->set('showInstallOptionsScreen', true);
                 $this->set('pkg', $p);
             }
         } else {
             $msg = t('Install failed - invalid package. Check log for details');
             $this->error->add($msg);
             $this->set('error', $this->error);
         }
     } else {
         $this->error->add(t('You do not have permission to install add-ons.'));
         $this->set('error', $this->error);
     }
 }
\tConcretePanelManager.register({'identifier': 'check-in', 'position': 'left', url: '{$panelCheckIn}'});
\tConcreteToolbar.start();
\t{$startEditMode}
\t{$launchPageComposer}
});
</script>

EOL;
            $v->addFooterItem($js);
            if (Config::get('concrete.misc.enable_progressive_page_reindex') && Config::get('concrete.misc.do_page_reindex_check')) {
                $v->addFooterItem('<script type="text/javascript">$(function() { ccm_doPageReindexing(); });</script>');
            }
            $cih = Loader::helper('concrete/ui');
            if (Localization::activeLanguage() != 'en') {
                $alternatives = array(Localization::activeLocale());
                if (Localization::activeLocale() !== Localization::activeLanguage()) {
                    $alternatives[] = Localization::activeLanguage();
                }
                foreach ($alternatives as $alternative) {
                    $alternativeJS = $html->javascript('i18n/ui.datepicker-' . str_replace('_', '-', $alternative) . '.js');
                    if (is_file($alternativeJS->getAssetPath())) {
                        $v->addFooterItem($alternativeJS);
                        break;
                    }
                }
                $v->addFooterItem('<script type="text/javascript">$(function() { jQuery.datepicker.setDefaults({dateFormat: \'yy-mm-dd\'}); });</script>');
            }
            if (!Config::get('concrete.misc.seen_introduction')) {
                $v->addFooterItem('<script type="text/javascript">$(function() { ccm_showAppIntroduction(); });</script>');
                Config::save('concrete.misc.seen_introduction', true);
            }
 /**
  * Run startup and localization events on any installed packages.
  */
 public function setupPackages()
 {
     $pla = \Concrete\Core\Package\PackageList::get();
     $pl = $pla->getPackages();
     $cl = ClassLoader::getInstance();
     foreach ($pl as $p) {
         if ($p->isPackageInstalled()) {
             $pkg = Package::getClass($p->getPackageHandle());
             if (is_object($pkg)) {
                 $cl->registerPackage($pkg);
                 // handle updates
                 if (Config::get('concrete.misc.enable_auto_update_packages')) {
                     $pkgInstalledVersion = $p->getPackageVersion();
                     $pkgFileVersion = $pkg->getPackageVersion();
                     if (version_compare($pkgFileVersion, $pkgInstalledVersion, '>')) {
                         $currentLocale = Localization::activeLocale();
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale('en_US');
                         }
                         $p->upgradeCoreData();
                         $p->upgrade();
                         if ($currentLocale != 'en_US') {
                             Localization::changeLocale($currentLocale);
                         }
                     }
                 }
                 $pkg->setupPackageLocalization();
                 if (method_exists($pkg, 'on_start')) {
                     $pkg->on_start();
                 }
             }
         }
     }
 }
Esempio n. 27
0
    public function on_page_view()
    {
        $balloonHtml = '';
        if ($this->balloonShow) {
            $balloonHtml = '<div style="overflow:hidden;white-space:nowrap;">';
            if (strlen($this->balloonContent)) {
                $balloonHtml .= Loader::helper('content')->translateFrom($this->balloonContent);
            }
            if ($this->balloonWithLinkToMaps) {
                $balloonHtml .= '<div style="font-size: smaller"><a href="//maps.google.com?' . h('ll=' . $this->latitude . ',' . $this->longitude . '&daddr=' . $this->latitude . ',' . $this->longitude . '&z=' . $this->zoom) . '" target="blank">' . h(t('Get Directions')) . '</a>&nbsp;&nbsp;</div>';
            }
            $balloonHtml .= '</div>';
            $this->set('balloonHtml', $balloonHtml);
        }
        $html = Loader::helper('html');
        $c = Page::getCurrentPage();
        if (!$c->isEditMode()) {
            $this->addFooterItem('<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=true&language=' . rawurlencode(str_replace('_', '-', Localization::activeLocale())) . '"></script>');
            $this->addFooterItem('<script type="text/javascript"> 
				function googleMapInit' . $this->bID . '() { 
				   try{
					  var latlng = new google.maps.LatLng(' . $this->latitude . ', ' . $this->longitude . '), balloonHtml = ' . Loader::helper('json')->encode($balloonHtml) . ', balloon;
					   var mapOptions = {
						 zoom: ' . $this->zoom . ',
						 center: latlng,
						 mapTypeId: google.maps.MapTypeId.ROADMAP,
						 streetViewControl: false,
						 mapTypeControl: false
					  };
					   var map = new google.maps.Map(document.getElementById(\'googleMapCanvas' . $this->bID . '\'), mapOptions);
					   var marker = new google.maps.Marker({
						   position: latlng, 
						   map: map
					   });
						if(balloonHtml) {
							balloon = new google.maps.InfoWindow({content: balloonHtml});
							google.maps.event.addListener(marker, "click", function() {
								balloon.open(map, marker);
							});
							setTimeout(function() {
								balloon.open(map, marker);
							}, 500);
						}
				   }catch(e){
				   $("#googleMapCanvas' . $this->bID . '").replaceWith("<p>Unable to display map: "+e.message+"</p>")}
				}
				$(function() {
					var t;
					var startWhenVisible = function (){
						if ($("#googleMapCanvas' . $this->bID . '").is(":visible")){
							window.clearInterval(t);
							googleMapInit' . $this->bID . '();
							return true;
						} 
						return false;
					};
					if (!startWhenVisible()){
						t = window.setInterval(function(){startWhenVisible();},100);      
					}
				});            
				</script>');
        }
    }
Esempio n. 28
0
    public function getDashboardAndSearchMenus()
    {
        if (isset($_SESSION['dashboardMenus'][Localization::activeLocale()])) {
            return $_SESSION['dashboardMenus'][Localization::activeLocale()];
        }
        $d = ConcreteDashboardMenu::getMine();
        $items = $d->getItems();
        ob_start();
        ?>
			<div id="ccm-intelligent-search-results">
			<?php 
        $page = Page::getByPath('/dashboard');
        $children = $page->getCollectionChildrenArray(true);
        $packagepages = array();
        $corepages = array();
        foreach ($children as $ch) {
            $page = Page::getByID($ch);
            $pageP = new Permissions($page);
            if ($pageP->canRead()) {
                if (!$page->getAttribute("exclude_nav")) {
                    if ($page->getPackageID() > 0) {
                        $packagepages[] = $page;
                    } else {
                        $corepages[] = $page;
                    }
                }
            } else {
                continue;
            }
            if ($page->getAttribute('exclude_search_index')) {
                continue;
            }
            if ($page->getCollectionPath() == '/dashboard/system') {
                $ch2 = $page->getCollectionChildrenArray();
            } else {
                $ch2 = $page->getCollectionChildrenArray(true);
            }
            ?>
				
				<div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite">
				
				<h1><?php 
            echo t($page->getCollectionName());
            ?>
</h1>
				
				
				<ul class="ccm-intelligent-search-results-list">
				<?php 
            if (count($ch2) == 0) {
                ?>
					<li><a href="<?php 
                echo Loader::helper('navigation')->getLinkTocollection($page, false, true);
                ?>
"><?php 
                echo t($page->getCollectionName());
                ?>
</a><span><?php 
                echo t($page->getCollectionName());
                ?>
 <?php 
                echo t($page->getAttribute('meta_keywords'));
                ?>
</span></li>
				<?php 
            }
            ?>
				
				<?php 
            if ($page->getCollectionPath() == '/dashboard/system') {
                ?>
					<li><a href="<?php 
                echo Loader::helper('navigation')->getLinkTocollection($page, false, true);
                ?>
"><?php 
                echo t('View All');
                ?>
</a><span><?php 
                echo t($page->getCollectionName());
                ?>
 <?php 
                echo t($page->getAttribute('meta_keywords'));
                ?>
</span></li>
				<?php 
            }
            foreach ($ch2 as $chi) {
                $subpage = Page::getByID($chi);
                $subpageP = new Permissions($subpage);
                if (!$subpageP->canRead()) {
                    continue;
                }
                if ($subpage->getAttribute('exclude_search_index')) {
                    continue;
                }
                ?>
					<li><a href="<?php 
                echo Loader::helper('navigation')->getLinkTocollection($subpage, false, true);
                ?>
"><?php 
                echo t($subpage->getCollectionName());
                ?>
</a><span><?php 
                if ($page->getCollectionPath() != '/dashboard/system') {
                    echo t($page->getCollectionName());
                    ?>
 <?php 
                    echo t($page->getAttribute('meta_keywords'));
                    ?>
 <?php 
                }
                echo t($subpage->getCollectionName());
                ?>
 <?php 
                echo t($subpage->getAttribute('meta_keywords'));
                ?>
</span></li>
					<?php 
            }
            ?>
				</ul>
				
				</div>
				<?php 
        }
        $custHome = Page::getByPath('/dashboard/home');
        $custHomeP = new Permissions($custHome);
        if ($custHomeP->canRead()) {
            ?>
				
				<div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-onsite">
				
				<h1><?php 
            echo t('Dashboard Home');
            ?>
</h1>
				
				
				<ul class="ccm-intelligent-search-results-list">
					<li><a href="<?php 
            echo View::url('/dashboard/home');
            ?>
"><?php 
            echo t('Customize');
            ?>
 <span><?php 
            echo t('Customize Dashboard Home');
            ?>
</span></a></li>
				</ul>
				
				</div>
				
				<?php 
        }
        ?>
				
				<div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-loading">
				<h1><?php 
        echo t('Your Site');
        ?>
</h1>
				<ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-your-site">
				</ul>
				</div>
				
				<?php 
        if (ENABLE_INTELLIGENT_SEARCH_HELP) {
            ?>
				<div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading">
				<h1><?php 
            echo t('Help');
            ?>
</h1>
				<ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-help">
				</ul>
				</div>
				<?php 
        }
        ?>
				
				<?php 
        if (ENABLE_INTELLIGENT_SEARCH_MARKETPLACE) {
            ?>
				<div class="ccm-intelligent-search-results-module ccm-intelligent-search-results-module-offsite ccm-intelligent-search-results-module-loading">
				<h1><?php 
            echo t('Add-Ons');
            ?>
</h1>
				<ul class="ccm-intelligent-search-results-list" id="ccm-intelligent-search-results-list-marketplace">
				</ul>
				</div>
				<?php 
        }
        ?>
				
			</div>
			
			<div id="ccm-dashboard-overlay">
			<div id="ccm-dashboard-overlay-core">
			<div class="ccm-dashboard-overlay-inner" id="ccm-dashboard-overlay-main">
			
			<!--recent-->
						
			
			<?php 
        $currentHeader = false;
        $x = 0;
        $itemsChanged = false;
        foreach ($items as $path) {
            $p = Page::getByPath($path, 'ACTIVE');
            // If page is not found etc, remove it from items
            if ($p->isError()) {
                $d->remove($p);
                $itemsChanged = true;
                continue;
            }
            $pc = new Permissions($p);
            if ($pc->canViewPage()) {
                $name = t($p->getCollectionName());
                $parent = Page::getByID($p->getCollectionParentID(), 'ACTIVE');
                if ($parent->getCollectionPath() == '/dashboard') {
                    $parent = $p;
                    $name = t('Home');
                }
                if ($currentHeader != $parent->getCollectionID()) {
                    ?>
						<?php 
                    if ($currentHeader != false) {
                        ?>
							</ul>
							</div>
							<?php 
                        $x++;
                        ?>
							<?php 
                        if ($x % 4 == 0) {
                            ?>
								<div class="clearfix" style="padding-bottom: 0px"></div>
							<?php 
                        }
                        ?>
							
						<?php 
                    }
                    ?>

						<div class="ccm-dashboard-overlay-module">
						<h1><?php 
                    echo t($parent->getCollectionName());
                    ?>
</h1>
						<ul>			
						
						<?php 
                    $currentHeader = $parent->getCollectionID();
                    ?>
		

					<?php 
                }
                ?>
					
						<li><a href="<?php 
                echo Loader::helper('navigation')->getLinkToCollection($p, false, true);
                ?>
"><?php 
                echo $name;
                ?>
</a></li>

				
				<?php 
            }
            ?>
				
							
			<?php 
        }
        ?>
			<?php 
        if ($itemsChanged) {
            $u = new User();
            $u->saveConfig('QUICK_NAV_BOOKMARKS', serialize($d));
        }
        ?>
			<?php 
        if ($currentHeader != false) {
            ?>
							</ul>
							</div>
			<?php 
        }
        ?>
			</div>
			</div>
			<div id="ccm-dashboard-overlay-misc" class="ccm-dashboard-overlay-misc-rounded">
			<div class="ccm-dashboard-overlay-inner">

            <?php 
        // Before we throw in a UL, we check permissions, etc. to see if any of the LI items need to be shown.
        $systemNews = Page::getByPath('/dashboard/news');
        $systemNewsP = new Permissions($systemNews);
        $canAccessNews = $systemNewsP->canRead();
        $systemSettings = Page::getByPath('/dashboard/system');
        $systemSettingsP = new Permissions($systemSettings);
        $canAccessSystem = $systemSettingsP->canRead();
        $tpa = new TaskPermission();
        $canAccessExtend = $tpa->canInstallPackages();
        $systemExtend = Page::getByPath('/dashboard/extend');
        $systemExtendP = new Permissions($systemExtend);
        $canViewExtend = $systemExtendP->canRead();
        // If any need to be shown then we proceed...
        if ($canAccessNews || $canAccessSystem || $canAccessExtend && $canViewExtend) {
            ?>

                <ul>

                <?php 
            if ($canAccessNews) {
                ?>
                    <li><a href="<?php 
                echo View::url('/dashboard/news');
                ?>
"><strong><?php 
                echo t('News');
                ?>
</strong></a> – <?php 
                echo t('Learn about your site and concrete5.');
                ?>
</li>
                <?php 
            }
            ?>

				<?php 
            if ($canAccessSystem) {
                ?>
                    <li><a href="<?php 
                echo View::url('/dashboard/system');
                ?>
"><strong><?php 
                echo t('System &amp; Settings');
                ?>
</strong></a> – <?php 
                echo t('Secure and setup your site.');
                ?>
</li>
                <?php 
            }
            ?>

                <?php 
            if ($canAccessExtend && $canViewExtend) {
                ?>
                    <li><a href="<?php 
                echo View::url('/dashboard/extend');
                ?>
"><strong><?php 
                echo t("Extend concrete5");
                ?>
</strong></a> – 
                    <?php 
                if (ENABLE_MARKETPLACE_SUPPORT) {
                    ?>
                    <?php 
                    echo sprintf(t('<a href="%s">Install</a>, <a href="%s">update</a> or download more <a href="%s">themes</a> and <a href="%s">add-ons</a>.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'), View::url('/dashboard/extend/themes'), View::url('/dashboard/extend/add-ons'));
                    ?>
                    <?php 
                } else {
                    ?>
					<?php 
                    echo sprintf(t('<a href="%s">Install</a> or <a href="%s">update</a> packages.'), View::url('/dashboard/extend/install'), View::url('/dashboard/extend/update'));
                    ?>
                    <?php 
                }
                ?>
					</li>
                <?php 
            }
            ?>

                </ul>

            <?php 
        }
        ?>

			</div>
			</div>
			<div id="ccm-dashboard-overlay-footer">
			<div class="ccm-dashboard-overlay-inner">
			<a href="<?php 
        echo View::url('/dashboard');
        ?>
"><?php 
        echo t('View Full Dashboard');
        ?>
  <i class="icon-arrow-right"></i></a>
			</div>
			</div>
			</div>
		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return str_replace(array("\n", "\r", "\t"), "", $html);
    }
Esempio n. 29
0
			</div>

			<?php 
if (count($locales)) {
    // "> 1" because en_US is always available
    ?>
		
			<div class="row">
				<div class="form-group">
					<label for="uEmail" class="control-label col-sm-3"><?php 
    echo t('Language');
    ?>
</label>
					<div class="col-sm-7">
					<?php 
    print $form->select('uDefaultLanguage', $locales, Localization::activeLocale());
    ?>
					</div>
				</div>
			</div>


			<?php 
}
?>
    	</fieldset>

	   	<?php 
if (count($attribs) > 0) {
    ?>
Esempio n. 30
0
 public function getLanguageText($locale = null)
 {
     try {
         if (!$locale) {
             $locale = \Localization::activeLocale();
         }
         $text = Language::getName($this->msLanguage, $locale);
     } catch (Exception $e) {
         $text = $this->msLanguage;
     }
     return $text;
 }