/web/htdocs/www.euroroma.net/home/zenphoto/zp-core/utilities/reset_albumthumbs.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
 * Use this utility to reset your album thumbnails to either "random" or from an ordered field query
 *
 * @package admin
 */
define('OFFSET_PATH'3);

require_once(
dirname(dirname(__FILE__)) . '/admin-globals.php');
require_once(
dirname(dirname(__FILE__)) . '/template-functions.php');

$buttonlist[] = array(
                
'category'         => gettext('Database'),
                
'enable'             => true,
                
'button_text'     => gettext('Reset album thumbs'),
                
'formname'         => 'reset_albumthumbs.php',
                
'action'             => 'utilities/reset_albumthumbs.php',
                
'icon'                 => 'images/reset.png',
                
'title'                 => gettext('Reset album thumbnails to either random or most recent'),
                
'alt'                     => '',
                
'hidden'             => '',
                
'rights'             => MANAGE_ALL_ALBUM_RIGHTS ADMIN_RIGHTS
);

admin_securityChecks(MANAGE_ALL_ALBUM_RIGHTS$return currentRelativeURL());

if (isset(
$_REQUEST['thumbtype']) || isset($_REQUEST['thumbselector'])) {
    
XSRFdefender('reset_thumbs');
}

$buffer '';
$webpath WEBPATH '/' ZENFOLDER '/';

$zenphoto_tabs['overview']['subtabs'] = array(gettext('Thumbs') => '');

printAdminHeader('overview''thumbs');
echo 
'</head>';
?>

<body>
    <?php printLogoAndLinks(); ?>
    <div id="main">
        <?php printTabs(); ?>
        <div id="content">
            <?php printSubtabs(); ?>
            <div class="tabbox">
                <?php zp_apply_filter('admin_note''reste_thumbs'''); ?>
                <h1><?php echo (gettext('Reset your album thumbnails')); ?></h1>
                <?php
                
if (isset($_REQUEST['thumbtype'])) {
                    
$key sanitize_numeric($_REQUEST['thumbtype'], 3);
                    
$sql 'UPDATE ' prefix('albums') . ' SET `thumb`=' $key;
                    
$text $_zp_albumthumb_selector[$key]['desc'];
                    if (
query($sql)) {
                        
?>
                        <div class="messagebox fade-message">
                            <h2>
                                <?php printf(gettext("Thumbnails all set to <em>%s</em>."), $text); ?></h2>
                        </div>
                        <?php
                    
} else {
                        
?>
                        <div class="errorbox fade-message">
                            <h2>
                                <?php echo gettext("Thumbnail reset query failed"); ?></h2>
                        </div>
                        <?php
                    
}
                }
                
$current getOption('AlbumThumbSelect');

                
$selections = array();
                foreach (
$_zp_albumthumb_selector as $key => $selection) {
                    
$selections[$selection['desc']] = $key;
                }
                
?>
                <form name="set_random" action="">
                    <?php XSRFToken('reset_thumbs'?>
                    <div class="buttons pad_button" id="set_all">
                        <button class="fixedwidth" type="submit"
                                        title="<?php echo gettext("Sets all album thumbs to the selected criteria"); ?>">
                            <img src="<?php echo $webpath?>images/burst.png" alt="" />
                            <?php echo gettext("Set all albums to"); ?>
                        </button>
                        <select id="thumbtype" name="thumbtype">
                            <?php
                            generateListFromArray
(array($current), $selectionsfalsetrue);
                            
?>
                        </select>
                    </div>
                    <br class="clearall" /> <br />
                </form>
                <br class="clearall" /> <br />
            </div>
        </div>
    </div><!-- content -->
</div><!-- main -->
<?php printAdminFooter(); ?>
</body>
<?php echo "</html>"?>