[geeklog-cvs] geeklog: Dropped the sp_uid column from the Static Pages plugin ...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Dec 13 10:43:19 EST 2009
changeset 7525:562adceee6b3
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/562adceee6b3
user: Dirk Haun <dirk at haun-online.de>
date: Sun Dec 13 09:23:37 2009 +0100
description:
Dropped the sp_uid column from the Static Pages plugin since it only duplicates owner_id
diffstat:
plugins/staticpages/functions.inc | 21 ++++++----
plugins/staticpages/services.inc.php | 11 +----
plugins/staticpages/sql/mssql_install.php | 3 +-
plugins/staticpages/sql/mssql_updates.php | 5 ++-
plugins/staticpages/sql/mysql_install.php | 1 -
plugins/staticpages/sql/mysql_updates.php | 4 ++
plugins/staticpages/templates/admin/editor.thtml | 11 ++---
plugins/staticpages/templates/admin/editor_advanced.thtml | 15 +++----
public_html/admin/plugins/staticpages/index.php | 22 ++++-------
public_html/docs/history | 1 +
10 files changed, 46 insertions(+), 48 deletions(-)
diffs (truncated from 357 to 300 lines):
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/functions.inc Sun Dec 13 09:23:37 2009 +0100
@@ -616,14 +616,14 @@
$query = trim(addslashes($query));
$sql = "SELECT sp.sp_id AS id, sp.sp_title AS title, sp.sp_content AS description, ";
- $sql .= "UNIX_TIMESTAMP(sp.sp_date) AS date, sp.sp_uid AS uid, sp.sp_hits AS hits, ";
+ $sql .= "UNIX_TIMESTAMP(sp.sp_date) AS date, sp.owner_id AS uid, sp.sp_hits AS hits, ";
$sql .= "CONCAT('/staticpages/index.php?page=', sp.sp_id) AS url ";
$sql .= "FROM {$_TABLES['staticpage']} AS sp,{$_TABLES['users']} AS u ";
- $sql .= "WHERE (sp.sp_uid = u.uid) ";
+ $sql .= "WHERE (sp.owner_id = u.uid) ";
$sql .= COM_getPermSQL('AND') . COM_getLangSQL('sp_id', 'AND', 'sp') . ' ';
if (!empty ($author)) {
- $sql .= "AND (sp_uid = '$author') ";
+ $sql .= "AND (owner_id = '$author') ";
}
if ($_SP_CONF['includesearchcenterblocks'] == 0) {
@@ -938,14 +938,13 @@
{
global $_TABLES, $_SP_CONF;
- if (DB_count ($_TABLES['staticpage'], 'sp_uid', $uid) +
- DB_count ($_TABLES['staticpage'], 'owner_id', $uid) == 0) {
+ if (DB_count($_TABLES['staticpage'], 'owner_id', $uid) == 0) {
return;
}
if ($_SP_CONF['delete_pages'] == 1) {
// delete the pages
- DB_query ("DELETE FROM {$_TABLES['staticpage']} WHERE (sp_uid = $uid) OR (owner_id = $uid)");
+ DB_query ("DELETE FROM {$_TABLES['staticpage']} WHERE owner_id = $uid");
} else {
// assign ownership to a user from the Root group
$rootgroup = DB_getItem ($_TABLES['groups'], 'grp_id',
@@ -954,7 +953,6 @@
$A = DB_fetchArray ($result);
$rootuser = $A['ug_uid'];
- DB_query ("UPDATE {$_TABLES['staticpage']} SET sp_uid = $rootuser WHERE sp_uid = $uid");
DB_query ("UPDATE {$_TABLES['staticpage']} SET owner_id = $rootuser WHERE owner_id = $uid");
}
}
@@ -1086,6 +1084,13 @@
break;
case '1.6.1':
+ if (isset($_UPDATES[$current_version])) {
+ $_SQL = $_UPDATES[$current_version];
+ foreach ($_SQL as $sql) {
+ DB_query($sql);
+ }
+ }
+
SP_update_ConfValues_1_6_1();
$current_version = '1.6.2';
@@ -1209,7 +1214,7 @@
case 'username':
case 'fullname':
- $retval = COM_getDisplayName($A['sp_uid'], $A['username'],
+ $retval = COM_getDisplayName($A['owner_id'], $A['username'],
$A['fullname']);
break;
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/services.inc.php Sun Dec 13 09:23:37 2009 +0100
@@ -117,10 +117,6 @@
}
}
- if (!isset($args['sp_uid'])) {
- $args['sp_uid'] = $_USER['uid'];
- }
-
if (empty($args['sp_title']) && !empty($args['title'])) {
$args['sp_title'] = $args['title'];
}
@@ -161,7 +157,7 @@
if ($args['gl_svc']) {
$par_str = array('mode', 'sp_id', 'sp_old_id', 'sp_tid', 'sp_format',
'postmode');
- $par_num = array('sp_uid', 'sp_hits', 'owner_id', 'group_id',
+ $par_num = array('sp_hits', 'owner_id', 'group_id',
'sp_where', 'sp_php', 'commentcode');
foreach ($par_str as $str) {
@@ -250,7 +246,6 @@
// END: Staticpages defaults
$sp_id = $args['sp_id'];
- $sp_uid = $args['sp_uid'];
$sp_title = $args['sp_title'];
$sp_content = $args['sp_content'];
$sp_hits = $args['sp_hits'];
@@ -404,9 +399,9 @@
list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
}
- DB_save ($_TABLES['staticpage'], 'sp_id,sp_uid,sp_title,sp_content,sp_date,sp_hits,sp_format,sp_onmenu,sp_label,commentcode,meta_description,meta_keywords,owner_id,group_id,'
+ DB_save ($_TABLES['staticpage'], 'sp_id,sp_title,sp_content,sp_date,sp_hits,sp_format,sp_onmenu,sp_label,commentcode,meta_description,meta_keywords,owner_id,group_id,'
.'perm_owner,perm_group,perm_members,perm_anon,sp_php,sp_nf,sp_centerblock,sp_help,sp_tid,sp_where,sp_inblock,postmode',
- "'$sp_id',$sp_uid,'$sp_title','$sp_content',NOW(),$sp_hits,'$sp_format',$sp_onmenu,'$sp_label','$commentcode','$meta_description','$meta_keywords',$owner_id,$group_id,"
+ "'$sp_id','$sp_title','$sp_content',NOW(),$sp_hits,'$sp_format',$sp_onmenu,'$sp_label','$commentcode','$meta_description','$meta_keywords',$owner_id,$group_id,"
."$perm_owner,$perm_group,$perm_members,$perm_anon,'$sp_php','$sp_nf',$sp_centerblock,'$sp_help','$sp_tid',$sp_where,"
."'$sp_inblock','$postmode'");
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/sql/mssql_install.php
--- a/plugins/staticpages/sql/mssql_install.php Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/sql/mssql_install.php Sun Dec 13 09:23:37 2009 +0100
@@ -31,7 +31,7 @@
// +---------------------------------------------------------------------------+
/**
-* MS SQL updates
+* MS SQL install
*
* @package StaticPages
*/
@@ -39,7 +39,6 @@
$_SQL[] = "
CREATE TABLE [dbo].[{$_TABLES['staticpage']}] (
[sp_id] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
- [sp_uid] [int] NOT NULL ,
[sp_title] [varchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[sp_content] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[sp_hits] [numeric](8, 0) NOT NULL ,
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/sql/mssql_updates.php
--- a/plugins/staticpages/sql/mssql_updates.php Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/sql/mssql_updates.php Sun Dec 13 09:23:37 2009 +0100
@@ -36,8 +36,11 @@
'1.6.0' => array(
"ALTER TABLE {$_TABLES['staticpage']} ADD meta_description [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER commentcode, ADD meta_keywords [meta_keywords] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER meta_description"
+ ),
+
+ '1.6.1' => array(
+ "ALTER TABLE {$_TABLES['staticpage']} DROP COLUMN sp_uid"
)
-
);
/**
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/sql/mysql_install.php
--- a/plugins/staticpages/sql/mysql_install.php Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/sql/mysql_install.php Sun Dec 13 09:23:37 2009 +0100
@@ -38,7 +38,6 @@
$_SQL[] = "
CREATE TABLE {$_TABLES['staticpage']} (
sp_id varchar(40) NOT NULL default '',
- sp_uid mediumint(8) NOT NULL default '1',
sp_title varchar(128) NOT NULL default '',
sp_content text NOT NULL,
sp_hits mediumint(8) unsigned NOT NULL default '0',
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/sql/mysql_updates.php
--- a/plugins/staticpages/sql/mysql_updates.php Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/sql/mysql_updates.php Sun Dec 13 09:23:37 2009 +0100
@@ -37,6 +37,10 @@
'1.6.0' => array(
"ALTER TABLE {$_TABLES['staticpage']} ADD meta_description TEXT NULL AFTER commentcode",
"ALTER TABLE {$_TABLES['staticpage']} ADD meta_keywords TEXT NULL AFTER meta_description"
+ ),
+
+ '1.6.1' => array(
+ "ALTER TABLE {$_TABLES['staticpage']} DROP COLUMN sp_uid"
)
);
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/templates/admin/editor.thtml
--- a/plugins/staticpages/templates/admin/editor.thtml Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/templates/admin/editor.thtml Sun Dec 13 09:23:37 2009 +0100
@@ -56,10 +56,6 @@
</td>
</tr>
<tr>
- <td align="right">{lang_writtenby}:</td>
- <td>{name}<input type="hidden" name="sp_uid" value="{sp_uid}"{xhtml}></td>
- </tr>
- <tr>
<td align="right">{lang_lastupdated}:</td>
<td>{sp_formateddate}</td>
</tr>
@@ -113,7 +109,10 @@
</tr>
<tr>
<td align="right">{lang_owner}:</td>
- <td>{owner_name}<input type="hidden" name="owner_id" value="{owner_id}"{xhtml}></td>
+ <td>
+ {owner_link} {camera_icon}
+ <input type="hidden" name="owner_id" value="{owner_id}"{xhtml}>
+ </td>
</tr>
<tr>
<td align="right">{lang_group}:</td>
@@ -122,7 +121,7 @@
</td>
</tr>
<tr>
- <td colspan="2"><b>{lang_permissions}</b>:</td>
+ <td colspan="2"><b>{lang_permissions}</b></td>
</tr>
<tr>
<td colspan="2"></td>
diff -r cd255b220b30 -r 562adceee6b3 plugins/staticpages/templates/admin/editor_advanced.thtml
--- a/plugins/staticpages/templates/admin/editor_advanced.thtml Sat Dec 12 23:02:40 2009 +0100
+++ b/plugins/staticpages/templates/admin/editor_advanced.thtml Sun Dec 13 09:23:37 2009 +0100
@@ -1,4 +1,4 @@
-<!-- Hide the Advanced Editor as Javascript is required. If JS is not enabled then the message below in the <nonscript> tags will be displayed -->
+<!-- Hide the Advanced Editor as JavaScript is required. If JS is not enabled then the message below in the <nonscript> tags will be displayed -->
<noscript>
<div class="pluginAlert" style="border:1px dashed #ccc;text-align:center;margin-top:10px;padding:15px;">{lang_nojavascript} </div>
</noscript>
@@ -6,7 +6,7 @@
// Setup editor path for FCKeditor JS Functions
geeklogEditorBasePath = "{site_url}/fckeditor/" ;
</script>
-<script type="text/JavaScript" src="{site_url}/javascript/staticpages_fckeditor.js"></script>
+<script type="text/javascript" src="{site_url}/javascript/staticpages_fckeditor.js"></script>
{start_block_editor}
<form action="{site_admin_url}/plugins/staticpages/index.php" method="post" onsubmit='set_postcontent();'>
@@ -87,10 +87,6 @@
</td>
</tr>
<tr>
- <td align="right">{lang_writtenby}:</td>
- <td>{name}<input type="hidden" name="sp_uid" value="{sp_uid}"{xhtml}></td>
- </tr>
- <tr>
<td align="right">{lang_lastupdated}:</td>
<td>{sp_formateddate}</td>
</tr>
@@ -144,7 +140,10 @@
</tr>
<tr>
<td align="right">{lang_owner}:</td>
- <td>{owner_name}<input type="hidden" name="owner_id" value="{owner_id}"{xhtml}></td>
+ <td>
+ {owner_link} {camera_icon}
+ <input type="hidden" name="owner_id" value="{owner_id}"{xhtml}>
+ </td>
</tr>
<tr>
<td align="right">{lang_group}:</td>
@@ -153,7 +152,7 @@
</td>
</tr>
<tr>
- <td colspan="2"><b>{lang_permissions}</b>:</td>
+ <td colspan="2"><b>{lang_permissions}</b></td>
</tr>
<tr>
<td colspan="2"></td>
diff -r cd255b220b30 -r 562adceee6b3 public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php Sat Dec 12 23:02:40 2009 +0100
+++ b/public_html/admin/plugins/staticpages/index.php Sun Dec 13 09:23:37 2009 +0100
@@ -216,13 +216,13 @@
}
$sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']);
$sp_template->set_var('username', DB_getItem($_TABLES['users'],
- 'username', "uid = {$A['sp_uid']}"));
- $authorname = COM_getDisplayName($A['sp_uid']);
+ 'username', "uid = {$A['owner_id']}"));
+ $authorname = COM_getDisplayName($A['owner_id']);
$sp_template->set_var('name', $authorname);
$sp_template->set_var('author', $authorname);
$sp_template->set_var('lang_url', $LANG_STATIC['url']);
$sp_template->set_var('lang_id', $LANG_STATIC['id']);
- $sp_template->set_var('sp_uid', $A['sp_uid']);
+ $sp_template->set_var('sp_uid', $A['owner_id']);
$sp_template->set_var('sp_id', $A['sp_id']);
$sp_template->set_var('sp_old_id', $A['sp_old_id']);
$sp_template->set_var('example_url', COM_buildURL($_CONF['site_url']
@@ -526,7 +526,7 @@
'table' => 'staticpage',
'sql' => "SELECT *,UNIX_TIMESTAMP(sp_date) AS unixdate, {$_TABLES['users']}.username, {$_TABLES['users']}.fullname "
."FROM {$_TABLES['staticpage']} "
- ."LEFT JOIN {$_TABLES['users']} ON {$_TABLES['staticpage']}.sp_uid = {$_TABLES['users']}.uid "
+ ."LEFT JOIN {$_TABLES['users']} ON {$_TABLES['staticpage']}.owner_id = {$_TABLES['users']}.uid "
."WHERE 1=1 ",
'query_fields' => array('sp_title', 'sp_id'),
'default_filter' => COM_getPermSQL('AND', 0, 3)
@@ -571,7 +571,7 @@
} else {
$A['sp_id'] = $sp_new_id;
}
- $A['sp_uid'] = $_USER['uid'];
+ $A['owner_id'] = $_USER['uid'];
$A['unixdate'] = time();
$A['sp_help'] = '';
$A['sp_old_id'] = '';
@@ -582,7 +582,7 @@
if (DB_numRows($result) == 1) {
$A = DB_fetchArray($result);
$A['sp_id'] = COM_makesid();
More information about the geeklog-cvs
mailing list