function edit()
 {
     $db = new sql();
     $db->connect();
     $res = $db->query("select * from news where id=" . $this->id);
     $data = $db->fetch_array($res);
     $data["text"] = htmlspecialchars($data["text"]);
     $select = admin::getDateSelectOptions($data["time"]);
     $chid = $this->chid;
     $action = "appendEdit";
     $header = "Редактирование";
     eval("\$content=\"" . admin::template("newsAdd", "FORMPOST", array("fields[title]" => "EXISTS")) . "\";");
     $this->elements["content"] = $content;
 }
 function wrongAdd()
 {
     session_start();
     if ($_SESSION["fields"]) {
         foreach ($_SESSION["wrongFields"] as $key => $value) {
             $message .= "<p class=\"error\">" . $value . "</p>";
         }
         $data = $_SESSION["fields"];
         $select = admin::getDateSelectOptions($data["time"]);
         $chid = $this->chid;
         $action = "appendAdd";
         $db = new sql();
         $db->connect();
         $res = $db->query("select * from types order by id");
         while ($data1 = $db->fetch_array($res)) {
             $i++;
             $types .= "<option" . ($data["type"] == $data1["id"] ? " selected" : "") . " value=\"{$data1['id']}\">{$data1['title']}</option>";
         }
         $ts[$data["type"]] = " selected";
         $true = $data["type"] == 4 ? " && true" : " && false";
         $data = $_SESSION["fields"];
         $header = "Добавление";
         $lid = $this->lid;
         $library["chid"] = admin::getTypeID("library");
         eval("\$content=\"" . admin::template("itemAdd", "FORMPOST", array("fields[title]" => "EXISTS", "fields[url]" => "EXISTS")) . "\";");
         $this->elements["content"] = $content;
     }
 }
    function edit()
    {
        $db = new sql();
        $db->connect();
        $res = $db->query("select * from library where id=" . $this->id);
        $data = $db->fetch_array($res);
        $data["text"] = htmlspecialchars($data["text"]);
        $select = admin::getDateSelectOptions($data["time"]);
        $chid = $this->chid;
        $action = "appendEdit";
        $id = '<tr>
			<td>№</td>
			<td><input maxlength="14" name="fields[id]" size="14" value="' . $this->id . '" readonly="readonly" style="width: auto;" value="' . $this->id . '"></td>
		</tr>';
        $res1 = $db->query("select library_authors.* from library_authors left join authors on library_authors.author=authors.id where library=" . $this->id . " order by firstname, secondname, lastname");
        $idSel = 0;
        while ($data1 = $db->fetch_array($res1)) {
            $curSel = $data1["author"];
            eval("\$authorsSel.=\"" . admin::template("authorsJSscr") . "\";");
            $idSel++;
        }
        $curSel = 0;
        eval("\$authorsSel.=\"" . admin::template("authorsJSscr") . "\";");
        $header = "Редактирование";
        $page = "&page=" . $this->page;
        eval("\$content=\"" . admin::template("libraryAdd", "FORMPOST", array("fields[name]" => "EXISTS")) . "\";");
        $this->elements["content"] = $content;
    }