... sort=[sortcode] ... sort ... page=[pageno] ... page ... query=[titlefilter] ... title filter Manage active texts ***************************************************************/ require_once 'settings.inc.php'; require_once 'connect.inc.php'; require_once 'dbutils.inc.php'; require_once 'utilities.inc.php'; // Page, Sort, etc. $currentlang = validateLang(processDBParam("filterlang", 'currentlanguage', '', 0)); $currentsort = processDBParam("sort", 'currenttextsort', '1', 1); $currentpage = processSessParam("page", "currenttextpage", '1', 1); $currentquery = processSessParam("query", "currenttextquery", '', 0); $currenttag1 = validateTextTag(processSessParam("tag1", "currenttexttag1", '', 0), $currentlang); $currenttag2 = validateTextTag(processSessParam("tag2", "currenttexttag2", '', 0), $currentlang); $currenttag12 = processSessParam("tag12", "currenttexttag12", '', 0); $wh_lang = $currentlang != '' ? ' and TxLgID=' . $currentlang : ''; $wh_query = convert_string_to_sqlsyntax(str_replace("*", "%", mb_strtolower($currentquery, 'UTF-8'))); $wh_query = $currentquery != '' ? ' and TxTitle like ' . $wh_query : ''; if ($currenttag1 == '' && $currenttag2 == '') { $wh_tag = ''; } else { if ($currenttag1 != '') { if ($currenttag1 == -1) { $wh_tag1 = "group_concat(TtT2ID) IS NULL"; } else { $wh_tag1 = "concat('/',group_concat(TtT2ID separator '/'),'/') like '%/" . $currenttag1 . "/%'"; } } if ($currenttag2 != '') {
function getPreviousAndNextTextLinks($textid, $url, $onlyann, $add) { global $tbpref; $currentlang = validateLang(processDBParam("filterlang", 'currentlanguage', '', 0)); $wh_lang = $currentlang != '' ? ' and TxLgID=' . $currentlang : ''; $currentquery = processSessParam("query", "currenttextquery", '', 0); $wh_query = convert_string_to_sqlsyntax(str_replace("*", "%", mb_strtolower($currentquery, 'UTF-8'))); $wh_query = $currentquery != '' ? ' and TxTitle like ' . $wh_query : ''; $currenttag1 = validateTextTag(processSessParam("tag1", "currenttexttag1", '', 0), $currentlang); $currenttag2 = validateTextTag(processSessParam("tag2", "currenttexttag2", '', 0), $currentlang); $currenttag12 = processSessParam("tag12", "currenttexttag12", '', 0); if ($currenttag1 == '' && $currenttag2 == '') { $wh_tag = ''; } else { if ($currenttag1 != '') { if ($currenttag1 == -1) { $wh_tag1 = "group_concat(TtT2ID) IS NULL"; } else { $wh_tag1 = "concat('/',group_concat(TtT2ID separator '/'),'/') like '%/" . $currenttag1 . "/%'"; } } if ($currenttag2 != '') { if ($currenttag2 == -1) { $wh_tag2 = "group_concat(TtT2ID) IS NULL"; } else { $wh_tag2 = "concat('/',group_concat(TtT2ID separator '/'),'/') like '%/" . $currenttag2 . "/%'"; } } if ($currenttag1 != '' && $currenttag2 == '') { $wh_tag = " having (" . $wh_tag1 . ') '; } elseif ($currenttag2 != '' && $currenttag1 == '') { $wh_tag = " having (" . $wh_tag2 . ') '; } else { $wh_tag = " having ((" . $wh_tag1 . ($currenttag12 ? ') AND (' : ') OR (') . $wh_tag2 . ')) '; } } $currentsort = processDBParam("sort", 'currenttextsort', '1', 1); $sorts = array('TxTitle', 'TxID desc', 'TxID'); $lsorts = count($sorts); if ($currentsort < 1) { $currentsort = 1; } if ($currentsort > $lsorts) { $currentsort = $lsorts; } if ($onlyann) { $sql = 'select TxID from ((' . $tbpref . 'texts left JOIN ' . $tbpref . 'texttags ON TxID = TtTxID) left join ' . $tbpref . 'tags2 on T2ID = TtT2ID), ' . $tbpref . 'languages where LgID = TxLgID AND LENGTH(TxAnnotatedText) > 0 ' . $wh_lang . $wh_query . ' group by TxID ' . $wh_tag . ' order by ' . $sorts[$currentsort - 1]; } else { $sql = 'select TxID from ((' . $tbpref . 'texts left JOIN ' . $tbpref . 'texttags ON TxID = TtTxID) left join ' . $tbpref . 'tags2 on T2ID = TtT2ID), ' . $tbpref . 'languages where LgID = TxLgID ' . $wh_lang . $wh_query . ' group by TxID ' . $wh_tag . ' order by ' . $sorts[$currentsort - 1]; } $list = array(0); $res = do_mysql_query($sql); while ($record = mysql_fetch_assoc($res)) { array_push($list, $record['TxID'] + 0); } mysql_free_result($res); array_push($list, 0); $listlen = count($list); for ($i = 1; $i < $listlen - 1; $i++) { if ($list[$i] == $textid) { if ($list[$i - 1] !== 0) { $title = tohtml(getTextTitle($list[$i - 1])); $prev = '<a href="' . $url . $list[$i - 1] . '" target="_top"><img src="icn/navigation-180-button.png" title="Previous Text: ' . $title . '" alt="Previous Text: ' . $title . '" /></a>'; } else { $prev = '<img src="icn/navigation-180-button-light.png" title="No Previous Text" alt="No Previous Text" />'; } if ($list[$i + 1] !== 0) { $title = tohtml(getTextTitle($list[$i + 1])); $next = '<a href="' . $url . $list[$i + 1] . '" target="_top"><img src="icn/navigation-000-button.png" title="Next Text: ' . $title . '" alt="Next Text: ' . $title . '" /></a>'; } else { $next = '<img src="icn/navigation-000-button-light.png" title="No Next Text" alt="No Next Text" />'; } return $add . $prev . ' ' . $next; } } return $add . '<img src="icn/navigation-180-button-light.png" title="No Previous Text" alt="No Previous Text" /> <img src="icn/navigation-000-button-light.png" title="No Next Text" alt="No Next Text" />'; }