function deleteMessage($message_id)
 {
     // reply
     $r_sql = new sql();
     $r_sql->setQuery("select * from rex_5_board where message_id='{$message_id}' and board_id='" . $this->boardname . "'");
     if ($r_sql->getRows() == 1) {
         if ($r_sql->getValue("re_message_id") != 0) {
             // reply
             $ur_sql = new sql();
             $ur_sql->setTable("rex_5_board");
             $ur_sql->where("message_id='{$message_id}'");
             $ur_sql->setValue("status", 0);
             $ur_sql->update();
             $message_id = $r_sql->getValue("re_message_id");
             // update topic
             $u_sql = new sql();
             $u_sql->setQuery("select * from rex_5_board where re_message_id='{$message_id}' and status='1'");
             $u_sql->setTable("rex_5_board");
             $u_sql->where("message_id='{$message_id}'");
             $u_sql->setValue("replies", $u_sql->getRows());
             $u_sql->update();
             $this->msg["bb_msg_id"] = $r_sql->getValue("re_message_id");
             $return = $this->showMessage();
         } else {
             // topic
             $u_sql = new sql();
             $u_sql->setTable("rex_5_board");
             $u_sql->where("message_id='{$message_id}' or re_message_id='{$message_id}'");
             $u_sql->setValue("status", 0);
             $u_sql->update();
             $this->errmsg = $this->text[250];
             $return = $this->showMessages();
         }
     } else {
         $this->errmsg = $this->text[260];
         $return = $this->showMessages();
     }
     return $return;
 }
         rex_newArtPrio($category_id, $key, 0, $Position_New_Article);
     }
     rex_generateArticle($id);
     // ----- EXTENSION POINT
     $message = rex_register_extension_point('ART_ADDED', $message, array("id" => $id, "status" => 0, "name" => $article_name, "re_id" => $category_id, "prior" => $Position_New_Article, "path" => $KATPATH, "template_id" => $template_id));
 } else {
     if (isset($function) and $function == "edit_article" && $article_id != "" && $KATPERM) {
         // --------------------- ARTIKEL EDIT
         $Position_Article = (int) $Position_Article;
         if ($Position_Article == 0) {
             $Position_Article = 1;
         }
         $amessage = $I18N->msg("article_updated");
         $EA = new sql();
         $EA->setTable($REX['TABLE_PREFIX'] . "article");
         $EA->where("id='{$article_id}' and clang={$clang}");
         $EA->setValue("name", $article_name);
         $EA->setValue("template_id", $template_id);
         // $EA->setValue("path",$KATPATH);
         $EA->setValue("updatedate", time());
         $EA->setValue("updateuser", $REX_USER->getValue("login"));
         $EA->setValue("prior", $Position_Article);
         $EA->update();
         // ----- PRIOR
         rex_newArtPrio($category_id, $clang, $Position_Article, $thisArt->getValue("prior"));
         rex_generateArticle($article_id);
         // ----- EXTENSION POINT
         $message = rex_register_extension_point('ART_UPDATED', $message, array("id" => $article_id, "status" => $thisArt->getValue("status"), "name" => $article_name, "clang" => $clang, "re_id" => $category_id, "prior" => $Position_Article, "path" => $KATPATH, "template_id" => $template_id));
     } elseif (isset($function) and $function == "delete_article" && $article_id != "" && $KATPERM && !$REX_USER->isValueOf("rights", "editContentOnly[]")) {
         // --------------------- ARTIKEL DELETE
         $message = rex_deleteArticle($article_id);
 } else {
     $thumbnail = $REX_MEDIA_1;
 }
 $sql->setValue("thumbnail", $thumbnail);
 if ($REX_MEDIA_2 == "delete file") {
     $picture = "";
 } else {
     $picture = $REX_MEDIA_2;
 }
 $sql->setValue("picture", $picture);
 $sql->setValue("relation_1", $article[relation_1]);
 $sql->setValue("relation_2", $article[relation_2]);
 $sql->setValue("relation_3", $article[relation_3]);
 if ($aid != "") {
     // ----> update eines Artikels
     $sql->where("id='" . $aid . "' AND clang='{$clang}'");
     $sql->update();
     if (strlen($sql->error) > 3) {
         echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("error"), $message_corpus);
     } else {
         echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("product_saved"), $message_corpus);
         if ($uebernehmen) {
             $send = 0;
             $function = "edit_article";
         } else {
             $send = 1;
             $function = "";
         }
     }
     $sql->flush();
     $sql->setTable("rex_4_article");
 if ($FUNC_MOVE != "" && $func_category_id > 0 && $REX_USER->isValueOf("rights", "advancedMode[]")) {
     if ($article->getValue("startpage") == 1) {
         $err_msg = $I18N->msg('article_cannot_be_moved') . " " . $I18N->msg('start_article_has_to_stay_in_category');
     } else {
         $err_msg = moveArticle($article_id, $func_category_id, $category_id);
         $category_id = $func_category_id;
     }
 } elseif ($FUNC_COPY != "" && $func_category_id > 0 && $REX_USER->isValueOf("rights", "advancedMode[]")) {
     copyArticle($article_id, $func_category_id);
     $err_msg = $I18N->msg('article_copied');
 }
 if ($save == "1") {
     #$debugsql = 1;
     $meta_sql = new sql();
     $meta_sql->setTable("rex_article");
     $meta_sql->where("id='{$article_id}'");
     $meta_sql->setValue("online_von", $jahr_von . $monat_von . $tag_von);
     $meta_sql->setValue("online_bis", $jahr_bis . $monat_bis . $tag_bis);
     $meta_sql->setValue("suchbegriffe", $suchbegriffe);
     $meta_sql->setValue("beschreibung", $beschreibung);
     $meta_sql->setValue("name", $article_name);
     $meta_sql->setValue("type_id", $type_id);
     $meta_sql->setValue("checkbox01", $checkbox01);
     // -------------------------- FILE UPLOAD META BILD/FILE
     $FILE = "METAFILE";
     $FILEDEL = "METAFILEDEL";
     if ($METAFILE != "" and $METAFILE != "none") {
         $FILENAME = "METAFILE_name";
         $FILESIZE = "METAFILE_size";
         $FILETYPE = "METAFILE_type";
         $NFILENAME = "";
    }
} elseif ($func == "edit") {
    $s = new sql();
    $s->setQuery("select * from rex_opf_lang where id='" . $oid . "'");
    if ($s->getRows() == 0) {
        $msg = "";
    } else {
        $SF = true;
        $msg = "";
        if (isset($_REQUEST["opfname"])) {
            $msg = "Value saved.";
            $SF = false;
            $sv = new sql();
            // $sv->debugsql = 1;
            $sv->setTable("rex_opf_lang");
            $sv->where("id='" . $oid . "'");
            $sv->setValue("name", trim($_REQUEST["opfname"]));
            $sv->update();
        }
        if ($msg != "") {
            echo rex_opf_msg($msg);
        }
        if ($SF) {
            echo "<table style='width: 770px' cellpadding=5 cellspacing=1 border=0 class=rextbl>";
            echo "<form action=index.php method=post><input type=hidden name=oid value={$oid}><input type=hidden name=clang value=" . $clang . "><input type=hidden name=page value=" . $mypage . "><input type=hidden name=func value=" . $func . " />";
            // echo "<tr><th colspan=2 align=left class=dgrey>Schnipsel hinzufuegen</th></tr>";
            echo "<tr><td class=grey width=150>New value</td><td class=grey><textarea cols=30 rows=2 name=opfname class=inp100>" . htmlspecialchars($s->getValue("name")) . "</textarea></td></tr>";
            echo "<tr><td class=grey>Replace value</td><td class=grey>" . htmlspecialchars($s->getValue("replacename")) . "</td></tr>";
            echo "<tr><td class=dgrey>&nbsp;</td><td class=dgrey><input type=submit value=add></td></tr>";
            echo "</table><br />";
        }
        print "<option value={$var['id']}>{$var['name']}</option>\n";
    }
    print "</select>";
    print "<br><br><input type=submit value='Import Folder'>";
    print "</td></tr>";
    print "</table>";
    print "</form>";
}
// *************************************** EXTRA FUNCTIONS
if ($PERMALL && isset($media_method) and $media_method == 'updatecat_selectedmedia') {
    if (is_array($_POST["selectedmedia"])) {
        foreach ($_POST["selectedmedia"] as $file_id) {
            $db = new sql();
            // $db->debugsql = true;
            $db->setTable($REX['TABLE_PREFIX'] . 'file');
            $db->where("file_id='{$file_id}'");
            $db->setValue('category_id', $rex_file_category);
            $db->setValue("updatedate", time());
            $db->setValue("updateuser", $REX_USER->getValue("login"));
            $db->update();
            $msg = $I18N->msg('pool_selectedmedia_moved');
        }
    } else {
        $msg = $I18N->msg('pool_selectedmedia_error');
    }
}
if ($PERMALL && isset($media_method) and $media_method == 'delete_selectedmedia') {
    if (is_array($_POST["selectedmedia"])) {
        $msg = "";
        foreach ($_POST["selectedmedia"] as $file_id) {
            //kopiet von Dateidetails delete_file
 function save_css($cssFile = false, $cssDir, $styles)
 {
     $style_arr = $this->parse_css($styles);
     global $REX_USER;
     $FILESQL = new sql();
     $FILESQL->setQuery("select * from rex_file where filename='{$cssFile}'");
     if ($FILESQL->getRows() == 1) {
         $openFile = fopen($cssDir . $cssFile, "w");
         fputs($openFile, $styles);
         fclose($openFile);
         $FILESIZE = filesize($cssDir . $cssFile);
         //if($upload) {
         @chmod($cssDir . "/{$NFILENAME}", 0777);
         //$FILESQL->debugsql=1;
         $FILESQL->setTable("rex_file");
         $FILESQL->where("filename='{$cssFile}'");
         //$FILESQL->setValue("filetype",$FILETYPE);
         $FILESQL->setValue("filesize", $FILESIZE);
         $FILESQL->setValue("updatedate", time());
         $FILESQL->setValue("updateuser", $REX_USER->getValue("login"));
         $FILESQL->update();
         $ok = 1;
         //}
     } elseif ($FILESQL->getRows() > 1) {
         $this->errorMsg .= 'Es gibt mehere Dateinamen mit ' . $cssFile . ' in der Datenbank';
     } else {
         $this->errorMsg .= 'Dateinamen ' . $cssFile . ' im Medienpool nicht gefunden';
     }
 }
                echo "<input type=submit name=delclang value=delete onclick='return confirm(\"" . $I18N->msg('delete') . " ?\")'>";
            }
            echo "</td>";
            echo "</form></tr>";
        } else {
            echo "<tr>" . "<td></td>" . "<td align=center>" . key($REX[CLANG]) . "</td>" . "<td><a href=index.php?page=specials&spage=lang&func=editclang&clang_id=" . key($REX[CLANG]) . "#clang>" . htmlentities(current($REX[CLANG])) . "</a></td>" . "<td></td></tr>";
        }
        next($REX[CLANG]);
    }
    echo "</table>";
} else {
    // ----- eigene typen definieren
    if ($function == "Update" or $function == "Ändern") {
        $update = new sql();
        $update->setTable("rex_article_type");
        $update->where("type_id='{$type_id}'");
        $update->setValue("name", $typname);
        $update->setValue("description", $description);
        $update->update();
        $type_id = 0;
        $function = "";
        $message = $I18N->msg("article_type_updated");
    } elseif ($function == "Delete" or $function == "Löschen") {
        if ($type_id != 1) {
            $delete = new sql();
            $result = $delete->get_array("SELECT name,id FROM rex_article WHERE type_id = {$type_id}");
            if (is_array($result)) {
                $message = $I18N->msg("article_type_still_used") . "<br>";
                foreach ($result as $var) {
                    $message .= "<br><a href=index.php?page=content&article_id=" . $var[id] . "&mode=meta target=_blank>" . $var[name] . "</a>";
                }
        $file = $_POST['fileCreate'];
    }
    $catId = $_POST['dirCreate'];
    $create = new css_style();
    $create->create_file($file, $cssDir, $catId);
    $debug = $create->debug();
    $debugErrorMsg = $create->debug_errorMsg();
    $debugSuccessMsg = $create->debug_successMsg();
    $textarea = "/* Hier können Sie nun Styles einfügen */";
    $highlight = "/* Hier können Sie nun Styles einfügen */";
}
if (isset($_POST['delete']) and isset($_POST['fileDelete'])) {
    $fileDelete = $_POST['fileDelete'];
    $sql = new sql();
    $sql->setTable("rex_file");
    $sql->where("filename = '{$fileDelete}'");
    $sql->delete();
}
if (isset($_POST['save']) or isset($_POST['update']) and isset($_POST['fileEdit']) and $_POST['fileEdit'] != "") {
    $file = $_POST['fileEdit'];
    $styles = $_POST['styles'];
    $save = new css_style();
    $save->save_css($file, $cssDir, $styles);
    $debug = $save->debug();
    $debugErrorMsg = $save->debug_errorMsg();
    $debugSuccessMsg = $save->debug_successMsg();
    $textarea = $save->print_css_textarea($file, $cssDir);
    $highlight = $save->print_css_highlight($file, $cssDir);
}
if (isset($_POST['validate'])) {
    $validateCSS = urlencode($_POST['styles']);
<?php

$mypage = "simple_shop";
$stats[0] = "<span style=\"color:red\">" . $I18N_SIMPLE_SHOP->msg("status_0") . "</span>";
$stats[1] = "<span style=\"color:orange\">" . $I18N_SIMPLE_SHOP->msg("status_1") . "</span>";
$stats[2] = "<span style=\"color:green\">" . $I18N_SIMPLE_SHOP->msg("status_2") . "</span>";
$sql = new sql();
if ($function == "delete") {
    $sql->setTable("rex_4_order");
    $sql->where("id=" . $aid . "");
    $sql->delete();
    $sql->setTable("rex_4_order_product");
    $sql->where("order_id=" . $aid . "");
    $sql->delete();
    $function = "";
}
if ($function == "edit_article" && $send == 1) {
    $sql->setTable("rex_4_order");
    $sql->setValue("status", $article[status]);
    $sql->where("id=" . $aid . "");
    $sql->update();
    $function = "";
}
if ($function == "edit_article") {
    $sql->setQuery("SELECT *,DATE_FORMAT(rex_4_order.date, '%d.%m.%Y %H:%i') as datum\r\n\tFROM rex_4_order LEFT JOIN rex_4_order_product ON rex_4_order.id = rex_4_order_product.order_id WHERE rex_4_order.id='" . $aid . "'");
    $mailtext = nl2br($sql->getValue("mailtext"));
    $status = $sql->getValue("status");
    echo "<a href=\"index.php?page=simple_shop&subpage=" . $subpage . "\" target=\"_self\">&#171; " . $I18N_SIMPLE_SHOP->msg("back_overview") . "</a><br /><br />\r\n\t\t\t<form action='index.php' method=post>\r\n\t\t\t<input type=hidden name='page' value='simple_shop' />\r\n\t\t\t<input type=hidden name='subpage' value='{$subpage}' />\r\n\t\t\t<input type=hidden name='clang' value='{$clang}' />\r\n\t\t\t<input type=hidden name='aid' value='" . $aid . "' />\r\n\t\t\t<input type=hidden name='function' value='edit_article' />\r\n\t\t\t<input type=hidden name='send' value='1' />\r\n\t\t\t<table width=770 border=0 cellpadding=5 cellspacing=1 />\r\n\t\t\t<tr>\r\n\t\t\t\t<th width=30>&nbsp;</th>\r\n\t\t\t\t<th colspan=2>" . $I18N_SIMPLE_SHOP->msg("header_order") . "</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td class=grey width=30>&nbsp;</td>\r\n\t\t\t\t<td class=grey width=170>" . $I18N_SIMPLE_SHOP->msg("date") . "</td>\r\n\t\t\t\t<td class=grey width=550>" . $sql->getValue("datum") . "</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td class=grey width=30>&nbsp;</td>\r\n\t\t\t\t<td class=grey width=170>" . $I18N_SIMPLE_SHOP->msg("customer") . "</td>\r\n\t\t\t\t<td class=grey width=550>" . $sql->getValue("name") . "</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td class=grey width=30>&nbsp;</td>\r\n\t\t\t\t<td class=grey width=170 valign=top>" . $I18N_SIMPLE_SHOP->msg("products") . "</td>\r\n\t\t\t\t<td class=grey width=550>";
    for ($i = 0; $i < $sql->rows; $i++) {
        echo $sql->getValue("amount") . " x " . $sql->getValue("product_name") . ", " . number_format($sql->getValue("price"), 2, ".", "") . "€ <br />";
        $sql->next();
            }
            $msg .= " | ";
            $mode = "";
        }
    } else {
        $msg = $I18N->msg('pool_file_not_found');
        $mode = "";
    }
}
if ($media_method == 'edit_file') {
    $gf = new sql();
    $gf->setQuery("select * from rex_file where file_id='{$file_id}'");
    if ($gf->getRows() == 1) {
        $FILESQL = new sql();
        $FILESQL->setTable("rex_file");
        $FILESQL->where("file_id='{$file_id}'");
        $FILESQL->setValue("title", $ftitle);
        $FILESQL->setValue("description", $fdescription);
        $FILESQL->setValue("copyright", $fcopyright);
        $FILESQL->setValue("category_id", $rex_file_category);
        $FILESQL->setValue("stamp", time());
        $msg = "Dateiinformationen wurden aktualisiert!";
        $filename = $gf->getValue("filename");
        $filetype = $gf->getValue("filetype");
        if ($_FILES[file_new][name] != "" and $_FILES[file_new][name] != "none") {
            $filetype_ii = in_array($filetype, $imagetype);
            $ffilename = $_FILES[file_new][tmp_name];
            $ffiletype = $_FILES[file_new][type];
            $ffilesize = $_FILES[file_new][size];
            if ($ffiletype == $filetype) {
                unlink($REX[MEDIAFOLDER] . "/" . $filename);
     $subject = str_replace("###LOGIN###", $gu->getValue("user_login"), $subject);
     $body = str_replace("###EMAIL###", $gu->getValue("user_email"), $body);
     $body = str_replace("###NAME###", $gu->getValue("user_name"), $body);
     $body = str_replace("###FIRSTNAME###", $gu->getValue("user_firstname"), $body);
     $body = str_replace("###LOGIN###", $gu->getValue("user_login"), $body);
     $body = str_replace("###PSW###", $gu->getValue("user_password"), $body);
     $mail->Subject = $subject;
     $mail->AltBody = $body;
     $mail->Send();
     echo "Mail wurde versendet<br /><br />";
     $aktionen = $mails[$mail_id]["action"];
     if (is_array($aktionen)) {
         $uu = new sql();
         $uu->debugsql = 0;
         $uu->setTable("rex_5_user");
         $uu->where("id='" . $oid . "'");
         foreach ($aktionen as $key => $value) {
             $uu->setValue($key, $value);
         }
         $uu->update();
         echo "Aktion/en wurden ausgeführt!<br /><br />";
     }
 } else {
     foreach ($mails as $key => $value) {
         echo "<br /><br /><a href=index.php?page=community&subpage=user&oid={$oid}&func=sendmail&subfunc=send&mail_id={$key}>&raquo; " . $value["name"] . "</a>";
     }
     echo "<br /><br />";
 }
 echo "</td></tr></table>";
 echo "<br /><table cellpadding=5 class=rex><tr><td><a href=index.php?page=" . $mypage . "&subpage=" . $subpage . "&func=edit&oid={$oid}><b>&laquo; Zurück zum User</b></a></td></tr></table>";
 $func = "nothing";
Beispiel #13
0
<?php

title("<a href=index.php?page=community class=head>Community</a>: <a href=index.php?page=community&subpage=user class=head>Userverwaltung</a>", "");
if ($FUPD != "") {
    $updateuser = new sql();
    $updateuser->setTable("rex__user");
    $updateuser->where("id='{$user_id}'");
    $updateuser->setValue("psw", $upsw);
    $updateuser->setValue("email", $uemail);
    $updateuser->setValue("name", $uname);
    $updateuser->setValue("firstname", $ufirstname);
    if ($usex != "m" and $usex != "f") {
        $usex = "";
    }
    $updateuser->setValue("sex", $usex);
    $updateuser->setValue("street", $ustreet);
    $updateuser->setValue("zip", $uzip);
    $updateuser->setValue("city", $ucity);
    $updateuser->setValue("phone", $uphone);
    $updateuser->setValue("profession", $uprofession);
    $updateuser->setValue("size", $usize);
    $updateuser->setValue("wheight", $uwheight);
    $updateuser->setValue("singlestatus", $usinglestatus);
    $updateuser->setValue("color_eyes", $ucolor_eyes);
    $updateuser->setValue("color_hair", $ucolor_hair);
    $updateuser->setValue("posx", $uposx);
    $updateuser->setValue("posy", $uposy);
    $updateuser->setValue("file", $ufile);
    $updateuser->setValue("birthday", $ubirthday);
    $updateuser->setValue("interests", $uinterests);
    $updateuser->setValue("motto", $umotto);
 } else {
     $thumbnail = $REX_MEDIA_1;
 }
 $sql->setValue("thumbnail", $thumbnail);
 if ($REX_MEDIA_2 == "delete file") {
     $picture = "";
 } else {
     $picture = $REX_MEDIA_2;
 }
 $sql->setValue("picture", $picture);
 $sql->setValue("relation_1", $article[relation_1]);
 $sql->setValue("relation_2", $article[relation_2]);
 $sql->setValue("relation_3", $article[relation_3]);
 if ($aid != "") {
     // ----> update eines Artikels
     $sql->where("id='" . $aid . "' AND clang='{$clang}'");
     $sql->update();
     if (strlen($sql->error) > 3) {
         echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("error"), $message_corpus);
     } else {
         echo preg_replace("!##msg##!", $I18N_SIMPLE_SHOP->msg("product_saved"), $message_corpus);
         if ($uebernehmen) {
             $send = 0;
             $function = "edit_article";
         } else {
             $send = 1;
             $function = "";
         }
     }
     $sql->flush();
     $sql->setTable("rex_4_article");
Beispiel #15
0
     $CONT->setSliceId($slice_id);
     $CONT->setMode($mode);
     $CONT->setCLang($clang);
     $CONT->setCType($ctype);
     $CONT->setEval(TRUE);
     $CONT->setFunction($function);
     eval("?>" . $CONT->getArticle());
     // ------------------------------------------ END: MODULE EDITIEREN/ADDEN ETC.
 } elseif ($mode == "meta") {
     // ------------------------------------------ START: META VIEW
     $extens = "";
     if (isset($save) and $save == "1") {
         $meta_sql = new sql();
         $meta_sql->setTable($REX['TABLE_PREFIX'] . "article");
         // $meta_sql->debugsql = 1;
         $meta_sql->where("id='{$article_id}' and clang={$clang}");
         $meta_sql->setValue("online_from", mktime(0, 0, 0, $monat_von, $tag_von, $jahr_von));
         $meta_sql->setValue("online_to", mktime(0, 0, 0, $monat_bis, $tag_bis, $jahr_bis));
         $meta_sql->setValue("keywords", $meta_keywords);
         $meta_sql->setValue("description", $meta_description);
         $meta_sql->setValue("name", $meta_article_name);
         $meta_sql->setValue("type_id", $type_id);
         if (!isset($meta_teaser)) {
             $meta_teaser = 0;
         }
         $meta_sql->setValue("teaser", $meta_teaser);
         $meta_sql->setValue("updatedate", time());
         $meta_sql->setValue("updateuser", $REX_USER->getValue("login"));
         // -------------------------- FILE UPLOAD META BILD/FILE
         $meta_sql->setValue("file", $REX_MEDIA_1);
         // ----------------------------- / FILE UPLOAD
 if ($function == "add") {
     $ITPL = new sql();
     $ITPL->setTable("rex_template");
     $ITPL->setValue("name", $templatename);
     $ITPL->setValue("active", $active);
     $ITPL->setValue("content", $content);
     $ITPL->insert();
     $template_id = $ITPL->last_insert_id;
     $message = $I18N->msg("template_added");
 } else {
     if (!isset($active)) {
         $active = 0;
     }
     $TMPL = new sql();
     $TMPL->setTable("rex_template");
     $TMPL->where("id='{$template_id}'");
     $TMPL->setValue("name", $templatename);
     $TMPL->setValue("content", $content);
     $TMPL->setValue("active", $active);
     $TMPL->update();
     $message = $I18N->msg("template_added");
 }
 $gt = new sql();
 $gt->setQuery("SELECT * FROM rex_template WHERE id = '{$template_id}'");
 $fp = fopen($REX['INCLUDE_PATH'] . "/generated/templates/" . $template_id . ".template", "w");
 fputs($fp, $gt->getValue("content"));
 fclose($fp);
 if (isset($goon) and $goon != "") {
     $function = "edit";
     $save = "nein";
 } else {
 function showForm()
 {
     global $FORM, $REX;
     // --------------------------------- EDIT: 1. WERTE AUS DB HOLEN
     for ($i = 0; $i < $this->counter; $i++) {
         if ($this->value_type[$i] != "multipleselectsql") {
             if ($FORM[$this->rfid][submit] != 1 && $this->form_type == "edit") {
                 $FORM[$this->rfid][values][$i] = htmlentities($this->sql->getValue($this->value_tbl[$i]));
             } else {
                 $FORMVAL[$this->rfid][values][$i] = htmlentities($this->sql->getValue($this->value_tbl[$i]));
             }
         } else {
             $selsql = new sql();
             $selsql->setQuery("select * from " . $this->type_value5[$i] . " where " . $this->type_value6[$i]);
             for ($j = 0; $j < $selsql->getRows(); $j++) {
                 if ($FORM[$this->rfid][submit] != 1 && $this->form_type == "edit") {
                     $FORM[$this->rfid][values][$i][] = $selsql->getValue($this->type_value7[$i]);
                 } else {
                     $FORMVAL[$this->rfid][values][$i][] = $selsql->getValue($this->type_value7[$i]);
                 }
                 $selsql->next();
             }
         }
     }
     // --------------------------------- ABGESCHICKTE EINGABEN CHECKEN
     if ($FORM[$this->rfid][submit] == 1) {
         // ----------------------------- eingaben überprüfen
         $this->form_show = false;
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->value_check[$i] != "") {
                 if ($FORM[$this->rfid][values][$i] == "") {
                     $errmsg .= "Bitte tragen Sie '" . $this->value_form[$i] . "' ein! <br>";
                     $this->form_show = true;
                 }
             }
         }
     }
     // --------------------------------- EDIT: SPEICHERN FALLS MÖGLICH
     if ($FORM[$this->rfid][submit] == 1 && $this->form_type == "edit") {
         if ($errmsg == "") {
             $aa = new sql();
             $aa->debugsql = 0;
             $aa->setTable($this->tbl_name);
             $aa->where($this->form_where);
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] == "picjpg") {
                     $folder = $this->type_value1[$i];
                     $foldertmp = $REX[INCLUDE_PATH] . "/../../ss_pics/";
                     $fname = $_FILES[FORM][name][$this->rfid][values][$i];
                     if ($fname != "") {
                         // neues file
                         $nfname = $this->checkFilename($fname, $folder);
                         if ($nfname[ext] == ".jpg") {
                             $ftmpname = $_FILES[FORM][tmp_name][$this->rfid][values][$i];
                             move_uploaded_file($ftmpname, $foldertmp . $nfname[nname]);
                             $this->resizeJPGImage($foldertmp . $nfname[nname], $folder . $nfname[nname], $this->type_value3[$i], $this->type_value4[$i]);
                             $FORM[$this->rfid][values][$i] = $nfname[nname];
                             $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                         }
                     } elseif ($FORM[$this->rfid][values][$i][delete] != "") {
                         $FORM[$this->rfid][values][$i] = "";
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } else {
                         $FORM[$this->rfid][values][$i] = $FORMVAL[$this->rfid][values][$i];
                     }
                 } elseif ($this->value_type[$i] == "file") {
                     $folder = $REX[INCLUDE_PATH] . "/../../ss_pics/";
                     $fname = $_FILES[FORM][name][$this->rfid][values][$i];
                     if ($fname != "") {
                         $nfname = $this->checkFilename($fname, $folder);
                         $ftmpname = $_FILES[FORM][tmp_name][$this->rfid][values][$i];
                         move_uploaded_file($ftmpname, $folder . $nfname[nname]);
                         $FORM[$this->rfid][values][$i] = $nfname[nname];
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } elseif ($FORM[$this->rfid][values][$i][delete] != "") {
                         $FORM[$this->rfid][values][$i] = "";
                         $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                     } else {
                         $FORM[$this->rfid][values][$i] = $FORMVAL[$this->rfid][values][$i];
                     }
                 } elseif ($this->value_type[$i] == "multipleselectsql") {
                     // multipleselect
                     $ms = new sql();
                     $ms->query("delete from " . $this->type_value5[$i] . " where " . $this->type_value6[$i]);
                     if (is_Array($FORM[$this->rfid][values][$i])) {
                         reset($FORM[$this->rfid][values][$i]);
                         for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                             $val = current($FORM[$this->rfid][values][$i]);
                             $sql = "insert into " . $this->type_value5[$i] . " set " . $this->type_value6[$i] . ", " . $this->type_value7[$i] . "={$val}";
                             $ms->query($sql);
                             next($FORM[$this->rfid][values][$i]);
                         }
                     }
                 } elseif ($this->value_type[$i] == "subline" || $this->value_type[$i] == "empty") {
                 } elseif ($this->value_type[$i] == "datum") {
                     $tag = substr($FORM[$this->rfid][values][$i], 0, 2);
                     $monat = substr($FORM[$this->rfid][values][$i], 3, 2);
                     $jahr = substr($FORM[$this->rfid][values][$i], 6, 4);
                     $aa->setValue($this->value_tbl[$i], mktime(0, 0, 0, $monat, $tag, $jahr));
                 } else {
                     $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                 }
             }
             $aa->update();
             $msg = "Daten wurden gespeichert";
         } else {
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] != "multipleselectsql") {
                     $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
                 }
             }
         }
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->value_type[$i] != "multipleselectsql") {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             } else {
                 // multipleselect
                 if (is_Array($FORM[$this->rfid][values][$i])) {
                     reset($FORM[$this->rfid][values][$i]);
                     for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                         $val = $FORM[$this->rfid][values][$i][j];
                     }
                 }
             }
         }
     }
     // --------------------------------- ADD: SPEICHERN FALLS MÖGLICH
     if ($FORM[$this->rfid][submit] == 1 && $this->form_type == "add") {
         if ($errmsg == "") {
             $aa = new sql();
             $aa->debugsql = 0;
             $aa->setTable($this->tbl_name);
             for ($i = 0; $i < $this->counter; $i++) {
                 if ($this->value_type[$i] == "datum") {
                     $tag = substr($FORM[$this->rfid][values][$i], 0, 2);
                     $monat = substr($FORM[$this->rfid][values][$i], 3, 2);
                     $jahr = substr($FORM[$this->rfid][values][$i], 6, 4);
                     $aa->setValue($this->value_tbl[$i], mktime(0, 0, 0, $monat, $tag, $jahr));
                 } elseif ($this->value_type[$i] != "multipleselectsql" && $this->value_type[$i] != "subline" && $this->value_type[$i] != "empty") {
                     $aa->setValue($this->value_tbl[$i], $FORM[$this->rfid][values][$i]);
                 }
             }
             $aa->insert();
             $msg = "Daten wurden gespeichert";
             for ($i = 0; $i < $this->counter; $i++) {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             }
         } else {
             for ($i = 0; $i < $this->counter; $i++) {
                 $FORM[$this->rfid][values][$i] = htmlentities(stripslashes($FORM[$this->rfid][values][$i]));
             }
         }
     }
     // --------------------------------- FORMULAR
     if ($this->form_show || $this->ShowFormAlways) {
         $ausgabe = "<table width=" . $this->width . " cellpadding=6 cellspacing=1 border=0 >";
         $ausgabe .= "<form ENCTYPE='multipart/form-data' action='" . $this->url . "' method='" . $this->method . "' name='" . $this->formname . "'>" . $this->form_header;
         $ausgabe .= "<input type=hidden name=FORM[{$this->rfid}][submit] value=1>";
         // ---------------------- FORM REIHEN
         $colcounter = $this->cols[0];
         for ($i = 0; $i < $this->counter; $i++) {
             if ($this->cols[$i] != "") {
                 $colcounter = $this->cols[$i];
             } else {
                 $this->cols[$i] = $colcounter;
             }
             if ($maxcount < $this->cols[$i]) {
                 $maxcount = $this->cols[$i];
             }
         }
         $colcounter = 0;
         if ($errmsg != "") {
             $ausgabe .= "<tr><td colspan=" . ($maxcount + 2) . " class=warning>{$errmsg}<br>Daten wurden noch nicht gespeichert</td></tr>";
         }
         if ($msg != "") {
             $ausgabe .= "<tr><td colspan=" . ($maxcount + 2) . " class=warning>{$msg}</td></tr>";
         }
         for ($i = 0; $i < $this->counter; $i++) {
             $name = "FORM[{$this->rfid}][values][{$i}]";
             $value = $FORM[$this->rfid][values][$i];
             // echo "<br>$i $maxcounter ".$this->cols[$i]." ".$this->cols[$i-1]." ".$this->value_form[$i];
             $colcounter++;
             if ($this->cols[$i - 1] != $this->cols[$i]) {
                 if ($i != 0) {
                     $ausgabe .= "</tr>\n\n";
                 }
                 $ausgabe .= "\n\n<tr>";
                 $colcounter = 0;
             } else {
                 // anfang
                 // ende
                 if ($colcounter == $this->cols[$i]) {
                     $ausgabe .= "</tr>\n\n";
                     $ausgabe .= "\n\n<tr>";
                     $colcounter = 0;
                 }
             }
             $addcolspawn = 0;
             if ($this->cols[$i] < $maxcount) {
                 $addcolspawn = 2;
             }
             switch ($this->value_type[$i]) {
                 // ---------------------- MULTIPLE SQL SELECT AUSGABE
                 case "multipleselectsql":
                     if ($this->form_type == "add") {
                         $ausgabe .= "<td colspan=2>Multiple Felder nur bei edit möglich\t</td>";
                     } else {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ssql = new sql();
                         $ssql->setQuery($this->type_value1[$i]);
                         $ssel = new rexselect();
                         $ssel->setName($name . "[]");
                         $ssel->setMultiple(1);
                         $ssel->setSize($this->type_value4[$i]);
                         $ssel->setStyle("width:100%;");
                         for ($j = 0; $j < $ssql->getRows(); $j++) {
                             $ssel->addOption($ssql->getValue($this->type_value3[$i]), $ssql->getValue($this->type_value2[$i]));
                             $ssql->next();
                         }
                         // $selsql = new sql;
                         // $selsql->setQuery("select * from ".$this->type_value5[$i]." where ".$this->type_value6[$i]);
                         if (is_Array($FORM[$this->rfid][values][$i])) {
                             reset($FORM[$this->rfid][values][$i]);
                             for ($j = 0; $j < count($FORM[$this->rfid][values][$i]); $j++) {
                                 $ssel->setSelected(current($FORM[$this->rfid][values][$i]));
                                 next($FORM[$this->rfid][values][$i]);
                             }
                         }
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                         $ausgabe .= "";
                     }
                     break;
                     // ---------------------- SINGLE SQL SELECT AUSGABE
                 // ---------------------- SINGLE SQL SELECT AUSGABE
                 case "singleselectsql":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ssql = new sql();
                     $ssql->setQuery($this->type_value1[$i]);
                     $ssel = new rexselect();
                     $ssel->setName($name);
                     $ssel->setStyle("width:100%;");
                     if ($this->value_check[$i] != 1) {
                         $ssel->addOption("----------------- keine Angabe -----------------", "0");
                     }
                     for ($j = 0; $j < $ssql->getRows(); $j++) {
                         $ssel->addOption($ssql->getValue($this->type_value3[$i]), $ssql->getValue($this->type_value2[$i]));
                         $ssql->next();
                     }
                     $ssel->setSelected($value);
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- SINGLE SELECT AUSGABE
                 // ---------------------- SINGLE SELECT AUSGABE
                 case "singleselect":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $stype = explode("|", $this->type_value1[$i]);
                     $ssel = new rexselect();
                     $ssel->setName($name);
                     $ssel->setStyle("width:100%;");
                     for ($j = 0; $j < count($stype); $j++) {
                         $svalue = $stype[$j];
                         $j++;
                         $sname = $stype[$j];
                         $ssel->addOption($sname, $svalue);
                     }
                     $ssel->setSelected($value);
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . $ssel->out() . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- Checkbox
                 // ---------------------- Checkbox
                 case "checkbox":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=checkbox name={$name} value=1 ";
                     if ($value == 1 || $value == "on") {
                         $ausgabe .= "checked";
                     }
                     $ausgabe .= "></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- PIC/JPG
                 // ---------------------- PIC/JPG
                 case "picjpg":
                     if ($value != "") {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><table cellpadding=2 cellspacing=0><tr><td><input name={$name} type=file size=10></td><td rowspan=2>&nbsp;&nbsp;&nbsp;</td><td rowspan=2><img src=" . $this->type_value2[$i] . "{$value} width=" . $this->type_value3[$i] . " height=" . $this->type_value4[$i] . "></td></tr>";
                         $ausgabe .= "<tr><td valign=middle align=left class=grey><input type=checkbox name=FORM[{$this->rfid}][values][{$i}][delete]>&nbsp;&nbsp;Datei löschen </td></tr></table>";
                         $ausgabe .= "</td>";
                     } else {
                         $ausgabe .= "\n\n";
                         $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                         $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input name={$name} type=file size=10></td>";
                         $ausgabe .= "";
                     }
                     break;
                     // ---------------------- FILE
                 // ---------------------- FILE
                 case "file":
                     $myout = "";
                     if ($value != "") {
                         $myout = "\n\n<table><tr>";
                         $myout .= "<td valign=middle align=right class=grey><input type=checkbox name=FORM[{$this->rfid}][values][{$i}][delete]></td>";
                         $myout .= "<td class=grey>Datei löschen <a href=" . $this->type_value2[$i] . "{$value} target=_blank>{$value}</a></td>";
                         $myout .= "</tr></table>";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "<br>{$myout}</td>";
                     $ausgabe .= "<td class=grey><input name={$name} type=file size=10></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- HTMLAREA
                 // ---------------------- HTMLAREA
                 case "htmlarea":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%; height:100px;";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=top class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . ">" . REXHTMLAREA($name, $value) . "</td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- TEXTAREA
                 // ---------------------- TEXTAREA
                 case "textarea":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%; height:100px;";
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=top class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><textarea name={$name} cols=30 rows=5 style='" . $this->type_value1[$i] . "'>{$value}</textarea></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- HIDDEN
                 // ---------------------- HIDDEN
                 case "hidden":
                     $ausgabe .= "<input type=hidden name={$name} value=\"" . $this->type_value1[$i] . "\">";
                     break;
                     // ---------------------- TEXT
                 // ---------------------- TEXT
                 case "text":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%;";
                     }
                     if ($this->type_value2[$i] != "") {
                         $this->type_value2[$i] = "maxlength=" . $this->type_value2[$i];
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" " . $this->type_value2[$i] . " size=20 style='" . $this->type_value1[$i] . "'></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- DATUM
                 // ---------------------- DATUM
                 case "datum":
                     if ($this->type_value1[$i] == "") {
                         $this->type_value1[$i] = "width:100%;";
                     }
                     if ($this->type_value2[$i] != "") {
                         $this->type_value2[$i] = "maxlength=" . $this->type_value2[$i];
                     }
                     if (!preg_match("![0-9]{2}\\.[0-9]{2}\\.[0-9]{4}!", $value)) {
                         $value = date("d.m.Y", $value);
                     }
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" " . $this->type_value2[$i] . " size=20 style='" . $this->type_value1[$i] . "'></td>";
                     $ausgabe .= "";
                     break;
                     // ---------------------- Überschrift
                 // ---------------------- Überschrift
                 case "subline":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<th valign=middle align=" . $this->value_tbl[$i] . " colspan=" . (2 + $addcolspawn) . ">" . $this->value_form[$i] . "</th>\n";
                     $ausgabe .= "\n";
                     break;
                     // ---------------------- Überschrift
                 // ---------------------- Überschrift
                 case "empty":
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey colspan=" . (2 + $addcolspawn) . ">&nbsp;</td>\n";
                     $ausgabe .= "\n";
                     break;
                     // ---------------------- STANDARD AUSGABE - TEXT
                 // ---------------------- STANDARD AUSGABE - TEXT
                 default:
                     $ausgabe .= "\n\n";
                     $ausgabe .= "<td valign=middle class=grey width=" . $this->labelwidth . " >" . $this->value_form[$i] . "</td>";
                     $ausgabe .= "<td class=grey colspan=" . (1 + $addcolspawn) . "><input type=text name={$name} value=\"{$value}\" size=20 style='width:100%'></td>";
                     $ausgabe .= "";
             }
         }
         $ausgabe .= "</tr>";
         // ---------------------- SUBMIT
         $ausgabe .= "<tr>\n\n";
         $ausgabe .= "<td class=dgrey  width=" . $this->labelwidth . " >&nbsp;</td>\n\n";
         $ausgabe .= "<td align=left class=dgrey colspan=" . ($maxcount + 1) . "><input type=submit value='" . $this->submit_value . "'></td>\n\n";
         $ausgabe .= "</tr>\n\n";
         $ausgabe .= "</form></table>\n\n";
         return $ausgabe;
     } else {
         if ($msg != "") {
             $ausgabe = "<table width=" . $this->width . " cellpadding=6 cellspacing=1 border=0 bgcolor=#ffffff>";
             $ausgabe .= "<tr><td class=warning>{$msg}</td></tr>";
             $ausgabe .= "</table>";
             return $ausgabe;
         }
     }
 }
 function write()
 {
     global $REX, $REX_USER;
     $sql = new sql();
     $sql->setTable($REX['TABLE_PREFIX'] . '51_cache_article');
     foreach ($this->vars as $key => $value) {
         $sql->setValue($key, $value);
     }
     $user = $REX['REDAXO'] ? $REX_USER->getValue('login') : '';
     if ($this->exists()) {
         $sql->where('article_id=' . $this->article_id . ' AND clang=' . $this->clang);
         $sql->setValue('updatedate', time());
         $sql->setValue('updateuser', $user);
         $sql->update();
     } else {
         $sql->setValue('article_id', $this->article_id);
         $sql->setValue('clang', $this->clang);
         $sql->setValue('createdate', time());
         $sql->setValue('createuser', $user);
         $sql->insert();
     }
 }
