Changeset 5371
- Timestamp:
- Mar 26, 2010, 1:55:12 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/languages.class.php
r5357 r5371 37 37 38 38 /** 39 * Set tabsheet for languages pages. 40 * @param string selected page. 41 */ 42 function set_tabsheet($selected) 43 { 44 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 45 46 $link = get_root_url().'admin.php?page='; 47 48 $tabsheet = new tabsheet(); 49 $tabsheet->add('languages_installed', l10n('Installed Languages'), $link.'languages_installed'); 50 $tabsheet->add('languages_new', l10n('Add New Language'), $link.'languages_new'); 51 $tabsheet->select($selected); 52 $tabsheet->assign(); 53 } 54 55 /** 39 56 * Perform requested actions 40 57 * @param string - action … … 171 188 $this->db_languages[ $row['id'] ] = $row['name']; 172 189 } 190 } 191 192 /** 193 * Retrieve PEM server datas to $server_languages 194 */ 195 function get_server_languages() 196 { 197 global $user; 198 199 $pem_category_id = 8; 200 201 // Retrieve PEM versions 202 $version = PHPWG_VERSION; 203 $versions_to_check = array(); 204 $url = PEM_URL . '/api/get_version_list.php?category_id='.$pem_category_id.'&format=php'; 205 if (fetchRemote($url, $result) and $pem_versions = @unserialize($result)) 206 { 207 if (!preg_match('/^\d+\.\d+\.\d+/', $version)) 208 { 209 $version = $pem_versions[0]['name']; 210 } 211 $branch = substr($version, 0, strrpos($version, '.')); 212 foreach ($pem_versions as $pem_version) 213 { 214 if (strpos($pem_version['name'], $branch) === 0) 215 { 216 $versions_to_check[] = $pem_version['id']; 217 } 218 } 219 } 220 if (empty($versions_to_check)) 221 { 222 return false; 223 } 224 225 // Retrieve PEM languages infos 226 $url = PEM_URL . '/api/get_revision_list.php?category_id='.$pem_category_id.'&format=php&last_revision_only=true'; 227 $url .= '&version=' . implode(',', $versions_to_check); 228 $url .= '&lang='.$user['language']; 229 230 if (fetchRemote($url, $result)) 231 { 232 $pem_languages = @unserialize($result); 233 if (!is_array($pem_languages)) 234 { 235 return false; 236 } 237 foreach ($pem_languages as $language) 238 { 239 if (preg_match('/^.*? \[[A-Z]{2}\]$/', $language['extension_name']) 240 and !in_array($language['extension_name'], $this->fs_languages)) 241 { 242 $this->server_languages[] = $language; 243 } 244 } 245 return true; 246 } 247 return false; 248 } 249 250 /** 251 * Extract language files from archive 252 * 253 * @param string - install or upgrade 254 * @param string - remote revision identifier (numeric) 255 * @param string - language id or extension id 256 */ 257 function extract_language_files($action, $revision, $dest='') 258 { 259 if ($archive = tempnam( PHPWG_ROOT_PATH.'language', 'zip')) 260 { 261 $url = PEM_URL . '/download.php?rid=' . $revision; 262 $url .= '&origin=piwigo_' . $action; 263 264 if ($handle = @fopen($archive, 'wb') and fetchRemote($url, $handle)) 265 { 266 fclose($handle); 267 include(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php'); 268 $zip = new PclZip($archive); 269 if ($list = $zip->listContent()) 270 { 271 foreach ($list as $file) 272 { 273 // we search iso.txt in archive 274 if (basename($file['filename']) == 'iso.txt' 275 and (!isset($main_filepath) 276 or strlen($file['filename']) < strlen($main_filepath))) 277 { 278 $main_filepath = $file['filename']; 279 } 280 } 281 if (isset($main_filepath)) 282 { 283 $root = basename(dirname($main_filepath)); // iso.txt path in archive 284 if (preg_match('/^[a-z]{2}_[A-Z]{2}$/', $root)) 285 { 286 if ($action == 'install') 287 { 288 $dest = $root; 289 } 290 $extract_path = PHPWG_ROOT_PATH.'language/'.$dest; 291 if ( 292 $result = $zip->extract( 293 PCLZIP_OPT_PATH, $extract_path, 294 PCLZIP_OPT_REMOVE_PATH, $root, 295 PCLZIP_OPT_REPLACE_NEWER 296 ) 297 ) 298 { 299 foreach ($result as $file) 300 { 301 if ($file['stored_filename'] == $main_filepath) 302 { 303 $status = $file['status']; 304 break; 305 } 306 } 307 if ($status == 'ok') 308 { 309 $this->fs_languages = $this->get_fs_languages(); 310 $this->perform_action('activate', $dest); 311 } 312 if (file_exists($extract_path.'/obsolete.list') 313 and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES) 314 and !empty($old_files)) 315 { 316 array_push($old_files, 'obsolete.list'); 317 foreach($old_files as $old_file) 318 { 319 $path = $extract_path.'/'.$old_file; 320 if (is_file($path)) 321 { 322 @unlink($path); 323 } 324 elseif (is_dir($path)) 325 { 326 if (!$this->deltree($path)) 327 { 328 $this->send_to_trash($path); 329 } 330 } 331 } 332 } 333 } 334 else $status = 'extract_error'; 335 } 336 else $status = 'archive_error'; 337 } 338 else $status = 'archive_error'; 339 } 340 else $status = 'archive_error'; 341 } 342 else $status = 'dl_archive_error'; 343 } 344 else $status = 'temp_path_error'; 345 346 @unlink($archive); 347 return $status; 173 348 } 174 349 -
trunk/admin/languages_installed.php
r5357 r5371 35 35 $languages = new languages(); 36 36 $languages->get_db_languages(); 37 $languages->set_tabsheet($page['page']); 37 38 38 39 //--------------------------------------------------perform requested actions -
trunk/admin/themes/default/default-layout.css
r5364 r5371 38 38 39 39 /* Plugins, languages tables */ 40 TABLE.plugins { min-width: 400px; } 40 TABLE.plugins, 41 TABLE.languages { 42 min-width: 500px; 43 } 41 44 TABLE.plugins A { border: 0; } 42 45 TABLE.plugins TR TD { padding: 4px 10px; } 43 46 TABLE.plugins TR TD.pluginState { padding: 4px 16px; } 47 TABLE.languages TR TD { padding: 7px 20px; } 44 48 45 49 TABLE.plugins TR TD.active, … … 64 68 65 69 TABLE.plugins ul.pluginsActions li { display: inline; } 66 67 TABLE.languages { min-width: 400px; }68 TABLE.languages TR TD { text-align: center; padding: 4px 20px; }69 70 70 71 /* categoryOrdering */ -
trunk/admin/themes/default/template/languages_installed.tpl
r5357 r5371 1 1 <div class="titrePage"> 2 <h2>{' Languages'|@translate}</h2>2 <h2>{'Installed Languages'|@translate}</h2> 3 3 </div> 4 4 … … 13 13 {foreach from=$languages item=language name=languages_loop} 14 14 <tr class="{if $smarty.foreach.languages_loop.index is odd}row1{else}row2{/if}"> 15 <td class="{$language.STATE}" style="text-align: left;">15 <td class="{$language.STATE}"> 16 16 {$language.NAME} 17 17 {if $language.IS_DEFAULT}<i>({'Default'|@translate})</i>{/if} 18 18 </td> 19 <td >19 <td style="text-align: center;"> 20 20 {if !$language.IS_DEFAULT} 21 21 {if $language.STATE == 'active' or $language.STATE == 'missing'} -
trunk/language/en_UK/admin.lang.php
r5369 r5371 753 753 $lang['Allow user customization'] = 'Allow user customization'; 754 754 $lang['Languages'] = 'Languages'; 755 $lang['Installed Languages'] = 'Installed Languages'; 756 $lang['Add New Language'] = 'Add New Language'; 757 $lang['Language has been successfully installed'] = 'Language has been successfully installed'; 755 758 ?> -
trunk/language/fr_FR/admin.lang.php
r5369 r5371 757 757 $lang['pLoader stands for <em>Piwigo Uploader</em>. From your computer, pLoader prepares your photos and transfer them to your Piwigo photo gallery.'] = 'pLoader signifie <em>Piwigo Uploader</em>. Depuis votre ordinateur, pLoader prépare vos photos et les transfert vers votre galerie photo Piwigo.'; 758 758 $lang['Languages'] = 'Langues'; 759 $lang['Installed Languages'] = 'Langues installées'; 760 $lang['Add New Language'] = 'Ajouter une langue'; 761 $lang['Language has been successfully installed'] = 'La langue a été installée avec succès'; 759 762 ?>
Note: See TracChangeset
for help on using the changeset viewer.