Changeset 13488
- Timestamp:
- Mar 6, 2012, 9:27:41 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 5 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)} -
trunk/include/functions.inc.php
r13258 r13488 26 26 include_once( PHPWG_ROOT_PATH .'include/functions_session.inc.php' ); 27 27 include_once( PHPWG_ROOT_PATH .'include/functions_category.inc.php' ); 28 include_once( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' );29 28 include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' ); 30 29 include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' ); -
trunk/language/en_UK/admin.lang.php
r13451 r13488 86 86 $lang[', click on'] = ", click on"; 87 87 $lang['... or '] = '... or '; 88 $lang['A local listing.xml file has been found for'] = "A local listing.xml file has been found for";89 88 $lang['A new version of Piwigo is available.'] = "A new version of Piwigo is available."; 90 $lang['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 :'] = "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 :";91 89 $lang['Access type'] = "Access type"; 92 90 $lang['ACCESS_0'] = "Free access"; … … 299 297 $lang['Extensions Update'] = 'Extensions Update'; 300 298 $lang['Failed to write file to disk'] = 'Failed to write file to disk'; 301 $lang['file create_listing_file.php on remote site was not found'] = "file create_listing_file.php not found on the remote site";302 299 $lang['File upload stopped by extension'] = 'File upload stopped by extension'; 303 300 $lang['File'] = "File"; … … 319 316 $lang['GD version'] = "GD version"; 320 317 $lang['General statistics'] = "General statistics"; 321 $lang['generate file listing.xml on remote site'] = "generate file listing.xml on the remote site";322 $lang['generate listing'] = "generate listing";323 318 $lang['Get Support on Piwigo Forum'] = 'Get support on Piwigo forum'; 324 319 $lang['Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'] = 'Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'; … … 405 400 $lang['Link all album photos to some existing albums'] = "Link all album photos to some existing albums"; 406 401 $lang['Linked albums'] = "Linked albums"; 407 $lang['listing.xml file was not found on the remote site. This file is generated by choosing the "generate listing" command in the Site manager'] = "listing.xml file not found on the remote site. This file is generated with the \"generate listing\" command in the Site manager";408 $lang['listing.xml file was not found'] = "listing.xml file not found";409 402 $lang['Local'] = "Local"; 410 403 $lang['Lock albums'] = "Lock albums"; … … 449 442 $lang['Missing a temporary folder'] = 'Missing a temporary folder'; 450 443 $lang['Missing Plugins'] = 'Missing Plugins'; 451 $lang['missing thumbnail'] = "missing thumbnail";452 444 $lang['Modify information'] = "Modify information"; 453 445 $lang['Month'] = "Month"; … … 542 534 $lang['Piwigo Update'] = 'Piwigo Update'; 543 535 $lang['Piwigo Uploader'] = 'Piwigo Uploader'; 544 $lang['Piwigo version differs on the remote site'] = "Piwigo version differs on the remote site";545 536 $lang['Piwigo version'] = "Piwigo version"; 546 537 $lang['pixels'] = 'pixels'; … … 578 569 $lang['Rating by guests'] = "Rating by guests"; 579 570 $lang['Rating'] = "Rating"; 580 $lang['read local listing.xml and update'] = "read local listing.xml and update";581 571 $lang['Read Piwigo Documentation'] = 'Read Piwigo Documentation'; 582 572 $lang['reduce to single existing albums'] = "reduce to single existing albums"; … … 594 584 $lang['remove creation date'] = 'remove creation date'; 595 585 $lang['Remove from caddie'] = 'Remove from caddie'; 596 $lang['remove remote listing.xml file'] = "remove remote listing.xml file";597 586 $lang['remove tags'] = "remove tags"; 598 587 $lang['remove this filter'] = 'remove this filter'; … … 779 768 $lang['Validate'] = "Validate"; 780 769 $lang['Validation'] = "Validation"; 781 $lang['Version of create_listing_file.php on the remote site and Piwigo must be the same'] = "Versions of create_listing_file.php on the remote site and Piwigo must be the same";782 770 $lang['Version'] = "Version"; 783 771 $lang['Virtual album added'] = "Virtual album added";
Note: See TracChangeset
for help on using the changeset viewer.