Редакция 573 | Редакция 575 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 573 | Редакция 574 | ||
---|---|---|---|
Строка 1067... | Строка 1067... | ||
1067 | 1067 | ||
1068 | return $show; |
1068 | return $show; |
1069 | }
|
1069 | }
|
1070 | 1070 | ||
1071 | /**
|
1071 | /**
|
- | 1072 | * Вывод списка протоколов
|
|
- | 1073 | *
|
|
- | 1074 | * @author Alexander Wolf
|
|
- | 1075 | * @category Core
|
|
- | 1076 | *
|
|
- | 1077 | * @param string $name
|
|
- | 1078 | * @param string $actor
|
|
- | 1079 | * @param string $format
|
|
- | 1080 | * @return string
|
|
- | 1081 | */
|
|
- | 1082 | public function showProtoList($name, $actor, $format = 'list') { |
|
- | 1083 | switch($format) { |
|
- | 1084 | case 'list': |
|
- | 1085 | $query = "SELECT * FROM ".$this->prefix."protos"; |
|
- | 1086 | $rq =& $this->db->query($query); |
|
- | 1087 | $show = "<ul>\n"; |
|
- | 1088 | while ($rq->fetchInto($element)) { |
|
- | 1089 | $show .= "<li>[<a href='".$actor."?mode=".$name."&action=edit&uuid=".$element["proto_id"]."' class='edit'>править</a>][<a href='".$actor."?mode=".$name."&action=delete&uuid=".$element["proto_id"]."' class='delete'>удалить</a>] ".$this->secure->checkStr($element["proto"],1)."</li>\n"; |
|
- | 1090 | }
|
|
- | 1091 | $show .= "</ul>"; |
|
- | 1092 | break; |
|
- | 1093 | case 'innerhtml': |
|
- | 1094 | $protoID = $this->secure->checkInt($actor); |
|
- | 1095 | $query = "SELECT * FROM ".$this->prefix."protos"; |
|
- | 1096 | $rq =& $this->db->query($query); |
|
- | 1097 | $show = "<select name='".$name."' id='".$name."'>\n"; |
|
- | 1098 | while ($rq->fetchInto($element)) { |
|
- | 1099 | if ($element["proto_id"]==$protoID) { |
|
- | 1100 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."' selected>".$this->secure->checkStr($element["proto"],1)."</option>\n"; |
|
- | 1101 | } else { |
|
- | 1102 | $show .= "<option value='".$this->secure->checkInt($element["proto_id"])."'>".$this->secure->checkStr($element["scheme"],1)."</option>\n"; |
|
- | 1103 | }
|
|
- | 1104 | }
|
|
- | 1105 | $show .= "</select>"; |
|
- | 1106 | break; |
|
- | 1107 | }
|
|
- | 1108 | return $show; |
|
- | 1109 | }
|
|
- | 1110 | ||
- | 1111 | /**
|
|
- | 1112 | * Добавление нового протокола
|
|
- | 1113 | *
|
|
- | 1114 | * @author Alexander Wolf
|
|
- | 1115 | * @category Core
|
|
- | 1116 | *
|
|
- | 1117 | * @param string $proto
|
|
- | 1118 | * @return array
|
|
- | 1119 | */
|
|
- | 1120 | public function addProto($proto) { |
|
- | 1121 | $result = array(); |
|
- | 1122 | $sProto = $this->secure->checkStr($proto,1); |
|
- | 1123 | ||
- | 1124 | $query = "INSERT INTO ".$this->prefix."protos SET proto='".$sProto."'"; |
|
- | 1125 | $rq =& $this->db->query($query); |
|
- | 1126 | if (PEAR::isError($this->db)) { |
|
- | 1127 | $result["ERR"] = 1; |
|
- | 1128 | $result["ERRINFO"] = $this->db->getMessage(); |
|
- | 1129 | } else { |
|
- | 1130 | $result["ERR"] = 0; |
|
- | 1131 | }
|
|
- | 1132 | ||
- | 1133 | return $result; |
|
- | 1134 | }
|
|
- | 1135 | ||
- | 1136 | /**
|
|
- | 1137 | * Удаление информации о протоколе
|
|
- | 1138 | *
|
|
- | 1139 | * @author Alexander Wolf
|
|
- | 1140 | * @category Core
|
|
- | 1141 | *
|
|
- | 1142 | * @param integer $protoID
|
|
- | 1143 | * @return array
|
|
- | 1144 | */
|
|
- | 1145 | public function dropProto($protoID) { |
|
- | 1146 | $result = array(); |
|
- | 1147 | $sProtoID = $this->secure->checkInt($protoID); |
|
- | 1148 | ||
- | 1149 | // Удаление протокола
|
|
- | 1150 | $query = "DELETE FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
|
- | 1151 | $rq =& $this->db->query($query); |
|
- | 1152 | if (PEAR::isError($this->db)) { |
|
- | 1153 | $result["ERR"] = 1; |
|
- | 1154 | $result["ERRINFO"] = $this->db->getMessage(); |
|
- | 1155 | } else { |
|
- | 1156 | $result["ERR"] = 0; |
|
- | 1157 | }
|
|
- | 1158 | ||
- | 1159 | return $result; |
|
- | 1160 | }
|
|
- | 1161 | ||
- | 1162 | /**
|
|
- | 1163 | * Обновление информации о протоколе
|
|
- | 1164 | *
|
|
- | 1165 | * @author Alexander Wolf
|
|
- | 1166 | * @category Core
|
|
- | 1167 | *
|
|
- | 1168 | * @param integer $protoID
|
|
- | 1169 | * @param string $info
|
|
- | 1170 | * @return array
|
|
- | 1171 | */
|
|
- | 1172 | public function updateProto($protoID, $info) { |
|
- | 1173 | $result = array(); |
|
- | 1174 | $sProtoID = $this->secure->checkInt($protoID); |
|
- | 1175 | $sProto = $this->secure->checkStr($proto,1); |
|
- | 1176 | ||
- | 1177 | $query = "UPDATE ".$this->prefix."protos SET proto='".$sProto."' WHERE proto_id='".$sProtoID."'"; |
|
- | 1178 | $rq =& $this->db->query($query); |
|
- | 1179 | if (PEAR::isError($this->db)) { |
|
- | 1180 | $result["ERR"] = 1; |
|
- | 1181 | $result["ERRINFO"] = $this->db->getMessage(); |
|
- | 1182 | } else { |
|
- | 1183 | $result["ERR"] = 0; |
|
- | 1184 | }
|
|
- | 1185 | ||
- | 1186 | return $result; |
|
- | 1187 | }
|
|
- | 1188 | ||
- | 1189 | /**
|
|
- | 1190 | * Вывод формы редактирования/добавления протоколов
|
|
- | 1191 | *
|
|
- | 1192 | * @author Alexander Wolf
|
|
- | 1193 | * @category Core
|
|
- | 1194 | *
|
|
- | 1195 | * @param integer $protoID
|
|
- | 1196 | * @param string $info
|
|
- | 1197 | * @return string
|
|
- | 1198 | */
|
|
- | 1199 | public function showProtoForm($protoID = 0, $info = "") { |
|
- | 1200 | $sProtoID = $this->secure->checkInt($protoID); |
|
- | 1201 | $sInfo = $this->secure->checkStr($info, 1); |
|
- | 1202 | if ($sInfo == "") { |
|
- | 1203 | $sInfo = "Протокол доступа"; |
|
- | 1204 | }
|
|
- | 1205 | $show = "<fieldset><legend>".$sInfo."</legend>\n"; |
|
- | 1206 | if ($sProtoID != 0) { |
|
- | 1207 | // Режим редактирования
|
|
- | 1208 | $query = "SELECT * FROM ".$this->prefix."protos WHERE proto_id='".$sProtoID."'"; |
|
- | 1209 | $rq =& $this->db->query($query); |
|
- | 1210 | $rq->fetchInto($element); |
|
- | 1211 | }
|
|
- | 1212 | ||
- | 1213 | $show .= "<div class='inputbox'><label for='proto'>Протокол доступа:</label> <input type='text' name='proto' id='proto' value='".$this->secure->checkStr($element["proto"],1)."'></div>\n"; |
|
- | 1214 | $show .= "<div class='inputbox'><input type='submit' value=' Отправить данные '></div>\n</fieldset>\n"; |
|
- | 1215 | ||
- | 1216 | return $show; |
|
- | 1217 | }
|
|
- | 1218 | ||
- | 1219 | /**
|
|
1072 | * Показывает список подписей
|
1220 | * Показывает список подписей
|
1073 | *
|
1221 | *
|
1074 | * @author Alexander Wolf
|
1222 | * @author Alexander Wolf
|
1075 | * @category Core
|
1223 | * @category Core
|
1076 | *
|
1224 | *
|