openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

LanguageAction.class.php (4765B)


      1 <?php
      2 
      3 namespace cms\action;
      4 
      5 use cms\base\Configuration;
      6 use cms\model\Folder;
      7 use cms\model\Language;
      8 use cms\model\Permission;
      9 use cms\model\Project;
     10 use util\exception\SecurityException;
     11 
     12 // OpenRat Content Management System
     13 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de
     14 //
     15 // This program is free software; you can redistribute it and/or
     16 // modify it under the terms of the GNU General Public License
     17 // as published by the Free Software Foundation; either version 2
     18 // of the License, or (at your option) any later version.
     19 //
     20 // This program is distributed in the hope that it will be useful,
     21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     23 // GNU General Public License for more details.
     24 //
     25 // You should have received a copy of the GNU General Public License
     26 // along with this program; if not, write to the Free Software
     27 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     28 
     29 
     30 /**
     31  * Action-Klasse f?r die Bearbeitung einer Sprache
     32  * @version $Id$
     33  * @author  $Author$
     34  * @package openrat.actions
     35  */
     36 class LanguageAction extends BaseAction
     37 {
     38 	const LANGUAGE_LIST =
     39 	[
     40 		'AA' => 'Afar',
     41 		'AB' => 'Abkhazian',
     42 		'AF' => 'Afrikaans',
     43 		'AM' => 'Amharic',
     44 		'AR' => 'Arabic',
     45 		'AS' => 'Assamese',
     46 		'AY' => 'Aymara',
     47 		'AZ' => 'Azerbaijani',
     48 		'BA' => 'Bashkir',
     49 		'BE' => 'Byelorussian',
     50 		'BG' => 'Bulgarian',
     51 		'BH' => 'Bihari',
     52 		'BI' => 'Bislama',
     53 		'BN' => 'Bengali',
     54 		'BO' => 'Tibetan',
     55 		'BR' => 'Breton',
     56 		'CA' => 'Catalan',
     57 		'CO' => 'Corsican',
     58 		'CS' => 'Czech',
     59 		'CY' => 'Welsh',
     60 		'DA' => 'Danish',
     61 		'DE' => 'German',
     62 		'DZ' => 'Bhutani',
     63 		'EL' => 'Greek',
     64 		'EN' => 'English',
     65 		'EO' => 'Esperanto',
     66 		'ES' => 'Spanish',
     67 		'ET' => 'Estonian',
     68 		'EU' => 'Basque',
     69 		'FA' => 'Persian',
     70 		'FI' => 'Finnish',
     71 		'FJ' => 'Fiji',
     72 		'FO' => 'Faeroese',
     73 		'FR' => 'French',
     74 		'FY' => 'Frisian',
     75 		'GA' => 'Irish',
     76 		'GD' => 'Gaelic',
     77 		'GL' => 'Galician',
     78 		'GN' => 'Guarani',
     79 		'GU' => 'Gujarati',
     80 		'HA' => 'Hausa',
     81 		'HI' => 'Hindi',
     82 		'HR' => 'Croatian',
     83 		'HU' => 'Hungarian',
     84 		'HY' => 'Armenian',
     85 		'IA' => 'Interlingua',
     86 		'IE' => 'Interlingue',
     87 		'IK' => 'Inupiak',
     88 		'IN' => 'Indonesian',
     89 		'IS' => 'Icelandic',
     90 		'IT' => 'Italian',
     91 		'IW' => 'Hebrew',
     92 		'JA' => 'Japanese',
     93 		'JI' => 'Yiddish',
     94 		'JW' => 'Javanese',
     95 		'KA' => 'Georgian',
     96 		'KK' => 'Kazakh',
     97 		'KL' => 'Greenlandic',
     98 		'KM' => 'Cambodian',
     99 		'KN' => 'Kannada',
    100 		'KO' => 'Korean',
    101 		'KS' => 'Kashmiri',
    102 		'KU' => 'Kurdish',
    103 		'KY' => 'Kirghiz',
    104 		'LA' => 'Latin',
    105 		'LN' => 'Lingala',
    106 		'LO' => 'Laothian',
    107 		'LT' => 'Lithuanian',
    108 		'LV' => 'Latvian',
    109 		'MG' => 'Malagasy',
    110 		'MI' => 'Maori',
    111 		'MK' => 'Macedonian',
    112 		'ML' => 'Malayalam',
    113 		'MN' => 'Mongolian',
    114 		'MO' => 'Moldavian',
    115 		'MR' => 'Marathi',
    116 		'MS' => 'Malay',
    117 		'MT' => 'Maltese',
    118 		'MY' => 'Burmese',
    119 		'NA' => 'Nauru',
    120 		'NE' => 'Nepali',
    121 		'NL' => 'Dutch',
    122 		'NO' => 'Norwegian',
    123 		'OC' => 'Occitan',
    124 		'OM' => 'Oromo',
    125 		'OR' => 'Oriya',
    126 		'PA' => 'Punjabi',
    127 		'PL' => 'Polish',
    128 		'PS' => 'Pashto',
    129 		'PT' => 'Portuguese',
    130 		'QU' => 'Quechua',
    131 		'RM' => 'Rhaeto-Romance',
    132 		'RN' => 'Kirundi',
    133 		'RO' => 'Romanian',
    134 		'RU' => 'Russian',
    135 		'RW' => 'Kinyarwanda',
    136 		'SA' => 'Sanskrit',
    137 		'SD' => 'Sindhi',
    138 		'SG' => 'Sangro',
    139 		'SH' => 'Serbo-Croatian',
    140 		'SI' => 'Singhalese',
    141 		'SK' => 'Slovak',
    142 		'SL' => 'Slovenian',
    143 		'SM' => 'Samoan',
    144 		'SN' => 'Shona',
    145 		'SO' => 'Somali',
    146 		'SQ' => 'Albanian',
    147 		'SR' => 'Serbian',
    148 		'SS' => 'Siswati',
    149 		'ST' => 'Sesotho',
    150 		'SU' => 'Sudanese',
    151 		'SV' => 'Swedish',
    152 		'SW' => 'Swahili',
    153 		'TA' => 'Tamil',
    154 		'TE' => 'Tegulu',
    155 		'TG' => 'Tajik',
    156 		'TH' => 'Thai',
    157 		'TI' => 'Tigrinya',
    158 		'TK' => 'Turkmen',
    159 		'TL' => 'Tagalog',
    160 		'TN' => 'Setswana',
    161 		'TO' => 'Tonga',
    162 		'TR' => 'Turkish',
    163 		'TS' => 'Tsonga',
    164 		'TT' => 'Tatar',
    165 		'TW' => 'Twi',
    166 		'UK' => 'Ukrainian',
    167 		'UR' => 'Urdu',
    168 		'UZ' => 'Uzbek',
    169 		'VI' => 'Vietnamese',
    170 		'VO' => 'Volapuk',
    171 		'WO' => 'Wolof',
    172 		'XH' => 'Xhosa',
    173 		'YO' => 'Yoruba',
    174 		'ZH' => 'Chinese',
    175 	];
    176 
    177 	/**
    178 	 * Zu bearbeitende Sprache, wird im Kontruktor instanziiert
    179 	 * @type Language
    180 	 */
    181 	protected $language;
    182 
    183 
    184 	/**
    185 	 * Konstruktor
    186 	 */
    187 	public function __construct()
    188 	{
    189         parent::__construct();
    190 
    191     }
    192 
    193 
    194     public function init()
    195     {
    196 		$this->language = new Language( $this->request->getId() );
    197 		$this->language->load();
    198 	}
    199 
    200 
    201 	/**
    202 	 * User must be an project administrator.
    203 	 */
    204 	public function checkAccess() {
    205 		$project      = new Project( $this->language->projectid );
    206 		$rootFolderId = $project->getRootObjectId();
    207 
    208 		$rootFolder = new Folder( $rootFolderId );
    209 		$rootFolder->load();
    210 
    211 		if   ( ! $rootFolder->hasRight( Permission::ACL_PROP )  )
    212 			throw new SecurityException();
    213 	}
    214 
    215 }