Changeset 13488 for trunk/admin
- Timestamp:
- Mar 6, 2012, 9:27:41 PM (12 years ago)
- Location:
- trunk/admin
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/site_manager.php
r12922 r13488 39 39 } 40 40 41 /**42 * requests the given $url (a remote create_listing_file.php) and fills a43 * list of lines corresponding to request output44 *45 * @param string $url46 * @return void47 */48 function remote_output($url)49 {50 global $template, $page;51 52 if (fetchRemote($url, $result))53 {54 $lines = explode("\r\n", $result);55 // cleaning lines from HTML tags56 foreach ($lines as $line)57 {58 $line = trim(strip_tags($line));59 if (preg_match('/^PWG-([A-Z]+)-/', $line, $matches))60 {61 $template->append(62 'remote_output',63 array(64 'CLASS' => 'remote'.ucfirst(strtolower($matches[1])),65 'CONTENT' => $line66 )67 );68 }69 }70 }71 else72 {73 array_push($page['errors'], l10n('file create_listing_file.php on remote site was not found'));74 }75 }76 77 78 41 // +-----------------------------------------------------------------------+ 79 42 // | template init | … … 87 50 { 88 51 $is_remote = url_is_remote( $_POST['galleries_url'] ); 52 if ($is_remote) 53 { 54 fatal_error('remote sites not supported'); 55 } 89 56 $url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']); 90 57 $url.= '/'; 91 if ( ! $is_remote)58 if ( ! (strpos($url, '.') === 0 ) ) 92 59 { 93 if ( ! (strpos($url, '.') === 0 ) ) 94 { 95 $url = './' . $url; 96 } 60 $url = './' . $url; 97 61 } 98 62 … … 111 75 if (count($page['errors']) == 0) 112 76 { 113 if ( $is_remote)77 if ( ! file_exists($url) ) 114 78 { 115 if ( ! isset($_POST['no_check']) ) 116 { 117 $clf_url = $url.'create_listing_file.php'; 118 $get_data = array( 119 'action' => 'test', 120 'version' => PHPWG_VERSION, 121 ); 122 if (fetchRemote($clf_url, $result, $get_data)) 123 { 124 $lines = explode("\r\n", $result); 125 $first_line = strip_tags($lines[0]); 126 if (!preg_match('/^PWG-INFO-2:/', $first_line)) 127 { 128 array_push($page['errors'], 129 l10n('an error happened').' : '.$first_line); 130 } 131 } 132 else 133 { 134 array_push($page['errors'], l10n('file create_listing_file.php on remote site was not found') ); 135 } 136 } 137 } 138 else 139 { // local directory 140 if ( ! file_exists($url) ) 141 { 142 array_push($page['errors'], 143 l10n('Directory does not exist').' ['.$url.']'); 144 } 79 array_push($page['errors'], 80 l10n('Directory does not exist').' ['.$url.']'); 145 81 } 146 82 } … … 177 113 switch($_GET['action']) 178 114 { 179 case 'generate' :180 {181 $title = $galleries_url.' : '.l10n('generate listing');182 remote_output($galleries_url.'create_listing_file.php?action=generate');183 break;184 }185 case 'test' :186 {187 $title = $galleries_url.' : '.l10n('test');188 remote_output($galleries_url.'create_listing_file.php?action=test&version='.PHPWG_VERSION);189 break;190 }191 case 'clean' :192 {193 $title = $galleries_url.' : '.l10n('clean');194 remote_output($galleries_url.'create_listing_file.php?action=clean');195 break;196 }197 115 case 'delete' : 198 116 { … … 212 130 ) 213 131 ); 214 215 // +-----------------------------------------------------------------------+216 // | remote sites list |217 // +-----------------------------------------------------------------------+218 219 if ( is_file(PHPWG_ROOT_PATH.'listing.xml') )220 {221 $xml_content = getXmlCode(PHPWG_ROOT_PATH.'listing.xml');222 $local_listing_site_url = getAttribute(223 getChild($xml_content, 'informations'),224 'url'225 );226 if ( !url_is_remote($local_listing_site_url) )227 {228 $local_listing_site_url = null;229 }230 }231 132 232 133 $query = ' … … 267 168 ); 268 169 269 if ($is_remote)270 {271 $tpl_var['remote'] =272 array(273 'U_TEST' => $base_url.'test',274 'U_GENERATE' => $row['galleries_url'].'create_listing_file.php?action=generate',275 'U_CLEAN' => $base_url.'clean',276 );277 }278 279 170 if ($row['id'] != 1) 280 171 { … … 290 181 291 182 $template->append('sites', $tpl_var); 292 293 if ( isset($local_listing_site_url) and294 $row['galleries_url']==$local_listing_site_url )295 {296 $local_listing_site_id = $row['id'];297 $template->assign( 'local_listing',298 array(299 'URL' => $local_listing_site_url,300 'U_SYNCHRONIZE' => $update_url.'&local_listing=1'301 )302 );303 }304 183 } 305 306 if ( isset($local_listing_site_url) and !isset($local_listing_site_id) )307 {308 $template->assign( 'local_listing',309 array(310 'URL' => $local_listing_site_url,311 'CREATE' => true312 )313 );314 }315 316 184 317 185 $template->assign_var_from_handle('ADMIN_CONTENT', 'site_manager'); -
trunk/admin/site_update.php
r13082 r13488 59 59 l10n('The name of directories and files must be composed of letters, numbers, "-", "_" or "."') 60 60 ), 61 'PWG-UPDATE-2' => array(62 l10n('missing thumbnail'),63 l10n('a picture filetype requires a thumbnail. The thumbnail must be present in the sub-directory "thumbnail" of the album directory. The thumbnail filename must start with the configured thumbnail prefix and the extension must be among the following list :').implode(',', $conf['picture_ext'])64 ),65 61 'PWG-ERROR-NO-FS' => array( 66 62 l10n('File/directory read error'), 67 63 l10n('The file or directory cannot be accessed (either it does not exist or the access is denied)') 68 64 ), 69 'PWG-ERROR-VERSION' => array(70 l10n('Piwigo version differs on the remote site'),71 l10n('Version of create_listing_file.php on the remote site and Piwigo must be the same')72 ),73 'PWG-ERROR-NOLISTING' => array(74 l10n('listing.xml file was not found'),75 l10n('listing.xml file was not found on the remote site. This file is generated by choosing the "generate listing" command in the Site manager')76 )77 65 ); 78 66 $errors = array(); … … 82 70 { 83 71 fatal_error('remote sites not supported'); 84 include_once(PHPWG_ROOT_PATH.'admin/site_reader_remote.php');85 $local_listing = null;86 if ( isset($_GET['local_listing'])87 and $_GET['local_listing'] )88 {89 $local_listing = PHPWG_ROOT_PATH.'listing.xml';90 }91 $site_reader = new RemoteSiteReader($site_url, $local_listing);92 72 } 93 73 else -
trunk/admin/themes/default/template/site_manager.tpl
r12693 r13488 11 11 </ul> 12 12 </div> 13 {/if}14 15 {if isset($local_listing)}16 {'A local listing.xml file has been found for'|@translate} {$local_listing.URL}17 {if isset($local_listing.CREATE)}18 <form action="{$F_ACTION}" method="post">19 <p>20 <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">21 {'Create this site'|@translate}:22 <input type="hidden" name="no_check" value="1">23 <input type="hidden" name="galleries_url" value="{$local_listing.URL}">24 <input type="submit" name="submit" value="{'Submit'|@translate}">25 </p>26 </form>27 {/if}28 {if isset($local_listing.U_SYNCHRONIZE)}29 <a href="{$local_listing.U_SYNCHRONIZE}" title="{'read local listing.xml and update'|@translate}">{'Synchronize'|@translate}</a>30 <br><br>31 {/if}32 13 {/if} 33 14 … … 46 27 [<a href="{$site.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|escape:'javascript'}');" 47 28 title="{'delete this site and all its attached elements'|@translate}">{'delete'|@translate}</a>] 48 {/if}49 {if isset($site.remote)}50 <br>51 [<a href="{$site.remote.U_TEST}" title="{'test this remote site'|@translate}">{'test'|@translate}</a>]52 [<a href="{$site.remote.U_GENERATE}" title="{'generate file listing.xml on remote site'|@translate}">{'generate listing'|@translate}</a>]53 [<a href="{$site.remote.U_CLEAN}" title="{'remove remote listing.xml file'|@translate}">{'clean'|@translate}</a>]54 29 {/if} 55 30 {if not empty($site.plugin_links)}
Note: See TracChangeset
for help on using the changeset viewer.