function rex_opf_sync() { global $REX; // abgleich der replacevalue felder.. $s = new sql(); // $s->debugsql = 1; $s->setQuery("select clang, replacename, name, count(replacename) from rex_opf_lang group by replacename"); for ($i = 0; $i < $s->getRows(); $i++) { if (count($REX['CLANG']) != $s->getValue("count(replacename)")) { reset($REX['CLANG']); while (list($key, $val) = each($REX['CLANG'])) { $lclang = $key; $replacename = $s->getValue("replacename"); $name = $s->getValue("name"); $gs = new sql(); $gs->setQuery("select clang from rex_opf_lang where clang={$lclang} and replacename='{$replacename}'"); if ($gs->getRows() == 0) { // erstelle $us = new sql(); $us->setTable("rex_opf_lang"); $us->setValue("clang", $lclang); $us->setValue("replacename", $replacename); $us->setValue("name", $name); $us->insert(); } } } $s->next(); } }
/** * Glossar Addon * < * @author staab[at]public-4u[dot]de Markus Staab * @author <a href="http://www.public-4u.de">www.public-4u.de</a> * @package redaxo3 * @version $Id: function_replace.inc.php,v 1.4 2008/01/25 09:48:36 kills Exp $ */ function rex_glossar_replace($params) { global $REX, $mypage, $I18N_GLOSSAR; $string = $params['subject']; // Aufteilen des Strings, damit nur im Body ersetzt wird $bodystart = strpos($string, '<body>'); $header = substr($string, 0, $bodystart); $body = substr($string, $bodystart); // Bereiche ersetzen, in denen keine Glossar ersetzungen durchgeführt werden sollen // welche nicht innerhalb des Tags sind $back_srch = array(); $back_rplc = array(); $mtchs = array(); if (preg_match_all('/(<textarea.*?>(.*?)<\\/textarea>)/s', $body, $mtchs)) { foreach ($mtchs[2] as $key => $mtch) { $back_srch[$key] = '###SPACER###' . $key . '###'; $back_rplc[$key] = $mtch; $body = str_replace($mtch, '###SPACER###' . $key . '###', $body); } } $sql = new sql(); //$sql->debugsql = true; $sql->setQuery('SELECT * FROM rex_13_glossar, rex_13_glossar_lang WHERE language = lang_id ORDER BY CHAR_LENGTH(shortcut) DESC'); // IE doesnt support <abbr> if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { $replacetag = 'acronym'; } else { $replacetag = 'abbr'; } $replaceformat = '<' . $replacetag . ' class=\\"abbr\\" title=\\"%desc% (%lang%)\\">%short%</' . $replacetag . '>'; $searches = array(); $replaces = array(); for ($i = 0; $i < $sql->getRows(); $i++) { $language = htmlspecialchars($sql->getValue('lang_name')); $shortcut = htmlspecialchars($sql->getValue('shortcut')); $description = htmlspecialchars($sql->getValue('description')); $casesense = $sql->getValue('casesense'); // Escape Shortcut for preg_match $escapedshortcut = preg_quote($shortcut, '/'); $escapedentitiesshortuct = htmlentities($escapedshortcut); if ($escapedentitiesshortuct == $escapedshortcut) { $search = '/((<[^>]*)|' . $escapedshortcut . ')/e'; } else { $search = '/((<[^>]*)|' . $escapedshortcut . '|' . $escapedentitiesshortuct . ')/e'; } $replacer = _rex_glossar_parse_replace_format($replaceformat, array('lang' => $language, 'desc' => $description, 'short' => $shortcut)); $replace = '"\\2"=="\\1" && strpos( "\\1", "<' . $replacetag . '>") === false ? "\\1":"' . $replacer . '"'; if ($casesense == 0) { $search .= 'i'; } $searches[] = $search; $replaces[] = $replace; $sql->next(); } // Ersetzungen durchführen $body = stripslashes(preg_replace($searches, $replaces, $body)); // Vorher ausgeschlossene Bereiche wieder einpflegen $body = str_replace($back_srch, $back_rplc, $body); return $header . $body; }
function glossar_replace($string) { global $REX, $mypage; $I18N_GLOSSAR = new i18n($REX[LANG], $REX[INCLUDE_PATH] . "/addons/{$mypage}/lang/"); // CREATE LANG OBJ FOR THIS ADDON $sql = new sql(); $sql->setQuery("select * from rex__glossar order by shortcut"); for ($i = 0; $i < $sql->getRows(); $i++) { $language = $sql->getValue("language"); if ($language == "0") { $language = $I18N_GLOSSAR->msg('lang_de_short'); } elseif ($language == "1") { $language = $I18N_GLOSSAR->msg('lang_en_short'); } else { $language = $I18N_GLOSSAR->msg('lang_fr_short'); } $id = $sql->getValue("short_id"); $shortcut = htmlentities($sql->getValue("shortcut")); $escapedshortcut = str_replace('.', '\\.', $shortcut); $description = htmlentities($sql->getValue("description")); $language = trim($language); $casesense = $sql->getValue("casesense"); $search = "/((<[^>]*)|{$escapedshortcut})/e"; $replace = '"\\2"=="\\1"? "\\1":"<span lang=\\"' . $language . '\\" xml:lang=\\"' . $language . '\\" title=\\"' . $language . ': ' . $description . '\\" class=\\"shortcut\\">' . $shortcut . '</span>"'; $subject = $string; if ($casesense == 0) { $search .= 'i'; } $string = preg_replace($search, $replace, $subject); $sql->counter++; } return $string; }
function rex_opf($params) { global $REX; $content = $params['subject']; $gv = new sql(); // $gv->debugsql = 1; $gv->setQuery("select * from rex_opf_lang where clang='" . $REX['CUR_CLANG'] . "'"); for ($i = 0; $i < $gv->getRows(); $i++) { $content = str_replace($gv->getValue("replacename"), $gv->getValue("name"), $content); $gv->next(); } return $content; }
/** * Gibt den HTML Content zurück */ function get() { $table = $this->getTable(); $field = $this->getField(); $foreignField = $this->getForeignField(); $value = $this->formatValue(); $qry = 'SELECT ' . $field . ' FROM ' . $table . ' WHERE ' . $foreignField . ' = "' . $value . '"'; $sql = new sql(); // $sql->debugsql = true; $sql->setQuery($qry); if ($sql->getRows() == 1) { return $sql->getValue($field); } return ''; }
function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0) { foreach ($email_elements as $k => $v) { if ($this->elements[3] == $k) { $value = $v; } } $gd = new sql(); // $gd->debugsql = 1; $gd->setQuery('select * from ' . $this->elements[1] . ' where ' . $this->elements[2] . '="' . addslashes($v) . '"'); if ($gd->getRows() == 1) { $ar = $gd->get_array(); foreach ($ar[0] as $k => $v) { $email_elements[$k] = $v; } } return; }
function getArticlesByType($article_type_id, $ignore_offlines = false, $clang = false) { global $REX; if ($clang === false) { $clang = $REX[CUR_CLANG]; } $offline = $ignore_offlines ? " and status = 1 " : ""; $artlist = array(); $sql = new sql(); $sql->setQuery("select " . implode(',', OORedaxo::getClassVars()) . " FROM rex_article WHERE type_id = '{$article_type_id}' AND clang='{$clang}' {$offline}"); for ($i = 0; $i < $sql->getRows(); $i++) { foreach (OORedaxo::getClassVars() as $var) { $article_data['_' . $var] = $sql->getValue($var); } $artlist[] = new OOArticle($article_data); $sql->next(); } return $artlist; }
function stat() { $this->MAIN['stamp'] = array(); $this->MAIN['ip'] = array(); $this->MAIN['pageviews'] = array(); // which pages in an array under this one $this->MAIN['useragent'] = array(); $this->MAIN['hostname'] = array(); $this->MAIN['referer'] = array(); $this->BROWSER['type'] = array(); $this->BROWSER['os'] = array(); $this->REFERER = array(); $this->SEARCH['engine'] = array(); $this->SEARCH['words'] = array(); $this->evalshows = array("REX_EVAL_DAY", "REX_EVAL_MONTH", "REX_EVAL_ALLARTICLE", "REX_EVAL_TOP10ARTICLE", "REX_EVAL_WORST10ARTICLE", "REX_EVAL_LAENDER", "REX_EVAL_SUCHMASCHINEN", "REX_EVAL_REFERER", "REX_EVAL_BROWSER", "REX_EVAL_OPERATINGSYSTEM", "REX_EVAL_SEARCHWORDS"); $this->evalsnipps = array(); $statartikel = new sql(); $statartikel->setQuery("SELECT id,name FROM rex_article"); for ($i = 0; $i < $statartikel->getRows(); $i++) { $this->ART[$statartikel->getValue("id")] = $statartikel->getValue("name"); $statartikel->next(); } }
// ----------------------------- / FILE UPLOAD $meta_sql->update(); $article->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where id='{$article_id}' and clang='{$clang}'"); if (!isset($message)) { $message = ''; } $err_msg = $I18N->msg("metadata_updated") . $message; rex_generateArticle($article_id); } $typesel = new select(); $typesel->set_name("type_id"); $typesel->set_style("width:100%;"); $typesel->set_size(1); $typesql = new sql(); $typesql->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article_type order by name"); for ($i = 0; $i < $typesql->getRows(); $i++) { $typesel->add_option($typesql->getValue("name"), $typesql->getValue("type_id")); $typesql->next(); } $typesel->set_selected($article->getValue("type_id")); // Artikeltyp-Auswahl nur anzeigen, wenn mehr als ein Typ vorhanden ist if ($typesql->getRows() <= 1) { $out = "<input type=hidden name=type_id value=0>"; } else { $out = "<tr><td class=grey>" . $I18N->msg("article_type_list_name") . "</td><td class=grey>" . $typesel->out() . "</td></tr>"; } echo " <table border=0 cellpadding=5 cellspacing=1 width=100%>\n <form action=index.php method=post ENCTYPE=multipart/form-data name=REX_FORM>\n <input type=hidden name=page value=content>\n <input type=hidden name=article_id value='{$article_id}'>\n <input type=hidden name=mode value='meta'>\n <input type=hidden name=save value=1>\n <input type=hidden name=clang value={$clang}>\n <input type=hidden name=ctype value={$ctype}>\n <tr>\n <td colspan=2>" . $I18N->msg("general") . "</td>\n </tr>"; if (isset($err_msg) and $err_msg != "") { echo '<tr><td colspan="2" class="warning"><font class="warning">' . $err_msg . '</font></td></tr>'; } function selectdate($date, $extens)
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; }
<?php echo "<table border=0 cellpadding=0 cellspacing=0 width=770 ><tr><td class=grey><br>"; $boards = new sql(); $boards->setQuery("select distinct board_id from rex_5_board"); if ($boards->getRows() > 0) { $currentboardname = ""; echo "<table border=0 cellpadding=5 cellspacing=1 width=100%>"; for ($i = 0; $i < $boards->getRows(); $i++) { $boardname = $boards->getValue("board_id"); echo "<tr><td class=dgrey><b><a href=index.php?page=community&subpage=board&FORM[boardname]={$boardname} class=black>{$boardname}</a></b></td></tr>"; if ($FORM[boardname] == $boardname) { $currentboardname = $boardname; } $boards->next(); } echo "</table><br>"; if ($currentboardname != "") { $board = new rex_com_board(); $board->addLink("page", "community"); $board->addLink("subpage", "board"); $board->setBoardname($currentboardname); // $board->setUserjoin("rex_2_user on rex_5_board.user_id=rex_2_user.id","rex_2_user.login"); $board->setAdmin(); $board->setAnonymous(true); echo $board->showBoard(); } } else { echo " Kein Board wurde eingetragen !<br>"; } echo "<br></td></tr></table>";
function generateCategoryList($re_id) { global $REX; $GC = new sql(); $GC->setQuery("select *\r\n\t\t\tfrom rex_category as cat1\r\n\t\t\tleft join rex_article on cat1.id=rex_article.category_id\r\n\t\t\twhere\r\n\t\t\tcat1.re_category_id='{$re_id}' and\r\n\t\t\tcat1.id=rex_article.category_id and\r\n\t\t\trex_article.startpage=1\r\n\t\t\torder by cat1.prior,cat1.name"); $content = "<?"; for ($i = 0; $i < $GC->getRows(); $i++) { $id = $GC->getValue("cat1.id"); $content .= "\r\n\$REX[RECAT][{$re_id}][] = \"" . $GC->getValue("cat1.id") . "\";\r\n\r\n\$REX[CAT][{$id}][name] = \"" . addslashes($GC->getValue("cat1.name")) . "\";\r\n\$REX[CAT][{$id}][re_category_id] = \"" . addslashes($GC->getValue("cat1.re_category_id")) . "\";\r\n\$REX[CAT][{$id}][category_id] = \"{$id}\";\r\n\$REX[CAT][{$id}][prior] = \"" . addslashes($GC->getValue("cat1.prior")) . "\";\r\n\$REX[CAT][{$id}][path] = \"" . addslashes($GC->getValue("cat1.path")) . "\";\r\n\$REX[CAT][{$id}][status] = \"" . addslashes($GC->getValue("cat1.status")) . "\";\r\n\$REX[CAT][{$id}][article_id] = \"" . addslashes($GC->getValue("rex_article.id")) . "\";\r\n\r\n"; $GC->next(); } $content .= "?>"; $fp = fopen($REX[INCLUDE_PATH] . "/generated/categories/" . $re_id . ".list.category", "w"); fputs($fp, $content); fclose($fp); }
function generateAll() { global $REX, $I18N; // ----------------------------------------------------------- generiere templates deleteDir($REX[INCLUDE_PATH] . "/generated/templates", 0); // mkdir($REX[INCLUDE_PATH]."/generated/templates",0664); $gt = new sql(); $gt->setQuery("select * from rex_template"); for ($i = 0; $i < $gt->getRows(); $i++) { $fp = fopen($REX[INCLUDE_PATH] . "/generated/templates/" . $gt->getValue("rex_template.id") . ".template", "w"); fputs($fp, $gt->getValue("rex_template.content")); fclose($fp); $gt->next(); } // ----------------------------------------------------------- generiere artikel deleteDir($REX[INCLUDE_PATH] . "/generated/articles", 0); // mkdir($REX[INCLUDE_PATH]."/generated/articles",0664); $gc = new sql(); $gc->setQuery("select * from rex_article"); for ($i = 0; $i < $gc->getRows(); $i++) { generateArticle($gc->getValue("id")); $gc->next(); } // ----------------------------------------------------------- generiere categorien deleteDir($REX[INCLUDE_PATH] . "/generated/categories", 0); // mkdir($REX[INCLUDE_PATH]."/generated/categories",0664); $gcc = new sql(); $gcc->setQuery("select * from rex_category"); for ($i = 0; $i < $gcc->getRows(); $i++) { generateCategory($gcc->getValue("id")); $gcc->next(); } // generateCategories(); $MSG = $I18N->msg('articles_generated') . " " . $I18N->msg('old_articles_deleted'); return $MSG; }
function read() { global $REX; $sql = new sql(); // $sql->debugsql = true; $sql->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . '51_cache_article WHERE article_id=' . $this->article_id . ' AND clang=' . $this->clang); $this->vars = array(); if ($sql->getRows() > 0) { $result = $sql->get_array(); $this->vars = $result[0]; } }
echo '<br />' . nl2br(htmlspecialchars($file_description)) . '<br /><br />' . $file_stamp . '|' . $file_updateuser . '</td>' . "\n"; echo ' <td valign="top" class="grey">' . $opener_link . '</td>' . "\n"; echo '</tr>' . "\n\n"; $files->next(); } if ($files->getRows() == 0) { // ----- no items found // print "<tr><td colspan=5> </td>"; print "<tr>\r\n <td class=grey align=center> </td>\r\n <td class=grey colspan=3>" . $I18N->msg('pool_nomediafound') . "</td>\r\n </tr>"; } elseif ($PERMALL) { print "</table>"; print "<table class=rex border=0 cellpadding=5 cellspacing=1 style='width:100%'>\n"; // ----- move and delete selected items print "<tr>\r\n <td align=center class=icon><!-- " . $I18N->msg('pool_select_all') . " --><input type=checkbox name=checkie value=0 onClick=\"SetAllCheckBoxes('rex_file_list','selectedmedia[]',this)\"></td>"; $filecat = new sql(); $filecat->setQuery("SELECT * FROM " . $REX['TABLE_PREFIX'] . "file_category ORDER BY name ASC LIMIT 1"); if ($filecat->getRows() > 0) { print "\r\n <!-- <td class=grey><b>" . $I18N->msg('pool_selectedmedia') . "</b> </td>-->\r\n <td class=grey>" . $cats_sel->out() . "</td>\r\n <td class=grey><input type=submit value=\"" . $I18N->msg('pool_changecat_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='updatecat_selectedmedia';\"></td>\r\n <td class=grey width=150><input type=submit value=\"" . $I18N->msg('pool_delete_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='delete_selectedmedia';return confirm('" . $I18N->msg('delete') . " ?');\"></td>\r\n "; } else { print "\r\n <td class=grey> </td>\r\n <td class=grey width=150><input type=submit value=\"" . $I18N->msg('pool_delete_selectedmedia') . "\" onclick=\"document.rex_file_list.media_method.value='delete_selectedmedia';return confirm('" . $I18N->msg('delete') . " ?');\" ></td>\r\n "; } print "</tr>"; } print "</form>"; print "</table>"; } echo "</body></html>"; function converDescription($description) { return htmlspecialchars($description); }
/** * Erstellt eine Clang * * @param $id Id der Clang * @param $name Name der Clang */ function rex_addCLang($id, $name) { global $REX; $REX['CLANG'][$id] = $name; $content = "// --- DYN\n\r"; reset($REX['CLANG']); for ($i = 0; $i < count($REX['CLANG']); $i++) { $cur = key($REX['CLANG']); $val = current($REX['CLANG']); $content .= "\n\r\$REX['CLANG']['{$cur}'] = \"{$val}\";"; next($REX['CLANG']); } $content .= "\n\r// --- /DYN"; $file = $REX['INCLUDE_PATH'] . "/clang.inc.php"; $h = fopen($file, "r"); $fcontent = fread($h, filesize($file)); $fcontent = ereg_replace("(\\/\\/.---.DYN.*\\/\\/.---.\\/DYN)", $content, $fcontent); fclose($h); $h = fopen($file, "w+"); fwrite($h, $fcontent, strlen($fcontent)); fclose($h); @chmod($file, 0777); $add = new sql(); $add->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where clang='0'"); $fields = $add->getFieldnames(); for ($i = 0; $i < $add->getRows(); $i++) { $adda = new sql(); // $adda->debugsql = 1; $adda->setTable($REX['TABLE_PREFIX'] . "article"); reset($fields); while (list($key, $value) = each($fields)) { if ($value == "pid") { echo ""; } else { if ($value == "clang") { $adda->setValue("clang", $id); } else { if ($value == "status") { $adda->setValue("status", "0"); } else { $adda->setValue($value, rex_addslashes($add->getValue("{$value}"))); } } } // createuser // updateuser } $adda->insert(); $add->next(); } $add = new sql(); $add->query("insert into " . $REX['TABLE_PREFIX'] . "clang set id='{$id}',name='{$name}'"); // ----- EXTENSION POINT rex_register_extension_point('CLANG_ADDED', '', array('id' => $id, 'name' => $name)); rex_generateAll(); }
$sel_status->add_option($ASTATUS[2], "2"); $sel_status->set_size(1); $sel_status->set_selected($status); echo "\t\n\t\t\t<form action=index.php method=post>\n\t\t\t<input type=hidden name=page value=module>\n\t\t\t<input type=hidden name=subpage value=actions>\n\t\t\t<input type=hidden name=function value={$function}>\n\t\t\t<input type=hidden name=save value=ja>\n\t\t\t<input type=hidden name=action_id value={$action_id}>\n\t\t\t<tr>\n\t\t\t\t<td width=100 class=grey>" . $I18N->msg("action_name") . "</td>\n\t\t\t\t<td class=grey colspan=2><input type=text size=10 name=mname value=\"" . htmlentities($mname) . "\" style='width:100%;'></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=top class=grey>" . $I18N->msg("input") . "</td>\n\t\t\t\t<td class=grey colspan=2><textarea cols=20 rows=70 name=actioninput style='width:100%; height: 150;'>" . htmlentities($actioninput) . "</textarea></td>\n\t\t\t</tr>"; echo "\n\t\t\t<tr>\n\t\t\t\t<td align=right valign=middle class=grey>{$PREPOST['0']}/{$PREPOST['1']}</td>\n\t\t\t\t<td valign=middle class=grey colspan=2>" . $sel_prepost->out() . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align=right valign=middle class=grey>STATUS</td>\n\t\t\t\t<td valign=middle class=grey colspan=2>" . $sel_status->out() . "</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=grey> </td>\n\t\t\t\t<td class=grey width=200><input type=submit value='" . $I18N->msg("save_action_and_quit") . "'></td>\n\t\t\t\t<td class=grey>"; if ($function != "add") { echo "<input type=submit name=goon value='" . $I18N->msg("save_action_and_continue") . "'>"; } echo "</td>\n\t\t\t</tr>\n\t\t\t</form>\n\t\t\t</table>"; $OUT = false; } } if ($OUT) { // ausgabe actionsliste ! echo "<table border=0 cellpadding=5 cellspacing=1 width=770>\n\t\t<tr>\n\t\t\t<th width=30><a href=index.php?page=module&subpage=actions&function=add><img src=pics/modul_plus.gif width=16 height=16 border=0></a></th>\n\t\t\t<th align=left width=300>" . $I18N->msg("action_name") . "</th>\n\t\t\t<th align=left>" . $I18N->msg("action_functions") . "</th>\n\t\t</tr>\n\t\t"; if ($message != "") { echo "<tr><td align=center class=warning><img src=pics/warning.gif width=16 height=16></td><td colspan=4 class=warning>{$message}</td></tr>"; } $sql = new sql(); $sql->setQuery("select * from rex_action order by name"); for ($i = 0; $i < $sql->getRows(); $i++) { echo "\t<tr bgcolor=#eeeeee>\n\t\t\t\t<td class=grey align=center><a href=index.php?page=module&subpage=actions&action_id=" . $sql->getValue("id") . "&function=edit><img src=pics/modul.gif width=16 height=16 border=0></a></td>\n\t\t\t\t<td class=grey><a href=index.php?page=module&subpage=actions&action_id=" . $sql->getValue("id") . "&function=edit>" . htmlentities($sql->getValue("name")) . "</a>"; if ($REX_USER->isValueOf("rights", "expertMode[]")) { echo " [" . $sql->getValue("id") . "]"; } echo " [" . $PREPOST[$sql->getValue("prepost")] . "|" . $ASTATUS[$sql->getValue("status")] . "]"; echo "</td>\n\t\t\t\t<td class=grey><a href=index.php?page=module&subpage=actions&action_id=" . $sql->getValue("id") . "&function=delete>" . $I18N->msg("action_delete") . "</a></td>\n\t\t\t</tr>"; $sql->counter++; } echo "</table>"; }
function getChildren($ignore_offlines = false) { $off = $ignore_offlines ? " and status = 1 " : ""; $catlist = array(); $sql = new sql(); $sql->setQuery("select id, name, description, func, re_category_id, prior, path, status from rex_category where re_category_id = {$this->_id} {$off} order by prior"); for ($i = 0; $i < $sql->getRows(); $i++) { $catlist[] = new OOCategory($sql->getValue("id"), $sql->getValue("name"), $sql->getValue("description"), $sql->getValue("func"), $sql->getValue("re_category_id"), $sql->getValue("prior"), $sql->getValue("path"), $sql->getValue("status")); $sql->next(); } return $catlist; }
function addSlice($I_ID, $module_id) { global $REX, $FORM, $I18N; $FILE1 = ""; $FILE2 = ""; $FILE3 = ""; $FILE4 = ""; $FILE5 = ""; $FILE6 = ""; $FILE7 = ""; $FILE8 = ""; $FILE9 = ""; $FILE10 = ""; $MOD = new sql(); $MOD->setQuery("select * from rex_modultyp where id={$module_id}"); if ($MOD->getRows() != 1) { $slice_content = "<table width=100% cellspacing=0 cellpadding=5 border=0><tr><td class=dblue>" . $I18N->msg('module_doesnt_exist') . "</td></tr></table>"; } else { $slice_content = "<a name=addslice></a><table width=100% cellspacing=0 cellpadding=5 border=0>\n <tr><td class=dblue><b>" . $I18N->msg('add_block') . "</b></td></tr>\n <tr><td class=blue>Modul: <b>" . $MOD->getValue("name") . "</b></td></tr>\n <tr>\n <td class=lblue>\n <form ENCTYPE=multipart/form-data action=index.php#slice{$I_ID} method=post name=REX_FORM>\n <input type=hidden name=article_id value={$this->article_id}>\n <input type=hidden name=page value=content>\n <input type=hidden name=mode value={$this->mode}>\n <input type=hidden name=slice_id value={$I_ID}>\n <input type=hidden name=function value=add>\n <input type=hidden name=module_id value={$module_id}>\n <input type=hidden name=save value=1>\n " . $MOD->getValue("eingabe") . "\n <br><input type=submit value='" . $I18N->msg('add_block') . "'></form>"; $slice_content = $this->sliceClear($slice_content); $slice_content .= "</td></tr></table>"; } return $slice_content; }
$tabs->setquery("SHOW TABLES"); $del = new sql; for($i=0;$i<$tabs->rows;$i++,$tabs->next(),$del->flush()) if($tabs->getvalue("Tables_in_".$DB[1][NAME]) != "rex_user") $del->setquery("DROP TABLE ".$tabs->getvalue("Tables_in_".$DB[1][NAME])); */ $add = new sql(); foreach ($all as $hier) { $add->setquery(Trim(str_replace("||||||+N+||||||", "\n", $hier), ";")); $add->flush(); } $msg = $I18N_ADDON->msg("database_imported") . ". " . $I18N_ADDON->msg("entry_count", count($all)) . "<br>"; unset($REX[CLANG]); $gl = new sql(); $gl->setQuery("select * from rex_clang"); for ($i = 0; $i < $gl->getRows(); $i++) { $id = $gl->getValue("id"); $name = $gl->getValue("name"); $REX[CLANG][$id] = $name; $gl->next(); } $msg .= rex_generateAll(); } if ($impname == "") { @unlink($file_temp); } } else { $msg = $I18N_ADDON->msg("file_could_not_be_uploaded") . " " . $I18N_ADDON->msg("you_have_no_write_permission_in", "addons/{$page}/files/") . " <br>"; } } } elseif ($function == "fileimport") {
<?php $SF = true; $mypage = "community"; $subpage = "messages"; $table = " rex_5_user_mail"; $bezeichner = "Private Nachricht"; $userReplaceValue = ""; $fromsql = new sql(); $fromsql->setQuery("SELECT id,user_login FROM rex_5_user"); if ($fromsql->getRows() > 0) { for ($i = 0; $i < $fromsql->getRows(); $i++) { $userReplaceValue .= $fromsql->getValue("id") . "|" . $fromsql->getValue("user_login") . "|"; if (trim(strtoupper($FORM['csuchtxt'])) == trim(strtoupper($fromsql->getValue("user_login")))) { $FORM['csuchid'][] = $fromsql->getValue("id"); } $fromsql->next(); } $userReplaceValue = substr($userReplaceValue, 0, strlen($userReplaceValue) - 1); } //------------------------------> Poll Anlegen|Editieren if ($func == "edit") { $mita = new rexform(); $mita->setWidth(770); $mita->setLabelWidth(160); $mita->setTablename($table); $mita->setFormtype("edit", "id='" . $oid . "'", "Nachricht wurde nicht gefunden"); $mita->setFormheader("<input type=hidden name=page value=" . $mypage . "><input type=hidden name=subpage value=" . $subpage . "><input type=hidden name=func value=" . $func . " /><input type=hidden name=oid value=" . $oid . ">"); $mita->setShowFormAlways(false); $mita->setValue("subline", "{$bezeichner} edieren", "left", 0); $mita->setValue("showtext", "An", "user_id", 0, "width:100%;'");
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> </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]> 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) . "> </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 . " > </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 showall($next) { global $REX; // ------------- FALLS KEIN ROWSELECT ALLE DATENSAETZE HOLEN UND ANZAHL SETZEN if ($this->rows == "") { $this->sql = new sql($this->DB); $this->sql->setQuery($this->query); $this->rows = $this->sql->getRows(); } $echo = "<table width=770 cellpadding=5 cellspacing=1 border=0 bgcolor=#ffffff>"; $echo .= $this->table_header; // ------------- BLAETTERN if (!($next > 0 && $next <= $this->rows)) { $next = 0; } $list_start = $next; $list_end = $next + $this->list_amount; if ($list_end > $this->rows) { $list_end = $this->rows; } $before = $next - $this->list_amount; if ($before < 0) { $before = 0; } $next = $next + $this->list_amount; if ($next > $this->rows) { $next = $next - $this->list_amount; } if ($next < 0) { $next = 0; } $bhead = $this->blaettern_head; $bhead = str_replace("###LINK_BACK###", $this->addonlink . $before, $bhead); $bhead = str_replace("###LINK_NEXT###", $this->addonlink . $next, $bhead); $bhead = str_replace("###LIST_START###", $list_start, $bhead); $bhead = str_replace("###LIST_END###", $list_end, $bhead); $bhead = str_replace("###LIST_ALL###", $this->rows, $bhead); if ($this->blaettern_top) { $echo .= "<tr><td colspan=" . $this->data_num . " class=lgrey>{$bhead}</td></tr>"; } // ------------ QUERY NEU ERSTELLEN MIT LIMIT $limit = "LIMIT " . $list_start . "," . $this->list_amount; $order = ""; if ($this->order_name != "") { $order = " order by " . $this->order_name . " " . $this->order_type; } elseif ($this->default_order_name != "") { $order = " order by " . $this->default_order_name . " " . $this->default_order_type; } $SQL = new sql($this->DB); $SQL->debugsql = $this->debugsql; $SQL->setQuery("{$this->query} {$order} {$limit}"); // ------------ <TH>HEADLINES $echo .= "<tr>"; for ($i = 1; $i <= $this->data_num; $i++) { $echo .= "<th>"; if ($this->data_order[$i]) { $type = $this->order_type; if ($type == "asc") { $type = "desc"; } else { $type = "asc"; } $echo .= " <a href=" . $this->addonlink . "&" . $this->var_ordername . "=" . $this->data[$i] . "&" . $this->var_ordertype . "=" . $type . "&" . $this->var_next . "={$before}><b>" . $this->data_name[$i] . "</b>" . $this->sort_char . "</a>"; } else { $echo .= $this->data_name[$i]; } $echo .= "</th>"; } $echo .= "</tr>"; // ------------ ERSTELLUNG DER LISTE for ($j = 0; $j < $SQL->getRows(); $j++) { for ($i = 1; $i <= $this->data_num; $i++) { // ----- START: DATENSATZ $echo .= "<td class=grey valign=top " . $this->td[$this->data_num] . ">"; // ----- START: FORMAT if (!is_array($this->format[$i])) { $value = htmlentities($SQL->getValue($this->data[$i])); } else { $value = $SQL->getValue($this->data[$i]); $contentvalue = $this->data[$i]; for ($k = 0; $k < count($this->format[$i]); $k++) { switch ($this->format[$i][$k]) { case "link": $linkid = $SQL->getValue($this->format_value2[$i][$k]); $value = '<a href="' . $this->format_value1[$i][$k] . $linkid . $this->format_value3[$i][$k] . '" ' . $this->format_value4[$i][$k] . '>' . $value . '</a>'; break; case "ifvalue": if ($value == $this->format_value1[$i][$k]) { $value = $this->format_value2[$i][$k]; } break; case "ifempty": if ($value == "") { $value = $this->format_value1[$i][$k]; } break; case "prefix": $value = $this->format_value1[$i][$k] . "{$value}"; break; case "suffix": $value = "{$value}" . $this->format_value1[$i][$k]; break; case "callback": $value = call_user_func($this->format_value1[$i][$k], $value); break; case "activestatus": if ($value == 0) { $value = "inactive"; } else { $value = "active"; } break; case "status": if ($value == 0) { $value = "inactive user"; } elseif ($value == 7) { $value = "superadmin"; } elseif ($value > 4) { $value = "admin"; } elseif ($value == 1) { $value = "guest"; } else { $value = "user"; } break; case "dt": $dt = $this->format_value1[$i][$k]; if ($dt == "") { $dt = "M-d Y H:i:s"; } $value = date_from_mydate($value, $dt); break; case "hour": $value = $value . " h"; break; case "minutes": $value = "{$value} min"; break; case "minute2hour": $hours = intval($value / 60); $minutes = ($value - $hours * 60) / 60 * 100; if ($minutes < 10) { $minutes = "0{$minutes}"; } elseif ($minutes == 0) { $minutes = "00"; } $value = "{$hours},{$minutes}"; break; case "date": $format = $this->format_value1[$i][$k]; if ($format == "") { $format = "d.M.Y H:i:s"; } $value = date_from_mydate($value, $format); break; case "time": $value = substr($value, 0, 2) . ":" . substr($value, 2, 2) . ""; break; case "unixToDateTime": $format = $this->format_value1[$i][$k]; if ($format == "") { $format = "d.M.Y H:i:s"; } $value = date($format, $value); break; case "nl2br": $value = nl2br($value); break; case "prozent": $value = "<img src=/pics/p_prozent/" . show_prozent($value) . ".gif height=13 width=50>"; break; case "wrap": $value = $this->format_value1[$i][$k] . $value . $this->format_value2[$i][$k]; break; case "addfield": $value = $value . $this->format_value2[$i][$k] . $SQL->getValue($this->format_value1[$i][$k]) . $this->format_value3[$i][$k]; break; case "clear": $value = ""; break; case "substr": $elements = imap_mime_header_decode($value); $value = ""; for ($l = 0; $l < count($elements); $l++) { // echo "Charset: {$elements[$i]->charset}\n"; $value .= $elements[$l]->text; } $value = substr($value, 0, $this->format_value1[$i][$k]); $value = htmlentities($value); break; case "content": $value = $contentvalue; break; case "size": $value = "<div style='text-align:right;width:auto;'>" . $this->human_file_size($value) . "</div>"; break; case "js": $elements = imap_mime_header_decode($value); $value = ""; for ($l = 0; $l < count($elements); $l++) { // echo "Charset: {$elements[$i]->charset}\n"; $value .= $elements[$l]->text; } if ($value == "") { $value = "<no entry>"; } if ($this->format_value4[$i][$k] == "") { $value = substr($value, 0, 30); } else { if ($this->format_value4[$i][$k] == "nosubstr") { $value = $value; } else { $value = substr($value, 0, $this->format_value4[$i][$k]); } } $value = nl2br(htmlentities($value)); $value = "<a href=javascript:" . $this->format_value1[$i][$k] . $SQL->getValue($this->format_value2[$i][$k]) . $this->format_value3[$i][$k] . ">{$value}</a>"; break; case "boldstatus": // ********************** // Prozer Special: MAIL // zum anzeigen von bold falls TRUE(1) // ********************** $elements = imap_mime_header_decode($value); $value = ""; for ($l = 0; $l < count($elements); $l++) { // echo "Charset: {$elements[$i]->charset}\n"; $value .= $elements[$l]->text; } if ($value == "") { $value = "<no subject entered>"; } $value = substr($value, 0, 30); $value = htmlentities($value); //echo "<!-- ".$SQL->getValue("header")."-->"; if ($SQL->getValue("spam") != 0 && eregi("X-Spam-Flag: YES", $SQL->getValue("header"))) { if (!$SQL->getValue($this->format_value1[$i][$k])) { $value = "<b style=\"color:red\">{$value}</b>"; } else { $value = "<span style=\"color:red\">{$value}</span>"; } } elseif (!$SQL->getValue($this->format_value1[$i][$k])) { $value = "<b>{$value}</b>"; } break; case "image": // ********************** // Prozer Special // zum anzeigen von bold falls TRUE(1) // ********************** if ($SQL->getValue($this->format_value1[$i][$k]) > 0) { $value = $this->format_value2[$i][$k] . " " . htmlentities($value); } else { $value = " "; } break; case "statustodo": // ********************** // Prozer Special // zum anzeigen von bold falls TRUE(1) // ********************** if ($value == 0) { $value = "done"; } elseif ($value == 1) { $value = "in work"; } elseif ($value == 2) { $value = "new"; } break; case "replace_value": $stype = explode("|", $this->format_value1[$i][$k]); $lvalue = $value; $defaultvalue = -1; for ($l = 0; $l < count($stype); $l++) { $svalue = $stype[$l]; $l++; $sname = $stype[$l]; if ($svalue === "") { $defaultvalue = $sname; } if ($lvalue == $svalue) { $lvalue = $sname; } } if ($lvalue == $value && $defaultvalue != -1) { $lvalue = $defaultvalue; } $value = $lvalue; break; case "checkbox": $value = "<input onclick=setTRColor('tr{$j}','#f0efeb','#d8dca5',this.checked); type=checkbox name='" . $this->format_value1[$i][$k] . "' value='" . $value . "'>"; break; } } } // if ($value==""){ $value = "-"; } // ----- END: FORMAT $echo .= $value; $echo .= "</td>\n"; // ----- END: DATENSATZ } $echo .= "</tr>"; // ----- END: REIHE $SQL->next(); } if ($this->blaettern_bottom) { $echo .= "<tr><td colspan=" . $this->data_num . " class=lgrey>{$bhead}</td></tr>"; } $echo .= $this->table_footer; $echo .= "</table>"; return $echo; }
function showall($next) { global $REX; // ------------- FALLS KEIN ROWSELECT ALLE DATENSAETZE HOLEN UND ANZAHL SETZEN if ($this->rows == "") { $this->sql = new sql($this->DB); //$this->sql->debugsql = true; $this->sql->setQuery($this->query); $this->rows = $this->sql->getRows(); } $echo = "<table width=770 cellpadding=5 cellspacing=1 border=0 bgcolor=#ffffff>"; $echo .= $this->table_header; // ------------- HEADER $echo .= "<tr><td colspan=" . ($this->data_num + $this->column_num) . " class=lgrey><b>"; // ------------- BLAETTERN if (!($next > 0 && $next <= $this->rows)) { $next = 0; } $list_start = $next; $list_end = $next + $this->list_amount; if ($list_end > $this->rows) { $list_end = $this->rows; } $before = $next - $this->list_amount; if ($before < 0) { $before = 0; } $next = $next + $this->list_amount; if ($next > $this->rows) { $next = $next - $this->list_amount; } if ($next < 0) { $next = 0; } $echo .= "<a href=" . $this->addonlink . "{$before}><img src={$REX['HTDOCS_PATH']}/pics/back.gif width=24 height=13 border=0></a> "; $echo .= "<a href=" . $this->addonlink . "{$next}><img src={$REX['HTDOCS_PATH']}/pics/forward.gif width=24 height=13 border=0></a>"; $echo .= " {$list_start} - {$list_end} of {$this->rows} "; $echo .= "</b></td></tr>"; // ------------ QUERY NEU ERSTELLEN MIT LIMIT $limit = "LIMIT " . $list_start . "," . $this->list_amount; $SQL = new sql($this->DB); $SQL->setQuery("{$this->query} {$limit}"); // ------------ <TH>HEADLINES $echo .= "<tr>"; for ($i = 1; $i <= $this->data_num; $i++) { $echo .= "<th>"; $echo .= $this->data_name[$i]; $echo .= "</th>"; if ($this->column_name[$i] != "") { $echo .= "<th> </th>"; } } $echo .= "</tr>"; // ------------ ERSTELLUNG DER LISTE for ($j = 0; $j < $SQL->getRows(); $j++) { // $echo .= "<tr onmouseover=\"setPointer(this,'#d8dca5')\" onmouseout=\"setPointer(this,'#f0efeb')\">"; $echo .= "<tr id=tr{$j}>"; for ($i = 1; $i <= $this->data_num; $i++) { $echo .= "<td class=grey valign=top>"; switch ($this->format[$i]) { case "replace_value": $stype = explode("|", $this->format_value1[$i]); $value = $SQL->getValue($this->data[$i]); for ($k = 0; $k < count($stype); $k++) { $svalue = $stype[$k]; $k++; $sname = $stype[$k]; if ($SQL->getValue($this->data[$i]) == $svalue) { $value = $sname; } } break; case "activestatus": if ($SQL->getValue($this->data[$i]) == 0) { $value = "inactive"; } else { $value = "active"; } break; case "minute2hour": $hours = intval($SQL->getValue($this->data[$i]) / 60); $minutes = ($SQL->getValue($this->data[$i]) - $hours * 60) / 60 * 100; if ($minutes < 10) { $minutes = "0{$minutes}"; } elseif ($minutes == 0) { $minutes = "00"; } $value = "{$hours},{$minutes}"; break; case "time": $value = substr($SQL->getValue($this->data[$i]), 0, 2) . ":" . substr($SQL->getValue($this->data[$i]), 2, 2) . ""; break; case "unixToDateTime": $value = date("d.M.Y H:i:s", $SQL->getValue($this->data[$i])); break; case "nl2br": $value = nl2br($SQL->getValue($this->data[$i])); break; case "content": $value = $this->data[$i]; break; default: $value = htmlentities($SQL->getValue($this->data[$i])); } if ($value == "") { $value = " "; } if ($this->link_to[$i] != "") { $link = $this->link_to[$i]; $link_field = $this->link_field[$i]; if ($this->link_field[$i] != "") { $value = "<a href=" . $this->link_to[$i] . urlencode($SQL->getValue($link_field)) . " class=yel>{$value}</a>"; } else { $value = value; } } $echo .= $value; $echo .= "</td>\n"; if ($this->column_name[$i] != "") { $link_name = $this->column_link[$i]; $link_field = $this->column_linkadd[$i]; $column_name = $this->column_name[$i]; $column_ausgabe = "<td class=grey valign=top><a href={$link_name}"; $column_ausgabe .= $SQL->getValue($link_field); $column_ausgabe .= $this->column_linkend[$i]; $column_ausgabe .= " class=yel>{$column_name}</a></td>"; $echo .= $column_ausgabe; } } $echo .= "</tr>"; $SQL->next(); } $echo .= $this->table_footer; $echo .= "</table>"; return $echo; }
echo "<br>"; } // ---------------------------------- MODUS 4 | User anlegen ... if ($checkmodus == 4 && $send == 1) { $err_msg = ""; if ($noadmin != 1) { if ($redaxo_user_login == '') { $err_msg .= "Bitte geben Sie das Administratorlogin ein!<br>"; } if ($redaxo_user_pass == '') { $err_msg .= "Bitte geben Sie das Administratorpasswort ein!<br>"; } if ($err_msg == "") { $ga = new sql(); $ga->setQuery("select * from rex_user where login='******'"); if ($ga->getRows() > 0) { $err_msg = "Dieses Login existiert schon !"; } else { $insert = "INSERT INTO rex_user (name,login,psw,rights) VALUES ('Administrator','{$redaxo_user_login}','{$redaxo_user_pass}','structure[all]\r\narticle[5]\r\ntemplate[]\r\nuser[]\r\nnewsletter[]\r\nmodule[php]\r\nmodule[html]\r\nmodule[]\r\nspecials[]\r\n\r\ncommunity[]\r\nimport[]\n\rexport[]\n\radvancedMode[]\n\rstats[]\n\rmediapool[]\n\raction[]\n\r')"; $link = @mysql_connect($DB[1][HOST], $DB[1][LOGIN], $DB[1][PSW]); if (!@mysql_db_query($DB[1][NAME], $insert, $link)) { $err_msg .= "Der Administrator konnte nicht angelegt werden.<br>"; } } } } if ($err_msg == "") { $checkmodus = 5; $send = ""; } }
$ga = new sql(); $ga->setQuery("select * from rex_user where login='******'"); if ($ga->getRows() > 0) { $err_msg = $I18N->msg("setup_042"); } else { $insert = "INSERT INTO rex_user (name,login,psw,rights) VALUES ('Administrator','{$redaxo_user_login}','{$redaxo_user_pass}','admin[]dev[]import[]stats[]moveslice[]')"; $link = @mysql_connect($DB[1][HOST], $DB[1][LOGIN], $DB[1][PSW]); if (!@mysql_db_query($DB[1][NAME], $insert, $link)) { $err_msg .= $I18N->msg("setup_043") . "<br>"; } } } } else { $gu = new sql(); $gu->setQuery("select * from rex_user LIMIT 1"); if ($gu->getRows() == 0) { $err_msg .= $I18N->msg("setup_044") . "<br>"; } } if ($err_msg == "") { $checkmodus = 5; $send = ""; } } if ($checkmodus == 4) { setuptitle($I18N->msg("setup_step4")); echo "<b>" . $I18N->msg("setup_045") . "</b><br><br>\r\n\t\t<table border=0 cellpadding=5 cellspacing=0 width=500>\r\n\t\t<form action=index.php method=post>\r\n\t\t<input type=hidden name=page value=setup>\r\n\t\t<input type=hidden name=checkmodus value=4>\r\n\t\t<input type=hidden name=send value=1>\r\n\t\t<input type=hidden name=lang value={$lang}>\r\n\t\t"; if ($err_msg != "") { echo "<tr><td class=warning colspan=2>{$err_msg}</td></tr><tr><td></td></tr>"; } if ($dbanlegen == 1) {
function getNewArticles($number_of_articles, $ignore_startpages = true, $ignore_offlines = true) { global $REX; $off = $ignore_offlines ? " and status = 1 " : ""; $nostart = $ignore_startpages ? " and startpage = 0 and id != {$REX[STARTARTIKEL_ID]}" : ""; $limit = " LIMIT 0, {$number_of_articles} "; $artlist = array(); $sql = new sql(); $sql->setQuery("select id,name,beschreibung,attribute,file,category_id,type_id,startpage,prior,path,status,online_von,online_bis,erstelldatum,suchbegriffe,template_id,checkbox01,checkbox02,checkbox03,checkbox04 from rex_article where 1=1 {$off} {$nostart} order by erstelldatum desc {$limit}"); for ($i = 0; $i < $sql->getRows(); $i++) { $artlist[] = new OOArticle($sql->getValue("id"), $sql->getValue("name"), $sql->getValue("beschreibung"), $sql->getValue("attribute"), $sql->getValue("file"), $sql->getValue("category_id"), $sql->getValue("type_id"), $sql->getValue("startpage"), $sql->getValue("prior"), $sql->getValue("path"), $sql->getValue("status"), $sql->getValue("online_von"), $sql->getValue("online_bis"), $sql->getValue("erstelldatum"), $sql->getValue("suchbegriffe"), $sql->getValue("template_id"), $sql->getValue("checkbox01"), $sql->getValue("checkbox02"), $sql->getValue("checkbox03"), $sql->getValue("checkbox04")); $sql->next(); } return $artlist; }
function getNextSlice() { global $REX; $table = ''; $table = $REX['TABLE_PREFIX'] . "article_slice"; $sql = new sql(); $query = <<<EOD SELECT id,re_article_slice_id,value1,value2,value3,value4,value5,value6, value7,value8,value9,value10,file1,file2,file3,file4,file5,file6, file7,file8,file9,file10,link1,link2,link3,link4,link5,link6,link7, link8,link9,link10,php,html,article_id,modultyp_id FROM {$table} WHERE re_article_slice_id = {$this->_id} EOD; $sql->setQuery($query); if ($sql->getRows() == 1) { return new OOArticleSlice($sql->getValue("id"), $sql->getValue("re_article_slice_id"), $sql->getValue("value1"), $sql->getValue("value2"), $sql->getValue("value3"), $sql->getValue("value4"), $sql->getValue("value5"), $sql->getValue("value6"), $sql->getValue("value7"), $sql->getValue("value8"), $sql->getValue("value9"), $sql->getValue("value10"), $sql->getValue("file1"), $sql->getValue("file2"), $sql->getValue("file3"), $sql->getValue("file4"), $sql->getValue("file5"), $sql->getValue("file6"), $sql->getValue("file7"), $sql->getValue("file8"), $sql->getValue("file9"), $sql->getValue("file10"), $sql->getValue("link1"), $sql->getValue("link2"), $sql->getValue("link3"), $sql->getValue("link4"), $sql->getValue("link5"), $sql->getValue("link6"), $sql->getValue("link7"), $sql->getValue("link8"), $sql->getValue("link9"), $sql->getValue("link10"), $sql->getValue("php"), $sql->getValue("html"), $sql->getValue("article_id"), $sql->getValue("modultyp_id")); } return null; }
<?php // changed 4.4.04 Carsten Eckelmann <*****@*****.**> $KAT = new sql(); $KATs = new sql(); $KATs->setQuery("select * from rex_category"); $KATlink = "index.php?page=structure"; $KATout = ""; $KATebene = 0; $KATcategory_id = $category_id; $KATSQLpath = ""; $KatMaxEbenen = 5; for ($ii = 0; $ii < $KatMaxEbenen; $ii++) { $KATs->counter = 0; for ($ik = 0; $ik < $KATs->getRows(); $ik++) { if ($KATcategory_id == $KATs->getValue("id")) { if ($REX_USER->isValueOf("rights", "structure[{$KATcategory_id}]")) { $STRUCTURE_PERM = TRUE; } if ($REX_USER->isValueOf("rights", "expertMode[]")) { $add_on = " [" . $KATs->getValue("id") . "]"; } else { $add_on = ""; } $KATout = " : <a href=index.php?page=structure&category_id=" . $KATs->getValue("id") . ">" . $KATs->getValue("name") . "</a>{$add_on}" . $KATout; $KATSQLpath = "-" . $KATs->getValue("id") . $KATSQLpath; $KATcategory_id = $KATs->getValue("re_category_id"); if ($KATs->getValue("id") == $category_id) { $re_category_id = $KATs->getValue("re_category_id"); } $KATebene++;
function REX_SEARCH($searchtxt, $surroundchars = 20, $categories = "", $surround_tag_start = "<b>", $surround_tag_end = "</b>") { ###### CHECK WHICH PATHES SHOULD BE SEARCHED if (!is_array($categories)) { $ADD_AREA .= "AND rex_article.path like '%-%'"; } else { $ADD_AREA = "AND ("; foreach ($categories as $var) { $ADD_AREA .= " rex_article.path like '%-{$var}%' OR "; } $ADD_AREA = substr($ADD_AREA, 0, -3) . ")"; } ##### TRIM SEARCHTXT $searchtxt = trim($searchtxt, " "); ##### CHECK IF SEARCH STRING IS LONG ENOUGH if (strlen($searchtxt) < 40 and strlen($searchtxt) > 2) { ##### EXPLODE SEARCH STRING $words = explode(" ", $searchtxt); $words_count = 0; if (count($words) > 3) { $words_count = 3; $RETURN[msg] = "Es wurden nur die ersten 3 Begriffe benutzt"; } else { $words_count = count($words); } ##### START SQL CLASS $SUCHE = new sql(); #### SEARCH FOR ALL KEYWORDS for ($i = 0; $i < $words_count; $i++) { $SUCHE->flush(); $KEYWORD = current($words); #### SQL QUERY $sql = "\r\n\t SELECT\r\n\r\n\t rex_article.id,rex_article.name,rex_article.beschreibung,\r\n\r\n\t\t\trex_article_slice.value1,rex_article_slice.value2,rex_article_slice.value3,\r\n\t\t\trex_article_slice.value4,rex_article_slice.value5,rex_article_slice.value6,\r\n\t\t\trex_article_slice.value7,rex_article_slice.value8,rex_article_slice.value9,\r\n\r\n\t (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.name,' ',',')) * 10) +\r\n\t (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.beschreibung,' ',',')) * 5) +\r\n\t (FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article.suchbegriffe,' ',',')) * 5) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value1,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value2,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value3,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value4,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value5,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value6,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value7,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value8,' ',',')) +\r\n\t FIND_IN_SET('{$KEYWORD}',REPLACE(rex_article_slice.value9,' ',','))\r\n\t AS COUNTWORD\r\n\r\n\t FROM rex_article_slice\r\n\r\n\t LEFT JOIN rex_article ON rex_article.id=rex_article_slice.article_id\r\n\r\n\t WHERE\r\n\r\n\t (\r\n\t rex_article.name LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article.beschreibung LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article.suchbegriffe LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value1 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value2 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value3 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value4 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value5 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value6 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value7 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value8 LIKE ('%{$KEYWORD}%') OR\r\n\t rex_article_slice.value9 LIKE ('%{$KEYWORD}%')\r\n\t )\r\n\r\n\t AND status = 1\r\n\r\n\t\t\t{$ADD_AREA}\r\n\r\n\t GROUP BY id\r\n\r\n\t ORDER BY COUNTWORD DESC\r\n\r\n\t LIMIT 0,50\r\n\r\n\t "; $SUCHE->setQuery($sql); $count_limit = 0; ###### GO THROUGH RESULTS for ($j = 0; $j < $SUCHE->getRows(); $j++) { $ART[$SUCHE->getValue("rex_article.id")][ID] = $SUCHE->getValue("rex_article.id"); $ART[$SUCHE->getValue("rex_article.id")][NAME] = $SUCHE->getValue("rex_article.name"); $ART[$SUCHE->getValue("rex_article.id")][DESC] = $SUCHE->getValue("rex_article.beschreibung"); $ART[$SUCHE->getValue("rex_article.id")][COUNTWORD] = $SUCHE->getValue("COUNTWORD"); $ART[$SUCHE->getValue("rex_article.id")][URL] = $SUCHE->getValue("rex_article.id") . "-" . ModRewriteName($SUCHE->getValue("rex_article.name")); ###### CHECK OCURRENCE OF KEYWORD for ($val = 1; $val < 10; $val++) { $regex = "/\\b.{0," . $surroundchars . "}" . $KEYWORD . ".{0," . $surroundchars . "}\\b/im"; preg_match_all($regex, strip_tags($SUCHE->getValue("rex_article_slice.value" . $val)), $matches); if ($matches[0][0] != '') { $ART_REGEX[$SUCHE->getValue("rex_article.id")] .= "... " . implode($matches[0], " ... "); } } $SUCHE->next(); } $SEARCH_WORDS[] = $KEYWORD; next($words); } if (is_array($ART_REGEX)) { $replace_string = implode("|", $SEARCH_WORDS); foreach ($ART_REGEX as $key => $var) { $ART[$key][DESC_REGEX] = preg_replace("/(" . $replace_string . ")/im", $surround_tag_start . "\\1" . $surround_tag_end, $var) . " ..."; } } } return $ART; }