-
Notifications
You must be signed in to change notification settings - Fork 31
/
versioncheck.php
160 lines (136 loc) · 4.95 KB
/
versioncheck.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Coppermine Photo Gallery
*
* v1.0 originally written by Gregory Demar
*
* @copyright Copyright (c) 2003-2020 Coppermine Dev Team
* @license GNU General Public License version 3 or later; see LICENSE
*
* versioncheck.php
* @since 1.6.08
*/
define('IN_COPPERMINE', true);
define('VERSIONCHECK_PHP', true);
require_once 'include/init.inc.php';
// define some vars that need to exist in JS
// Include the JS for versioncheck.php
js_include('js/versioncheck.js');
require_once 'include/versioncheck.inc.php';
if (!GALLERY_ADMIN_MODE) {
cpg_die($lang_common['error'], $lang_errors['access_denied'], __FILE__, __LINE__);
}
// Sanitize the GET vars and populate the optionsArray --- start
// possible values: screen, textarea, create, options
$optionDisplayOutput_array = array('screen'=>'','textarea'=>'','errors_only'=>'','hide_images'=>'','no_modification_check'=>'','do_not_connect_to_online_repository'=>'');
$actionGet = $superCage->get->getMatched('output','/^[a-z]+$/');
if ($actionGet && in_array($actionGet[0], array('screen', 'textarea', 'create', 'options'))) {
$action = $actionGet[0];
} else {
$action = 'options';
}
if ($superCage->get->getInt('do_not_connect_to_online_repository') == '1') {
$displayOption_array['do_not_connect_to_online_repository'] = 1;
$optionDisplayOutput_array['do_not_connect_to_online_repository'] = 'checked="checked"';
} else {
$displayOption_array['do_not_connect_to_online_repository'] = 0;
}
if ($action == 'textarea') {
$displayOption_array['output'] = 'textarea';
$optionDisplayOutput_array['screen'] = '';
$optionDisplayOutput_array['textarea'] = 'checked="checked"';
} elseif ($action == 'create') {
$displayOption_array['output'] = 'create';
$displayOption_array['do_not_connect_to_online_repository'] = 1;
} elseif ($action == 'screen') {
$displayOption_array['output'] = 'screen';
$optionDisplayOutput_array['screen'] = 'checked="checked"';
$optionDisplayOutput_array['textarea'] = '';
} else {
$displayOption_array['output'] = 'options';
$optionDisplayOutput_array['screen'] = 'checked="checked"';
$optionDisplayOutput_array['textarea'] = '';
}
if ($superCage->get->getInt('errors_only') == '1') {
$displayOption_array['errors_only'] = 1;
$optionDisplayOutput_array['errors_only'] = 'checked="checked"';
} else {
$displayOption_array['errors_only'] = 0;
}
if ($superCage->get->getInt('hide_images') == '1') {
$displayOption_array['hide_images'] = 1;
$optionDisplayOutput_array['hide_images'] = 'checked="checked"';
} else {
$displayOption_array['hide_images'] = 0;
}
if ($superCage->get->getInt('no_modification_check') == '1') {
$displayOption_array['no_modification_check'] = 1;
$optionDisplayOutput_array['no_modification_check'] = 'checked="checked"';
} else {
$displayOption_array['no_modification_check'] = 0;
}
// Sanitize the GET vars and populate the optionsArray --- end
// Connect to the repository
if ($displayOption_array['output'] != 'options') {
$file_data_array = cpgVersioncheckConnectRepository();
$file_data_array = cpg_versioncheckPopulateArray($file_data_array);
$file_data_count = count($file_data_array);
}
// main code starts here
$title_help = ' ' . cpg_display_help('f=upgrading.htm&as=versioncheck&ae=versioncheck_end', '600', '400');
pageheader($lang_versioncheck_php['title']);
if ($displayOption_array['output'] != 'options' && !$file_data_array) {
msg_box($lang_versioncheck_php['no_repo_title'], $lang_versioncheck_php['no_repo_message'], '', '', 'warning');
}
starttable('100%', cpg_fetch_icon('check_versions', 2) . $lang_versioncheck_php['title']. $title_help, 1);
//print '<h1>' . cpg_fetch_icon('check_versions', 2) . $lang_versioncheck_php['title']. $title_help . '</h1>';
// Print options if applicable
if ($displayOption_array['output'] == 'options' || $displayOption_array['output'] == 'screen' || $displayOption_array['output'] == 'textarea') {
print <<< EOT
<tr>
<td class="tableb">
EOT;
cpg_versioncheckDisplayOptions();
print <<< EOT
</td>
</tr>
EOT;
}
if ($displayOption_array['output'] == 'create') {
// create data
$file_data_count = cpg_versioncheckCreateXml($file_data_array);
} else if ($displayOption_array['output'] == 'textarea') {
// display the output in a textarea field
print <<< EOT
<tr>
<td class="tableb">
EOT;
print cpg_versioncheckCreateTextOnlyOutput($file_data_array);
print <<< EOT
</td>
</tr>
EOT;
} else if ($displayOption_array['output'] == 'screen') {
// display the output in HTML
print <<< EOT
<tr>
<td class="tableb">
EOT;
$outputResult = cpg_versioncheckCreateHTMLOutput($file_data_array);
print <<< EOT
</td>
</tr>
EOT;
print <<< EOT
<tr>
<td class="tablef">
EOT;
printf($lang_versioncheck_php['files_folder_processed'], $outputResult['display'], $outputResult['total'], $outputResult['error']);
print <<< EOT
</td>
</tr>
EOT;
}
endtable();
pagefooter();
//EOF