/web/htdocs/www.euroroma.net/home/zenphoto/zp-core/zp-extensions/site_upgrade/site_upgrade.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php

define
('OFFSET_PATH'3);
require_once(
dirname(dirname(dirname(__FILE__))) . '/admin-globals.php');
require_once(
SERVERPATH '/' ZENFOLDER '/functions-config.php');

admin_securityChecks(ALBUM_RIGHTScurrentRelativeURL());
$htpath SERVERPATH '/.htaccess';
$ht = @file_get_contents($htpath);

switch (isset(
$_GET['siteState']) ? $_GET['siteState'] : NULL) {
    case 
'closed':
        
// TODO: do the same for other feeds?
        
if (class_exists('RSS')) {

            class 
setupRSS extends RSS {

                public function 
getitems() {
                    
$this->feedtype 'setup';
                    
$items = array();
                    
$items[] = array('title'                         => gettext('RSS suspended'),
                                    
'link'                         => '',
                                    
'enclosure'                 => '',
                                    
'category'                 => '',
                                    
'media_content'         => '',
                                    
'media_thumbnail'     => '',
                                    
'pubdate'                     => date("r"time()),
                                    
'desc'                         => gettext('The RSS feed is currently not available.'));
                    return 
$items;
                }

                protected function 
startCache() {

                }

                protected function 
endCache() {

                }

            }

            
$rss = new setupRSS();
            
ob_start();
            
$rss->printFeed();
            
$xml ob_get_contents();
            
ob_end_clean();
            
file_put_contents(SERVERPATH '/' USER_PLUGIN_FOLDER '/site_upgrade/rss-closed.xml'$xml);
        }
        
$report gettext('Site is now marked in upgrade.');
        
setSiteState('closed');
        break;
    case 
'open':
        
$report gettext('Site is viewable.');
        
setSiteState('open');
        break;
    case 
'closed_for_test':
        
$report gettext('Site is avaiable for testing only.');
        
setSiteState('closed_for_test');
        break;
}

header('Location: ' FULLWEBPATH '/' ZENFOLDER '/admin.php?report=' $report);
exitZP();

/**
 * updates the site status
 * @param string $state
 */
function setSiteState($state) {
    global 
$_configMutex;
    
$_configMutex->lock();
    
$zp_cfg = @file_get_contents(SERVERPATH '/' DATA_FOLDER '/' CONFIGFILE);
    
$zp_cfg updateConfigItem('site_upgrade_state'$state$zp_cfg);
    
storeConfig($zp_cfg);
    
$_configMutex->unlock();
    
setOption('site_upgrade_state'$state);
}

?>