1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 821: 822: 823: 824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837: 838: 839: 840: 841: 842: 843: 844: 845: 846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858: 859: 860: 861: 862: 863: 864: 865: 866: 867: 868: 869: 870: 871: 872: 873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884: 885: 886: 887: 888: 889: 890: 891: 892: 893: 894: 895: 896: 897: 898: 899: 900: 901: 902: 903: 904: 905: 906: 907: 908: 909: 910: 911: 912: 913: 914: 915: 916: 917: 918: 919: 920: 921: 922: 923: 924: 925: 926: 927: 928: 929: 930: 931: 932: 933: 934: 935: 936: 937: 938: 939:
<?php
function template_permission_index()
{
global $context, $settings, $scripturl, $txt, $modSettings;
if (!$context['can_modify'])
echo '
<div class="errorbox">
', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
</div>';
echo '
<div id="admin_form_wrapper">
<form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" id="permissionForm">';
if (!empty($context['profile']))
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_for_profile'], ': "', $context['profile']['name'], '"</h3>
</div>';
else
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_title'], '</h3>
</div>';
echo '
<table class="table_grid">
<thead>
<tr class="title_bar">
<th>', $txt['membergroups_name'], '</th>
<th class="small_table">', $txt['membergroups_members_top'], '</th>';
if (empty($modSettings['permission_enable_deny']))
echo '
<th class="small_table">', $txt['membergroups_permissions'], '</th>';
else
echo '
<th class="small_table">', $txt['permissions_allowed'], '</th>
<th class="small_table">', $txt['permissions_denied'], '</th>';
echo '
<th class="small_table">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th>
<th class="table_icon centercol">
', $context['can_modify'] ? '<input type="checkbox" onclick="invertAll(this, this.form, \'group\');">' : '', '
</th>
</tr>
</thead>
<tbody>';
foreach ($context['groups'] as $group)
{
echo '
<tr class="windowbg">
<td>
', !empty($group['help']) ? ' <a class="help" href="' . $scripturl . '?action=helpadmin;help=' . $group['help'] . '" onclick="return reqOverlayDiv(this.href);"><span class="main_icons help" title="' . $txt['help'] . '"></span></a> ' : '<img class="icon" src="' . $settings['images_url'] . '/blank.png" alt="' . $txt['help'] . '">', '<span>', $group['name'], '</span>';
if (!empty($group['children']))
echo '
<br>
<span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>';
echo '
</td>
<td>', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>';
if (empty($modSettings['permission_enable_deny']))
echo '
<td>', $group['num_permissions']['allowed'], '</td>';
else
echo '
<td ', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>
', $group['num_permissions']['allowed'], '
</td>
<td ', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' class="red"' : ''), '>
', $group['num_permissions']['denied'], '
</td>';
echo '
<td>
', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '
</td>
<td class="centercol">
', $group['allow_modify'] && $context['can_modify'] ? '<input type="checkbox" name="group[]" value="' . $group['id'] . '">' : '', '
</td>
</tr>';
}
echo '
</tbody>
</table>
<br>';
if ($context['can_modify'])
{
echo '
<div class="cat_bar">
<h3 class="catbg">
<span id="permissions_panel_toggle" class="', empty($context['show_advanced_options']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
<a href="#" id="permissions_panel_link">', $txt['permissions_advanced_options'], '</a>
</h3>
</div>
<div id="permissions_panel_advanced" class="windowbg">
<fieldset>
<legend>', $txt['permissions_with_selection'], '</legend>
<dl class="settings">
<dt>
<a class="help" href="', $scripturl, '?action=helpadmin;help=permissions_quickgroups" onclick="return reqOverlayDiv(this.href);"><span class="main_icons help" title="', $txt['help'], '"></span></a>
', $txt['permissions_apply_pre_defined'], ':
</dt>
<dd>
<select name="predefined">
<option value="">(', $txt['permissions_select_pre_defined'], ')</option>
<option value="restrict">', $txt['permitgroups_restrict'], '</option>
<option value="standard">', $txt['permitgroups_standard'], '</option>
<option value="moderator">', $txt['permitgroups_moderator'], '</option>
<option value="maintenance">', $txt['permitgroups_maintenance'], '</option>
</select>
</dd>
<dt>
', $txt['permissions_like_group'], ':
</dt>
<dd>
<select name="copy_from">
<option value="empty">(', $txt['permissions_select_membergroup'], ')</option>';
foreach ($context['groups'] as $group)
if ($group['id'] != 1)
echo '
<option value="', $group['id'], '">', $group['name'], '</option>';
echo '
</select>
</dd>
<dt>
<select name="add_remove">
<option value="add">', $txt['permissions_add'], '...</option>
<option value="clear">', $txt['permissions_remove'], '...</option>';
if (!empty($modSettings['permission_enable_deny']))
echo '
<option value="deny">', $txt['permissions_deny'], '...</option>';
echo '
</select>
</dt>
<dd style="overflow:auto;">
<select name="permissions">
<option value="">(', $txt['permissions_select_permission'], ')</option>';
foreach ($context['permissions'] as $permissionType)
{
if ($permissionType['id'] == 'membergroup' && !empty($context['profile']))
continue;
foreach ($permissionType['columns'] as $column)
{
foreach ($column as $permissionGroup)
{
if ($permissionGroup['hidden'])
continue;
echo '
<option value="" disabled>[', $permissionGroup['name'], ']</option>';
foreach ($permissionGroup['permissions'] as $perm)
{
if ($perm['hidden'])
continue;
if ($perm['has_own_any'])
echo '
<option value="', $permissionType['id'], '/', $perm['own']['id'], '"> ', $perm['name'], ' (', $perm['own']['name'], ')</option>
<option value="', $permissionType['id'], '/', $perm['any']['id'], '"> ', $perm['name'], ' (', $perm['any']['name'], ')</option>';
else
echo '
<option value="', $permissionType['id'], '/', $perm['id'], '"> ', $perm['name'], '</option>';
}
}
}
}
echo '
</select>
</dd>
</dl>
</fieldset>
<input type="submit" value="', $txt['permissions_set_permissions'], '" onclick="return checkSubmit();" class="button">
</div><!-- #permissions_panel_advanced -->';
echo '
<script>
var oPermissionsPanelToggle = new smc_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: ', empty($context['show_advanced_options']) ? 'true' : 'false', ',
aSwappableContainers: [
\'permissions_panel_advanced\'
],
aSwapImages: [
{
sId: \'permissions_panel_toggle\',
altExpanded: ', JavaScriptEscape($txt['hide']), ',
altCollapsed: ', JavaScriptEscape($txt['show']), '
}
],
aSwapLinks: [
{
sId: \'permissions_panel_link\',
msgExpanded: ', JavaScriptEscape($txt['permissions_advanced_options']), ',
msgCollapsed: ', JavaScriptEscape($txt['permissions_advanced_options']), '
}
],
oThemeOptions: {
bUseThemeSettings: true,
sOptionName: \'admin_preferences\',
sSessionVar: smf_session_var,
sSessionId: smf_session_id,
sThemeId: \'1\',
sAdditionalVars: \';admin_key=app\'
}
});
function checkSubmit()
{
if ((document.forms.permissionForm.predefined.value != "" && (document.forms.permissionForm.copy_from.value != "empty" || document.forms.permissionForm.permissions.value != "")) || (document.forms.permissionForm.copy_from.value != "empty" && document.forms.permissionForm.permissions.value != ""))
{
alert("', $txt['permissions_only_one_option'], '");
return false;
}
if (document.forms.permissionForm.predefined.value == "" && document.forms.permissionForm.copy_from.value == "" && document.forms.permissionForm.permissions.value == "")
{
alert("', $txt['permissions_no_action'], '");
return false;
}
if (document.forms.permissionForm.permissions.value != "" && document.forms.permissionForm.add_remove.value == "deny")
return confirm("', $txt['permissions_deny_dangerous'], '");
return true;
}
</script>';
if (!empty($context['profile']))
echo '
<input type="hidden" name="pid" value="', $context['profile']['id'], '">';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="', $context['admin-mpq_token_var'], '" value="', $context['admin-mpq_token'], '">';
}
echo '
</form>
</div><!-- #admin_form_wrapper -->';
}
function template_by_board()
{
global $context, $scripturl, $txt;
echo '
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=permissions;sa=board" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_boards'], '</h3>
</div>
<div class="information">
', $txt['permissions_boards_desc'], '
</div>
<div class="cat_bar">
<h3 id="board_permissions" class="catbg flow_hidden">
<span class="perm_name floatleft">', $txt['board_name'], '</span>
<span class="perm_profile floatleft">', $txt['permission_profile'], '</span>';
echo '
</h3>
</div>
<div class="windowbg">';
foreach ($context['categories'] as $category)
{
echo '
<div class="sub_bar">
<h3 class="subbg">', $category['name'], '</h3>
</div>';
if (!empty($category['boards']))
echo '
<ul class="perm_boards flow_hidden">';
foreach ($category['boards'] as $board)
{
echo '
<li class="flow_hidden">
<span class="perm_board floatleft">
<a href="', $scripturl, '?action=admin;area=manageboards;sa=board;boardid=', $board['id'], ';rid=permissions;', $context['session_var'], '=', $context['session_id'], '">', str_repeat('-', $board['child_level']), ' ', $board['name'], '</a>
</span>
<span class="perm_boardprofile floatleft">';
if ($context['edit_all'])
{
echo '
<select name="boardprofile[', $board['id'], ']">';
foreach ($context['profiles'] as $id => $profile)
echo '
<option value="', $id, '"', $id == $board['profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
echo '
</select>';
}
else
echo '
<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $board['profile'], ';', $context['session_var'], '=', $context['session_id'], '">', $board['profile_name'], '</a>';
echo '
</span>
</li>';
}
if (!empty($category['boards']))
echo '
</ul>';
}
if ($context['edit_all'])
echo '
<input type="submit" name="save_changes" value="', $txt['save'], '" class="button">';
else
echo '
<a class="button" href="', $scripturl, '?action=admin;area=permissions;sa=board;edit;', $context['session_var'], '=', $context['session_id'], '">', $txt['permissions_board_all'], '</a>';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="', $context['admin-mpb_token_var'], '" value="', $context['admin-mpb_token'], '">
</div><!-- .windowbg -->
</form>';
}
function template_edit_profiles()
{
global $context, $scripturl, $txt;
echo '
<div id="admin_form_wrapper">
<form action="', $scripturl, '?action=admin;area=permissions;sa=profiles" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_profile_edit'], '</h3>
</div>
<table class="table_grid">
<thead>
<tr class="title_bar">
<th>', $txt['permissions_profile_name'], '</th>
<th>', $txt['permissions_profile_used_by'], '</th>
<th class="table_icon"', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '>', $txt['delete'], '</th>
</tr>
</thead>
<tbody>';
foreach ($context['profiles'] as $profile)
{
echo '
<tr class="windowbg">
<td>';
if (!empty($context['show_rename_boxes']) && $profile['can_edit'])
echo '
<input type="text" name="rename_profile[', $profile['id'], ']" value="', $profile['name'], '">';
else
echo '
<a href="', $scripturl, '?action=admin;area=permissions;sa=index;pid=', $profile['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $profile['name'], '</a>';
echo '
</td>
<td>
', !empty($profile['boards_text']) ? $profile['boards_text'] : $txt['permissions_profile_used_by_none'], '
</td>
<td', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '>
<input type="checkbox" name="delete_profile[]" value="', $profile['id'], '" ', $profile['can_delete'] ? '' : 'disabled', '>
</td>
</tr>';
}
echo '
</tbody>
</table>
<div class="flow_auto righttext padding">
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">';
if ($context['can_edit_something'])
echo '
<input type="submit" name="rename" value="', empty($context['show_rename_boxes']) ? $txt['permissions_profile_rename'] : $txt['permissions_commit'], '" class="button">';
echo '
<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" class="button" ', !empty($context['show_rename_boxes']) ? ' style="display:none"' : '', '>
</div>
</form>
<br>
<form action="', $scripturl, '?action=admin;area=permissions;sa=profiles" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_profile_new'], '</h3>
</div>
<div class="windowbg">
<dl class="settings">
<dt>
<strong>', $txt['permissions_profile_name'], ':</strong>
</dt>
<dd>
<input type="text" name="profile_name" value="">
</dd>
<dt>
<strong>', $txt['permissions_profile_copy_from'], ':</strong>
</dt>
<dd>
<select name="copy_from">';
foreach ($context['profiles'] as $id => $profile)
echo '
<option value="', $id, '">', $profile['name'], '</option>';
echo '
</select>
</dd>
</dl>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="', $context['admin-mpp_token_var'], '" value="', $context['admin-mpp_token'], '">
<input type="submit" name="create" value="', $txt['permissions_profile_new_create'], '" class="button">
</div><!-- .windowbg -->
</form>
</div><!-- #admin_form_wrapper -->';
}
function template_modify_group()
{
global $context, $scripturl, $txt, $modSettings;
if (!$context['profile']['can_modify'])
echo '
<div class="errorbox">
', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
</div>';
else
echo '
<script>
window.smf_usedDeny = false;
function warnAboutDeny()
{
if (window.smf_usedDeny)
return confirm("', $txt['permissions_deny_dangerous'], '");
else
return true;
}
</script>';
echo '
<form id="permissions" action="', $scripturl, '?action=admin;area=permissions;sa=modify2;group=', $context['group']['id'], ';pid=', $context['profile']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="permissionForm" onsubmit="return warnAboutDeny();">';
if (!empty($modSettings['permission_enable_deny']) && $context['group']['id'] != -1)
echo '
<div class="noticebox">
', $txt['permissions_option_desc'], '
</div>';
echo '
<div class="cat_bar">
<h3 class="catbg">';
if ($context['permission_type'] == 'board')
echo '
', $txt['permissions_local_for'], ' "', $context['group']['name'], '" ', $txt['permissions_on'], ' "', $context['profile']['name'], '"';
else
echo '
', $context['permission_type'] == 'membergroup' ? $txt['permissions_general'] : $txt['permissions_board'], ' - "', $context['group']['name'], '"';
echo '
</h3>
</div>';
template_modify_group_display($context['permission_type']);
if ($context['permission_type'] == 'membergroup')
{
echo '
<br>
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_board'], '</h3>
</div>
<div class="information">
', $txt['permissions_board_desc'], '
</div>';
template_modify_group_display('board');
}
if ($context['profile']['can_modify'])
echo '
<div class="padding">
<input type="submit" value="', $txt['permissions_commit'], '" class="button">
</div>';
foreach ($context['hidden_perms'] as $hidden_perm)
echo '
<input type="hidden" name="perm[', $hidden_perm[0], '][', $hidden_perm[1], ']" value="', $hidden_perm[2], '">';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">
</form>';
}
function template_modify_group_display($type)
{
global $context, $scripturl, $txt, $modSettings;
$permission_type = &$context['permissions'][$type];
$disable_field = $context['profile']['can_modify'] ? '' : 'disabled ';
foreach ($permission_type['columns'] as $column)
{
echo '
<table class="table_grid half_content">';
foreach ($column as $permissionGroup)
{
if (empty($permissionGroup['permissions']))
continue;
$has_display_content = false;
if (!$permissionGroup['hidden'])
{
foreach ($permissionGroup['permissions'] as $permission)
if (!$permission['hidden'])
$has_display_content = true;
if ($has_display_content)
{
echo '
<tr class="title_bar">
<th></th>
<th', $context['group']['id'] == -1 ? ' colspan="2"' : '', ' class="smalltext">', $permissionGroup['name'], '</th>';
if ($context['group']['id'] != -1)
echo '
<th>', $txt['permissions_option_own'], '</th>
<th>', $txt['permissions_option_any'], '</th>';
echo '
</tr>';
}
}
foreach ($permissionGroup['permissions'] as $permission)
{
if (!$permission['hidden'] && !$permissionGroup['hidden'])
{
echo '
<tr class="windowbg">
<td>
', $permission['show_help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=permissionhelp_' . $permission['id'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="main_icons help" title="' . $txt['help'] . '"></span></a>' : '', '
</td>
<td class="lefttext full_width">
', $permission['name'], (!empty($permission['note']) ? '<br>
<strong class="smalltext">' . $permission['note'] . '</strong>' : ''), '
</td>
<td>';
if ($permission['has_own_any'])
{
if ($context['group']['id'] != -1)
{
if (empty($modSettings['permission_enable_deny']))
echo '
<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']"', $permission['own']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" id="', $permission['own']['id'], '_on" ', $disable_field, '>';
else
{
echo '
<select name="perm[', $permission_type['id'], '][', $permission['own']['id'], ']" ', $disable_field, '>';
foreach (array('on', 'off', 'deny') as $c)
echo '
<option ', $permission['own']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
echo '
</select>';
}
echo '
</td>
<td>';
}
if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
echo '
<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']"', $permission['any']['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>';
else
{
echo '
<select name="perm[', $permission_type['id'], '][', $permission['any']['id'], ']" ', $disable_field, '>';
foreach (array('on', 'off', 'deny') as $c)
echo '
<option ', $permission['any']['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
echo '
</select>';
}
}
else
{
if ($context['group']['id'] != -1)
echo '
</td>
<td>';
if (empty($modSettings['permission_enable_deny']) || $context['group']['id'] == -1)
echo '
<input type="checkbox" name="perm[', $permission_type['id'], '][', $permission['id'], ']"', $permission['select'] == 'on' ? ' checked="checked"' : '', ' value="on" ', $disable_field, '>';
else
{
echo '
<select name="perm[', $permission_type['id'], '][', $permission['id'], ']" ', $disable_field, '>';
foreach (array('on', 'off', 'deny') as $c)
echo '
<option ', $permission['select'] == $c ? ' selected' : '', ' value="', $c, '">', $txt['permissions_option_' . $c], '</option>';
echo '
</select>';
}
}
echo '
</td>
</tr>';
}
}
}
echo '
</table>';
}
echo '
<br class="clear">';
}
function template_inline_permissions()
{
global $context, $txt, $modSettings;
echo '
<fieldset id="', $context['current_permission'], '">
<legend><a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'none\';document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'block\'; return false;" class="toggle_up"> ', $txt['avatar_select_permission'], '</a></legend>';
if (empty($modSettings['permission_enable_deny']))
echo '
<ul>';
else
echo '
<div class="information">', $txt['permissions_option_desc'], '</div>
<dl class="settings">
<dt>
<span class="perms"><strong>', $txt['permissions_option_on'], '</strong></span>
<span class="perms"><strong>', $txt['permissions_option_off'], '</strong></span>
<span class="perms red"><strong>', $txt['permissions_option_deny'], '</strong></span>
</dt>
<dd>
</dd>';
foreach ($context['member_groups'] as $group)
{
if (!empty($modSettings['permission_enable_deny']))
echo '
<dt>';
else
echo '
<li>';
if (empty($modSettings['permission_enable_deny']))
echo '
<input type="checkbox" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '>';
else
echo '
<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="on"', $group['status'] == 'on' ? ' checked' : '', '></span>
<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="off"', $group['status'] == 'off' ? ' checked' : '', '></span>
<span class="perms"><input type="radio" name="', $context['current_permission'], '[', $group['id'], ']" value="deny"', $group['status'] == 'deny' ? ' checked' : '', '></span>';
if (!empty($modSettings['permission_enable_deny']))
echo '
</dt>
<dd>
<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
</dd>';
else
echo '
<span', $group['is_postgroup'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</span>
</li>';
}
if (empty($modSettings['permission_enable_deny']))
echo '
<li>
<input type="checkbox" onclick="invertAll(this, this.form, \'' . $context['current_permission'] . '[\');">
<span>', $txt['check_all'], '</span>
</li>
</ul>';
else
echo '
</dl>';
echo '
</fieldset>
<a href="javascript:void(0);" onclick="document.getElementById(\'', $context['current_permission'], '\').style.display = \'block\'; document.getElementById(\'', $context['current_permission'], '_groups_link\').style.display = \'none\'; return false;" id="', $context['current_permission'], '_groups_link" style="display: none;" class="toggle_down"> ', $txt['avatar_select_permission'], '</a>
<script>
document.getElementById("', $context['current_permission'], '").style.display = "none";
document.getElementById("', $context['current_permission'], '_groups_link").style.display = "";
</script>';
}
function template_postmod_permissions()
{
global $context, $scripturl, $txt, $modSettings;
echo '
<div id="admin_form_wrapper">
<form action="', $scripturl, '?action=admin;area=permissions;sa=postmod;', $context['session_var'], '=', $context['session_id'], '" method="post" name="postmodForm" id="postmodForm" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['permissions_post_moderation'], '</h3>
</div>';
echo '
<div class="windowbg">
<dl class="settings">
<dt>', $txt['permissions_post_moderation_enable'], '</dt>
<dd><input type="checkbox" name="postmod_active"', !empty($modSettings['postmod_active']) ? ' checked' : '', '></dd>
</dl>
</div>';
if (!empty($modSettings['postmod_active']))
{
if (!empty($modSettings['permission_enable_deny']))
echo '
<div class="information">', $txt['permissions_post_moderation_deny_note'], '</div>';
echo '
<div class="padding">
<ul class="floatleft smalltext block">
<strong>', $txt['permissions_post_moderation_legend'], ':</strong>
<li><span class="main_icons post_moderation_allow"></span>', $txt['permissions_post_moderation_allow'], '</li>
<li><span class="main_icons post_moderation_moderate"></span>', $txt['permissions_post_moderation_moderate'], '</li>
<li><span class="main_icons post_moderation_deny"></span>', $txt['permissions_post_moderation_disallow'], '</li>
</ul>
<p class="righttext floatright block">
<br><br><br>
', $txt['permissions_post_moderation_select'], ':
<select name="pid" onchange="document.forms.postmodForm.submit();">';
foreach ($context['profiles'] as $profile)
if ($profile['can_modify'])
echo '
<option value="', $profile['id'], '"', $profile['id'] == $context['current_profile'] ? ' selected' : '', '>', $profile['name'], '</option>';
echo '
</select>
<input type="submit" value="', $txt['go'], '" class="button">
</p>
</div><!-- .padding -->
<table class="table_grid" id="postmod">
<thead>
<tr class="title_bar">
<th></th>
<th class="centercol" colspan="3">
', $txt['permissions_post_moderation_new_topics'], '
</th>
<th class="centercol" colspan="3">
', $txt['permissions_post_moderation_replies_own'], '
</th>
<th class="centercol" colspan="3">
', $txt['permissions_post_moderation_replies_any'], '
</th>';
if ($modSettings['attachmentEnable'] == 1)
echo '
<th class="centercol" colspan="3">
', $txt['permissions_post_moderation_attachments'], '
</th>';
echo '
</tr>
<tr class="windowbg">
<th class="quarter_table">
', $txt['permissions_post_moderation_group'], '
</th>
<th><span class="main_icons post_moderation_allow"></span></th>
<th><span class="main_icons post_moderation_moderate"></span></th>
<th><span class="main_icons post_moderation_deny"></span></th>
<th><span class="main_icons post_moderation_allow"></span></th>
<th><span class="main_icons post_moderation_moderate"></span></th>
<th><span class="main_icons post_moderation_deny"></span></th>
<th><span class="main_icons post_moderation_allow"></span></th>
<th><span class="main_icons post_moderation_moderate"></span></th>
<th><span class="main_icons post_moderation_deny"></span></th>';
if ($modSettings['attachmentEnable'] == 1)
echo '
<th><span class="main_icons post_moderation_allow"></span></th>
<th><span class="main_icons post_moderation_moderate"></span></th>
<th><span class="main_icons post_moderation_deny"></span></th>';
echo '
</tr>
</thead>
<tbody>';
foreach ($context['profile_groups'] as $group)
{
echo '
<tr class="windowbg">
<td class="half_table">
<span ', ($group['color'] ? 'style="color: ' . $group['color'] . '"' : ''), '>', $group['name'], '</span>';
if (!empty($group['children']))
echo '
<br>
<span class="smalltext">', $txt['permissions_includes_inherited'], ': "', implode('", "', $group['children']), '"</span>';
echo '
</td>
<td class="centercol">
<input type="radio" name="new_topic[', $group['id'], ']" value="allow"', $group['new_topic'] == 'allow' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="new_topic[', $group['id'], ']" value="moderate"', $group['new_topic'] == 'moderate' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="new_topic[', $group['id'], ']" value="disallow"', $group['new_topic'] == 'disallow' ? ' checked' : '', '>
</td>';
if ($group['id'] == '-1')
echo '
<td colspan="3"></td>';
else
echo '
<td class="centercol">
<input type="radio" name="replies_own[', $group['id'], ']" value="allow"', $group['replies_own'] == 'allow' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="replies_own[', $group['id'], ']" value="moderate"', $group['replies_own'] == 'moderate' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="replies_own[', $group['id'], ']" value="disallow"', $group['replies_own'] == 'disallow' ? ' checked' : '', '>
</td>';
echo '
<td class="centercol">
<input type="radio" name="replies_any[', $group['id'], ']" value="allow"', $group['replies_any'] == 'allow' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="replies_any[', $group['id'], ']" value="moderate"', $group['replies_any'] == 'moderate' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="replies_any[', $group['id'], ']" value="disallow"', $group['replies_any'] == 'disallow' ? ' checked' : '', '>
</td>';
if ($modSettings['attachmentEnable'] == 1)
echo '
<td class="centercol">
<input type="radio" name="attachment[', $group['id'], ']" value="allow"', $group['attachment'] == 'allow' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="attachment[', $group['id'], ']" value="moderate"', $group['attachment'] == 'moderate' ? ' checked' : '', '>
</td>
<td class="centercol">
<input type="radio" name="attachment[', $group['id'], ']" value="disallow"', $group['attachment'] == 'disallow' ? ' checked' : '', '>
</td>';
echo '
</tr>';
}
echo '
</tbody>
</table>';
}
echo '
<input type="submit" name="save_changes" value="', $txt['permissions_commit'], '" class="button">
<input type="hidden" name="', $context['admin-mppm_token_var'], '" value="', $context['admin-mppm_token'], '">
</form>
</div><!-- #admin_form_wrapper -->';
}
?>