Changeset 31448


Ignore:
Timestamp:
03/15/16 19:33:53 (4 years ago)
Author:
ddtddt
Message:

[extensions] - Des_activate_all_languages - Beta1

Location:
extensions/de_activate_all_languages
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • extensions/de_activate_all_languages/initadmin.php

    r31444 r31448  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Des_activate all language plugin for piwigo                           | 
     3// | de_activate all language plugin for piwigo                            | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     
    2828 
    2929function plugDalPf(){ 
    30   global $template; 
     30  global $template, $conf; 
    3131  $admin_base_url = $_SERVER['REQUEST_URI']; 
    32   $template->assign('U_DAL',($admin_base_url . '&amp;desactivatelanguage')); 
    33   $template->assign('U_DALA',($admin_base_url . '&amp;activatelanguage')); 
     32   $template->assign( 
     33    array( 
     34                'U_DAL' => $admin_base_url . '&amp;deactivatelanguage', 
     35                'U_DALA' => $admin_base_url . '&amp;activatelanguage', 
     36  )); 
     37   
     38  if(isset($conf['de_activate_all_language'])){ 
     39  $template->assign('U_RDAL',($admin_base_url . '&amp;reactivatelanguage')); 
     40  } 
    3441   
    3542  $template->set_prefilter('languages', 'plugDalPT'); 
     
    4350</div> 
    4451<p style="text-align: left;padding:10px"> 
    45 <a href="{$U_DAL}" name="submitDal" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:javascript}\');"><span class="icon-check-empty"></span>{\'Desactivate all language\'|@translate}</a> 
     52<a href="{$U_DAL}" name="submitDal" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:javascript}\');"><span class="icon-check-empty"></span>{\'Deactivate all language\'|@translate}</a> 
     53{if isset ($U_RDAL)} 
     54| <a href="{$U_RDAL}" name="submitrdal" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:javascript}\');"><span class="icon-check"></span>{\'Activate language Deactivate\'|@translate}</a> 
     55{/if} 
    4656| <a href="{$U_DALA}" name="submitDala" onclick="return confirm(\'{\'Are you sure?\'|@translate|@escape:javascript}\');"><span class="icon-check"></span>{\'Activate all language\'|@translate}</a> 
    4757</p> 
     
    5161  
    5262function plugDal_action(){ 
    53   load_language('plugin.lang', DAL_PATH);        
    54   if (isset($_GET['desactivatelanguage'])) { 
    55         $admin_base_url=explode('&desactivatelanguage', $_SERVER['REQUEST_URI']); 
    56     $default_language = get_default_language(); 
     63  load_language('plugin.lang', DAL_PATH); 
     64  global $template, $conf; 
     65   
     66  if (isset($_GET['deactivatelanguage'])) { 
     67        $admin_base_url=explode('&deactivatelanguage', $_SERVER['REQUEST_URI']); 
     68    $activelang=array(); 
     69        $query = 'SELECT * FROM '.LANGUAGES_TABLE.';'; 
     70        $result=pwg_query($query); 
     71        while ($row = pwg_db_fetch_assoc($result)) 
     72          { 
     73        $activelang[]=array( 
     74                  'id'=>$row['id'], 
     75                  'version'=>$row['version'], 
     76                  'name'=>$row['name'],            
     77                ); 
     78      } 
     79        if(count($activelang)!=1){ 
     80        conf_update_param('de_activate_all_language', $activelang); 
     81        } 
     82         
     83        $default_language = get_default_language(); 
    5784    $query = 'DELETE FROM '.LANGUAGES_TABLE.' WHERE id!= \''.$default_language.'\';'; 
    5885        pwg_query($query); 
     
    81108        } 
    82109        redirect($admin_base_url[0]); 
    83   }        
     110  } 
     111 
     112  if (isset($_GET['reactivatelanguage'])) { 
     113        $admin_base_url=explode('&reactivatelanguage', $_SERVER['REQUEST_URI']); 
     114        $reaclang = safe_unserialize($conf['de_activate_all_language']); 
     115        foreach ($reaclang as $key => $lang){ 
     116          if($lang['id']!=get_default_language()){ 
     117                $query = 'INSERT INTO '.LANGUAGES_TABLE.'(id, version, name) VALUES(\''.$lang['id'].'\',\''.$lang['version'].'\',\''.$lang['name'].'\');'; 
     118                pwg_query($query); 
     119          } 
     120        } 
     121        conf_delete_param('de_activate_all_language', $activelang); 
     122        redirect($admin_base_url[0]); 
     123  }          
    84124           
    85125} 
  • extensions/de_activate_all_languages/language/en_UK/description.txt

    r31444 r31448  
    1 Add the option Disactivate / Activate all languages on the language management page 
     1Add the option deactivate / activate all languages on the language management page 
  • extensions/de_activate_all_languages/language/en_UK/plugin.lang.php

    r31444 r31448  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Des_activate all language plugin for piwigo                           | 
     3// | de_activate all language plugin for piwigo                            | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     
    2020// +-----------------------------------------------------------------------+ 
    2121 
    22 $lang['Desactivate all language'] = 'Desactivate all language'; 
     22$lang['Deactivate all language'] = 'Deactivate all language'; 
    2323$lang['Activate all language'] = 'Activate all language'; 
     24$lang['Activate language Deactivate'] = 'Activate language Deactivate'; 
    2425 
    2526?> 
  • extensions/de_activate_all_languages/language/fr_FR/plugin.lang.php

    r31444 r31448  
    11<?php 
    22// +-----------------------------------------------------------------------+ 
    3 // | Des_activate all language plugin for piwigo                           | 
     3// | de_activate all language plugin for piwigo                            | 
    44// +-----------------------------------------------------------------------+ 
    55// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
     
    2020// +-----------------------------------------------------------------------+ 
    2121 
    22 $lang['Desactivate all language'] = 'Désactiver toutes les langues'; 
     22$lang['Deactivate all language'] = 'Désactiver toutes les langues'; 
    2323$lang['Activate all language'] = 'Activer toutes les langues'; 
     24$lang['Activate language Deactivate'] = 'Réactiver les langues désactiver'; 
    2425 
    2526?> 
  • extensions/de_activate_all_languages/main.inc.php

    r31444 r31448  
    11<?php 
    22/* 
    3 Plugin Name: Des_activate all language 
     3Plugin Name: de_activate all language 
    44Version: auto 
    5 Description: Add the option Disactivate / Activate all languages on the language management page 
     5Description: Add the option Deactivate / Activate all languages on the language management page 
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=826 
    77Author: ddtddt 
     
    1010 
    1111// +-----------------------------------------------------------------------+ 
    12 // | Des_activate all language plugin for piwigo                           | 
     12// | de_activate all language plugin for piwigo                            | 
    1313// +-----------------------------------------------------------------------+ 
    1414// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ | 
Note: See TracChangeset for help on using the changeset viewer.