本文整理汇总了PHP中sql::next方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::next方法的具体用法?PHP sql::next怎么用?PHP sql::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql
的用法示例。
在下文中一共展示了sql::next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rex_opf_sync
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();
}
}
示例2: rex_glossar_replace
/**
* 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;
}
示例3: getAll
public static function getAll()
{
if (!count(self::$all)) {
$sql = new sql();
$sql->query('SELECT name FROM ' . sql::table('addons') . ' WHERE `install` = 1 AND `active` = 1')->result();
while ($sql->isNext()) {
self::$all[] = $sql->get('name');
$sql->next();
}
}
return self::$all;
}
示例4: sql
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;
}
示例5: getArticlesByType
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;
}
示例6: searchArticles
function searchArticles($search)
{
global $REX;
$strings = explode(" ", $search);
$counter = 0;
foreach ($strings as $s) {
if ($counter != 0) {
$add .= " AND ";
}
$add .= "( name like '%{$s}%' OR description like '%{$s}%' OR detaildesc like '%{$s}%' OR artnr like '%{$s}%')";
$counter++;
}
$sql = new sql();
$sql->debugsql = 0;
$sql->setQuery("SELECT * FROM " . $REX[ADDON][tbl][art]["simple_shop"] . "\r\n\t\t\twhere clang='" . $clang . "' AND\r\n\t\t\tstatus>0 AND " . $add . " ORDER BY name");
$return = array();
for ($i = 0; $i < $sql->rows; $i++) {
$return[] = new shop_article($sql->getValue("id"), $sql->getValue("clang"), $sql->getValue("name"), $sql->getValue("path"), $sql->getValue("category"), $sql->getValue("description"), $sql->getValue("artnr"), $sql->getValue("mwst"), $sql->getValue("price"), $sql->getValue("old_price"), $sql->getValue("deliver_price"), $sql->getValue("detaildesc"), $sql->getValue("thumbnail"), $sql->getValue("picture"), $sql->getValue("relation_1"), $sql->getValue("relation_2"), $sql->getValue("relation_3"), $sql->getValue("prio"), $sql->getValue("status"), $sql->getValue("instock"), $sql->getValue("stockinfo"));
$sql->next();
}
return $return;
}
示例7: stat
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();
}
}
示例8: select
$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)
{
$date = date("Ymd", $date);
示例9: showForm
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 {
//.........这里部分代码省略.........
示例10: sql
} else {
echo "<td align=right class=grey><input type=checkbox name=checkbox01 value=1></td>";
}
echo "\t<td class=grey>" . $I18N->msg("tease_on_startpage") . "</td>\r\n\t\t\t\t</tr>";
echo "\t</tr>\r\n\t\t\t\t{$out}\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=grey> </td>\r\n\t\t\t\t\t<td class=grey><input type=submit value='" . $I18N->msg("update_metadata") . "' size=8></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t</form>\r\n\t\t\t\t</table>";
if ($REX_USER->isValueOf("rights", "advancedMode[]")) {
echo "<table border=0 cellpadding=5 cellspacing=1 width=100%>\r\n\t\t\t\t\t<form action=index.php method=get>\r\n\t\t\t\t\t<input type=hidden name=page value=content>\r\n\t\t\t\t\t<input type=hidden name=article_id value='{$article_id}'>\r\n\t\t\t\t\t<input type=hidden name=mode value='meta'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan=2>" . $I18N->msg("other_functions") . "</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t<td class=grey width=150>" . $I18N->msg("category") . "</td>\r\n\t\t\t\t\t\t<td class=grey><select name=func_category_id size=1 style='width:100%;'>";
$csql = new sql();
$csql->setQuery("select * from rex_category order by re_category_id");
for ($i = 0; $i < $csql->getRows(); $i++) {
echo "<option value=" . $csql->getValue("id");
if ($category_id == $csql->getValue("id")) {
echo " selected";
}
echo ">" . $csql->getValue("name") . " [" . $csql->getValue("id") . "]" . "</option>";
$csql->next();
}
echo "</select></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=grey> </td>\r\n\t\t\t\t\t\t<td class=grey>";
if ($article->getValue("startpage") != 1) {
echo "<input type=submit name=FUNC_MOVE value=\"" . $I18N->msg("move_article") . "\" size=8>";
}
echo "<input type=submit name=FUNC_COPY value=\"" . $I18N->msg("copy_article") . "\" size=8>";
echo "</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t\t</table>";
}
} else {
// preview, add, edit, delete , module mode
$CONT = new article();
$CONT->setArticleId($article_id);
$CONT->setSliceId($slice_id);
$CONT->setMode($mode);
$CONT->setEval(TRUE);
示例11: htmlspecialchars
$echo .= $I18N->msg("category_edit_delete");
}
$echo .= " </a></td>\r\n <td>{$kat_status}</td>\r\n </tr>";
}
} else {
if ($REX_USER->isValueOf("rights", "csr[{$i_category_id}]") || $REX_USER->isValueOf("rights", "csw[{$i_category_id}]")) {
// --------------------- KATEGORIE WITH READ
$kat_link = "index.php?page=structure&category_id={$i_category_id}&clang={$clang}";
$echo .= "<tr>\r\n <td class=icon><a href={$kat_link}><img src=pics/folder.gif border=0 width=16 height=16 align=middle></a></td>";
if ($REX_USER->isValueOf("rights", "advancedMode[]")) {
$echo .= "<td class=grey align=center>{$i_category_id}</td>";
}
$echo .= "\r\n <td><a href={$kat_link}>" . $KAT->getValue("catname") . " </a></td>\r\n <td valign=middle width=20>" . htmlspecialchars($KAT->getValue("catprior")) . "</td>\r\n <td>" . $I18N->msg("no_permission_to_edit") . "</td><td class=grey>{$kat_status}</td>\r\n </tr>";
}
}
$KAT->next();
}
echo $echo;
echo "</table>";
// --------------------------------------------- ARTIKEL LISTE
// --------------------- READ TEMPLATES
if ($category_id > -1) {
$TEMPLATES = new sql();
$TEMPLATES->setQuery("select * from " . $REX['TABLE_PREFIX'] . "template order by name");
$TMPL_SEL = new select();
$TMPL_SEL->set_name("template_id");
$TMPL_SEL->set_size(1);
$TMPL_SEL->set_style("width:150");
$TMPL_SEL->add_option($I18N->msg("option_no_template"), "0");
for ($i = 0; $i < $TEMPLATES->getRows(); $i++) {
if ($TEMPLATES->getValue("active") == 1) {
示例12: sql
<?php
$OUT = TRUE;
if ($function == "delete") {
$del = new sql();
$del->setQuery("select * from rex_module_action where action_id='{$action_id}'");
// module mit dieser aktion vorhanden ?
if ($del->getRows() > 0) {
$module = "<font class=black>|</font> ";
$modulname = htmlentities($del->getValue("rex_module_action.module_id"));
for ($i = 0; $i < $del->getRows(); $i++) {
$module .= "<a href=index.php?page=module&function=edit&modul_id=" . $del->getValue("rex_module_action.module_id") . ">" . $del->getValue("rex_module_action.module_id") . "</a> <font class=black>|</font> ";
$del->next();
}
$message = "<b>" . $I18N->msg("action_cannot_be_deleted", $action_id) . "</b><br> {$module}";
} else {
$del->query("delete from rex_action where id='{$action_id}'");
$message = $I18N->msg("action_deleted");
}
}
if ($function == "add" or $function == "edit") {
if ($save == "ja") {
$faction = new sql();
if ($function == "add") {
$faction->query("insert into rex_action (name,action,prepost,status) VALUES ('{$mname}','{$actioninput}','{$prepost}','{$status}')");
$message = "<p class=warning>" . $I18N->msg("action_added") . "</p>";
} else {
$faction->query("update rex_action set name='{$mname}',action='{$actioninput}',prepost='{$prepost}',status='{$status}' where id='{$action_id}'");
$message = "<p class=warning>" . $I18N->msg("action_updated") . "</p>";
}
if ($goon != "") {
示例13: rex_addCLang
/**
* 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();
}
示例14: REX_SEARCH
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;
}
示例15: elseif
} else {
echo ' <td class="icon"> </td>' . "\n";
}
if (!isset($opener_link)) {
$opener_link = '';
}
// wenn datei fehlt
if (!file_exists($REX["INCLUDE_PATH"] . "/../../files/{$file_name}")) {
$thumbnail = "<img src=pics/mime_icons/mime-error.gif width=44 height=38 border=0>";
}
echo ' <td style="background-color:#e6e6e6; text-align:center; vertical-align:middle;"><a href="' . $ilink . '">' . $thumbnail . '</a></td>' . "\n";
echo ' <td valign="top" class="grey"><b><a href="' . $ilink . '">' . $file_title . '</a></b><br /><br /><b>' . $file_name . ' [' . $file_size . ']</b>';
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 {