コード例 #1
0
ファイル: banlist.php プロジェクト: gitye/e107
 public function timesPage()
 {
     if (!getperms('0')) {
         return;
     }
     $pref = e107::getPref();
     $tp = e107::getParser();
     $frm = e107::getForm();
     $mes = e107::getMessage();
     $ipAdministrator = new banlistManager();
     $text = '';
     if (!isset($pref['ban_messages']) || !is_array($pref['ban_messages'])) {
         foreach ($ipAdministrator->getValidReasonList() as $bt) {
             $pref['ban_messages'][$bt] = '';
         }
     }
     if (!isset($pref['ban_durations']) || !is_array($pref['ban_durations'])) {
         foreach ($ipAdministrator->getValidReasonList() as $bt) {
             $pref['ban_durations'][$bt] = 0;
         }
     }
     $text .= "\n\t\t\t\t<form method='post' action='" . e_SELF . '?' . e_QUERY . "' id='ban_options'>\n\t\t\t\t\t<fieldset id='core-banlist-times'>\n\t\t\t\t\t\t<legend class='e-hideme'>" . BANLAN_77 . "</legend>\n\t\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t\t\t<col style='width: 65%' />\n\t\t\t\t\t\t\t\t<col style='width: 15%' />\n\t\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th>" . BANLAN_28 . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . BANLAN_29 . "<br />" . BANLAN_31 . "</th>\n\t\t\t\t\t\t\t\t\t<th class='center last'>" . BANLAN_30 . "</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>\n\t\t\t";
     foreach ($ipAdministrator->getValidReasonList() as $bt) {
         $i = abs($bt) + 1;
         // Forces a single-digit positive number
         $text .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<strong>" . $ipAdministrator->getBanTypeString($bt, FALSE) . "</strong>\n\t\t\t\t\t\t\t\t<div class='field-help'>" . $ipAdministrator->getBanTypeString($bt, TRUE) . "</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class='left'>\n\t\t\t\t\t\t\t\t" . $frm->textarea('ban_text_' . $i, $pref['ban_messages'][$bt], 4, 15) . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class='center'>" . ban_time_dropdown('', BANLAN_32, $pref['ban_durations'][$bt], 'ban_time_' . $i) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t";
     }
     $text .= "\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<div class='buttons-bar center'>\n\t\t\t\t\t\t\t" . $frm->admin_button('update_ban_prefs', LAN_UPDATE, 'update') . "\n\t\t\t\t\t\t\t<input type='hidden' name='e-token' value='" . e_TOKEN . "' />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\t\t\t\t";
     echo $mes->render() . $text;
 }
コード例 #2
0
ファイル: banlist.php プロジェクト: notzen/e107
         $row['banlist_reason'] = str_replace('LAN_LOGIN_18', BANLAN_11, $row['banlist_reason']);
         $text .= "<tr>";
         foreach ($col_defs[$action] as $cd => $fv) {
             $row_class = '';
             switch ($cd) {
                 case 'banlist_datestamp':
                     $val = $row['banlist_datestamp'] ? strftime($pref['ban_date_format'], $row['banlist_datestamp']) : BANLAN_22;
                     break;
                 case 'banlist_bantype':
                     $val = "<div class='nowrap' title='" . $ipAdministrator->getBanTypeString($row['banlist_bantype'], TRUE) . "'>" . $ipAdministrator->getBanTypeString($row['banlist_bantype'], FALSE) . " <a href='#' title='" . $ipAdministrator->getBanTypeString($row['banlist_bantype'], TRUE) . "' onclick='return false;'><img class='action info S16' src='" . e_IMAGE_ABS . "admin_images/info_16.png' alt='' /></a></div>";
                     break;
                 case 'ip_reason':
                     $val = e107::getIPHandler()->ipDecode($row['banlist_ip']) . "<br />" . $fv . ": " . $row['banlist_reason'];
                     break;
                 case 'banlist_banexpires':
                     $val = ($row['banlist_banexpires'] ? strftime($pref['ban_date_format'], $row['banlist_banexpires']) . ($row['banlist_banexpires'] < time() ? ' (' . BANLAN_34 . ')' : '') : LAN_NEVER) . "<br />" . ban_time_dropdown("onchange=\"e107Helper.urlJump('" . e_SELF . "?newtime-{$row['banlist_ip']}-'+this.value)\"");
                     break;
                 case 'ban_options':
                     $row_class = ' class="center"';
                     $val = "\n\t\t\t\t\t\t\t<a class='action edit' href='" . e_SELF . "?{$edit_action}-{$row['banlist_ip']}'>" . ADMIN_EDIT_ICON . "</a>\n<input class='action delete no-confirm' name='delete_ban_entry' value='" . e_SELF . "?{$del_action}-{$row['banlist_ip']}' type='image' src='" . ADMIN_DELETE_ICON_PATH . "' alt='" . LAN_DELETE . "' title='" . $tp->toJS(LAN_CONFIRMDEL . " [" . e107::getIPHandler()->ipDecode($row['banlist_ip']) . "]") . "' />";
                     break;
                 case 'banlist_notes':
                 default:
                     $val = $row[$cd];
             }
             $text .= "<td{$row_class}>{$val}</td>";
         }
         $text .= '</tr>';
     }
     $text .= "</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t(function () {\n\t\t\t\t\t\tvar del_sel = \$\$('input[name=delete_ban_entry]');\n\t\t\t\t\t\tdel_sel.each(function (element) {\n\t\t\t\t\t\t\tvar msg = element.readAttribute('title');\n\t\t\t\t\t\t\telement.writeAttribute('title', '" . LAN_DELETE . "').writeAttribute('confirm-msg', msg);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tdel_sel.invoke('observe', 'click', function (event) {\n\n\t\t\t\t\t\t\tvar element = event.element(), msg = element.readAttribute('confirm-msg');\n\t\t\t\t\t\t\tif(!e107Helper.confirm(msg)) { event.stop(); return; }\n\t\t\t\t\t\t\t\$('core-banlist-form').writeAttribute('action', element.value).submit();\n\t\t\t\t\t\t});\n\t\t\t\t\t}())\n\t\t\t\t\t</script>\n\t\t\t";
 }