/**
 * Kopiert die Metadaten eines Artikels in einen anderen Artikel
 * 
 * @param $from_id      ArtikelId des Artikels, aus dem kopiert werden (Quell ArtikelId)
 * @param $to_id        ArtikelId des Artikel, in den kopiert werden sollen (Ziel ArtikelId)
 * @param [$from_clang] ClangId des Artikels, aus dem kopiert werden soll (Quell ClangId)
 * @param [$to_clang]   ClangId des Artikels, in den kopiert werden soll (Ziel ClangId)
 * @param [$params]     Array von Spaltennamen, welche kopiert werden sollen
 */
function rex_copyMeta($from_id, $to_id, $from_clang = 0, $to_clang = 0, $params = array())
{
    global $REX, $REX_USER;
    $from_clang = (int) $from_clang;
    $to_clang = (int) $to_clang;
    $from_id = (int) $from_id;
    $to_id = (int) $to_id;
    if (!is_array($params)) {
        $params = array();
    }
    if ($from_id == $to_id && $from_clang == $to_clang) {
        return false;
    }
    $gc = new sql();
    $gc->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='{$from_clang}' and id='{$from_id}'");
    if ($gc->getRows() == 1) {
        $uc = new sql();
        // $uc->debugsql = 1;
        $uc->setTable($REX['TABLE_PREFIX'] . "article");
        $uc->where("clang='{$to_clang}' and id='{$to_id}'");
        $uc->setValue("updatedate", time());
        $uc->setValue("updateuser", addslashes($REX_USER->getValue("login")));
        foreach ($params as $key => $value) {
            $var = $gc->getValue("{$value}");
            $uc->setValue("{$value}", $var);
        }
        $uc->update();
        rex_generateArticle($to_id, false);
        return true;
    }
    return false;
}
Beispiel #20
0
function doAction($short_id, $shortcut, $description, $language, $casesense, $mode = 'update')
{
    global $I18N, $I18N_GLOSSAR;
    // Validierung der Modi
    $mode = trim($mode);
    if ($mode != trim($I18N->msg('add')) && $mode != trim($I18N->msg('update')) && $mode != trim($I18N->msg('delete'))) {
        return $I18N_GLOSSAR->msg('invalid_action') . $mode;
    }
    $sql = new sql();
    $sql->setTable('rex__glossar');
    // Delete Query zusammenbauen
    if ($mode == trim($I18N->msg('delete'))) {
        $sql->where("short_id='{$short_id}'");
        $sql->delete();
        return $I18N_GLOSSAR->msg('deleted');
    }
    // Validierung der eingaben (Alle Felder müssen gefüllt sein)
    if ($shortcut === '' || $description === '' || $language === '' || $casesense === '') {
        return $I18N_GLOSSAR->msg('invalid_input');
    }
    $sql->setValue('shortcut', $shortcut);
    $sql->setValue('description', $description);
    $sql->setValue('language', $language);
    $sql->setValue('casesense', $casesense);
    // Update Query zusammenbauen
    if ($mode == trim($I18N->msg('update'))) {
        $sql->where("short_id='{$short_id}'");
        $sql->update();
        return $I18N_GLOSSAR->msg('updated');
    } else {
        $sql->insert();
        return $I18N_GLOSSAR->msg('inserted');
    }
}