Changeset 13488


Ignore:
Timestamp:
03/06/12 21:27:41 (8 years ago)
Author:
rvelices
Message:

remove remote sites feature

Location:
trunk
Files:
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/site_manager.php

    r12922 r13488  
    3939} 
    4040 
    41 /** 
    42  * requests the given $url (a remote create_listing_file.php) and fills a 
    43  * list of lines corresponding to request output 
    44  * 
    45  * @param string $url 
    46  * @return void 
    47  */ 
    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 tags 
    56     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' => $line 
    66            ) 
    67          ); 
    68       } 
    69     } 
    70   } 
    71   else 
    72   { 
    73     array_push($page['errors'], l10n('file create_listing_file.php on remote site was not found')); 
    74   } 
    75 } 
    76  
    77  
    7841// +-----------------------------------------------------------------------+ 
    7942// |                             template init                             | 
     
    8750{ 
    8851  $is_remote = url_is_remote( $_POST['galleries_url'] ); 
     52  if ($is_remote) 
     53  { 
     54    fatal_error('remote sites not supported'); 
     55  } 
    8956  $url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']); 
    9057  $url.= '/'; 
    91   if (! $is_remote) 
     58  if ( ! (strpos($url, '.') === 0 ) ) 
    9259  { 
    93     if ( ! (strpos($url, '.') === 0 ) ) 
    94     { 
    95       $url = './' . $url; 
    96     } 
     60    $url = './' . $url; 
    9761  } 
    9862 
     
    11175  if (count($page['errors']) == 0) 
    11276  { 
    113     if ($is_remote) 
     77    if ( ! file_exists($url) ) 
    11478    { 
    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.']'); 
    14581    } 
    14682  } 
     
    177113  switch($_GET['action']) 
    178114  { 
    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     } 
    197115    case 'delete' : 
    198116    { 
     
    212130    ) 
    213131  ); 
    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 } 
    231132 
    232133$query = ' 
     
    267168     ); 
    268169      
    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  
    279170  if ($row['id'] != 1) 
    280171  { 
     
    290181 
    291182  $template->append('sites', $tpl_var); 
    292  
    293   if ( isset($local_listing_site_url) and 
    294        $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   } 
    304183} 
    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' => true 
    312       ) 
    313     ); 
    314 } 
    315  
    316184 
    317185$template->assign_var_from_handle('ADMIN_CONTENT', 'site_manager'); 
  • trunk/admin/site_update.php

    r13082 r13488  
    5959    l10n('The name of directories and files must be composed of letters, numbers, "-", "_" or "."') 
    6060    ), 
    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     ), 
    6561  'PWG-ERROR-NO-FS' => array( 
    6662    l10n('File/directory read error'), 
    6763    l10n('The file or directory cannot be accessed (either it does not exist or the access is denied)') 
    6864    ), 
    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     ) 
    7765  ); 
    7866$errors = array(); 
     
    8270{ 
    8371  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); 
    9272} 
    9373else 
  • trunk/admin/themes/default/template/site_manager.tpl

    r12693 r13488  
    1111  </ul> 
    1212</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 &nbsp;<a href="{$local_listing.U_SYNCHRONIZE}" title="{'read local listing.xml and update'|@translate}">{'Synchronize'|@translate}</a> 
    30 <br><br> 
    31 {/if} 
    3213{/if} 
    3314 
     
    4627      [<a href="{$site.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|escape:'javascript'}');" 
    4728                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>] 
    5429    {/if} 
    5530    {if not empty($site.plugin_links)} 
  • trunk/include/functions.inc.php

    r13258 r13488  
    2626include_once( PHPWG_ROOT_PATH .'include/functions_session.inc.php' ); 
    2727include_once( PHPWG_ROOT_PATH .'include/functions_category.inc.php' ); 
    28 include_once( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' ); 
    2928include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' ); 
    3029include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' ); 
  • trunk/language/en_UK/admin.lang.php

    r13451 r13488  
    8686$lang[', click on'] = ", click on"; 
    8787$lang['... or '] = '... or '; 
    88 $lang['A local listing.xml file has been found for'] = "A local listing.xml file has been found for"; 
    8988$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 :"; 
    9189$lang['Access type'] = "Access type"; 
    9290$lang['ACCESS_0'] = "Free access"; 
     
    299297$lang['Extensions Update'] = 'Extensions Update'; 
    300298$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"; 
    302299$lang['File upload stopped by extension'] = 'File upload stopped by extension'; 
    303300$lang['File'] = "File"; 
     
    319316$lang['GD version'] = "GD version"; 
    320317$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"; 
    323318$lang['Get Support on Piwigo Forum'] = 'Get support on Piwigo forum'; 
    324319$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'; 
     
    405400$lang['Link all album photos to some existing albums'] = "Link all album photos to some existing albums"; 
    406401$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"; 
    409402$lang['Local'] = "Local"; 
    410403$lang['Lock albums'] = "Lock albums"; 
     
    449442$lang['Missing a temporary folder'] = 'Missing a temporary folder'; 
    450443$lang['Missing Plugins'] = 'Missing Plugins'; 
    451 $lang['missing thumbnail'] = "missing thumbnail"; 
    452444$lang['Modify information'] = "Modify information"; 
    453445$lang['Month'] = "Month"; 
     
    542534$lang['Piwigo Update'] = 'Piwigo Update'; 
    543535$lang['Piwigo Uploader'] = 'Piwigo Uploader'; 
    544 $lang['Piwigo version differs on the remote site'] = "Piwigo version differs on the remote site"; 
    545536$lang['Piwigo version'] = "Piwigo version"; 
    546537$lang['pixels'] = 'pixels'; 
     
    578569$lang['Rating by guests'] = "Rating by guests"; 
    579570$lang['Rating'] = "Rating"; 
    580 $lang['read local listing.xml and update'] = "read local listing.xml and update"; 
    581571$lang['Read Piwigo Documentation'] = 'Read Piwigo Documentation'; 
    582572$lang['reduce to single existing albums'] = "reduce to single existing albums"; 
     
    594584$lang['remove creation date'] = 'remove creation date'; 
    595585$lang['Remove from caddie'] = 'Remove from caddie'; 
    596 $lang['remove remote listing.xml file'] = "remove remote listing.xml file"; 
    597586$lang['remove tags'] = "remove tags"; 
    598587$lang['remove this filter'] = 'remove this filter'; 
     
    779768$lang['Validate'] = "Validate"; 
    780769$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"; 
    782770$lang['Version'] = "Version"; 
    783771$lang['Virtual album added'] = "Virtual album added"; 
Note: See TracChangeset for help on using the changeset viewer.