/web/htdocs/www.euroroma.net/home/zenphoto/zp-core/zp-extensions/markRelease.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
<?php

/**
 * Inserts or removes the qualifiers from the version file so that the install is switched between
 * a "debug" release and a normal release.
 *
 * @package plugins
 * @subpackage development
 *
 */
$plugin_is_filter ADMIN_PLUGIN;
$plugin_description gettext('Mark installation as "released".');
$plugin_author "Stephen Billard (sbillard)";

zp_register_filter('admin_utilities_buttons''markRelease_button');

if (isset(
$_REQUEST['markRelease'])) {
    if (
$_REQUEST['markRelease'] == 'released') {
        
$mark '';
        
$action 'debug';
    } else {
        
$mark '-DEBUG';
        
$action 'released';
    }
    
XSRFdefender('markRelease');
    
$i strpos($rawversion ZENPHOTO_VERSION'-');
    if (
$i === false) {
        
$rawversion ZENPHOTO_VERSION;
    } else {
        
$rawversion substr(ZENPHOTO_VERSION0$i);
    }
    
$v file_get_contents(SERVERPATH '/' ZENFOLDER '/version.php');
    
$v str_replace(ZENPHOTO_VERSION$rawversion $mark$v);
    
file_put_contents(SERVERPATH '/' ZENFOLDER '/version.php'$v);
    
header('location:' FULLWEBPATH '/' ZENFOLDER '/admin.php');

    exit();
}

function 
markRelease_button($buttons) {
    
$text = array('released' => gettext('released'), 'debug' => gettext('debug'));
    
$i strpos($rawversion ZENPHOTO_VERSION'-');
    if (
$i === false) {
        
$mark '';
        
$action 'debug';
    } else {
        
$mark '-DEBUG';
        
$action 'released';
    }

    
$buttons[] = array(
                    
'category'         => gettext('Development'),
                    
'enable'             => true,
                    
'button_text'     => gettext('Mark release'),
                    
'formname'         => 'markRelease_button',
                    
'action'             => '?markRelease=' $action,
                    
'icon'                 => $mark 'images/comments-on.png' 'images/comments-off.png',
                    
'title'                 => sprintf(gettext('Edits the version.php file making a "%s" install.'), $text[$action]),
                    
'alt'                     => '',
                    
'hidden'             => '<input type="hidden" name="markRelease" value="' $action '" />',
                    
'rights'             => ADMIN_RIGHTS,
                    
'XSRFTag'             => 'markRelease'
    
);
    return 
$buttons;
}

?>