本文整理汇总了PHP中rex_sql::hasNext方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::hasNext方法的具体用法?PHP rex_sql::hasNext怎么用?PHP rex_sql::hasNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_sql
的用法示例。
在下文中一共展示了rex_sql::hasNext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rex_rewriter_generate_pathnames
/**
* rex_rewriter_generate_pathnames
* generiert die Pathlist, abhŠngig von Aktion
* @author markus.staab[at]redaxo[dot]de Markus Staab
* @package redaxo4.2
*/
function rex_rewriter_generate_pathnames($params)
{
global $REX, $REXPATH;
if (file_exists(FULLNAMES_PATHLIST)) {
require_once FULLNAMES_PATHLIST;
}
if (!isset($REXPATH)) {
$REXPATH = array();
}
if (!isset($params['extension_point'])) {
$params['extension_point'] = '';
}
$where = '';
switch ($params['extension_point']) {
// ------- sprachabhängig, einen artikel aktualisieren
case 'CAT_DELETED':
case 'ART_DELETED':
unset($REXPATH[$params['id']]);
break;
case 'CAT_ADDED':
case 'CAT_UPDATED':
case 'ART_ADDED':
case 'ART_UPDATED':
$where = '(id=' . $params['id'] . ' AND clang=' . $params['clang'] . ') OR (path LIKE "%|' . $params['id'] . '|%" AND clang=' . $params['clang'] . ')';
break;
// ------- alles aktualisieren
// ------- alles aktualisieren
case 'ALL_GENERATED':
default:
$where = '1=1';
break;
}
if ($where != '') {
$db = new rex_sql();
// $db->debugsql=true;
$db->setQuery('SELECT id,clang,path,startpage FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE ' . $where . ' and revision=0');
while ($db->hasNext()) {
$clang = $db->getValue('clang');
$pathname = '';
if (count($REX['CLANG']) > 1) {
$pathname = $REX['CLANG'][$clang] . '/';
}
// pfad über kategorien bauen
$path = trim($db->getValue('path'), '|');
if ($path != '') {
$path = explode('|', $path);
foreach ($path as $p) {
$ooc = OOCategory::getCategoryById($p, $clang);
$name = $ooc->getName();
unset($ooc);
// speicher freigeben
$pathname = rex_rewriter_appendToPath($pathname, $name);
}
}
$ooa = OOArticle::getArticleById($db->getValue('id'), $clang);
if ($ooa->isStartArticle()) {
$ooc = $ooa->getCategory();
$catname = $ooc->getName();
unset($ooc);
// speicher freigeben
$pathname = rex_rewriter_appendToPath($pathname, $catname);
}
// eigentlicher artikel anhängen
$name = $ooa->getName();
unset($ooa);
// speicher freigeben
$pathname = rex_rewriter_appendToPath($pathname, $name);
$pathname = substr($pathname, 0, strlen($pathname) - 1) . '.html';
$REXPATH[$db->getValue('id')][$db->getValue('clang')] = $pathname;
$db->next();
}
}
rex_put_file_contents(FULLNAMES_PATHLIST, "<?php\n\$REXPATH = " . var_export($REXPATH, true) . ";\n");
}
示例2: rex_deleteCategoryReorganized
/**
* Löscht eine Kategorie und reorganisiert die Prioritäten verbleibender Geschwister-Kategorien
*
* @param int $category_id Id der Kategorie die gelöscht werden soll
*
* @return array Ein Array welches den status sowie eine Fehlermeldung beinhaltet
*/
function rex_deleteCategoryReorganized($category_id)
{
global $REX, $I18N;
$return = array();
$return['state'] = FALSE;
$return['message'] = '';
$clang = 0;
$thisCat = new rex_sql();
$thisCat->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE id=' . $category_id . ' and clang=' . $clang);
// Prüfen ob die Kategorie existiert
if ($thisCat->getRows() == 1) {
$KAT = new rex_sql();
$KAT->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where re_id='{$category_id}' and clang='{$clang}' and startpage=1");
// Prüfen ob die Kategorie noch Unterkategorien besitzt
if ($KAT->getRows() == 0) {
$KAT->setQuery("select * from " . $REX['TABLE_PREFIX'] . "article where re_id='{$category_id}' and clang='{$clang}' and startpage=0");
// Prüfen ob die Kategorie noch Artikel besitzt (ausser dem Startartikel)
if ($KAT->getRows() == 0) {
$thisCat = new rex_sql();
$thisCat->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE id=' . $category_id);
$re_id = $thisCat->getValue('re_id');
$return = rex_deleteArticle($category_id);
while ($thisCat->hasNext()) {
$_clang = $thisCat->getValue('clang');
// ----- PRIOR
rex_newCatPrio($re_id, $_clang, 0, 1);
// ----- EXTENSION POINT
$return = rex_register_extension_point('CAT_DELETED', $return, array('id' => $category_id, 're_id' => $re_id, 'clang' => $_clang, 'name' => $thisCat->getValue('catname'), 'prior' => $thisCat->getValue('catprior'), 'path' => $thisCat->getValue('path'), 'status' => $thisCat->getValue('status')));
$thisCat->next();
}
} else {
$return['message'] = $I18N->msg('category_could_not_be_deleted') . ' ' . $I18N->msg('category_still_contains_articles');
}
} else {
$return['message'] = $I18N->msg('category_could_not_be_deleted') . ' ' . $I18N->msg('category_still_contains_subcategories');
}
} else {
$return['message'] = $I18N->msg('category_could_not_be_deleted');
}
return array($return['state'], $return['message']);
}
示例3: seo42_generate_pathlist
/**
* seo42_generate_pathlist()
*
* generiert die Pathlist, abhängig von Aktion
* @author markus.staab[at]redaxo[dot]de Markus Staab
* @package redaxo4.2
*/
function seo42_generate_pathlist($params)
{
global $REX, $SEO42_IDS, $SEO42_URLS;
// temporary community install workaround
if (!isset($REX['ADDON']['seo42'])) {
return;
}
// include pathlist file
if (file_exists(SEO42_PATHLIST)) {
require_once SEO42_PATHLIST;
}
// EXTENSION POINT "SEO42_PATHLIST_BEFORE_REBUILD"
$subject = array('SEO42_IDS' => $SEO42_IDS, 'SEO42_URLS' => $SEO42_URLS);
rex_register_extension_point('SEO42_PATHLIST_BEFORE_REBUILD', $subject);
$SEO42_IDS = array();
$SEO42_URLS = array();
$REX['SEO42_URL_CLONE'] = array();
$db = new rex_sql();
// REVISION FIX
$db->setQuery('UPDATE ' . $REX['TABLE_PREFIX'] . 'article SET revision = 0 WHERE revision IS NULL;');
$db->setQuery('UPDATE ' . $REX['TABLE_PREFIX'] . 'article_slice SET revision = 0 WHERE revision IS NULL;');
if ($REX['ADDON']['seo42']['settings']['ignore_root_cats']) {
$sqlQuery = 'SELECT `id`, `clang`, `path`, `startpage`,`seo_custom_url` FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE re_id != 0 OR (re_id = 0 AND catname LIKE "") AND revision=0 OR revision IS NULL ORDER BY id';
} else {
$sqlQuery = 'SELECT `id`, `clang`, `path`, `startpage`,`seo_custom_url` FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE revision=0 OR revision IS NULL ORDER BY id';
}
$db->setQuery($sqlQuery);
// redirects start articles withou slash: /xx to /xx/
if (count($REX['CLANG']) > 1) {
foreach ($REX['CLANG'] as $clangId => $clangName) {
if ($REX['ADDON']['seo42']['settings']['url_ending'] == '') {
$langSlug = seo42::getLangUrlSlug($clangId) . '/';
} else {
$langSlug = seo42::getLangUrlSlug($clangId);
}
if ($REX['ADDON']['seo42']['settings']['homelang'] != $clangId) {
$SEO42_URLS[$langSlug] = array('id' => $REX['START_ARTICLE_ID'], 'clang' => $clangId, 'status' => 301);
}
}
}
while ($db->hasNext()) {
$pathname = '';
$id = $db->getValue('id');
$clang = $db->getValue('clang');
$path = $db->getValue('path');
// LANG SLUG
if (count($REX['CLANG']) > 1 && $clang != $REX['ADDON']['seo42']['settings']['hide_langslug']) {
$pathname = '';
$pathname = seo42_appendToPath($pathname, seo42::getLangUrlSlug($clang), $id, $clang);
}
// pfad über kategorien bauen
$path = trim($path, '|');
if ($path != '') {
$path = explode('|', $path);
foreach ($path as $p) {
$ooc = OOCategory::getCategoryById($p, seo42_utils::getInheritedClang($clang));
// PREVENT FATALS IN RARE CONDITIONS WHERE DB/CACHE ARE OUT OF SYNC
if (!is_a($ooc, 'OOCategory')) {
continue;
}
// 42
if ($REX['ADDON']['seo42']['settings']['ignore_root_cats'] && $ooc->getParentId() == 0) {
continue;
}
$name = $ooc->getName();
unset($ooc);
$pathname = seo42_appendToPath($pathname, $name, $id, $clang);
}
}
$ooa = OOArticle::getArticleById($id, seo42_utils::getInheritedClang($clang));
// PREVENT FATALS IN RARE CONDITIONS WHERE DB/CACHE ARE OUT OF SYNC
if (!is_a($ooa, 'OOArticle')) {
$db->next();
continue;
}
if ($ooa->isStartArticle()) {
$ooc = $ooa->getCategory();
$catname = $ooc->getName();
unset($ooc);
$pathname = seo42_appendToPath($pathname, $catname, $id, $clang);
}
// url_schema: seo42
if (!$ooa->isStartArticle()) {
// eigentlicher artikel anhängen
$name = $ooa->getName();
unset($ooa);
$pathname = seo42_appendToPath($pathname, $name, $id, $clang);
}
// ALLGEMEINE URL ENDUNG
$pathname = substr($pathname, 0, strlen($pathname) - 1) . $REX['ADDON']['seo42']['settings']['url_ending'];
// STARTSEITEN URL FORMAT
if ($db->getValue('id') == $REX['START_ARTICLE_ID'] && $db->getValue('clang') == $REX['ADDON']['seo42']['settings']['homelang'] && ($REX['ADDON']['seo42']['settings']['homeurl'] == 1 || $REX['ADDON']['seo42']['settings']['homeurl'] == 2)) {
$pathname = '';
//.........这里部分代码省略.........
示例4: rex_generateClang
/**
* Schreibt Spracheigenschaften in die Datei include/clang.inc.php
*
* @return TRUE bei Erfolg, sonst eine Fehlermeldung
*/
function rex_generateClang()
{
global $REX;
$lg = new rex_sql();
$lg->setQuery("select * from " . $REX['TABLE_PREFIX'] . "clang order by id");
$REX['CLANG'] = array();
while ($lg->hasNext()) {
$REX['CLANG'][$lg->getValue("id")] = $lg->getValue("name");
$lg->next();
}
$file = $REX['INCLUDE_PATH'] . "/clang.inc.php";
if (rex_replace_dynamic_contents($file, "\$REX['CLANG'] = " . var_export($REX['CLANG'], TRUE) . ";\n") === FALSE) {
return 'Datei "' . $file . '" hat keine Schreibrechte';
}
return TRUE;
}