Changeset 9735 for extensions/autoupdate/trunk
- Timestamp:
- Mar 16, 2011, 11:45:17 PM (13 years ago)
- Location:
- extensions/autoupdate/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/autoupdate/trunk/ajax/ignore_list.php
r9723 r9735 18 18 } 19 19 20 if (empty($_POST['id']) or empty($_POST['type'])) 20 if (empty($_POST['id']) or empty($_POST['type']) 21 or !in_array($_POST['type'], array('plugins', 'themes', 'languages'))) 21 22 { 22 23 die; … … 24 25 25 26 // 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']])) 27 if (!in_array($_POST['id'], $conf['AU_ignore'][$_POST['type']])) 30 28 { 31 unset($ignore[$_POST['id']]); 32 $ignore = array_flip($ignore); 29 array_push($conf['AU_ignore'][$_POST['type']], $_POST['id']); 33 30 } 34 else35 {36 $ignore = array_flip($ignore);37 array_push($ignore, $_POST['id']);38 }39 40 sort($ignore);41 $conf['AU_ignore'][$_POST['type']] = $ignore;42 31 conf_update_param('autoupdate_ignore_list', pwg_db_real_escape_string(serialize($conf['AU_ignore']))); 43 32 unset($_SESSION['extensions_need_update']); -
extensions/autoupdate/trunk/include/functions.inc.php
r9712 r9735 86 86 } 87 87 } 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.php106 autoupdate_add_index($dir);107 108 // mysql.inc.php109 $file = PHPWG_ROOT_PATH.'include/mysql.inc.php';110 if (is_readable($file))111 {112 $file_content = '<?php113 $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.php144 $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 // languages152 $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.css174 $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.css182 $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 else230 {231 array_push($page['errors'], l10n('Unable to send template directory.'));232 88 } 233 89 } … … 312 168 $remove_path = version_compare($code, '2.0.8', '>=') ? 'piwigo' : 'piwigo-'.$code; 313 169 $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 }319 170 } 320 171 -
extensions/autoupdate/trunk/language/en_UK/plugin.lang.php
r9721 r9735 37 37 $lang['autoupdate_ignore'] = 'Ignore this update'; 38 38 $lang['autoupdate_reset_ignore'] = 'Reset ignored updates'; 39 $lang['autoupdate_update_all'] = ' All update';39 $lang['autoupdate_update_all'] = 'Update All'; 40 40 $lang['ERROR'] = 'ERROR'; 41 41 $lang['Upgrade Complete'] = 'Upgrade Complete'; -
extensions/autoupdate/trunk/template/autoupdate.js
r9723 r9735 9 9 if (extList.length > 0) eval(extList[0]); 10 10 } 11 return false;12 11 }; 13 12 … … 23 22 jQuery("#reset_ignore").hide(); 24 23 jQuery("#ignored").hide(); 24 checkFieldsets(); 25 25 } 26 26 } 27 27 ); 28 return false;29 28 }; 30 29 … … 36 35 nbExtensions = 0; 37 36 jQuery("div[id^='"+types[i]+"_']").each(function(index) { 38 39 40 41 42 37 if (jQuery(this).css('display') == 'block') 38 nbExtensions++; 39 else 40 ignored++; 41 }); 43 42 total = total + nbExtensions; 44 43 if (nbExtensions == 0) … … 103 102 dataType: 'json' 104 103 }); 105 return false;106 104 }; 107 105 … … 118 116 } 119 117 ); 120 return false;121 118 }; -
extensions/autoupdate/trunk/template/update_ext.tpl
r9729 r9735 32 32 <div class="autoupdate_bar"> 33 33 <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}> 36 36 </div> 37 37 <div class="autoupdate_bar" style="display:none;"> … … 44 44 <div> 45 45 <fieldset id="plugins"> 46 <legend>{'Plugins which need upgrade'|@translate}</legend>46 <legend>{'Plugins'|@translate}</legend> 47 47 {foreach from=$update_plugins item=plugin name=plugins_loop} 48 48 <div class="pluginBox" id="plugin_{$plugin.EXT_ID}" {if $plugin.IGNORED}style="display:none;"{/if}> … … 55 55 <a href="#" onClick="upgradeExtension('plugin', '{$plugin.EXT_ID}', {$plugin.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a> 56 56 | <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> 58 58 </td> 59 59 </tr> … … 86 86 <div> 87 87 <fieldset id="themes"> 88 <legend>{'Themes which need upgrade'|@translate}</legend>88 <legend>{'Themes'|@translate}</legend> 89 89 {foreach from=$update_themes item=theme name=themes_loop} 90 90 <div class="pluginBox" id="theme_{$theme.EXT_ID}" {if $theme.IGNORED}style="display:none;"{/if}> … … 97 97 <a href="#" onClick="upgradeExtension('theme', '{$theme.EXT_ID}', {$theme.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a> 98 98 | <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> 100 100 </td> 101 101 </tr> … … 128 128 <div> 129 129 <fieldset id="languages"> 130 <legend>{'Languages which need upgrade'|@translate}</legend>130 <legend>{'Languages'|@translate}</legend> 131 131 {foreach from=$update_languages item=language name=languages_loop} 132 132 <div class="pluginBox" id="language_{$language.EXT_ID}" {if $language.IGNORED}style="display:none;"{/if}> … … 139 139 <a href="#" onClick="upgradeExtension('language', '{$language.EXT_ID}', {$language.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a> 140 140 | <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> 142 142 </td> 143 143 </tr> -
extensions/autoupdate/trunk/template/update_pwg.tpl
r9712 r9735 57 57 <form action="" method="post"> 58 58 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 67 59 {counter assign=i} 68 60 <fieldset> -
extensions/autoupdate/trunk/update_pwg.inc.php
r9712 r9735 106 106 if ($step == 3 and is_webmaster()) 107 107 { 108 if (isset($_POST['saveTemplate']) and version_compare(PHPWG_VERSION, '2.1', '<'))109 {110 autoupdate_save_template_dir();111 }112 113 108 if (isset($_POST['dumpDatabase'])) 114 109 {
Note: See TracChangeset
for help on using the changeset viewer.