fix tables names

This commit is contained in:
Jean-Christian Paul Denis 2022-11-30 21:54:14 +01:00
parent 18020aa260
commit e0721fdecb
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 27 additions and 7 deletions

20
_init.php Normal file
View File

@ -0,0 +1,20 @@
<?php
/**
* @brief zoneclearFeedServer, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis, BG, Pierre Van Glabeke
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
class initZoneclearFeedServer
{
public const FEED_TABLE_NAME = 'zc_feed';
}

View File

@ -40,7 +40,7 @@ try {
# Tables
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$t->zc_feed
$t->{initZoneclearFeedServer::FEED_TABLE_NAME}
->feed_id('bigint', 0, false)
->feed_creadt('timestamp', 0, false, 'now()')
->feed_upddt('timestamp', 0, false, 'now()')

View File

@ -75,7 +75,7 @@ class zcfsFeedsActionsPage extends dcActions
$this->rs = $feeds;
} else {
$this->rs = dcCore::app()->con->select(
'SELECT blog_id FROM ' . dcCore::app()->prefix . 'blog WHERE false'
'SELECT blog_id FROM ' . dcCore::app()->prefix . dcBlog::BLOG_TABLE_NAME . ' WHERE false'
);
}
}

View File

@ -38,7 +38,7 @@ class zoneclearFeedServer
{
$this->con = dcCore::app()->con;
$this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
$this->table = dcCore::app()->prefix . 'zc_feed';
$this->table = dcCore::app()->prefix . initZoneclearFeedServer::FEED_TABLE_NAME;
}
/**
@ -247,7 +247,7 @@ class zoneclearFeedServer
}
$strReq .= 'FROM ' . $this->table . ' Z ' .
'LEFT OUTER JOIN ' . dcCore::app()->prefix . 'category C ON Z.cat_id = C.cat_id ';
'LEFT OUTER JOIN ' . dcCore::app()->prefix . dcCategories::CATEGORY_TABLE_NAME . ' C ON Z.cat_id = C.cat_id ';
if (!empty($params['from'])) {
$strReq .= $params['from'] . ' ';
@ -837,7 +837,7 @@ class zoneclearFeedServer
# Get super admins
$rs = $this->con->select(
'SELECT user_id, user_super, user_name, user_firstname, user_displayname ' .
'FROM ' . $this->con->escapeSystem(dcCore::app()->prefix . 'user') . ' ' .
'FROM ' . $this->con->escapeSystem(dcCore::app()->prefix . dcCategories::CATEGORY_TABLE_NAME) . ' ' .
'WHERE user_super = 1 AND user_status = 1 '
);
@ -856,8 +856,8 @@ class zoneclearFeedServer
# Get admins
$rs = $this->con->select(
'SELECT U.user_id, U.user_super, U.user_name, U.user_firstname, U.user_displayname ' .
'FROM ' . $this->con->escapeSystem(dcCore::app()->prefix . 'user') . ' U ' .
'LEFT JOIN ' . $this->con->escapeSystem(dcCore::app()->prefix . 'permissions') . ' P ' .
'FROM ' . $this->con->escapeSystem(dcCore::app()->prefix . dcCategories::CATEGORY_TABLE_NAME) . ' U ' .
'LEFT JOIN ' . $this->con->escapeSystem(dcCore::app()->prefix . dcAuth::PERMISSIONS_TABLE_NAME) . ' P ' .
'ON U.user_id=P.user_id ' .
'WHERE U.user_status = 1 ' .
"AND P.blog_id = '" . $this->blog . "' " .