annotate forum/Themes/default/Packages.template.php @ 77:b31c38a09c41 website

Add justification text in registration
author Chris Cannam
date Sun, 07 Jul 2013 11:57:22 +0200
parents e3e11437ecea
children
rev   line source
Chris@76 1 <?php
Chris@76 2 /**
Chris@76 3 * Simple Machines Forum (SMF)
Chris@76 4 *
Chris@76 5 * @package SMF
Chris@76 6 * @author Simple Machines
Chris@76 7 * @copyright 2011 Simple Machines
Chris@76 8 * @license http://www.simplemachines.org/about/smf/license.php BSD
Chris@76 9 *
Chris@76 10 * @version 2.0
Chris@76 11 */
Chris@76 12
Chris@76 13 function template_main()
Chris@76 14 {
Chris@76 15 global $context, $settings, $options;
Chris@76 16 }
Chris@76 17
Chris@76 18 function template_view_package()
Chris@76 19 {
Chris@76 20 global $context, $settings, $options, $txt, $scripturl, $smcFunc;
Chris@76 21
Chris@76 22 echo '
Chris@76 23 <div id="admincenter">
Chris@76 24 <div class="cat_bar">
Chris@76 25 <h3 class="catbg">', $txt[($context['uninstalling'] ? 'un' : '') . 'install_mod'], '</h3>
Chris@76 26 </div>
Chris@76 27 <div class="information">';
Chris@76 28
Chris@76 29 if ($context['is_installed'])
Chris@76 30 echo '
Chris@76 31 <strong>', $txt['package_installed_warning1'], '</strong><br />
Chris@76 32 <br />
Chris@76 33 ', $txt['package_installed_warning2'], '<br />
Chris@76 34 <br />';
Chris@76 35
Chris@76 36 echo $txt['package_installed_warning3'], '
Chris@76 37 </div>';
Chris@76 38
Chris@76 39 // Do errors exist in the install? If so light them up like a christmas tree.
Chris@76 40 if ($context['has_failure'])
Chris@76 41 {
Chris@76 42 echo '
Chris@76 43 <div class="errorbox">
Chris@76 44 <strong>', $txt['package_will_fail_title'], '</strong><br />
Chris@76 45 ', $txt['package_will_fail_warning'], '
Chris@76 46 </div>';
Chris@76 47 }
Chris@76 48
Chris@76 49 if (isset($context['package_readme']))
Chris@76 50 {
Chris@76 51 echo '
Chris@76 52 <div class="cat_bar">
Chris@76 53 <h3 class="catbg">', $txt['package_' . ($context['uninstalling'] ? 'un' : '') . 'install_readme'], '</h3>
Chris@76 54 </div>
Chris@76 55 <div class="windowbg2">
Chris@76 56 <span class="topslice"><span></span></span>
Chris@76 57 <div class="content">
Chris@76 58 ', $context['package_readme'], '
Chris@76 59 <span class="floatright">', $txt['package_available_readme_language'], '
Chris@76 60 <select name="readme_language" id="readme_language" onchange="if (this.options[this.selectedIndex].value) window.location.href = smf_prepareScriptUrl(smf_scripturl + \'', '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', ';package=', $context['filename'], ';readme=\' + this.options[this.selectedIndex].value);">';
Chris@76 61 foreach ($context['readmes'] as $a => $b)
Chris@76 62 echo '<option value="', $b, '"', $a === 'selected' ? ' selected="selected"' : '', '>', $b == 'default' ? $txt['package_readme_default'] : ucfirst($b), '</option>';
Chris@76 63 echo '
Chris@76 64 </select>
Chris@76 65 </span>
Chris@76 66 </div>
Chris@76 67 <span class="botslice"><span></span></span>
Chris@76 68 </div>
Chris@76 69 <br />';
Chris@76 70 }
Chris@76 71
Chris@76 72 echo '
Chris@76 73 <form action="', $scripturl, '?action=admin;area=packages;sa=', $context['uninstalling'] ? 'uninstall' : 'install', $context['ftp_needed'] ? '' : '2', ';package=', $context['filename'], ';pid=', $context['install_id'], '" onsubmit="submitonce(this);" method="post" accept-charset="', $context['character_set'], '">
Chris@76 74 <div class="cat_bar">
Chris@76 75 <h3 class="catbg">
Chris@76 76 ', $context['uninstalling'] ? $txt['package_uninstall_actions'] : $txt['package_install_actions'], ' &quot;', $context['package_name'], '&quot;
Chris@76 77 </h3>
Chris@76 78 </div>';
Chris@76 79
Chris@76 80 // Are there data changes to be removed?
Chris@76 81 if ($context['uninstalling'] && !empty($context['database_changes']))
Chris@76 82 {
Chris@76 83 echo '
Chris@76 84 <div class="windowbg2">
Chris@76 85 <span class="topslice"><span></span></span>
Chris@76 86 <div class="content">
Chris@76 87 <label for="do_db_changes"><input type="checkbox" name="do_db_changes" id="do_db_changes" class="input_check" />', $txt['package_db_uninstall'], '</label> [<a href="#" onclick="return swap_database_changes();">', $txt['package_db_uninstall_details'], '</a>]
Chris@76 88 <div id="db_changes_div">
Chris@76 89 ', $txt['package_db_uninstall_actions'], ':
Chris@76 90 <ul>';
Chris@76 91
Chris@76 92 foreach ($context['database_changes'] as $change)
Chris@76 93 echo '
Chris@76 94 <li>', $change, '</li>';
Chris@76 95 echo '
Chris@76 96 </ul>
Chris@76 97 </div>
Chris@76 98 </div>
Chris@76 99 <span class="botslice"><span></span></span>
Chris@76 100 </div>';
Chris@76 101 }
Chris@76 102
Chris@76 103 echo '
Chris@76 104 <div class="information">';
Chris@76 105
Chris@76 106 if (empty($context['actions']) && empty($context['database_changes']))
Chris@76 107 echo '
Chris@76 108 <strong>', $txt['corrupt_compatible'], '</strong>
Chris@76 109 </div>';
Chris@76 110 else
Chris@76 111 {
Chris@76 112 echo '
Chris@76 113 ', $txt['perform_actions'], '
Chris@76 114 </div>
Chris@76 115 <table class="table_grid" width="100%">
Chris@76 116 <thead>
Chris@76 117 <tr class="catbg">
Chris@76 118 <th scope="col" width="20"></th>
Chris@76 119 <th scope="col" width="30"></th>
Chris@76 120 <th scope="col" class="lefttext">', $txt['package_install_type'], '</th>
Chris@76 121 <th scope="col" class="lefttext" width="50%">', $txt['package_install_action'], '</th>
Chris@76 122 <th scope="col" class="lefttext" width="20%">', $txt['package_install_desc'], '</th>
Chris@76 123 </tr>
Chris@76 124 </thead>
Chris@76 125 <tbody>';
Chris@76 126
Chris@76 127 $alternate = true;
Chris@76 128 $i = 1;
Chris@76 129 $action_num = 1;
Chris@76 130 $js_operations = array();
Chris@76 131 foreach ($context['actions'] as $packageaction)
Chris@76 132 {
Chris@76 133 // Did we pass or fail? Need to now for later on.
Chris@76 134 $js_operations[$action_num] = isset($packageaction['failed']) ? $packageaction['failed'] : 0;
Chris@76 135
Chris@76 136 echo '
Chris@76 137 <tr class="windowbg', $alternate ? '' : '2', '">
Chris@76 138 <td>', isset($packageaction['operations']) ? '<img id="operation_img_' . $action_num . '" src="' . $settings['images_url'] . '/sort_down.gif" alt="*" style="display: none;" />' : '', '</td>
Chris@76 139 <td>', $i++, '.</td>
Chris@76 140 <td>', $packageaction['type'], '</td>
Chris@76 141 <td>', $packageaction['action'], '</td>
Chris@76 142 <td>', $packageaction['description'], '</td>
Chris@76 143 </tr>';
Chris@76 144
Chris@76 145 // Is there water on the knee? Operation!
Chris@76 146 if (isset($packageaction['operations']))
Chris@76 147 {
Chris@76 148 echo '
Chris@76 149 <tr id="operation_', $action_num, '">
Chris@76 150 <td colspan="5" class="windowbg3">
Chris@76 151 <table border="0" cellpadding="3" cellspacing="0" width="100%">';
Chris@76 152
Chris@76 153 // Show the operations.
Chris@76 154 $alternate2 = true;
Chris@76 155 $operation_num = 1;
Chris@76 156 foreach ($packageaction['operations'] as $operation)
Chris@76 157 {
Chris@76 158 // Determine the position text.
Chris@76 159 $operation_text = $operation['position'] == 'replace' ? 'operation_replace' : ($operation['position'] == 'before' ? 'operation_after' : 'operation_before');
Chris@76 160
Chris@76 161 echo '
Chris@76 162 <tr class="windowbg', $alternate2 ? '' : '2', '">
Chris@76 163 <td width="0"></td>
Chris@76 164 <td width="30" class="smalltext"><a href="' . $scripturl . '?action=admin;area=packages;sa=showoperations;operation_key=', $operation['operation_key'], ';package=', $_REQUEST['package'], ';filename=', $operation['filename'], ($operation['is_boardmod'] ? ';boardmod' : ''), (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'uninstall' ? ';reverse' : ''), '" onclick="return reqWin(this.href, 680, 400, false);"><img src="', $settings['default_images_url'], '/admin/package_ops.gif" alt="" /></a></td>
Chris@76 165 <td width="30" class="smalltext">', $operation_num, '.</td>
Chris@76 166 <td width="23%" class="smalltext">', $txt[$operation_text], '</td>
Chris@76 167 <td width="50%" class="smalltext">', $operation['action'], '</td>
Chris@76 168 <td width="20%" class="smalltext">', $operation['description'], !empty($operation['ignore_failure']) ? ' (' . $txt['operation_ignore'] . ')' : '', '</td>
Chris@76 169 </tr>';
Chris@76 170
Chris@76 171 $operation_num++;
Chris@76 172 $alternate2 = !$alternate2;
Chris@76 173 }
Chris@76 174
Chris@76 175 echo '
Chris@76 176 </table>
Chris@76 177 </td>
Chris@76 178 </tr>';
Chris@76 179
Chris@76 180 // Increase it.
Chris@76 181 $action_num++;
Chris@76 182 }
Chris@76 183 $alternate = !$alternate;
Chris@76 184 }
Chris@76 185 echo '
Chris@76 186 </tbody>
Chris@76 187 </table>
Chris@76 188 ';
Chris@76 189
Chris@76 190 // What if we have custom themes we can install into? List them too!
Chris@76 191 if (!empty($context['theme_actions']))
Chris@76 192 {
Chris@76 193 echo '
Chris@76 194 <br />
Chris@76 195 <div class="cat_bar">
Chris@76 196 <h3 class="catbg">
Chris@76 197 ', $context['uninstalling'] ? $txt['package_other_themes_uninstall'] : $txt['package_other_themes'], '
Chris@76 198 </h3>
Chris@76 199 </div>
Chris@76 200 <div id="custom_changes">
Chris@76 201 <div class="information">
Chris@76 202 ', $txt['package_other_themes_desc'], '
Chris@76 203 </div>
Chris@76 204 <table class="table_grid" width="100%">';
Chris@76 205
Chris@76 206 // Loop through each theme and display it's name, and then it's details.
Chris@76 207 foreach ($context['theme_actions'] as $id => $theme)
Chris@76 208 {
Chris@76 209 // Pass?
Chris@76 210 $js_operations[$action_num] = !empty($theme['has_failure']);
Chris@76 211
Chris@76 212 echo '
Chris@76 213 <tr class="catbg">
Chris@76 214 <td></td>
Chris@76 215 <td align="center">';
Chris@76 216 if (!empty($context['themes_locked']))
Chris@76 217 echo '
Chris@76 218 <input type="hidden" name="custom_theme[]" value="', $id, '" />';
Chris@76 219 echo '
Chris@76 220 <input type="checkbox" name="custom_theme[]" id="custom_theme_', $id, '" value="', $id, '" class="input_check" onclick="', (!empty($theme['has_failure']) ? 'if (this.form.custom_theme_' . $id . '.checked && !confirm(\'' . $txt['package_theme_failure_warning'] . '\')) return false;' : ''), 'invertAll(this, this.form, \'dummy_theme_', $id, '\', true);" ', !empty($context['themes_locked']) ? 'disabled="disabled" checked="checked"' : '', '/>
Chris@76 221 </td>
Chris@76 222 <td colspan="3">
Chris@76 223 ', $theme['name'], '
Chris@76 224 </td>
Chris@76 225 </tr>';
Chris@76 226
Chris@76 227 foreach ($theme['actions'] as $action)
Chris@76 228 {
Chris@76 229 echo '
Chris@76 230 <tr class="windowbg', $alternate ? '' : '2', '">
Chris@76 231 <td>', isset($packageaction['operations']) ? '<img id="operation_img_' . $action_num . '" src="' . $settings['images_url'] . '/sort_down.gif" alt="*" style="display: none;" />' : '', '</td>
Chris@76 232 <td width="30" align="center">
Chris@76 233 <input type="checkbox" name="theme_changes[]" value="', !empty($action['value']) ? $action['value'] : '', '" id="dummy_theme_', $id, '" class="input_check" ', (!empty($action['not_mod']) ? '' : 'disabled="disabled"'), ' ', !empty($context['themes_locked']) ? 'checked="checked"' : '', '/>
Chris@76 234 </td>
Chris@76 235 <td>', $action['type'], '</td>
Chris@76 236 <td width="50%">', $action['action'], '</td>
Chris@76 237 <td width="20%"><strong>', $action['description'], '</strong></td>
Chris@76 238 </tr>';
Chris@76 239
Chris@76 240 // Is there water on the knee? Operation!
Chris@76 241 if (isset($action['operations']))
Chris@76 242 {
Chris@76 243 echo '
Chris@76 244 <tr id="operation_', $action_num, '">
Chris@76 245 <td colspan="5" class="windowbg3">
Chris@76 246 <table border="0" cellpadding="3" cellspacing="0" width="100%">';
Chris@76 247
Chris@76 248 $alternate2 = true;
Chris@76 249 $operation_num = 1;
Chris@76 250 foreach ($action['operations'] as $operation)
Chris@76 251 {
Chris@76 252 // Determine the possition text.
Chris@76 253 $operation_text = $operation['position'] == 'replace' ? 'operation_replace' : ($operation['position'] == 'before' ? 'operation_after' : 'operation_before');
Chris@76 254
Chris@76 255 echo '
Chris@76 256 <tr class="windowbg', $alternate2 ? '' : '2', '">
Chris@76 257 <td width="0"></td>
Chris@76 258 <td width="30" class="smalltext"><a href="' . $scripturl . '?action=admin;area=packages;sa=showoperations;operation_key=', $operation['operation_key'], ';package=', $_REQUEST['package'], ';filename=', $operation['filename'], ($operation['is_boardmod'] ? ';boardmod' : ''), (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'uninstall' ? ';reverse' : ''), '" onclick="return reqWin(this.href, 600, 400, false);"><img src="', $settings['default_images_url'], '/admin/package_ops.gif" alt="" /></a></td>
Chris@76 259 <td width="30" class="smalltext">', $operation_num, '.</td>
Chris@76 260 <td width="23%" class="smalltext">', $txt[$operation_text], '</td>
Chris@76 261 <td width="50%" class="smalltext">', $operation['action'], '</td>
Chris@76 262 <td width="20%" class="smalltext">', $operation['description'], !empty($operation['ignore_failure']) ? ' (' . $txt['operation_ignore'] . ')' : '', '</td>
Chris@76 263 </tr>';
Chris@76 264 $operation_num++;
Chris@76 265 $alternate2 = !$alternate2;
Chris@76 266 }
Chris@76 267
Chris@76 268 echo '
Chris@76 269 </table>
Chris@76 270 </td>
Chris@76 271 </tr>';
Chris@76 272
Chris@76 273 // Increase it.
Chris@76 274 $action_num++;
Chris@76 275 }
Chris@76 276 }
Chris@76 277
Chris@76 278 $alternate = !$alternate;
Chris@76 279 }
Chris@76 280
Chris@76 281 echo '
Chris@76 282 </table>
Chris@76 283 </div>';
Chris@76 284 }
Chris@76 285 }
Chris@76 286
Chris@76 287 // Are we effectively ready to install?
Chris@76 288 if (!$context['ftp_needed'] && (!empty($context['actions']) || !empty($context['database_changes'])))
Chris@76 289 {
Chris@76 290 echo '
Chris@76 291 <div class="righttext padding">
Chris@76 292 <input type="submit" value="', $context['uninstalling'] ? $txt['package_uninstall_now'] : $txt['package_install_now'], '" onclick="return ', !empty($context['has_failure']) ? '(submitThisOnce(this) &amp;&amp; confirm(\'' . ($context['uninstalling'] ? $txt['package_will_fail_popup_uninstall'] : $txt['package_will_fail_popup']) . '\'))' : 'submitThisOnce(this)', ';" class="button_submit" />
Chris@76 293 </div>';
Chris@76 294 }
Chris@76 295 // If we need ftp information then demand it!
Chris@76 296 elseif ($context['ftp_needed'])
Chris@76 297 {
Chris@76 298 echo '
Chris@76 299 <div class="cat_bar">
Chris@76 300 <h3 class="catbg">', $txt['package_ftp_necessary'], '</h3>
Chris@76 301 </div>
Chris@76 302 <div>
Chris@76 303 ', template_control_chmod(), '
Chris@76 304 </div>';
Chris@76 305 }
Chris@76 306 echo '
Chris@76 307
Chris@76 308 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />', (isset($context['form_sequence_number']) && !$context['ftp_needed']) ? '
Chris@76 309 <input type="hidden" name="seqnum" value="' . $context['form_sequence_number'] . '" />' : '', '
Chris@76 310 </form>
Chris@76 311 </div>
Chris@76 312 <br class="clear" />';
Chris@76 313
Chris@76 314 // Toggle options.
Chris@76 315 echo '
Chris@76 316 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 317 var aOperationElements = new Array();';
Chris@76 318
Chris@76 319 // Operations.
Chris@76 320 if (!empty($js_operations))
Chris@76 321 {
Chris@76 322 foreach ($js_operations as $key => $operation)
Chris@76 323 {
Chris@76 324 echo '
Chris@76 325 aOperationElements[', $key, '] = new smc_Toggle({
Chris@76 326 bToggleEnabled: true,
Chris@76 327 bCurrentlyCollapsed: ', $operation ? 'false' : 'true', ',
Chris@76 328 aSwappableContainers: [
Chris@76 329 \'operation_', $key, '\'
Chris@76 330 ],
Chris@76 331 aSwapImages: [
Chris@76 332 {
Chris@76 333 sId: \'operation_img_', $key, '\',
Chris@76 334 srcExpanded: smf_images_url + \'/sort_down.gif\',
Chris@76 335 altExpanded: \'*\',
Chris@76 336 srcCollapsed: smf_images_url + \'/selected.gif\',
Chris@76 337 altCollapsed: \'*\'
Chris@76 338 }
Chris@76 339 ]
Chris@76 340 });';
Chris@76 341 }
Chris@76 342 }
Chris@76 343
Chris@76 344 echo '
Chris@76 345 // ]]></script>';
Chris@76 346
Chris@76 347 // And a bit more for database changes.
Chris@76 348 if (!empty($context['database_changes']))
Chris@76 349 echo '
Chris@76 350 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 351 var database_changes_area = document.getElementById(\'db_changes_div\');
Chris@76 352 var db_vis = false;
Chris@76 353 database_changes_area.style.display = "none";
Chris@76 354 function swap_database_changes()
Chris@76 355 {
Chris@76 356 db_vis = !db_vis;
Chris@76 357 database_changes_area.style.display = db_vis ? "" : "none";
Chris@76 358 return false;
Chris@76 359 }
Chris@76 360 // ]]></script>';
Chris@76 361 }
Chris@76 362 function template_extract_package()
Chris@76 363 {
Chris@76 364 global $context, $settings, $options, $txt, $scripturl;
Chris@76 365
Chris@76 366 if (!empty($context['redirect_url']))
Chris@76 367 {
Chris@76 368 echo '
Chris@76 369 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 370 setTimeout("doRedirect();", ', empty($context['redirect_timeout']) ? '5000' : $context['redirect_timeout'], ');
Chris@76 371
Chris@76 372 function doRedirect()
Chris@76 373 {
Chris@76 374 window.location = "', $context['redirect_url'], '";
Chris@76 375 }
Chris@76 376 // ]]></script>';
Chris@76 377 }
Chris@76 378
Chris@76 379 echo '
Chris@76 380 <div id="admincenter">';
Chris@76 381
Chris@76 382 if (empty($context['redirect_url']))
Chris@76 383 {
Chris@76 384 echo '
Chris@76 385 <div class="cat_bar">
Chris@76 386 <h3 class="catbg">', $context['uninstalling'] ? $txt['uninstall'] : $txt['extracting'], '</h3>
Chris@76 387 </div>
Chris@76 388 <div class="information">', $txt['package_installed_extract'], '</div>';
Chris@76 389 }
Chris@76 390 else
Chris@76 391 echo '
Chris@76 392 <div class="cat_bar">
Chris@76 393 <h3 class="catbg">', $txt['package_installed_redirecting'], '</h3>
Chris@76 394 </div>';
Chris@76 395
Chris@76 396 echo '
Chris@76 397 <div class="windowbg">
Chris@76 398 <span class="topslice"><span></span></span>
Chris@76 399 <div class="content">';
Chris@76 400
Chris@76 401 // If we are going to redirect we have a slightly different agenda.
Chris@76 402 if (!empty($context['redirect_url']))
Chris@76 403 {
Chris@76 404 echo '
Chris@76 405 ', $context['redirect_text'], '<br /><br />
Chris@76 406 <a href="', $context['redirect_url'], '">', $txt['package_installed_redirect_go_now'], '</a> | <a href="', $scripturl, '?action=admin;area=packages;sa=browse">', $txt['package_installed_redirect_cancel'], '</a>';
Chris@76 407 }
Chris@76 408 elseif ($context['uninstalling'])
Chris@76 409 echo '
Chris@76 410 ', $txt['package_uninstall_done'];
Chris@76 411 elseif ($context['install_finished'])
Chris@76 412 {
Chris@76 413 if ($context['extract_type'] == 'avatar')
Chris@76 414 echo '
Chris@76 415 ', $txt['avatars_extracted'];
Chris@76 416 elseif ($context['extract_type'] == 'language')
Chris@76 417 echo '
Chris@76 418 ', $txt['language_extracted'];
Chris@76 419 else
Chris@76 420 echo '
Chris@76 421 ', $txt['package_installed_done'];
Chris@76 422 }
Chris@76 423 else
Chris@76 424 echo '
Chris@76 425 ', $txt['corrupt_compatible'];
Chris@76 426
Chris@76 427 echo '
Chris@76 428 </div>
Chris@76 429 <span class="botslice"><span></span></span>
Chris@76 430 </div>';
Chris@76 431
Chris@76 432 // Show the "restore permissions" screen?
Chris@76 433 if (function_exists('template_show_list') && !empty($context['restore_file_permissions']['rows']))
Chris@76 434 {
Chris@76 435 echo '<br />';
Chris@76 436 template_show_list('restore_file_permissions');
Chris@76 437 }
Chris@76 438
Chris@76 439 echo '
Chris@76 440 </div>
Chris@76 441 <br class="clear" />';
Chris@76 442 }
Chris@76 443
Chris@76 444 function template_list()
Chris@76 445 {
Chris@76 446 global $context, $settings, $options, $txt, $scripturl;
Chris@76 447
Chris@76 448 echo '
Chris@76 449 <div id="admincenter">
Chris@76 450 <div class="cat_bar">
Chris@76 451 <h3 class="catbg">', $txt['list_file'], '</h3>
Chris@76 452 </div>
Chris@76 453 <div class="title_bar">
Chris@76 454 <h3 class="titlebg">', $txt['files_archive'], ' ', $context['filename'], ':</h3>
Chris@76 455 </div>
Chris@76 456 <div class="windowbg">
Chris@76 457 <span class="topslice"><span></span></span>
Chris@76 458 <div class="content">
Chris@76 459 <ol>';
Chris@76 460
Chris@76 461 foreach ($context['files'] as $fileinfo)
Chris@76 462 echo '
Chris@76 463 <li><a href="', $scripturl, '?action=admin;area=packages;sa=examine;package=', $context['filename'], ';file=', $fileinfo['filename'], '" title="', $txt['view'], '">', $fileinfo['filename'], '</a> (', $fileinfo['size'], ' ', $txt['package_bytes'], ')</li>';
Chris@76 464
Chris@76 465 echo '
Chris@76 466 </ol>
Chris@76 467 <br />
Chris@76 468 <a href="', $scripturl, '?action=admin;area=packages">[ ', $txt['back'], ' ]</a>
Chris@76 469 </div>
Chris@76 470 <span class="botslice"><span></span></span>
Chris@76 471 </div>
Chris@76 472 </div>
Chris@76 473 <br class="clear" />';
Chris@76 474 }
Chris@76 475
Chris@76 476 function template_examine()
Chris@76 477 {
Chris@76 478 global $context, $settings, $options, $txt, $scripturl;
Chris@76 479
Chris@76 480 echo '
Chris@76 481 <div id="admincenter">
Chris@76 482 <div class="cat_bar">
Chris@76 483 <h3 class="catbg">', $txt['package_examine_file'], '</h3>
Chris@76 484 </div>
Chris@76 485 <div class="title_bar">
Chris@76 486 <h3 class="titlebg">', $txt['package_file_contents'], ' ', $context['filename'], ':</h3>
Chris@76 487 </div>
Chris@76 488 <div class="windowbg">
Chris@76 489 <span class="topslice"><span></span></span>
Chris@76 490 <div class="content">
Chris@76 491 <pre class="file_content">', $context['filedata'], '</pre>
Chris@76 492 <a href="', $scripturl, '?action=admin;area=packages;sa=list;package=', $context['package'], '">[ ', $txt['list_files'], ' ]</a>
Chris@76 493 </div>
Chris@76 494 <span class="botslice"><span></span></span>
Chris@76 495 </div>
Chris@76 496 </div>
Chris@76 497 <br class="clear" />';
Chris@76 498 }
Chris@76 499
Chris@76 500 function template_view_installed()
Chris@76 501 {
Chris@76 502 global $context, $settings, $options, $txt, $scripturl;
Chris@76 503
Chris@76 504 echo '
Chris@76 505 <div id="admincenter">
Chris@76 506 <div class="title_bar">
Chris@76 507 <h3 class="titlebg">' . $txt['view_and_remove'] . '</h3>
Chris@76 508 </div>';
Chris@76 509
Chris@76 510 if (empty($context['installed_mods']))
Chris@76 511 {
Chris@76 512 echo '
Chris@76 513 <div class="information">
Chris@76 514 ', $txt['no_mods_installed'], '
Chris@76 515 </div>';
Chris@76 516 }
Chris@76 517 else
Chris@76 518 {
Chris@76 519 echo '
Chris@76 520 <table class="table_grid" width="100%">
Chris@76 521 <thead>
Chris@76 522 <tr class="catbg">
Chris@76 523 <th scope="col" width="32"></th>
Chris@76 524 <th scope="col" width="25%">', $txt['mod_name'], '</th>
Chris@76 525 <th scope="col" width="25%">', $txt['mod_version'], '</th>
Chris@76 526 <th scope="col" width="49%"></th>
Chris@76 527 </tr>
Chris@76 528 </thead>
Chris@76 529 <tbody>';
Chris@76 530
Chris@76 531 $alt = false;
Chris@76 532 foreach ($context['installed_mods'] as $i => $file)
Chris@76 533 {
Chris@76 534 echo '
Chris@76 535 <tr class="', $alt ? 'windowbg' : 'windowbg2', '">
Chris@76 536 <td><span class="smalltext">', ++$i, '.</span></td>
Chris@76 537 <td><span class="smalltext">', $file['name'], '</span></td>
Chris@76 538 <td><span class="smalltext">', $file['version'], '</span></td>
Chris@76 539 <td align="right"><span class="smalltext"><a href="', $scripturl, '?action=admin;area=packages;sa=uninstall;package=', $file['filename'], ';pid=', $file['id'], '">[ ', $txt['uninstall'], ' ]</a></span></td>
Chris@76 540 </tr>';
Chris@76 541 $alt = !$alt;
Chris@76 542 }
Chris@76 543
Chris@76 544 echo '
Chris@76 545 </tbody>
Chris@76 546 </table>
Chris@76 547 <br />
Chris@76 548 <a href="', $scripturl, '?action=admin;area=packages;sa=flush;', $context['session_var'], '=', $context['session_id'], '">[ ', $txt['delete_list'], ' ]</a>';
Chris@76 549 }
Chris@76 550
Chris@76 551 echo '
Chris@76 552 </div>
Chris@76 553 <br class="clear" />';
Chris@76 554 }
Chris@76 555
Chris@76 556 function template_browse()
Chris@76 557 {
Chris@76 558 global $context, $settings, $options, $txt, $scripturl, $modSettings, $forum_version;
Chris@76 559
Chris@76 560 echo '
Chris@76 561 <div id="admincenter">
Chris@76 562 <div class="cat_bar">
Chris@76 563 <h3 class="catbg">
Chris@76 564 <span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=latest_packages" onclick="return reqWin(this.href);" class="help"><img class="icon" src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" align="top" /></a> ', $txt['packages_latest'], '</span>
Chris@76 565 </h3>
Chris@76 566 </div>
Chris@76 567 <div class="windowbg2">
Chris@76 568 <span class="topslice"><span></span></span>
Chris@76 569 <div class="content">
Chris@76 570 <div id="packagesLatest">', $txt['packages_latest_fetch'], '</div>
Chris@76 571 </div>
Chris@76 572 <span class="botslice clear_right"><span></span></span>
Chris@76 573 </div>
Chris@76 574
Chris@76 575 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 576 window.smfForum_scripturl = "', $scripturl, '";
Chris@76 577 window.smfForum_sessionid = "', $context['session_id'], '";
Chris@76 578 window.smfForum_sessionvar = "', $context['session_var'], '";';
Chris@76 579
Chris@76 580 // Make a list of already installed mods so nothing is listed twice ;).
Chris@76 581 echo '
Chris@76 582 window.smfInstalledPackages = ["', implode('", "', $context['installed_mods']), '"];
Chris@76 583 window.smfVersion = "', $context['forum_version'], '";
Chris@76 584 // ]]></script>';
Chris@76 585
Chris@76 586 if (empty($modSettings['disable_smf_js']))
Chris@76 587 echo '
Chris@76 588 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-packages.js"></script>';
Chris@76 589
Chris@76 590 echo '
Chris@76 591 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 592 var tempOldOnload;
Chris@76 593
Chris@76 594 function smfSetLatestPackages()
Chris@76 595 {
Chris@76 596 if (typeof(window.smfLatestPackages) != "undefined")
Chris@76 597 setInnerHTML(document.getElementById("packagesLatest"), window.smfLatestPackages);
Chris@76 598
Chris@76 599 if (tempOldOnload)
Chris@76 600 tempOldOnload();
Chris@76 601 }
Chris@76 602 // ]]></script>';
Chris@76 603
Chris@76 604 echo '
Chris@76 605 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 606 smfSetLatestPackages();
Chris@76 607 // ]]></script>';
Chris@76 608
Chris@76 609 echo '
Chris@76 610 <br />
Chris@76 611 <div class="cat_bar">
Chris@76 612 <h3 class="catbg">', $txt['browse_packages'], '</h3>
Chris@76 613 </div>';
Chris@76 614
Chris@76 615 if (!empty($context['available_mods']))
Chris@76 616 {
Chris@76 617 echo '
Chris@76 618 <br />
Chris@76 619 <div class="title_bar">
Chris@76 620 <h3 class="titlebg">', $txt['modification_package'], '</h3>
Chris@76 621 </div>
Chris@76 622
Chris@76 623 <table class="table_grid" width="100%">
Chris@76 624 <thead>
Chris@76 625 <tr class="catbg">
Chris@76 626 <th class="first_th" width="32"></th>
Chris@76 627 <th class="lefttext" width="25%">', $txt['mod_name'], '</th>
Chris@76 628 <th class="lefttext" width="25%">', $txt['mod_version'], '</th>
Chris@76 629 <th class="last_th" width="49%"></th>
Chris@76 630 </tr>
Chris@76 631 </thead>
Chris@76 632 <tbody>';
Chris@76 633
Chris@76 634 $alt = false;
Chris@76 635 foreach ($context['available_mods'] as $i => $package)
Chris@76 636 {
Chris@76 637 echo '
Chris@76 638 <tr class="', $alt ? 'windowbg2' : 'windowbg', '">
Chris@76 639 <td>', ++$i, '.</td>
Chris@76 640 <td>', $package['name'], '</td>
Chris@76 641 <td>
Chris@76 642 ', $package['version'];
Chris@76 643
Chris@76 644 if ($package['is_installed'] && !$package['is_newer'])
Chris@76 645 echo '
Chris@76 646 <img src="', $settings['images_url'], '/icons/package_', $package['is_current'] ? 'installed' : 'old', '.gif" alt="" align="middle" style="margin-left: 2ex;" />';
Chris@76 647
Chris@76 648 echo '
Chris@76 649 </td>
Chris@76 650 <td align="right">';
Chris@76 651
Chris@76 652 if ($package['can_uninstall'])
Chris@76 653 echo '
Chris@76 654 <a href="', $scripturl, '?action=admin;area=packages;sa=uninstall;package=', $package['filename'], ';pid=', $package['installed_id'], '">[ ', $txt['uninstall'], ' ]</a>';
Chris@76 655 elseif ($package['can_upgrade'])
Chris@76 656 echo '
Chris@76 657 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['package_upgrade'], ' ]</a>';
Chris@76 658 elseif ($package['can_install'])
Chris@76 659 echo '
Chris@76 660 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['install_mod'], ' ]</a>';
Chris@76 661
Chris@76 662 echo '
Chris@76 663 <a href="', $scripturl, '?action=admin;area=packages;sa=list;package=', $package['filename'], '">[ ', $txt['list_files'], ' ]</a>
Chris@76 664 <a href="', $scripturl, '?action=admin;area=packages;sa=remove;package=', $package['filename'], ';', $context['session_var'], '=', $context['session_id'], '"', $package['is_installed'] && $package['is_current'] ? ' onclick="return confirm(\'' . $txt['package_delete_bad'] . '\');"' : '', '>[ ', $txt['package_delete'], ' ]</a>
Chris@76 665 </td>
Chris@76 666 </tr>';
Chris@76 667 $alt = !$alt;
Chris@76 668 }
Chris@76 669
Chris@76 670 echo '
Chris@76 671 </tbody>
Chris@76 672 </table>';
Chris@76 673 }
Chris@76 674
Chris@76 675 if (!empty($context['available_avatars']))
Chris@76 676 {
Chris@76 677 echo '
Chris@76 678 <br />
Chris@76 679 <div class="title_bar">
Chris@76 680 <h3 class="titlebg">', $txt['avatar_package'], '</h3>
Chris@76 681 </div>
Chris@76 682 <table class="table_grid" width="100%">
Chris@76 683 <thead>
Chris@76 684 <tr class="catbg">
Chris@76 685 <th width="32"></th>
Chris@76 686 <th width="25%">', $txt['mod_name'], '</th>
Chris@76 687 <th width="25%">', $txt['mod_version'], '</th>
Chris@76 688 <th width="49%"></th>
Chris@76 689 </tr>
Chris@76 690 </thead>
Chris@76 691 <tbody>';
Chris@76 692
Chris@76 693 foreach ($context['available_avatars'] as $i => $package)
Chris@76 694 {
Chris@76 695 echo '
Chris@76 696 <tr class="windowbg2">
Chris@76 697 <td>', ++$i, '.</td>
Chris@76 698 <td>', $package['name'], '</td>
Chris@76 699 <td>', $package['version'];
Chris@76 700
Chris@76 701 if ($package['is_installed'] && !$package['is_newer'])
Chris@76 702 echo '
Chris@76 703 <img src="', $settings['images_url'], '/icons/package_', $package['is_current'] ? 'installed' : 'old', '.gif" alt="" align="middle" style="margin-left: 2ex;" />';
Chris@76 704
Chris@76 705 echo '
Chris@76 706 </td>
Chris@76 707 <td align="right">';
Chris@76 708
Chris@76 709 if ($package['can_uninstall'])
Chris@76 710 echo '
Chris@76 711 <a href="', $scripturl, '?action=admin;area=packages;sa=uninstall;package=', $package['filename'], ';pid=', $package['installed_id'], '">[ ', $txt['uninstall'], ' ]</a>';
Chris@76 712 elseif ($package['can_upgrade'])
Chris@76 713 echo '
Chris@76 714 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['package_upgrade'], ' ]</a>';
Chris@76 715 elseif ($package['can_install'])
Chris@76 716 echo '
Chris@76 717 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['install_mod'], ' ]</a>';
Chris@76 718
Chris@76 719 echo '
Chris@76 720 <a href="', $scripturl, '?action=admin;area=packages;sa=list;package=', $package['filename'], '">[ ', $txt['list_files'], ' ]</a>
Chris@76 721 <a href="', $scripturl, '?action=admin;area=packages;sa=remove;package=', $package['filename'], ';', $context['session_var'], '=', $context['session_id'], '"', $package['is_installed'] && $package['is_current'] ? ' onclick="return confirm(\'' . $txt['package_delete_bad'] . '\');"' : '', '>[ ', $txt['package_delete'], ' ]</a>
Chris@76 722 </td>
Chris@76 723 </tr>';
Chris@76 724 }
Chris@76 725
Chris@76 726 echo '
Chris@76 727 </tbody>
Chris@76 728 </table>';
Chris@76 729 }
Chris@76 730
Chris@76 731 if (!empty($context['available_languages']))
Chris@76 732 {
Chris@76 733 echo '
Chris@76 734 <br />
Chris@76 735 <div class="title_bar">
Chris@76 736 <h3 class="titlebg">' . $txt['language_package'] . '</h3>
Chris@76 737 </div>
Chris@76 738 <table class="table_grid" width="100%">
Chris@76 739 <thead>
Chris@76 740 <tr class="catbg">
Chris@76 741 <th width="32"></th>
Chris@76 742 <th width="25%">', $txt['mod_name'], '</th>
Chris@76 743 <th width="25%">', $txt['mod_version'], '</th>
Chris@76 744 <th width="49%"></th>
Chris@76 745 </tr>
Chris@76 746 </thead>
Chris@76 747 <tbody>';
Chris@76 748
Chris@76 749 foreach ($context['available_languages'] as $i => $package)
Chris@76 750 {
Chris@76 751 echo '
Chris@76 752 <tr class="windowbg">
Chris@76 753 <td>' . ++$i . '.</td>
Chris@76 754 <td>' . $package['name'] . '</td>
Chris@76 755 <td>' . $package['version'];
Chris@76 756
Chris@76 757 if ($package['is_installed'] && !$package['is_newer'])
Chris@76 758 echo '
Chris@76 759 <img src="', $settings['images_url'], '/icons/package_', $package['is_current'] ? 'installed' : 'old', '.gif" alt="" align="middle" style="margin-left: 2ex;" />';
Chris@76 760
Chris@76 761 echo '
Chris@76 762 </td>
Chris@76 763 <td align="right">';
Chris@76 764
Chris@76 765 if ($package['can_uninstall'])
Chris@76 766 echo '
Chris@76 767 <a href="', $scripturl, '?action=admin;area=packages;sa=uninstall;package=', $package['filename'], ';pid=', $package['installed_id'], '">[ ', $txt['uninstall'], ' ]</a>';
Chris@76 768 elseif ($package['can_upgrade'])
Chris@76 769 echo '
Chris@76 770 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['package_upgrade'], ' ]</a>';
Chris@76 771 elseif ($package['can_install'])
Chris@76 772 echo '
Chris@76 773 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['install_mod'], ' ]</a>';
Chris@76 774
Chris@76 775 echo '
Chris@76 776 <a href="', $scripturl, '?action=admin;area=packages;sa=list;package=', $package['filename'], '">[ ', $txt['list_files'], ' ]</a>
Chris@76 777 <a href="', $scripturl, '?action=admin;area=packages;sa=remove;package=', $package['filename'], ';', $context['session_var'], '=', $context['session_id'], '"', $package['is_installed'] && $package['is_current'] ? ' onclick="return confirm(\'' . $txt['package_delete_bad'] . '\');"' : '', '>[ ', $txt['package_delete'], ' ]</a>
Chris@76 778 </td>
Chris@76 779 </tr>';
Chris@76 780 }
Chris@76 781
Chris@76 782 echo '
Chris@76 783 </tbody>
Chris@76 784 </table>';
Chris@76 785 }
Chris@76 786
Chris@76 787 if (!empty($context['available_other']))
Chris@76 788 {
Chris@76 789 echo '
Chris@76 790 <br />
Chris@76 791 <div class="title_bar">
Chris@76 792 <h3 class="titlebg">' . $txt['unknown_package'] . '</h3>
Chris@76 793 </div>
Chris@76 794 <table class="table_grid" width="100%">
Chris@76 795 <thead>
Chris@76 796 <tr class="catbg">
Chris@76 797 <th width="32"></th>
Chris@76 798 <th width="25%">', $txt['mod_name'], '</th>
Chris@76 799 <th width="25%">', $txt['mod_version'], '</th>
Chris@76 800 <th width="49%"></th>
Chris@76 801 </tr>
Chris@76 802 </thead>
Chris@76 803 <tbody>';
Chris@76 804
Chris@76 805 foreach ($context['available_other'] as $i => $package)
Chris@76 806 {
Chris@76 807 echo '
Chris@76 808 <tr class="windowbg2">
Chris@76 809 <td>' . ++$i . '.</td>
Chris@76 810 <td>' . $package['name'] . '</td>
Chris@76 811 <td>' . $package['version'];
Chris@76 812
Chris@76 813 if ($package['is_installed'] && !$package['is_newer'])
Chris@76 814 echo '
Chris@76 815 <img src="', $settings['images_url'], '/icons/package_', $package['is_current'] ? 'installed' : 'old', '.gif" alt="" align="middle" style="margin-left: 2ex;" />';
Chris@76 816
Chris@76 817 echo '
Chris@76 818 </td>
Chris@76 819 <td align="right">';
Chris@76 820
Chris@76 821 if ($package['can_uninstall'])
Chris@76 822 echo '
Chris@76 823 <a href="', $scripturl, '?action=admin;area=packages;sa=uninstall;package=', $package['filename'], ';pid=', $package['installed_id'], '">[ ', $txt['uninstall'], ' ]</a>';
Chris@76 824 elseif ($package['can_upgrade'])
Chris@76 825 echo '
Chris@76 826 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['package_upgrade'], ' ]</a>';
Chris@76 827 elseif ($package['can_install'])
Chris@76 828 echo '
Chris@76 829 <a href="', $scripturl, '?action=admin;area=packages;sa=install;package=', $package['filename'], '">[ ', $txt['install_mod'], ' ]</a>';
Chris@76 830
Chris@76 831 echo '
Chris@76 832 <a href="', $scripturl, '?action=admin;area=packages;sa=list;package=', $package['filename'], '">[ ', $txt['list_files'], ' ]</a>
Chris@76 833 <a href="', $scripturl, '?action=admin;area=packages;sa=remove;package=', $package['filename'], ';', $context['session_var'], '=', $context['session_id'], '"', $package['is_installed'] && $package['is_current'] ? ' onclick="return confirm(\'' . $txt['package_delete_bad'] . '\');"' : '', '>[ ', $txt['package_delete'], ' ]</a>
Chris@76 834 </td>
Chris@76 835 </tr>';
Chris@76 836 }
Chris@76 837
Chris@76 838 echo '
Chris@76 839 </tbody>
Chris@76 840 </table>';
Chris@76 841 }
Chris@76 842
Chris@76 843 if (empty($context['available_mods']) && empty($context['available_avatars']) && empty($context['available_languages']) && empty($context['available_other']))
Chris@76 844 echo '
Chris@76 845 <div class="information">', $txt['no_packages'], '</div>';
Chris@76 846
Chris@76 847 echo '
Chris@76 848 <div class="flow_auto">
Chris@76 849 <div class="padding smalltext floatleft">
Chris@76 850 ', $txt['package_installed_key'], '
Chris@76 851 <img src="', $settings['images_url'], '/icons/package_installed.gif" alt="" align="middle" style="margin-left: 1ex;" /> ', $txt['package_installed_current'], '
Chris@76 852 <img src="', $settings['images_url'], '/icons/package_old.gif" alt="" align="middle" style="margin-left: 2ex;" /> ', $txt['package_installed_old'], '
Chris@76 853 </div>
Chris@76 854 <div class="padding smalltext floatright">
Chris@76 855 <a href="#" onclick="document.getElementById(\'advanced_box\').style.display = document.getElementById(\'advanced_box\').style.display == \'\' ? \'none\' : \'\'; return false;">', $txt['package_advanced_button'], '</a>
Chris@76 856 </div>
Chris@76 857 </div>
Chris@76 858 <form action="', $scripturl, '?action=admin;area=packages;sa=browse" method="get">
Chris@76 859 <div id="advanced_box" style="display: none;">
Chris@76 860 <div class="cat_bar">
Chris@76 861 <h3 class="catbg">', $txt['package_advanced_options'], '</h3>
Chris@76 862 </div>
Chris@76 863 <div class="windowbg">
Chris@76 864 <span class="topslice"><span></span></span>
Chris@76 865 <div class="content">
Chris@76 866 <p>
Chris@76 867 ', $txt['package_emulate_desc'], '
Chris@76 868 </p>
Chris@76 869 <dl class="settings">
Chris@76 870 <dt>
Chris@76 871 <strong>', $txt['package_emulate'], ':</strong><br />
Chris@76 872 <span class="smalltext">
Chris@76 873 <a href="#" onclick="document.getElementById(\'ve\').value = \'', $forum_version, '\'; return false">', $txt['package_emulate_revert'], '</a>
Chris@76 874 </span>
Chris@76 875 </dt>
Chris@76 876 <dd>
Chris@76 877 <input type="text" name="version_emulate" id="ve" value="', $context['forum_version'], '" size="25" class="input_text" />
Chris@76 878 </dd>
Chris@76 879 </dl>
Chris@76 880 <div class="righttext padding">
Chris@76 881 <input type="submit" value="', $txt['package_apply'], '" class="button_submit" />
Chris@76 882 </div>
Chris@76 883 </div>
Chris@76 884 <span class="botslice"><span></span></span>
Chris@76 885 </div>
Chris@76 886 </div>
Chris@76 887 <input type="hidden" name="action" value="admin" />
Chris@76 888 <input type="hidden" name="area" value="packages" />
Chris@76 889 <input type="hidden" name="sa" value="browse" />
Chris@76 890 </form>
Chris@76 891 </div>
Chris@76 892 <br class="clear" />';
Chris@76 893 }
Chris@76 894
Chris@76 895 function template_servers()
Chris@76 896 {
Chris@76 897 global $context, $settings, $options, $txt, $scripturl;
Chris@76 898
Chris@76 899 if (!empty($context['package_ftp']['error']))
Chris@76 900 echo '
Chris@76 901 <div class="errorbox">
Chris@76 902 <tt>', $context['package_ftp']['error'], '</tt>
Chris@76 903 </div>';
Chris@76 904
Chris@76 905 echo '
Chris@76 906 <div id="admincenter">
Chris@76 907 <div class="cat_bar">
Chris@76 908 <h3 class="catbg">', $txt['download_new_package'], '</h3>
Chris@76 909 </div>';
Chris@76 910
Chris@76 911 if ($context['package_download_broken'])
Chris@76 912 {
Chris@76 913 echo '
Chris@76 914 <div class="title_bar">
Chris@76 915 <h3 class="titlebg">', $txt['package_ftp_necessary'], '</h3>
Chris@76 916 </div>
Chris@76 917 <div class="windowbg">
Chris@76 918 <span class="topslice"><span></span></span>
Chris@76 919 <div class="content">
Chris@76 920 <p>
Chris@76 921 ', $txt['package_ftp_why_download'], '
Chris@76 922 </p>
Chris@76 923 <form action="', $scripturl, '?action=admin;area=packages;get" method="post" accept-charset="', $context['character_set'], '">
Chris@76 924 <dl class="settings">
Chris@76 925 <dt>
Chris@76 926 <label for="ftp_server">', $txt['package_ftp_server'], ':</label>
Chris@76 927 </dt>
Chris@76 928 <dd>
Chris@76 929 <input type="text" size="30" name="ftp_server" id="ftp_server" value="', $context['package_ftp']['server'], '" class="input_text" />
Chris@76 930 <label for="ftp_port">', $txt['package_ftp_port'], ':&nbsp;</label> <input type="text" size="3" name="ftp_port" id="ftp_port" value="', $context['package_ftp']['port'], '" class="input_text" />
Chris@76 931 </dd>
Chris@76 932 <dt>
Chris@76 933 <label for="ftp_username">', $txt['package_ftp_username'], ':</label>
Chris@76 934 </dt>
Chris@76 935 <dd>
Chris@76 936 <input type="text" size="50" name="ftp_username" id="ftp_username" value="', $context['package_ftp']['username'], '" style="width: 99%;" class="input_text" />
Chris@76 937 </dd>
Chris@76 938 <dt>
Chris@76 939 <label for="ftp_password">', $txt['package_ftp_password'], ':</label>
Chris@76 940 </dt>
Chris@76 941 <dd>
Chris@76 942 <input type="password" size="50" name="ftp_password" id="ftp_password" style="width: 99%;" class="input_password" />
Chris@76 943 </dd>
Chris@76 944 <dt>
Chris@76 945 <label for="ftp_path">', $txt['package_ftp_path'], ':</label>
Chris@76 946 </dt>
Chris@76 947 <dd>
Chris@76 948 <input type="text" size="50" name="ftp_path" id="ftp_path" value="', $context['package_ftp']['path'], '" style="width: 99%;" class="input_text" />
Chris@76 949 </dd>
Chris@76 950 </dl>
Chris@76 951 <div class="righttext">
Chris@76 952 <input type="submit" value="', $txt['package_proceed'], '" class="button_submit" />
Chris@76 953 </div>
Chris@76 954 </form>
Chris@76 955 </div>
Chris@76 956 <span class="botslice"><span></span></span>
Chris@76 957 </div>';
Chris@76 958 }
Chris@76 959
Chris@76 960 echo '
Chris@76 961 <div class="windowbg2">
Chris@76 962 <span class="topslice"><span></span></span>
Chris@76 963 <div class="content">
Chris@76 964 <fieldset>
Chris@76 965 <legend>' . $txt['package_servers'] . '</legend>
Chris@76 966 <ul class="package_servers">';
Chris@76 967 foreach ($context['servers'] as $server)
Chris@76 968 echo '
Chris@76 969 <li class="flow_auto">
Chris@76 970 <span class="floatleft">' . $server['name'] . '</span>
Chris@76 971 <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=remove;server=' . $server['id'] . ';', $context['session_var'], '=', $context['session_id'], '">[ ' . $txt['delete'] . ' ]</a></span>
Chris@76 972 <span class="package_server floatright"><a href="' . $scripturl . '?action=admin;area=packages;get;sa=browse;server=' . $server['id'] . '">[ ' . $txt['package_browse'] . ' ]</a></span>
Chris@76 973 </li>';
Chris@76 974 echo '
Chris@76 975 </ul>
Chris@76 976 </fieldset>
Chris@76 977 <fieldset>
Chris@76 978 <legend>' . $txt['add_server'] . '</legend>
Chris@76 979 <form action="' . $scripturl . '?action=admin;area=packages;get;sa=add" method="post" accept-charset="', $context['character_set'], '">
Chris@76 980 <dl class="settings">
Chris@76 981 <dt>
Chris@76 982 <strong>' . $txt['server_name'] . ':</strong>
Chris@76 983 </dt>
Chris@76 984 <dd>
Chris@76 985 <input type="text" name="servername" size="44" value="SMF" class="input_text" />
Chris@76 986 </dd>
Chris@76 987 <dt>
Chris@76 988 <strong>' . $txt['serverurl'] . ':</strong>
Chris@76 989 </dt>
Chris@76 990 <dd>
Chris@76 991 <input type="text" name="serverurl" size="44" value="http://" class="input_text" />
Chris@76 992 </dd>
Chris@76 993 </dl>
Chris@76 994 <div class="righttext">
Chris@76 995 <input type="submit" value="' . $txt['add_server'] . '" class="button_submit" />
Chris@76 996 <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
Chris@76 997 </div>
Chris@76 998 </form>
Chris@76 999 </fieldset>
Chris@76 1000 <fieldset>
Chris@76 1001 <legend>', $txt['package_download_by_url'], '</legend>
Chris@76 1002 <form action="', $scripturl, '?action=admin;area=packages;get;sa=download;byurl;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
Chris@76 1003 <dl class="settings">
Chris@76 1004 <dt>
Chris@76 1005 <strong>' . $txt['serverurl'] . ':</strong>
Chris@76 1006 </dt>
Chris@76 1007 <dd>
Chris@76 1008 <input type="text" name="package" size="44" value="http://" class="input_text" />
Chris@76 1009 </dd>
Chris@76 1010 <dt>
Chris@76 1011 <strong>', $txt['package_download_filename'], ':</strong>
Chris@76 1012 </dt>
Chris@76 1013 <dd>
Chris@76 1014 <input type="text" name="filename" size="44" class="input_text" /><br />
Chris@76 1015 <span class="smalltext">', $txt['package_download_filename_info'], '</span>
Chris@76 1016 </dd>
Chris@76 1017 </dl>
Chris@76 1018 <div class="righttext">
Chris@76 1019 <input type="submit" value="', $txt['download'], '" class="button_submit" />
Chris@76 1020 </div>
Chris@76 1021 </form>
Chris@76 1022 </fieldset>
Chris@76 1023 </div>
Chris@76 1024 <span class="botslice"><span></span></span>
Chris@76 1025 </div>
Chris@76 1026 <br />
Chris@76 1027 <div class="cat_bar">
Chris@76 1028 <h3 class="catbg">' . $txt['package_upload_title'] . '</h3>
Chris@76 1029 </div>
Chris@76 1030 <div class="windowbg">
Chris@76 1031 <span class="topslice"><span></span></span>
Chris@76 1032 <div class="content">
Chris@76 1033 <form action="' . $scripturl . '?action=admin;area=packages;get;sa=upload" method="post" accept-charset="', $context['character_set'], '" enctype="multipart/form-data" style="margin-bottom: 0;">
Chris@76 1034 <dl class="settings">
Chris@76 1035 <dt>
Chris@76 1036 <strong>' . $txt['package_upload_select'] . ':</strong>
Chris@76 1037 </dt>
Chris@76 1038 <dd>
Chris@76 1039 <input type="file" name="package" size="38" class="input_file" />
Chris@76 1040 </dd>
Chris@76 1041 </dl>
Chris@76 1042 <div class="righttext">
Chris@76 1043 <input type="submit" value="' . $txt['package_upload'] . '" class="button_submit" />
Chris@76 1044 <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
Chris@76 1045 </div>
Chris@76 1046 </form>
Chris@76 1047 </div>
Chris@76 1048 <span class="botslice"><span></span></span>
Chris@76 1049 </div>
Chris@76 1050 </div>
Chris@76 1051 <br class="clear" />';
Chris@76 1052 }
Chris@76 1053
Chris@76 1054 function template_package_confirm()
Chris@76 1055 {
Chris@76 1056 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1057
Chris@76 1058 echo '
Chris@76 1059 <div id="admincenter">
Chris@76 1060 <div class="cat_bar">
Chris@76 1061 <h3 class="catbg">', $context['page_title'], '</h3>
Chris@76 1062 </div>
Chris@76 1063 <div class="windowbg">
Chris@76 1064 <span class="topslice"><span></span></span>
Chris@76 1065 <div class="content">
Chris@76 1066 <p>', $context['confirm_message'], '</p>
Chris@76 1067 <a href="', $context['proceed_href'], '">[ ', $txt['package_confirm_proceed'], ' ]</a> <a href="JavaScript:history.go(-1);">[ ', $txt['package_confirm_go_back'], ' ]</a>
Chris@76 1068 </div>
Chris@76 1069 <span class="botslice"><span></span></span>
Chris@76 1070 </div>
Chris@76 1071 </div>
Chris@76 1072 <br class="clear" />';
Chris@76 1073 }
Chris@76 1074
Chris@76 1075 function template_package_list()
Chris@76 1076 {
Chris@76 1077 global $context, $settings, $options, $txt, $scripturl, $smcFunc;
Chris@76 1078
Chris@76 1079 echo '
Chris@76 1080 <div id="admincenter">
Chris@76 1081 <div class="cat_bar">
Chris@76 1082 <h3 class="catbg">' . $context['page_title'] . '</h3>
Chris@76 1083 </div>
Chris@76 1084 <div class="windowbg">
Chris@76 1085 <span class="topslice"><span></span></span>
Chris@76 1086 <div class="content">';
Chris@76 1087
Chris@76 1088 // No packages, as yet.
Chris@76 1089 if (empty($context['package_list']))
Chris@76 1090 echo '
Chris@76 1091 <ul>
Chris@76 1092 <li>', $txt['no_packages'], '</li>
Chris@76 1093 </ul>';
Chris@76 1094 // List out the packages...
Chris@76 1095 else
Chris@76 1096 {
Chris@76 1097 echo '
Chris@76 1098 <ul id="package_list">';
Chris@76 1099 foreach ($context['package_list'] as $i => $packageSection)
Chris@76 1100 {
Chris@76 1101 echo '
Chris@76 1102 <li>
Chris@76 1103 <strong><img id="ps_img_', $i, '" src="', $settings['images_url'], '/upshrink.png" alt="*" style="display: none;" /> ', $packageSection['title'], '</strong>';
Chris@76 1104
Chris@76 1105 if (!empty($packageSection['text']))
Chris@76 1106 echo '
Chris@76 1107 <div class="information">', $packageSection['text'], '</div>';
Chris@76 1108
Chris@76 1109 echo '
Chris@76 1110 <', $context['list_type'], ' id="package_section_', $i, '" class="packages">';
Chris@76 1111
Chris@76 1112 $alt = false;
Chris@76 1113
Chris@76 1114 foreach ($packageSection['items'] as $id => $package)
Chris@76 1115 {
Chris@76 1116 echo '
Chris@76 1117 <li>';
Chris@76 1118 // Textual message. Could be empty just for a blank line...
Chris@76 1119 if ($package['is_text'])
Chris@76 1120 echo '
Chris@76 1121 ', empty($package['name']) ? '&nbsp;' : $package['name'];
Chris@76 1122 // This is supposed to be a rule..
Chris@76 1123 elseif ($package['is_line'])
Chris@76 1124 echo '
Chris@76 1125 <hr class="hrcolor" />';
Chris@76 1126 // A remote link.
Chris@76 1127 elseif ($package['is_remote'])
Chris@76 1128 {
Chris@76 1129 echo '
Chris@76 1130 <strong>', $package['link'], '</strong>';
Chris@76 1131 }
Chris@76 1132 // A title?
Chris@76 1133 elseif ($package['is_heading'] || $package['is_title'])
Chris@76 1134 {
Chris@76 1135 echo '
Chris@76 1136 <strong>', $package['name'], '</strong>';
Chris@76 1137 }
Chris@76 1138 // Otherwise, it's a package.
Chris@76 1139 else
Chris@76 1140 {
Chris@76 1141 // 1. Some mod [ Download ].
Chris@76 1142 echo '
Chris@76 1143 <strong><img id="ps_img_', $i, '_pkg_', $id, '" src="', $settings['images_url'], '/upshrink.png" alt="*" style="display: none;" /> ', $package['can_install'] ? '<strong>' . $package['name'] . '</strong> <a href="' . $package['download']['href'] . '">[ ' . $txt['download'] . ' ]</a>': $package['name'];
Chris@76 1144
Chris@76 1145 // Mark as installed and current?
Chris@76 1146 if ($package['is_installed'] && !$package['is_newer'])
Chris@76 1147 echo '<img src="', $settings['images_url'], '/icons/package_', $package['is_current'] ? 'installed' : 'old', '.gif" width="12" height="11" align="middle" style="margin-left: 2ex;" alt="', $package['is_current'] ? $txt['package_installed_current'] : $txt['package_installed_old'], '" />';
Chris@76 1148
Chris@76 1149 echo '
Chris@76 1150 </strong>
Chris@76 1151 <ul id="package_section_', $i, '_pkg_', $id, '" class="package_section">';
Chris@76 1152
Chris@76 1153 // Show the mod type?
Chris@76 1154 if ($package['type'] != '')
Chris@76 1155 echo '
Chris@76 1156 <li class="package_section">', $txt['package_type'], ':&nbsp; ', $smcFunc['ucwords']($smcFunc['strtolower']($package['type'])), '</li>';
Chris@76 1157 // Show the version number?
Chris@76 1158 if ($package['version'] != '')
Chris@76 1159 echo '
Chris@76 1160 <li class="package_section">', $txt['mod_version'], ':&nbsp; ', $package['version'], '</li>';
Chris@76 1161 // How 'bout the author?
Chris@76 1162 if (!empty($package['author']) && $package['author']['name'] != '' && isset($package['author']['link']))
Chris@76 1163 echo '
Chris@76 1164 <li class="package_section">', $txt['mod_author'], ':&nbsp; ', $package['author']['link'], '</li>';
Chris@76 1165 // The homepage....
Chris@76 1166 if ($package['author']['website']['link'] != '')
Chris@76 1167 echo '
Chris@76 1168 <li class="package_section">', $txt['author_website'], ':&nbsp; ', $package['author']['website']['link'], '</li>';
Chris@76 1169
Chris@76 1170 // Desciption: bleh bleh!
Chris@76 1171 // Location of file: http://someplace/.
Chris@76 1172 echo '
Chris@76 1173 <li class="package_section">', $txt['file_location'], ':&nbsp; <a href="', $package['href'], '">', $package['href'], '</a></li>
Chris@76 1174 <li class="package_section"><div class="information">', $txt['package_description'], ':&nbsp; ', $package['description'], '</div></li>
Chris@76 1175 </ul>';
Chris@76 1176 }
Chris@76 1177 $alt = !$alt;
Chris@76 1178 echo '
Chris@76 1179 </li>';
Chris@76 1180 }
Chris@76 1181 echo '
Chris@76 1182 </', $context['list_type'], '>
Chris@76 1183 </li>';
Chris@76 1184 }
Chris@76 1185 echo '
Chris@76 1186 </ul>';
Chris@76 1187
Chris@76 1188 }
Chris@76 1189
Chris@76 1190 echo '
Chris@76 1191 </div>
Chris@76 1192 <span class="botslice"><span></span></span>
Chris@76 1193 </div>
Chris@76 1194 <div class="padding smalltext floatleft">
Chris@76 1195 ', $txt['package_installed_key'], '
Chris@76 1196 <img src="', $settings['images_url'], '/icons/package_installed.gif" alt="" align="middle" style="margin-left: 1ex;" /> ', $txt['package_installed_current'], '
Chris@76 1197 <img src="', $settings['images_url'], '/icons/package_old.gif" alt="" align="middle" style="margin-left: 2ex;" /> ', $txt['package_installed_old'], '
Chris@76 1198 </div>
Chris@76 1199 </div>
Chris@76 1200 <br class="clear" />
Chris@76 1201
Chris@76 1202 ';
Chris@76 1203 // Now go through and turn off all the sections.
Chris@76 1204 if (!empty($context['package_list']))
Chris@76 1205 {
Chris@76 1206 $section_count = count($context['package_list']);
Chris@76 1207 echo '
Chris@76 1208 <script type="text/javascript"><!-- // --><![CDATA[';
Chris@76 1209 foreach ($context['package_list'] as $section => $ps)
Chris@76 1210 {
Chris@76 1211 echo '
Chris@76 1212 var oPackageServerToggle_', $section, ' = new smc_Toggle({
Chris@76 1213 bToggleEnabled: true,
Chris@76 1214 bCurrentlyCollapsed: ', count($ps['items']) == 1 || $section_count == 1 ? 'false' : 'true', ',
Chris@76 1215 aSwappableContainers: [
Chris@76 1216 \'package_section_', $section, '\'
Chris@76 1217 ],
Chris@76 1218 aSwapImages: [
Chris@76 1219 {
Chris@76 1220 sId: \'ps_img_', $section, '\',
Chris@76 1221 srcExpanded: smf_images_url + \'/upshrink.png\',
Chris@76 1222 altExpanded: \'*\',
Chris@76 1223 srcCollapsed: smf_images_url + \'/upshrink2.png\',
Chris@76 1224 altCollapsed: \'*\'
Chris@76 1225 }
Chris@76 1226 ]
Chris@76 1227 });';
Chris@76 1228
Chris@76 1229 foreach ($ps['items'] as $id => $package)
Chris@76 1230 {
Chris@76 1231 if (!$package['is_text'] && !$package['is_line'] && !$package['is_remote'])
Chris@76 1232 echo '
Chris@76 1233 var oPackageToggle_', $section, '_pkg_', $id, ' = new smc_Toggle({
Chris@76 1234 bToggleEnabled: true,
Chris@76 1235 bCurrentlyCollapsed: true,
Chris@76 1236 aSwappableContainers: [
Chris@76 1237 \'package_section_', $section, '_pkg_', $id, '\'
Chris@76 1238 ],
Chris@76 1239 aSwapImages: [
Chris@76 1240 {
Chris@76 1241 sId: \'ps_img_', $section, '_pkg_', $id, '\',
Chris@76 1242 srcExpanded: smf_images_url + \'/upshrink.png\',
Chris@76 1243 altExpanded: \'*\',
Chris@76 1244 srcCollapsed: smf_images_url + \'/upshrink2.png\',
Chris@76 1245 altCollapsed: \'*\'
Chris@76 1246 }
Chris@76 1247 ]
Chris@76 1248 });';
Chris@76 1249 }
Chris@76 1250 }
Chris@76 1251 echo '
Chris@76 1252 // ]]></script>';
Chris@76 1253 }
Chris@76 1254 }
Chris@76 1255
Chris@76 1256 function template_downloaded()
Chris@76 1257 {
Chris@76 1258 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1259
Chris@76 1260 echo '
Chris@76 1261 <div id="admincenter">
Chris@76 1262 <div class="cat_bar">
Chris@76 1263 <h3 class="catbg">', $context['page_title'], '</h3>
Chris@76 1264 </div>
Chris@76 1265 <div class="windowbg">
Chris@76 1266 <span class="topslice"><span></span></span>
Chris@76 1267 <div class="content">
Chris@76 1268 <p>', (empty($context['package_server']) ? $txt['package_uploaded_successfully'] : $txt['package_downloaded_successfully']), '</p>
Chris@76 1269 <ul class="reset">
Chris@76 1270 <li class="reset"><span class="floatleft"><strong>', $context['package']['name'], '</strong></span>
Chris@76 1271 <span class="package_server floatright">', $context['package']['list_files']['link'], '</span>
Chris@76 1272 <span class="package_server floatright">', $context['package']['install']['link'], '</span>
Chris@76 1273 </li>
Chris@76 1274 </ul>
Chris@76 1275 <br /><br />
Chris@76 1276 <p><a href="', $scripturl, '?action=admin;area=packages;get', (isset($context['package_server']) ? ';sa=browse;server=' . $context['package_server'] : ''), '">[ ', $txt['back'], ' ]</a></p>
Chris@76 1277 </div>
Chris@76 1278 <span class="botslice"><span></span></span>
Chris@76 1279 </div>
Chris@76 1280 </div>
Chris@76 1281 <br class="clear" />';
Chris@76 1282 }
Chris@76 1283
Chris@76 1284 function template_install_options()
Chris@76 1285 {
Chris@76 1286 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1287
Chris@76 1288 echo '
Chris@76 1289 <div id="admincenter">
Chris@76 1290 <div class="cat_bar">
Chris@76 1291 <h3 class="catbg">', $txt['package_install_options'], '</h3>
Chris@76 1292 </div>
Chris@76 1293 <div class="information">
Chris@76 1294 ', $txt['package_install_options_ftp_why'], '
Chris@76 1295 </div>
Chris@76 1296
Chris@76 1297 <div class="windowbg">
Chris@76 1298 <span class="topslice"><span></span></span>
Chris@76 1299 <div class="content">
Chris@76 1300 <form action="', $scripturl, '?action=admin;area=packages;sa=options" method="post" accept-charset="', $context['character_set'], '">
Chris@76 1301 <dl class="settings">
Chris@76 1302 <dt>
Chris@76 1303 <label for="pack_server"><strong>', $txt['package_install_options_ftp_server'], ':</strong></label>
Chris@76 1304 </dt>
Chris@76 1305 <dd>
Chris@76 1306 <input type="text" name="pack_server" id="pack_server" value="', $context['package_ftp_server'], '" size="30" class="input_text" />
Chris@76 1307 </dd>
Chris@76 1308 <dt>
Chris@76 1309 <label for="pack_port"><strong>', $txt['package_install_options_ftp_port'], ':</strong></label>
Chris@76 1310 </dt>
Chris@76 1311 <dd>
Chris@76 1312 <input type="text" name="pack_port" id="pack_port" size="3" value="', $context['package_ftp_port'], '" class="input_text" />
Chris@76 1313 </dd>
Chris@76 1314 <dt>
Chris@76 1315 <label for="pack_user"><strong>', $txt['package_install_options_ftp_user'], ':</strong></label>
Chris@76 1316 </dt>
Chris@76 1317 <dd>
Chris@76 1318 <input type="text" name="pack_user" id="pack_user" value="', $context['package_ftp_username'], '" size="30" class="input_text" />
Chris@76 1319 </dd>
Chris@76 1320 </dl>
Chris@76 1321 <label for="package_make_backups"><input type="checkbox" name="package_make_backups" id="package_make_backups" value="1" class="input_check"', $context['package_make_backups'] ? ' checked="checked"' : '', ' /> ', $txt['package_install_options_make_backups'], '</label><br /><br />
Chris@76 1322 <div class="righttext">
Chris@76 1323 <input type="submit" name="submit" value="', $txt['save'], '" class="button_submit" />
Chris@76 1324 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
Chris@76 1325 </div>
Chris@76 1326 </form>
Chris@76 1327 </div>
Chris@76 1328 <span class="botslice"><span></span></span>
Chris@76 1329 </div>
Chris@76 1330 </div>
Chris@76 1331 <br class="clear" />';
Chris@76 1332 }
Chris@76 1333
Chris@76 1334 function template_control_chmod()
Chris@76 1335 {
Chris@76 1336 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1337
Chris@76 1338 // Nothing to do? Brilliant!
Chris@76 1339 if (empty($context['package_ftp']))
Chris@76 1340 return false;
Chris@76 1341
Chris@76 1342 if (empty($context['package_ftp']['form_elements_only']))
Chris@76 1343 {
Chris@76 1344 echo '
Chris@76 1345 ', sprintf($txt['package_ftp_why'], 'document.getElementById(\'need_writable_list\').style.display = \'\'; return false;'), '<br />
Chris@76 1346 <div id="need_writable_list" class="smalltext">
Chris@76 1347 ', $txt['package_ftp_why_file_list'], '
Chris@76 1348 <ul style="display: inline;">';
Chris@76 1349 if (!empty($context['notwritable_files']))
Chris@76 1350 foreach ($context['notwritable_files'] as $file)
Chris@76 1351 echo '
Chris@76 1352 <li>', $file, '</li>';
Chris@76 1353
Chris@76 1354 echo '
Chris@76 1355 </ul>
Chris@76 1356 </div>';
Chris@76 1357 }
Chris@76 1358
Chris@76 1359 echo '
Chris@76 1360 <div class="bordercolor" id="ftp_error_div" style="', (!empty($context['package_ftp']['error']) ? '' : 'display:none;'), 'padding: 1px; margin: 1ex;"><div class="windowbg2" id="ftp_error_innerdiv" style="padding: 1ex;">
Chris@76 1361 <tt id="ftp_error_message">', !empty($context['package_ftp']['error']) ? $context['package_ftp']['error'] : '', '</tt>
Chris@76 1362 </div></div>';
Chris@76 1363
Chris@76 1364 if (!empty($context['package_ftp']['destination']))
Chris@76 1365 echo '
Chris@76 1366 <form action="', $context['package_ftp']['destination'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">';
Chris@76 1367
Chris@76 1368 echo '
Chris@76 1369 <fieldset>
Chris@76 1370 <dl class="settings">
Chris@76 1371 <dt>
Chris@76 1372 <label for="ftp_server">', $txt['package_ftp_server'], ':</label>
Chris@76 1373 </dt>
Chris@76 1374 <dd>
Chris@76 1375 <input type="text" size="30" name="ftp_server" id="ftp_server" value="', $context['package_ftp']['server'], '" class="input_text" />
Chris@76 1376 <label for="ftp_port">', $txt['package_ftp_port'], ':&nbsp;</label> <input type="text" size="3" name="ftp_port" id="ftp_port" value="', $context['package_ftp']['port'], '" class="input_text" />
Chris@76 1377 </dd>
Chris@76 1378 <dt>
Chris@76 1379 <label for="ftp_username">', $txt['package_ftp_username'], ':</label>
Chris@76 1380 </dt>
Chris@76 1381 <dd>
Chris@76 1382 <input type="text" size="50" name="ftp_username" id="ftp_username" value="', $context['package_ftp']['username'], '" style="width: 98%;" class="input_text" />
Chris@76 1383 </dd>
Chris@76 1384 <dt>
Chris@76 1385 <label for="ftp_password">', $txt['package_ftp_password'], ':</label>
Chris@76 1386 </dt>
Chris@76 1387 <dd>
Chris@76 1388 <input type="password" size="50" name="ftp_password" id="ftp_password" style="width: 98%;" class="input_password" />
Chris@76 1389 </dd>
Chris@76 1390 <dt>
Chris@76 1391 <label for="ftp_path">', $txt['package_ftp_path'], ':</label>
Chris@76 1392 </dt>
Chris@76 1393 <dd>
Chris@76 1394 <input type="text" size="50" name="ftp_path" id="ftp_path" value="', $context['package_ftp']['path'], '" style="width: 98%;" class="input_text" />
Chris@76 1395 </dd>
Chris@76 1396 </dl>
Chris@76 1397 </fieldset>';
Chris@76 1398
Chris@76 1399 if (empty($context['package_ftp']['form_elements_only']))
Chris@76 1400 echo '
Chris@76 1401
Chris@76 1402 <div class="righttext" style="margin: 1ex;">
Chris@76 1403 <span id="test_ftp_placeholder_full"></span>
Chris@76 1404 <input type="submit" value="', $txt['package_proceed'], '" class="button_submit" />
Chris@76 1405 </div>';
Chris@76 1406
Chris@76 1407 if (!empty($context['package_ftp']['destination']))
Chris@76 1408 echo '
Chris@76 1409 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
Chris@76 1410 </form>';
Chris@76 1411
Chris@76 1412 // Hide the details of the list.
Chris@76 1413 if (empty($context['package_ftp']['form_elements_only']))
Chris@76 1414 echo '
Chris@76 1415 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 1416 document.getElementById(\'need_writable_list\').style.display = \'none\';
Chris@76 1417 // ]]></script>';
Chris@76 1418
Chris@76 1419 // Quick generate the test button.
Chris@76 1420 echo '
Chris@76 1421 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 1422 // Generate a "test ftp" button.
Chris@76 1423 var generatedButton = false;
Chris@76 1424 function generateFTPTest()
Chris@76 1425 {
Chris@76 1426 // Don\'t ever call this twice!
Chris@76 1427 if (generatedButton)
Chris@76 1428 return false;
Chris@76 1429 generatedButton = true;
Chris@76 1430
Chris@76 1431 // No XML?
Chris@76 1432 if (!window.XMLHttpRequest || (!document.getElementById("test_ftp_placeholder") && !document.getElementById("test_ftp_placeholder_full")))
Chris@76 1433 return false;
Chris@76 1434
Chris@76 1435 var ftpTest = document.createElement("input");
Chris@76 1436 ftpTest.type = "button";
Chris@76 1437 ftpTest.onclick = testFTP;
Chris@76 1438
Chris@76 1439 if (document.getElementById("test_ftp_placeholder"))
Chris@76 1440 {
Chris@76 1441 ftpTest.value = "', $txt['package_ftp_test'], '";
Chris@76 1442 document.getElementById("test_ftp_placeholder").appendChild(ftpTest);
Chris@76 1443 }
Chris@76 1444 else
Chris@76 1445 {
Chris@76 1446 ftpTest.value = "', $txt['package_ftp_test_connection'], '";
Chris@76 1447 document.getElementById("test_ftp_placeholder_full").appendChild(ftpTest);
Chris@76 1448 }
Chris@76 1449 }
Chris@76 1450 function testFTP()
Chris@76 1451 {
Chris@76 1452 ajax_indicator(true);
Chris@76 1453
Chris@76 1454 // What we need to post.
Chris@76 1455 var oPostData = {
Chris@76 1456 0: "ftp_server",
Chris@76 1457 1: "ftp_port",
Chris@76 1458 2: "ftp_username",
Chris@76 1459 3: "ftp_password",
Chris@76 1460 4: "ftp_path"
Chris@76 1461 }
Chris@76 1462
Chris@76 1463 var sPostData = "";
Chris@76 1464 for (i = 0; i < 5; i++)
Chris@76 1465 sPostData = sPostData + (sPostData.length == 0 ? "" : "&") + oPostData[i] + "=" + escape(document.getElementById(oPostData[i]).value);
Chris@76 1466
Chris@76 1467 // Post the data out.
Chris@76 1468 sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=admin;area=packages;sa=ftptest;xml;', $context['session_var'], '=', $context['session_id'], '\', sPostData, testFTPResults);
Chris@76 1469 }
Chris@76 1470 function testFTPResults(oXMLDoc)
Chris@76 1471 {
Chris@76 1472 ajax_indicator(false);
Chris@76 1473
Chris@76 1474 // This assumes it went wrong!
Chris@76 1475 var wasSuccess = false;
Chris@76 1476 var message = "', addcslashes($txt['package_ftp_test_failed'], "'"), '";
Chris@76 1477
Chris@76 1478 var results = oXMLDoc.getElementsByTagName(\'results\')[0].getElementsByTagName(\'result\');
Chris@76 1479 if (results.length > 0)
Chris@76 1480 {
Chris@76 1481 if (results[0].getAttribute(\'success\') == 1)
Chris@76 1482 wasSuccess = true;
Chris@76 1483 message = results[0].firstChild.nodeValue;
Chris@76 1484 }
Chris@76 1485
Chris@76 1486 document.getElementById("ftp_error_div").style.display = "";
Chris@76 1487 document.getElementById("ftp_error_div").style.backgroundColor = wasSuccess ? "green" : "red";
Chris@76 1488 document.getElementById("ftp_error_innerdiv").style.backgroundColor = wasSuccess ? "#DBFDC7" : "#FDBDBD";
Chris@76 1489
Chris@76 1490 setInnerHTML(document.getElementById("ftp_error_message"), message);
Chris@76 1491 }
Chris@76 1492 generateFTPTest();
Chris@76 1493 // ]]></script>';
Chris@76 1494
Chris@76 1495 // Make sure the button gets generated last.
Chris@76 1496 $context['insert_after_template'] .= '
Chris@76 1497 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 1498 generateFTPTest();
Chris@76 1499 // ]]></script>';
Chris@76 1500 }
Chris@76 1501
Chris@76 1502 function template_ftp_required()
Chris@76 1503 {
Chris@76 1504 global $context, $settings, $options, $txt, $scripturl;
Chris@76 1505
Chris@76 1506 echo '
Chris@76 1507 <fieldset>
Chris@76 1508 <legend>
Chris@76 1509 ', $txt['package_ftp_necessary'], '
Chris@76 1510 </legend>
Chris@76 1511 <div class="ftp_details">
Chris@76 1512 ', template_control_chmod(), '
Chris@76 1513 </div>
Chris@76 1514 </fieldset>';
Chris@76 1515 }
Chris@76 1516
Chris@76 1517 function template_view_operations()
Chris@76 1518 {
Chris@76 1519 global $context, $txt, $settings;
Chris@76 1520
Chris@76 1521 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Chris@76 1522 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
Chris@76 1523 <head>
Chris@76 1524 <title>', $txt['operation_title'], '</title>
Chris@76 1525 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
Chris@76 1526 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index.css" />
Chris@76 1527 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/admin.css" />
Chris@76 1528 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
Chris@76 1529 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/theme.js?fin20"></script>
Chris@76 1530 </head>
Chris@76 1531 <body>
Chris@76 1532 <div class="padding windowbg">
Chris@76 1533 <div class="padding">
Chris@76 1534 ', $context['operations']['search'], '
Chris@76 1535 </div>
Chris@76 1536 <div class="padding">
Chris@76 1537 ', $context['operations']['replace'], '
Chris@76 1538 </div>
Chris@76 1539 </div>
Chris@76 1540 </body>
Chris@76 1541 </html>';
Chris@76 1542 }
Chris@76 1543
Chris@76 1544 function template_file_permissions()
Chris@76 1545 {
Chris@76 1546 global $txt, $scripturl, $context, $settings;
Chris@76 1547
Chris@76 1548 // This will handle expanding the selection.
Chris@76 1549 echo '
Chris@76 1550 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 1551 var oRadioColors = {
Chris@76 1552 0: "#D1F7BF",
Chris@76 1553 1: "#FFBBBB",
Chris@76 1554 2: "#FDD7AF",
Chris@76 1555 3: "#C2C6C0",
Chris@76 1556 4: "#EEEEEE"
Chris@76 1557 }
Chris@76 1558 var oRadioValues = {
Chris@76 1559 0: "read",
Chris@76 1560 1: "writable",
Chris@76 1561 2: "execute",
Chris@76 1562 3: "custom",
Chris@76 1563 4: "no_change"
Chris@76 1564 }
Chris@76 1565 function expandFolder(folderIdent, folderReal)
Chris@76 1566 {
Chris@76 1567 // See if it already exists.
Chris@76 1568 var possibleTags = document.getElementsByTagName("tr");
Chris@76 1569 var foundOne = false;
Chris@76 1570
Chris@76 1571 for (var i = 0; i < possibleTags.length; i++)
Chris@76 1572 {
Chris@76 1573 if (possibleTags[i].id.indexOf("content_" + folderIdent + ":-:") == 0)
Chris@76 1574 {
Chris@76 1575 possibleTags[i].style.display = possibleTags[i].style.display == "none" ? "" : "none";
Chris@76 1576 foundOne = true;
Chris@76 1577 }
Chris@76 1578 }
Chris@76 1579
Chris@76 1580 // Got something then we\'re done.
Chris@76 1581 if (foundOne)
Chris@76 1582 {
Chris@76 1583 return false;
Chris@76 1584 }
Chris@76 1585 // Otherwise we need to get the wicked thing.
Chris@76 1586 else if (window.XMLHttpRequest)
Chris@76 1587 {
Chris@76 1588 ajax_indicator(true);
Chris@76 1589 getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=admin;area=packages;onlyfind=\' + escape(folderReal) + \';sa=perms;xml;', $context['session_var'], '=', $context['session_id'], '\', onNewFolderReceived);
Chris@76 1590 }
Chris@76 1591 // Otherwise reload.
Chris@76 1592 else
Chris@76 1593 return true;
Chris@76 1594
Chris@76 1595 return false;
Chris@76 1596 }
Chris@76 1597 function dynamicExpandFolder()
Chris@76 1598 {
Chris@76 1599 expandFolder(this.ident, this.path);
Chris@76 1600
Chris@76 1601 return false;
Chris@76 1602 }
Chris@76 1603 function dynamicAddMore()
Chris@76 1604 {
Chris@76 1605 ajax_indicator(true);
Chris@76 1606
Chris@76 1607 getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=admin;area=packages;fileoffset=\' + (parseInt(this.offset) + ', $context['file_limit'], ') + \';onlyfind=\' + escape(this.path) + \';sa=perms;xml;', $context['session_var'], '=', $context['session_id'], '\', onNewFolderReceived);
Chris@76 1608 }
Chris@76 1609 function repeatString(sString, iTime)
Chris@76 1610 {
Chris@76 1611 if (iTime < 1)
Chris@76 1612 return \'\';
Chris@76 1613 else
Chris@76 1614 return sString + repeatString(sString, iTime - 1);
Chris@76 1615 }
Chris@76 1616 // Create a named element dynamically - thanks to: http://www.thunderguy.com/semicolon/2005/05/23/setting-the-name-attribute-in-internet-explorer/
Chris@76 1617 function createNamedElement(type, name, customFields)
Chris@76 1618 {
Chris@76 1619 var element = null;
Chris@76 1620
Chris@76 1621 if (!customFields)
Chris@76 1622 customFields = "";
Chris@76 1623
Chris@76 1624 // Try the IE way; this fails on standards-compliant browsers
Chris@76 1625 try
Chris@76 1626 {
Chris@76 1627 element = document.createElement("<" + type + \' name="\' + name + \'" \' + customFields + ">");
Chris@76 1628 }
Chris@76 1629 catch (e)
Chris@76 1630 {
Chris@76 1631 }
Chris@76 1632 if (!element || element.nodeName != type.toUpperCase())
Chris@76 1633 {
Chris@76 1634 // Non-IE browser; use canonical method to create named element
Chris@76 1635 element = document.createElement(type);
Chris@76 1636 element.name = name;
Chris@76 1637 }
Chris@76 1638
Chris@76 1639 return element;
Chris@76 1640 }
Chris@76 1641 // Getting something back?
Chris@76 1642 function onNewFolderReceived(oXMLDoc)
Chris@76 1643 {
Chris@76 1644 ajax_indicator(false);
Chris@76 1645
Chris@76 1646 var fileItems = oXMLDoc.getElementsByTagName(\'folders\')[0].getElementsByTagName(\'folder\');
Chris@76 1647
Chris@76 1648 // No folders, no longer worth going further.
Chris@76 1649 if (fileItems.length < 1)
Chris@76 1650 {
Chris@76 1651 if (oXMLDoc.getElementsByTagName(\'roots\')[0].getElementsByTagName(\'root\')[0])
Chris@76 1652 {
Chris@76 1653 var rootName = oXMLDoc.getElementsByTagName(\'roots\')[0].getElementsByTagName(\'root\')[0].firstChild.nodeValue;
Chris@76 1654 var itemLink = document.getElementById(\'link_\' + rootName);
Chris@76 1655
Chris@76 1656 // Move the children up.
Chris@76 1657 for (i = 0; i <= itemLink.childNodes.length; i++)
Chris@76 1658 itemLink.parentNode.insertBefore(itemLink.childNodes[0], itemLink);
Chris@76 1659
Chris@76 1660 // And remove the link.
Chris@76 1661 itemLink.parentNode.removeChild(itemLink);
Chris@76 1662 }
Chris@76 1663 return false;
Chris@76 1664 }
Chris@76 1665 var tableHandle = false;
Chris@76 1666 var isMore = false;
Chris@76 1667 var ident = "";
Chris@76 1668 var my_ident = "";
Chris@76 1669 var curLevel = 0;
Chris@76 1670
Chris@76 1671 for (var i = 0; i < fileItems.length; i++)
Chris@76 1672 {
Chris@76 1673 if (fileItems[i].getAttribute(\'more\') == 1)
Chris@76 1674 {
Chris@76 1675 isMore = true;
Chris@76 1676 var curOffset = fileItems[i].getAttribute(\'offset\');
Chris@76 1677 }
Chris@76 1678
Chris@76 1679 if (fileItems[i].getAttribute(\'more\') != 1 && document.getElementById("insert_div_loc_" + fileItems[i].getAttribute(\'ident\')))
Chris@76 1680 {
Chris@76 1681 ident = fileItems[i].getAttribute(\'ident\');
Chris@76 1682 my_ident = fileItems[i].getAttribute(\'my_ident\');
Chris@76 1683 curLevel = fileItems[i].getAttribute(\'level\') * 5;
Chris@76 1684 curPath = fileItems[i].getAttribute(\'path\');
Chris@76 1685
Chris@76 1686 // Get where we\'re putting it next to.
Chris@76 1687 tableHandle = document.getElementById("insert_div_loc_" + fileItems[i].getAttribute(\'ident\'));
Chris@76 1688
Chris@76 1689 var curRow = document.createElement("tr");
Chris@76 1690 curRow.className = "windowbg";
Chris@76 1691 curRow.id = "content_" + my_ident;
Chris@76 1692 curRow.style.display = "";
Chris@76 1693 var curCol = document.createElement("td");
Chris@76 1694 curCol.className = "smalltext";
Chris@76 1695 curCol.width = "40%";
Chris@76 1696
Chris@76 1697 // This is the name.
Chris@76 1698 var fileName = document.createTextNode(fileItems[i].firstChild.nodeValue);
Chris@76 1699
Chris@76 1700 // Start by wacking in the spaces.
Chris@76 1701 setInnerHTML(curCol, repeatString("&nbsp;", curLevel));
Chris@76 1702
Chris@76 1703 // Create the actual text.
Chris@76 1704 if (fileItems[i].getAttribute(\'folder\') == 1)
Chris@76 1705 {
Chris@76 1706 var linkData = document.createElement("a");
Chris@76 1707 linkData.name = "fol_" + my_ident;
Chris@76 1708 linkData.id = "link_" + my_ident;
Chris@76 1709 linkData.href = \'#\';
Chris@76 1710 linkData.path = curPath + "/" + fileItems[i].firstChild.nodeValue;
Chris@76 1711 linkData.ident = my_ident;
Chris@76 1712 linkData.onclick = dynamicExpandFolder;
Chris@76 1713
Chris@76 1714 var folderImage = document.createElement("img");
Chris@76 1715 folderImage.src = \'', addcslashes($settings['default_images_url'], "\\"), '/board.gif\';
Chris@76 1716 linkData.appendChild(folderImage);
Chris@76 1717
Chris@76 1718 linkData.appendChild(fileName);
Chris@76 1719 curCol.appendChild(linkData);
Chris@76 1720 }
Chris@76 1721 else
Chris@76 1722 curCol.appendChild(fileName);
Chris@76 1723
Chris@76 1724 curRow.appendChild(curCol);
Chris@76 1725
Chris@76 1726 // Right, the permissions.
Chris@76 1727 curCol = document.createElement("td");
Chris@76 1728 curCol.className = "smalltext";
Chris@76 1729
Chris@76 1730 var writeSpan = document.createElement("span");
Chris@76 1731 writeSpan.style.color = fileItems[i].getAttribute(\'writable\') ? "green" : "red";
Chris@76 1732 setInnerHTML(writeSpan, fileItems[i].getAttribute(\'writable\') ? \'', $txt['package_file_perms_writable'], '\' : \'', $txt['package_file_perms_not_writable'], '\');
Chris@76 1733 curCol.appendChild(writeSpan);
Chris@76 1734
Chris@76 1735 if (fileItems[i].getAttribute(\'permissions\'))
Chris@76 1736 {
Chris@76 1737 var permData = document.createTextNode("\u00a0(', $txt['package_file_perms_chmod'], ': " + fileItems[i].getAttribute(\'permissions\') + ")");
Chris@76 1738 curCol.appendChild(permData);
Chris@76 1739 }
Chris@76 1740
Chris@76 1741 curRow.appendChild(curCol);
Chris@76 1742
Chris@76 1743 // Now add the five radio buttons.
Chris@76 1744 for (j = 0; j < 5; j++)
Chris@76 1745 {
Chris@76 1746 curCol = document.createElement("td");
Chris@76 1747 curCol.style.backgroundColor = oRadioColors[j];
Chris@76 1748 curCol.align = "center";
Chris@76 1749
Chris@76 1750 var curInput = createNamedElement("input", "permStatus[" + curPath + "/" + fileItems[i].firstChild.nodeValue + "]", j == 4 ? \'checked="checked"\' : "");
Chris@76 1751 curInput.type = "radio";
Chris@76 1752 curInput.checked = "checked";
Chris@76 1753 curInput.value = oRadioValues[j];
Chris@76 1754
Chris@76 1755 curCol.appendChild(curInput);
Chris@76 1756 curRow.appendChild(curCol);
Chris@76 1757 }
Chris@76 1758
Chris@76 1759 // Put the row in.
Chris@76 1760 tableHandle.parentNode.insertBefore(curRow, tableHandle);
Chris@76 1761
Chris@76 1762 // Put in a new dummy section?
Chris@76 1763 if (fileItems[i].getAttribute(\'folder\') == 1)
Chris@76 1764 {
Chris@76 1765 var newRow = document.createElement("tr");
Chris@76 1766 newRow.id = "insert_div_loc_" + my_ident;
Chris@76 1767 newRow.style.display = "none";
Chris@76 1768 tableHandle.parentNode.insertBefore(newRow, tableHandle);
Chris@76 1769 var newCol = document.createElement("td");
Chris@76 1770 newCol.colspan = 2;
Chris@76 1771 newRow.appendChild(newCol);
Chris@76 1772 }
Chris@76 1773 }
Chris@76 1774 }
Chris@76 1775
Chris@76 1776 // Is there some more to remove?
Chris@76 1777 if (document.getElementById("content_" + ident + "_more"))
Chris@76 1778 {
Chris@76 1779 document.getElementById("content_" + ident + "_more").parentNode.removeChild(document.getElementById("content_" + ident + "_more"));
Chris@76 1780 }
Chris@76 1781
Chris@76 1782 // Add more?
Chris@76 1783 if (isMore && tableHandle)
Chris@76 1784 {
Chris@76 1785 // Create the actual link.
Chris@76 1786 var linkData = document.createElement("a");
Chris@76 1787 linkData.href = \'#fol_\' + my_ident;
Chris@76 1788 linkData.path = curPath;
Chris@76 1789 linkData.offset = curOffset;
Chris@76 1790 linkData.onclick = dynamicAddMore;
Chris@76 1791
Chris@76 1792 linkData.appendChild(document.createTextNode(\'', $txt['package_file_perms_more_files'], '\'));
Chris@76 1793
Chris@76 1794 curRow = document.createElement("tr");
Chris@76 1795 curRow.className = "windowbg";
Chris@76 1796 curRow.id = "content_" + ident + "_more";
Chris@76 1797 tableHandle.parentNode.insertBefore(curRow, tableHandle);
Chris@76 1798 curCol = document.createElement("td");
Chris@76 1799 curCol.className = "smalltext";
Chris@76 1800 curCol.width = "40%";
Chris@76 1801
Chris@76 1802 setInnerHTML(curCol, repeatString("&nbsp;", curLevel));
Chris@76 1803 curCol.appendChild(document.createTextNode(\'\\u00ab \'));
Chris@76 1804 curCol.appendChild(linkData);
Chris@76 1805 curCol.appendChild(document.createTextNode(\' \\u00bb\'));
Chris@76 1806
Chris@76 1807 curRow.appendChild(curCol);
Chris@76 1808 curCol = document.createElement("td");
Chris@76 1809 curCol.className = "smalltext";
Chris@76 1810 curRow.appendChild(curCol);
Chris@76 1811 }
Chris@76 1812
Chris@76 1813 // Keep track of it.
Chris@76 1814 var curInput = createNamedElement("input", "back_look[]");
Chris@76 1815 curInput.type = "hidden";
Chris@76 1816 curInput.value = curPath;
Chris@76 1817
Chris@76 1818 curCol.appendChild(curInput);
Chris@76 1819 }
Chris@76 1820 // ]]></script>';
Chris@76 1821
Chris@76 1822 echo '
Chris@76 1823 <div class="information">
Chris@76 1824 <div>
Chris@76 1825 <strong>', $txt['package_file_perms_warning'], ':</strong>
Chris@76 1826 <div class="smalltext">
Chris@76 1827 <ol style="margin-top: 2px; margin-bottom: 2px">
Chris@76 1828 ', $txt['package_file_perms_warning_desc'], '
Chris@76 1829 </ol>
Chris@76 1830 </div>
Chris@76 1831 </div>
Chris@76 1832 </div>
Chris@76 1833
Chris@76 1834 <form action="', $scripturl, '?action=admin;area=packages;sa=perms;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
Chris@76 1835 <div class="title_bar">
Chris@76 1836 <h3 class="titlebg">
Chris@76 1837 <span class="floatleft">', $txt['package_file_perms'], '</span><span class="fperm floatright">', $txt['package_file_perms_new_status'], '</span>
Chris@76 1838 </h3>
Chris@76 1839 </div>
Chris@76 1840 <table width="100%" class="table_grid">
Chris@76 1841 <thead>
Chris@76 1842 <tr class="catbg">
Chris@76 1843 <th class="first_th lefttext" width="30%">&nbsp;', $txt['package_file_perms_name'], '&nbsp;</th>
Chris@76 1844 <th width="30%" class="lefttext">', $txt['package_file_perms_status'], '</th>
Chris@76 1845 <th align="center" width="8%"><span class="filepermissions">', $txt['package_file_perms_status_read'], '</span></th>
Chris@76 1846 <th align="center" width="8%"><span class="filepermissions">', $txt['package_file_perms_status_write'], '</span></th>
Chris@76 1847 <th align="center" width="8%"><span class="filepermissions">', $txt['package_file_perms_status_execute'], '</span></th>
Chris@76 1848 <th align="center" width="8%"><span class="filepermissions">', $txt['package_file_perms_status_custom'], '</span></th>
Chris@76 1849 <th class="last_th" align="center" width="8%"><span class="filepermissions">', $txt['package_file_perms_status_no_change'], '</span></th>
Chris@76 1850 </tr>
Chris@76 1851 </thead>';
Chris@76 1852
Chris@76 1853 foreach ($context['file_tree'] as $name => $dir)
Chris@76 1854 {
Chris@76 1855 echo '
Chris@76 1856 <tbody>
Chris@76 1857 <tr class="windowbg2">
Chris@76 1858 <td width="30%"><strong>';
Chris@76 1859
Chris@76 1860 if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
Chris@76 1861 echo '
Chris@76 1862 <img src="', $settings['default_images_url'], '/board.gif" alt="*" />';
Chris@76 1863
Chris@76 1864 echo '
Chris@76 1865 ', $name, '
Chris@76 1866 </strong></td>
Chris@76 1867 <td width="30%">
Chris@76 1868 <span style="color: ', ($dir['perms']['chmod'] ? 'green' : 'red'), '">', ($dir['perms']['chmod'] ? $txt['package_file_perms_writable'] : $txt['package_file_perms_not_writable']), '</span>
Chris@76 1869 ', ($dir['perms']['perms'] ? '&nbsp;(' . $txt['package_file_perms_chmod'] . ': ' . substr(sprintf('%o', $dir['perms']['perms']), -4) . ')' : ''), '
Chris@76 1870 </td>
Chris@76 1871 <td align="center" class="perm_read" width="8%"><input type="radio" name="permStatus[', $name, ']" value="read" class="input_radio" /></td>
Chris@76 1872 <td align="center" class="perm_write" width="8%"><input type="radio" name="permStatus[', $name, ']" value="writable" class="input_radio" /></td>
Chris@76 1873 <td align="center" class="perm_execute" width="8%"><input type="radio" name="permStatus[', $name, ']" value="execute" class="input_radio" /></td>
Chris@76 1874 <td align="center" class="perm_custom" width="8%"><input type="radio" name="permStatus[', $name, ']" value="custom" class="input_radio" /></td>
Chris@76 1875 <td align="center" class="perm_nochange" width="8%"><input type="radio" name="permStatus[', $name, ']" value="no_change" checked="checked" class="input_radio" /></td>
Chris@76 1876 </tr>
Chris@76 1877 </tbody>';
Chris@76 1878
Chris@76 1879 if (!empty($dir['contents']))
Chris@76 1880 template_permission_show_contents($name, $dir['contents'], 1);
Chris@76 1881 }
Chris@76 1882
Chris@76 1883 echo '
Chris@76 1884
Chris@76 1885 </table>
Chris@76 1886 <br />
Chris@76 1887 <div class="cat_bar">
Chris@76 1888 <h3 class="catbg">', $txt['package_file_perms_change'], '</h3>
Chris@76 1889 </div>
Chris@76 1890 <div class="windowbg">
Chris@76 1891 <span class="topslice"><span></span></span>
Chris@76 1892 <div class="content">
Chris@76 1893 <fieldset>
Chris@76 1894 <dl>
Chris@76 1895 <dt>
Chris@76 1896 <input type="radio" name="method" value="individual" checked="checked" id="method_individual" class="input_radio" />
Chris@76 1897 <label for="method_individual"><strong>', $txt['package_file_perms_apply'], '</strong></label>
Chris@76 1898 </dt>
Chris@76 1899 <dd>
Chris@76 1900 <em class="smalltext">', $txt['package_file_perms_custom'], ': <input type="text" name="custom_value" value="0755" maxlength="4" size="5" class="input_text" />&nbsp;<a href="', $scripturl, '?action=helpadmin;help=chmod_flags" onclick="return reqWin(this.href);" class="help">(?)</a></em>
Chris@76 1901 </dd>
Chris@76 1902 <dt>
Chris@76 1903 <input type="radio" name="method" value="predefined" id="method_predefined" class="input_radio" />
Chris@76 1904 <label for="method_predefined"><strong>', $txt['package_file_perms_predefined'], ':</strong></label>
Chris@76 1905 <select name="predefined" onchange="document.getElementById(\'method_predefined\').checked = \'checked\';">
Chris@76 1906 <option value="restricted" selected="selected">', $txt['package_file_perms_pre_restricted'], '</option>
Chris@76 1907 <option value="standard">', $txt['package_file_perms_pre_standard'], '</option>
Chris@76 1908 <option value="free">', $txt['package_file_perms_pre_free'], '</option>
Chris@76 1909 </select>
Chris@76 1910 </dt>
Chris@76 1911 <dd>
Chris@76 1912 <em class="smalltext">', $txt['package_file_perms_predefined_note'], '</em>
Chris@76 1913 </dd>
Chris@76 1914 </dl>
Chris@76 1915 </fieldset>';
Chris@76 1916
Chris@76 1917 // Likely to need FTP?
Chris@76 1918 if (empty($context['ftp_connected']))
Chris@76 1919 echo '
Chris@76 1920 <p>
Chris@76 1921 ', $txt['package_file_perms_ftp_details'], ':
Chris@76 1922 </p>
Chris@76 1923 ', template_control_chmod(), '
Chris@76 1924 <div class="information">', $txt['package_file_perms_ftp_retain'], '</div>';
Chris@76 1925
Chris@76 1926 echo '
Chris@76 1927 <span id="test_ftp_placeholder_full"></span>
Chris@76 1928 <div class="righttext padding">
Chris@76 1929 <input type="hidden" name="action_changes" value="1" />
Chris@76 1930 <input type="submit" value="', $txt['package_file_perms_go'], '" name="go" class="button_submit" />
Chris@76 1931 </div>
Chris@76 1932 </div>
Chris@76 1933 <span class="botslice"><span></span></span>
Chris@76 1934 </div>';
Chris@76 1935
Chris@76 1936 // Any looks fors we've already done?
Chris@76 1937 foreach ($context['look_for'] as $path)
Chris@76 1938 echo '
Chris@76 1939 <input type="hidden" name="back_look[]" value="', $path, '" />';
Chris@76 1940 echo '
Chris@76 1941 </form><br />';
Chris@76 1942 }
Chris@76 1943
Chris@76 1944 function template_permission_show_contents($ident, $contents, $level, $has_more = false)
Chris@76 1945 {
Chris@76 1946 global $settings, $txt, $scripturl, $context;
Chris@76 1947 $js_ident = preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident);
Chris@76 1948 // Have we actually done something?
Chris@76 1949 $drawn_div = false;
Chris@76 1950
Chris@76 1951 foreach ($contents as $name => $dir)
Chris@76 1952 {
Chris@76 1953 if (isset($dir['perms']))
Chris@76 1954 {
Chris@76 1955 if (!$drawn_div)
Chris@76 1956 {
Chris@76 1957 $drawn_div = true;
Chris@76 1958 echo '
Chris@76 1959 </table>
Chris@76 1960 <table border="0" width="100%" class="table_grid" id="', $js_ident, '">';
Chris@76 1961 }
Chris@76 1962
Chris@76 1963 $cur_ident = preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident . '/' . $name);
Chris@76 1964 echo '
Chris@76 1965 <tr class="windowbg" id="content_', $cur_ident, '">
Chris@76 1966 <td class="smalltext" width="30%">' . str_repeat('&nbsp;', $level * 5), '
Chris@76 1967 ', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '<a id="link_' . $cur_ident . '" href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident . '/' . $name) . ';back_look=' . $context['back_look_data'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . $cur_ident . '" onclick="return expandFolder(\'' . $cur_ident . '\', \'' . addcslashes($ident . '/' . $name, "'\\") . '\');">' : '';
Chris@76 1968
Chris@76 1969 if (!empty($dir['type']) && ($dir['type'] == 'dir' || $dir['type'] == 'dir_recursive'))
Chris@76 1970 echo '
Chris@76 1971 <img src="', $settings['default_images_url'], '/board.gif" alt="*" />';
Chris@76 1972
Chris@76 1973 echo '
Chris@76 1974 ', $name, '
Chris@76 1975 ', (!empty($dir['type']) && $dir['type'] == 'dir_recursive') || !empty($dir['list_contents']) ? '</a>' : '', '
Chris@76 1976 </td>
Chris@76 1977 <td class="smalltext">
Chris@76 1978 <span class="', ($dir['perms']['chmod'] ? 'success' : 'error'), '">', ($dir['perms']['chmod'] ? $txt['package_file_perms_writable'] : $txt['package_file_perms_not_writable']), '</span>
Chris@76 1979 ', ($dir['perms']['perms'] ? '&nbsp;(' . $txt['package_file_perms_chmod'] . ': ' . substr(sprintf('%o', $dir['perms']['perms']), -4) . ')' : ''), '
Chris@76 1980 </td>
Chris@76 1981 <td align="center" width="8%" class="perm_read"><input type="radio" name="permStatus[', $ident . '/' . $name, ']" value="read" class="input_radio" /></td>
Chris@76 1982 <td align="center" width="8%" class="perm_write"><input type="radio" name="permStatus[', $ident . '/' . $name, ']" value="writable" class="input_radio" /></td>
Chris@76 1983 <td align="center" width="8%" class="perm_execute"><input type="radio" name="permStatus[', $ident . '/' . $name, ']" value="execute" class="input_radio" /></td>
Chris@76 1984 <td align="center" width="8%" class="perm_custom"><input type="radio" name="permStatus[', $ident . '/' . $name, ']" value="custom" class="input_radio" /></td>
Chris@76 1985 <td align="center" width="8%" class="perm_nochange"><input type="radio" name="permStatus[', $ident . '/' . $name, ']" value="no_change" checked="checked" class="input_radio" /></td>
Chris@76 1986 </tr>
Chris@76 1987 <tr id="insert_div_loc_' . $cur_ident . '" style="display: none;"><td></td></tr>';
Chris@76 1988
Chris@76 1989 if (!empty($dir['contents']))
Chris@76 1990 {
Chris@76 1991 template_permission_show_contents($ident . '/' . $name, $dir['contents'], $level + 1, !empty($dir['more_files']));
Chris@76 1992
Chris@76 1993 }
Chris@76 1994 }
Chris@76 1995 }
Chris@76 1996
Chris@76 1997 // We have more files to show?
Chris@76 1998 if ($has_more)
Chris@76 1999 echo '
Chris@76 2000 <tr class="windowbg" id="content_', $js_ident, '_more">
Chris@76 2001 <td class="smalltext" width="40%">' . str_repeat('&nbsp;', $level * 5), '
Chris@76 2002 &#171; <a href="' . $scripturl . '?action=admin;area=packages;sa=perms;find=' . base64_encode($ident) . ';fileoffset=', ($context['file_offset'] + $context['file_limit']), ';' . $context['session_var'] . '=' . $context['session_id'] . '#fol_' . preg_replace('~[^A-Za-z0-9_\-=:]~', ':-:', $ident) . '">', $txt['package_file_perms_more_files'], '</a> &#187;
Chris@76 2003 </td>
Chris@76 2004 <td colspan="6"></td>
Chris@76 2005 </tr>';
Chris@76 2006
Chris@76 2007 if ($drawn_div)
Chris@76 2008 {
Chris@76 2009 // Hide anything too far down the tree.
Chris@76 2010 $isFound = false;
Chris@76 2011 foreach ($context['look_for'] as $tree)
Chris@76 2012 {
Chris@76 2013 if (substr($tree, 0, strlen($ident)) == $ident)
Chris@76 2014 $isFound = true;
Chris@76 2015 }
Chris@76 2016
Chris@76 2017 if ($level > 1 && !$isFound)
Chris@76 2018 echo '
Chris@76 2019 </table><script type="text/javascript"><!-- // --><![CDATA[
Chris@76 2020 expandFolder(\'', $js_ident, '\', \'\');
Chris@76 2021 // ]]></script>
Chris@76 2022 <table border="0" width="100%" class="table_grid">
Chris@76 2023 <tr style="display: none;"><td></td></tr>';
Chris@76 2024 }
Chris@76 2025 }
Chris@76 2026
Chris@76 2027 function template_action_permissions()
Chris@76 2028 {
Chris@76 2029 global $txt, $scripturl, $context, $settings;
Chris@76 2030
Chris@76 2031 $countDown = 3;
Chris@76 2032
Chris@76 2033 echo '
Chris@76 2034 <div id="admincenter">
Chris@76 2035 <form action="', $scripturl, '?action=admin;area=packages;sa=perms;', $context['session_var'], '=', $context['session_id'], '" id="perm_submit" method="post" accept-charset="', $context['character_set'], '">
Chris@76 2036 <div class="cat_bar">
Chris@76 2037 <h3 class="catbg">', $txt['package_file_perms_applying'], '</h3>
Chris@76 2038 </div>';
Chris@76 2039
Chris@76 2040 if (!empty($context['skip_ftp']))
Chris@76 2041 echo '
Chris@76 2042 <div class="errorbox">
Chris@76 2043 ', $txt['package_file_perms_skipping_ftp'], '
Chris@76 2044 </div>';
Chris@76 2045
Chris@76 2046 // How many have we done?
Chris@76 2047 $remaining_items = count($context['method'] == 'individual' ? $context['to_process'] : $context['directory_list']);
Chris@76 2048 $progress_message = sprintf($context['method'] == 'individual' ? $txt['package_file_perms_items_done'] : $txt['package_file_perms_dirs_done'], $context['total_items'] - $remaining_items, $context['total_items']);
Chris@76 2049 $progress_percent = round(($context['total_items'] - $remaining_items) / $context['total_items'] * 100, 1);
Chris@76 2050
Chris@76 2051 echo '
Chris@76 2052 <div class="windowbg">
Chris@76 2053 <span class="topslice"><span></span></span>
Chris@76 2054 <div class="content">
Chris@76 2055 <div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
Chris@76 2056 <strong>', $progress_message, '</strong>
Chris@76 2057 <div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
Chris@76 2058 <div style="padding-top: ', $context['browser']['is_webkit'] || $context['browser']['is_konqueror'] ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $progress_percent, '%</div>
Chris@76 2059 <div style="width: ', $progress_percent, '%; height: 12pt; z-index: 1; background-color: #98b8f4;">&nbsp;</div>
Chris@76 2060 </div>
Chris@76 2061 </div>';
Chris@76 2062
Chris@76 2063 // Second progress bar for a specific directory?
Chris@76 2064 if ($context['method'] != 'individual' && !empty($context['total_files']))
Chris@76 2065 {
Chris@76 2066 $file_progress_message = sprintf($txt['package_file_perms_files_done'], $context['file_offset'], $context['total_files']);
Chris@76 2067 $file_progress_percent = round($context['file_offset'] / $context['total_files'] * 100, 1);
Chris@76 2068
Chris@76 2069 echo '
Chris@76 2070 <br />
Chris@76 2071 <div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
Chris@76 2072 <strong>', $file_progress_message, '</strong>
Chris@76 2073 <div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
Chris@76 2074 <div style="padding-top: ', $context['browser']['is_webkit'] || $context['browser']['is_konqueror'] ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $file_progress_percent, '%</div>
Chris@76 2075 <div style="width: ', $file_progress_percent, '%; height: 12pt; z-index: 1; background-color: #c1ffc1;">&nbsp;</div>
Chris@76 2076 </div>
Chris@76 2077 </div>';
Chris@76 2078 }
Chris@76 2079
Chris@76 2080 echo '
Chris@76 2081 <br />';
Chris@76 2082
Chris@76 2083 // Put out the right hidden data.
Chris@76 2084 if ($context['method'] == 'individual')
Chris@76 2085 echo '
Chris@76 2086 <input type="hidden" name="custom_value" value="', $context['custom_value'], '" />
Chris@76 2087 <input type="hidden" name="totalItems" value="', $context['total_items'], '" />
Chris@76 2088 <input type="hidden" name="toProcess" value="', base64_encode(serialize($context['to_process'])), '" />';
Chris@76 2089 else
Chris@76 2090 echo '
Chris@76 2091 <input type="hidden" name="predefined" value="', $context['predefined_type'], '" />
Chris@76 2092 <input type="hidden" name="fileOffset" value="', $context['file_offset'], '" />
Chris@76 2093 <input type="hidden" name="totalItems" value="', $context['total_items'], '" />
Chris@76 2094 <input type="hidden" name="dirList" value="', base64_encode(serialize($context['directory_list'])), '" />
Chris@76 2095 <input type="hidden" name="specialFiles" value="', base64_encode(serialize($context['special_files'])), '" />';
Chris@76 2096
Chris@76 2097 // Are we not using FTP for whatever reason.
Chris@76 2098 if (!empty($context['skip_ftp']))
Chris@76 2099 echo '
Chris@76 2100 <input type="hidden" name="skip_ftp" value="1" />';
Chris@76 2101
Chris@76 2102 // Retain state.
Chris@76 2103 foreach ($context['back_look_data'] as $path)
Chris@76 2104 echo '
Chris@76 2105 <input type="hidden" name="back_look[]" value="', $path, '" />';
Chris@76 2106
Chris@76 2107 echo '
Chris@76 2108 <input type="hidden" name="method" value="', $context['method'], '" />
Chris@76 2109 <input type="hidden" name="action_changes" value="1" />
Chris@76 2110 <div class="righttext padding">
Chris@76 2111 <input type="submit" name="go" id="cont" value="', $txt['not_done_continue'], '" class="button_submit" />
Chris@76 2112 </div>
Chris@76 2113 </div>
Chris@76 2114 <span class="botslice"><span></span></span>
Chris@76 2115 </div>
Chris@76 2116 </form>
Chris@76 2117 </div>
Chris@76 2118 <br class="clear" />';
Chris@76 2119
Chris@76 2120 // Just the countdown stuff
Chris@76 2121 echo '
Chris@76 2122 <script type="text/javascript"><!-- // --><![CDATA[
Chris@76 2123 var countdown = ', $countDown, ';
Chris@76 2124 doAutoSubmit();
Chris@76 2125
Chris@76 2126 function doAutoSubmit()
Chris@76 2127 {
Chris@76 2128 if (countdown == 0)
Chris@76 2129 document.forms.perm_submit.submit();
Chris@76 2130 else if (countdown == -1)
Chris@76 2131 return;
Chris@76 2132
Chris@76 2133 document.getElementById(\'cont\').value = "', $txt['not_done_continue'], ' (" + countdown + ")";
Chris@76 2134 countdown--;
Chris@76 2135
Chris@76 2136 setTimeout("doAutoSubmit();", 1000);
Chris@76 2137 }
Chris@76 2138 // ]]></script>';
Chris@76 2139
Chris@76 2140 }
Chris@76 2141
Chris@76 2142 ?>