Changeset 9735


Ignore:
Timestamp:
Mar 16, 2011, 11:45:17 PM (13 years ago)
Author:
patdenice
Message:

Remove useless function.
Update englich language key.

Location:
extensions/autoupdate/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/trunk/ajax/ignore_list.php

    r9723 r9735  
    1818}
    1919
    20 if (empty($_POST['id']) or empty($_POST['type']))
     20if (empty($_POST['id']) or empty($_POST['type'])
     21  or !in_array($_POST['type'], array('plugins', 'themes', 'languages')))
    2122{
    2223  die;
     
    2425
    2526// Add or remove plugin from ignore list
    26 $ignore = $conf['AU_ignore'][$_POST['type']];
    27 $ignore = array_flip($ignore);
    28 
    29 if (isset($ignore[$_POST['id']]))
     27if (!in_array($_POST['id'], $conf['AU_ignore'][$_POST['type']]))
    3028{
    31   unset($ignore[$_POST['id']]);
    32   $ignore = array_flip($ignore);
     29  array_push($conf['AU_ignore'][$_POST['type']], $_POST['id']);
    3330}
    34 else
    35 {
    36   $ignore = array_flip($ignore);
    37   array_push($ignore, $_POST['id']);
    38 }
    39 
    40 sort($ignore);
    41 $conf['AU_ignore'][$_POST['type']] = $ignore;
    4231conf_update_param('autoupdate_ignore_list', pwg_db_real_escape_string(serialize($conf['AU_ignore'])));
    4332unset($_SESSION['extensions_need_update']);
  • extensions/autoupdate/trunk/include/functions.inc.php

    r9712 r9735  
    8686      }
    8787    }
    88   }
    89 }
    90 
    91 function move_local_files($dir)
    92 {
    93   global $page, $cfgBase, $cfgUser, $cfgPassword, $cfgHote, $prefixeTable;
    94 
    95   if ((!is_dir($dir) and !mkdir($dir, 0777))
    96     or (!is_dir($dir.'/config') and !mkdir($dir.'/config'))
    97     or (!is_dir($dir.'/css') and !mkdir($dir.'/css'))
    98     or (!is_dir($dir.'/language') and !mkdir($dir.'/language')))
    99   {
    100     autoupdate_deltree($dir);
    101     array_push($page['errors'], l10n('Unable to write new local directory.'));
    102     return;
    103   }
    104 
    105   // Add index.php
    106   autoupdate_add_index($dir);
    107 
    108   // mysql.inc.php
    109   $file = PHPWG_ROOT_PATH.'include/mysql.inc.php';
    110   if (is_readable($file))
    111   {
    112     $file_content = '<?php
    113 $conf[\'dblayer\'] = \'mysql\';
    114 $conf[\'db_base\'] = \''.$cfgBase.'\';
    115 $conf[\'db_user\'] = \''.$cfgUser.'\';
    116 $conf[\'db_password\'] = \''.$cfgPassword.'\';
    117 $conf[\'db_host\'] = \''.$cfgHote.'\';
    118 
    119 $prefixeTable = \''.$prefixeTable.'\';
    120 
    121 define(\'PHPWG_INSTALLED\', true);';
    122     if (defined('PWG_CHARSET'))
    123     {
    124       $file_content.= '
    125 define(\'PWG_CHARSET\', \'utf-8\');
    126 define(\'DB_CHARSET\', \'utf8\');
    127 define(\'DB_COLLATE\', \'\');';
    128     }
    129     $file_content.= '
    130 ?>';
    131     $new_config_file = $dir.'/config/database.inc.php';
    132 
    133     if (!($fp = @fopen($new_config_file, 'w'))
    134       or !@fwrite($fp, $file_content)
    135       or !@fclose($fp))
    136     {
    137       array_push($page['errors'], l10n('Unable to write new local directory.'));
    138       return;
    139     }
    140     @chmod($new_config_file, 0755);
    141   }
    142 
    143   // config_local.inc.php
    144   $file = PHPWG_ROOT_PATH.'include/config_local.inc.php';
    145   if (is_readable($file))
    146   {
    147     copy($file, $dir.'/config/config.inc.php');
    148     @chmod($file, 0755);
    149   }
    150 
    151   // languages
    152   $language_dir = opendir(PHPWG_ROOT_PATH.'language');
    153   while ($file = readdir($language_dir))
    154   {
    155     $path = PHPWG_ROOT_PATH.'language/'.$file;
    156     if (!is_link($path) and is_dir($path) and is_readable($path.'/local.lang.php'))
    157     {
    158       $content = file_get_contents($path.'/local.lang.php');
    159       $langdef = explode('.',$file);
    160       if (count($langdef)>1)
    161       {
    162         $content = utf8_encode($content);
    163       }
    164       $filename = $dir.'/language/'.$langdef[0].'.lang.php';
    165       $fp = @fopen($filename, 'w');
    166       @fwrite($fp, $content);
    167       @fclose($fp);
    168       @chmod($filename, 0755);
    169     }
    170   }
    171   closedir($language_dir);
    172 
    173   // template-common/local-layout.css
    174   $file = PHPWG_ROOT_PATH.'template-common/local-layout.css';
    175   if (is_readable($file))
    176   {
    177     copy($file, $dir.'/css/rules.css');
    178     @chmod($file, 0755);
    179   }
    180 
    181   // template/xxx/local-layout.css
    182   $known_templates = array(
    183     'yoga'     => 'default',
    184     'floPure'  => 'Pure_default',
    185     'floOs'    => 'OS_default',
    186     'gally'    => 'gally-default',
    187     'simple'   => 'simple',
    188   );
    189 
    190   foreach ($known_templates as $old_tpl => $new_tpl)
    191   {
    192     $file = PHPWG_ROOT_PATH.'template/'.$old_tpl.'/local-layout.css';
    193     if (is_readable($file))
    194     {
    195       copy($file, $dir.'/css/'.$new_tpl.'-rules.css');
    196       @chmod($file, 0755);
    197     }
    198   }
    199 }
    200 
    201 function autoupdate_save_template_dir()
    202 {
    203   global $page, $conf;
    204 
    205   $path = $conf['local_data_dir'].'/autoupdate';
    206 
    207   if (@mkgetdir($path)
    208     and ($zip = tempnam($path, 'zip'))
    209     and ($archive = new pclZip($zip))
    210     and ($v_list = $archive->add(PHPWG_ROOT_PATH.'template', PCLZIP_OPT_REMOVE_PATH, PHPWG_ROOT_PATH))
    211     and is_array($v_list)
    212     and !empty($v_list))
    213   {
    214     $http_headers = array(
    215       'Content-Length: '.@filesize($zip),
    216       'Content-Type: application/zip',
    217       'Content-Disposition: attachment; filename="template.zip";',
    218       'Content-Transfer-Encoding: binary',
    219       );
    220 
    221     foreach ($http_headers as $header) {
    222       header($header);
    223     }
    224 
    225     @readfile($zip);
    226     autoupdate_deltree($conf['local_data_dir'].'/autoupdate');
    227     exit();
    228   }
    229   else
    230   {
    231     array_push($page['errors'], l10n('Unable to send template directory.'));
    23288  }
    23389}
     
    312168    $remove_path = version_compare($code, '2.0.8', '>=') ? 'piwigo' : 'piwigo-'.$code;
    313169    $obsolete_list = PHPWG_ROOT_PATH.'install/obsolete.list';
    314 
    315     if (version_compare(PHPWG_VERSION, '2.1', '<'))
    316     {
    317       move_local_files(PHPWG_ROOT_PATH.'local');
    318     }
    319170  }
    320171
  • extensions/autoupdate/trunk/language/en_UK/plugin.lang.php

    r9721 r9735  
    3737$lang['autoupdate_ignore'] = 'Ignore this update';
    3838$lang['autoupdate_reset_ignore'] = 'Reset ignored updates';
    39 $lang['autoupdate_update_all'] = 'All update';
     39$lang['autoupdate_update_all'] = 'Update All';
    4040$lang['ERROR'] = 'ERROR';
    4141$lang['Upgrade Complete'] = 'Upgrade Complete';
  • extensions/autoupdate/trunk/template/autoupdate.js

    r9723 r9735  
    99    if (extList.length > 0) eval(extList[0]);
    1010  }
    11   return false;
    1211};
    1312
     
    2322        jQuery("#reset_ignore").hide();
    2423        jQuery("#ignored").hide();
     24        checkFieldsets();
    2525      }
    2626    }
    2727  );
    28   return false;
    2928};
    3029
     
    3635    nbExtensions = 0;
    3736    jQuery("div[id^='"+types[i]+"_']").each(function(index) {
    38         if (jQuery(this).css('display') == 'block')
    39           nbExtensions++;
    40         else
    41           ignored++;
    42       });
     37      if (jQuery(this).css('display') == 'block')
     38        nbExtensions++;
     39      else
     40        ignored++;
     41    });
    4342    total = total + nbExtensions;
    4443    if (nbExtensions == 0)
     
    103102    dataType: 'json'
    104103  });
    105   return false;
    106104};
    107105
     
    118116    }
    119117  );
    120   return false;
    121118};
  • extensions/autoupdate/trunk/template/update_ext.tpl

    r9729 r9735  
    3232<div class="autoupdate_bar">
    3333<br>
    34 <input type="button" id="update_all" value="{'autoupdate_update_all'|@translate}" onClick="updateAll();">
    35 <input type="button" id="reset_ignore" value="{'autoupdate_reset_ignore'|@translate}" onClick="resetIgnored();" {if !$SHOW_RESET}style="display:none;"{/if}>
     34<input type="submit" id="update_all" value="{'autoupdate_update_all'|@translate}" onClick="updateAll(); return false;">
     35<input type="submit" id="reset_ignore" value="{'autoupdate_reset_ignore'|@translate}" onClick="resetIgnored(); return false;" {if !$SHOW_RESET}style="display:none;"{/if}>
    3636</div>
    3737<div class="autoupdate_bar" style="display:none;">
     
    4444<div>
    4545<fieldset id="plugins">
    46 <legend>{'Plugins which need upgrade'|@translate}</legend>
     46<legend>{'Plugins'|@translate}</legend>
    4747{foreach from=$update_plugins item=plugin name=plugins_loop}
    4848<div class="pluginBox" id="plugin_{$plugin.EXT_ID}" {if $plugin.IGNORED}style="display:none;"{/if}>
     
    5555        <a href="#" onClick="upgradeExtension('plugin', '{$plugin.EXT_ID}', {$plugin.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a>
    5656        | <a href="{$plugin.URL_DOWNLOAD}">{'Download'|@translate}</a>
    57         | <a href="#" onClick="ignoreExtension('plugin', '{$plugin.EXT_ID}');">{'autoupdate_ignore'|@translate}</a>
     57        | <a href="#" onClick="ignoreExtension('plugin', '{$plugin.EXT_ID}'); return false;">{'autoupdate_ignore'|@translate}</a>
    5858      </td>
    5959    </tr>
     
    8686<div>
    8787<fieldset id="themes">
    88 <legend>{'Themes which need upgrade'|@translate}</legend>
     88<legend>{'Themes'|@translate}</legend>
    8989{foreach from=$update_themes item=theme name=themes_loop}
    9090<div class="pluginBox" id="theme_{$theme.EXT_ID}" {if $theme.IGNORED}style="display:none;"{/if}>
     
    9797        <a href="#" onClick="upgradeExtension('theme', '{$theme.EXT_ID}', {$theme.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a>
    9898        | <a href="{$theme.URL_DOWNLOAD}">{'Download'|@translate}</a>
    99         | <a href="#" onClick="ignoreExtension('theme', '{$theme.EXT_ID}');">{'autoupdate_ignore'|@translate}</a>
     99        | <a href="#" onClick="ignoreExtension('theme', '{$theme.EXT_ID}'); return false;">{'autoupdate_ignore'|@translate}</a>
    100100      </td>
    101101    </tr>
     
    128128<div>
    129129<fieldset id="languages">
    130 <legend>{'Languages which need upgrade'|@translate}</legend>
     130<legend>{'Languages'|@translate}</legend>
    131131{foreach from=$update_languages item=language name=languages_loop}
    132132<div class="pluginBox" id="language_{$language.EXT_ID}" {if $language.IGNORED}style="display:none;"{/if}>
     
    139139        <a href="#" onClick="upgradeExtension('language', '{$language.EXT_ID}', {$language.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a>
    140140        | <a href="{$language.URL_DOWNLOAD}">{'Download'|@translate}</a>
    141         | <a href="#" onClick="ignoreExtension('language', '{$language.EXT_ID}');">{'autoupdate_ignore'|@translate}</a>
     141        | <a href="#" onClick="ignoreExtension('language', '{$language.EXT_ID}'); return false;">{'autoupdate_ignore'|@translate}</a>
    142142      </td>
    143143    </tr>
  • extensions/autoupdate/trunk/template/update_pwg.tpl

    r9712 r9735  
    5757<form action="" method="post">
    5858
    59 {if version_compare($PHPWG_VERSION, '2.1', '<')}
    60 {counter assign=i}
    61 <fieldset>
    62   <legend>{'autoupdate_step_'|cat:$i|@translate}</legend>
    63   <p><input type="submit" name="saveTemplate" value="{'Save Template Directory'|@translate}"></p>
    64 </fieldset>
    65 {/if}
    66 
    6759{counter assign=i}
    6860<fieldset>
  • extensions/autoupdate/trunk/update_pwg.inc.php

    r9712 r9735  
    106106if ($step == 3 and is_webmaster())
    107107{
    108   if (isset($_POST['saveTemplate']) and version_compare(PHPWG_VERSION, '2.1', '<'))
    109   {
    110     autoupdate_save_template_dir();
    111   }
    112 
    113108  if (isset($_POST['dumpDatabase']))
    114109  {
Note: See TracChangeset for help on using the changeset viewer.