[geeklog-cvs] geeklog: Hiding search info also works for plugins on old api. M...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon May 25 12:00:29 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c68402fc8a20
changeset: 7056:c68402fc8a20
user: Sami Barakat
date: Mon May 25 16:57:48 2009 +0100
description:
Hiding search info also works for plugins on old api. Minor cosmetic changes.
diffstat:
plugins/calendar/functions.inc | 14 ++++++++------
plugins/links/functions.inc | 17 +++++++++--------
plugins/staticpages/functions.inc | 12 +++++++-----
system/classes/search.class.php | 17 ++++++++++-------
4 files changed, 34 insertions(+), 26 deletions(-)
diffs (202 lines):
diff -r ad57bda59747 -r c68402fc8a20 plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc Mon May 25 14:06:13 2009 +0100
+++ b/plugins/calendar/functions.inc Mon May 25 16:57:48 2009 +0100
@@ -119,10 +119,10 @@
if($_DB_dbms == 'mssql') {
$eventSql .= "WHERE dateend >= DATEADD(hh, 24, NOW()) AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) ";
} else {
- $eventSql .= "WHERE dateend >= (NOW() - INTERVAL 24 HOUR) AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) ";
+ $eventSql .= "WHERE dateend >= (NOW() - INTERVAL 24 HOUR) AND (TO_DAYS(datestart) - TO_DAYS(NOW()) < $range) ";
}
$eventSql .= 'ORDER BY datestart,timestart';
-
+
if(( $_CA_CONF['personalcalendars'] == 1 ) && !empty( $_USER['uid'] )) {
$personaleventsql = 'SELECT eid,title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon '
. "FROM {$_TABLES['personal_events']} ";
@@ -1619,10 +1619,12 @@
// Make sure the query is SQL safe
$query = trim(addslashes($query));
- $sql_e = "SELECT eid AS id, title, description, UNIX_TIMESTAMP(datestart) AS date, owner_id AS uid, hits, CONCAT('/calendar/event.php?eid=',eid) AS url ";
+ $sql_e = "SELECT eid AS id, title, description, UNIX_TIMESTAMP(datestart) AS date, owner_id AS uid, hits, ";
+ $sql_e .= "CONCAT('/calendar/event.php?eid=',eid) AS url ";
$sql_e .= "FROM {$_TABLES['events']} WHERE 1=1 ";
- $sql_p = "SELECT eid AS id, title, description, UNIX_TIMESTAMP(datestart) AS date, owner_id AS uid, '0' AS hits, CONCAT('/calendar/event.php?eid=',eid) AS url ";
+ $sql_p = "SELECT eid AS id, title, description, UNIX_TIMESTAMP(datestart) AS date, owner_id AS uid, ";
+ $sql_p .= "CONCAT('/calendar/event.php?eid=',eid) AS url ";
$sql_p .= "FROM {$_TABLES['personal_events']} WHERE 1=1 ";
$sql = COM_getPermSQL('AND') . ' ';
@@ -1645,7 +1647,7 @@
// Search the public events
$search_e = new SearchCriteria('calendar', array($LANG_CAL_1[16],$LANG_CAL_1[24]));
- $columns = array('location', 'description', 'title' => 'title');
+ $columns = array('title' => 'title', 'location', 'description');
list($sql_tmp,$ftsql_tmp) = $search_e->buildSearchSQL($keyType, $query, $columns, $sql_e . $sql);
$search_e->setSQL($sql_tmp);
$search_e->setFTSQL($ftsql_tmp);
@@ -1653,7 +1655,7 @@
// Search personal events
$search_p = new SearchCriteria('calendar', array($LANG_CAL_1[16],$LANG_CAL_1[23]));
- $columns = array('location', 'description','title' => 'title');
+ $columns = array('title' => 'title', 'location', 'description');
list($sql_tmp,$ftsql_tmp) = $search_p->buildSearchSQL($keyType, $query, $columns, $sql_p . $sql);
$search_p->setSQL($sql_tmp);
$search_p->setFTSQL($ftsql_tmp);
diff -r ad57bda59747 -r c68402fc8a20 plugins/links/functions.inc
--- a/plugins/links/functions.inc Mon May 25 14:06:13 2009 +0100
+++ b/plugins/links/functions.inc Mon May 25 16:57:48 2009 +0100
@@ -219,9 +219,9 @@
{
global $_CONF;
- require_once $_CONF['path'] . 'plugins/links/autoinstall.php';
+ require_once $_CONF['path'] . 'plugins/links/autoinstall.php';
- $inst_parms = plugin_autoinstall_links('links');
+ $inst_parms = plugin_autoinstall_links('links');
return $inst_parms['info']['pi_version'];
}
@@ -363,7 +363,8 @@
// Make sure the query is SQL safe
$query = trim(addslashes($query));
- $sql = "SELECT lid AS id, title, description, UNIX_TIMESTAMP(date) AS date, owner_id AS uid, hits, CONCAT('/links/portal.php?what=link&item=', lid) AS url ";
+ $sql = "SELECT lid AS id, title, description, UNIX_TIMESTAMP(date) AS date, owner_id AS uid, hits, ";
+ $sql .= "CONCAT('/links/portal.php?what=link&item=', lid) AS url ";
$sql .= "FROM {$_TABLES['links']} WHERE date <> 1 ";
$sql .= COM_getPermSQL('AND') . ' ';
@@ -384,7 +385,7 @@
}
$search = new SearchCriteria('links', $LANG_LINKS[14]);
- $columns = array('description', 'title' => 'title');
+ $columns = array('title' => 'title', 'description');
list($sql,$ftsql) = $search->buildSearchSQL($keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
@@ -639,15 +640,15 @@
{
global $_CONF, $_TABLES, $_LI_CONF;
- $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
+ $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version',
"pi_name = 'links'");
$code_version = plugin_chkVersion_links();
if ($installed_version == $code_version) {
- // nothing to do
- return true;
+ // nothing to do
+ return true;
}
- require_once $_CONF['path'] . 'plugins/links/autoinstall.php';
+ require_once $_CONF['path'] . 'plugins/links/autoinstall.php';
if (! plugin_compatible_with_this_version_links('links')) {
return 3002;
diff -r ad57bda59747 -r c68402fc8a20 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc Mon May 25 14:06:13 2009 +0100
+++ b/plugins/staticpages/functions.inc Mon May 25 16:57:48 2009 +0100
@@ -608,7 +608,9 @@
// Make sure the query is SQL safe
$query = trim(addslashes($query));
- $sql = "SELECT sp.sp_id AS id, sp.sp_title AS title, sp.sp_content AS description, UNIX_TIMESTAMP(sp.sp_date) AS date, sp.sp_uid AS uid, sp.sp_hits AS hits, CONCAT('/staticpages/index.php?page=', sp.sp_id) AS url ";
+ $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 .= "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) AND (sp_php <> 1) ";
$sql .= COM_getPermSQL('AND') . COM_getLangSQL('sp_id', 'AND', 'sp') . ' ';
@@ -630,7 +632,7 @@
}
$search = new SearchCriteria('staticpages', $LANG_STATIC['staticpages']);
- $columns = array('sp_content', 'title' => 'sp_title');
+ $columns = array('title' => 'sp_title', 'sp_content');
list($sql,$ftsql) = $search->buildSearchSQL($keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
@@ -931,9 +933,9 @@
global $_CONF;
require_once $_CONF['path'] . 'plugins/staticpages/autoinstall.php';
-
+
$inst_parms = plugin_autoinstall_staticpages('staticpages');
-
+
return $inst_parms['info']['pi_version'];
}
@@ -1014,7 +1016,7 @@
}
require_once $_CONF['path'] . 'plugins/staticpages/autoinstall.php';
-
+
if (! plugin_compatible_with_this_version_staticpages('staticpages')) {
return 3002;
}
diff -r ad57bda59747 -r c68402fc8a20 system/classes/search.class.php
--- a/system/classes/search.class.php Mon May 25 14:06:13 2009 +0100
+++ b/system/classes/search.class.php Mon May 25 16:57:48 2009 +0100
@@ -352,7 +352,9 @@
// Make sure the query is SQL safe
$query = trim(addslashes($this->_query));
- $sql = "SELECT s.sid AS id, s.title AS title, s.introtext AS description, UNIX_TIMESTAMP(s.date) AS date, s.uid AS uid, s.hits AS hits, CONCAT('/article.php?story=',s.sid) AS url ";
+ $sql = "SELECT s.sid AS id, s.title AS title, s.introtext AS description, ";
+ $sql .= "UNIX_TIMESTAMP(s.date) AS date, s.uid AS uid, s.hits AS hits, ";
+ $sql .= "CONCAT('/article.php?story=',s.sid) AS url ";
$sql .= "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u ";
$sql .= "WHERE (draft_flag = 0) AND (date <= NOW()) AND (u.uid = s.uid) ";
$sql .= COM_getPermSQL('AND') . COM_getTopicSQL('AND') . COM_getLangSQL('sid', 'AND') . ' ';
@@ -377,7 +379,7 @@
}
$search = new SearchCriteria('stories', $LANG09[65]);
- $columns = array('introtext', 'bodytext', 'title' => 'title');
+ $columns = array('title' => 'title', 'introtext', 'bodytext');
list($sql, $ftsql) = $search->buildSearchSQL($this->_keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
@@ -403,7 +405,8 @@
// Make sure the query is SQL safe
$query = trim(addslashes($this->_query));
- $sql = "SELECT c.cid AS id, c.title AS title, c.comment AS description, UNIX_TIMESTAMP(c.date) AS date, c.uid AS uid, '0' AS hits, ";
+ $sql = "SELECT c.cid AS id, c.title AS title, c.comment AS description, ";
+ $sql .= "UNIX_TIMESTAMP(c.date) AS date, c.uid AS uid, ";
// MSSQL has a problem when concatenating numeric values
if ($_DB_dbms == 'mssql') {
@@ -437,7 +440,7 @@
}
$search = new SearchCriteria('comments', $LANG09[66]);
- $columns = array('comment', 'title' => 'c.title');
+ $columns = array('title' => 'c.title', 'comment');
list($sql, $ftsql) = $search->buildSearchSQL($this->_keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
@@ -632,9 +635,9 @@
SQL_TITLE => $label,
'title' => $col_title == -1 ? '<i>' . $LANG09[70] . '</i>' : $old_row[$col_title],
'description' => $col_desc == -1 ? '<i>' . $LANG09[70] . '</i>' : $old_row[$col_desc],
- 'date' => $col_date == -1 ? ' ' : $date,
- 'uid' => $col_user == -1 ? ' ' : $old_row[$col_user],
- 'hits' => $col_hits == -1 ? '0' : str_replace(',', '', $old_row[$col_hits])
+ 'date' => $col_date == -1 ? 'LF_NULL' : $date,
+ 'uid' => $col_user == -1 ? 'LF_NULL' : $old_row[$col_user],
+ 'hits' => $col_hits == -1 ? 'LF_NULL' : str_replace(',', '', $old_row[$col_hits])
);
preg_match('/href="([^"]+)"/i', $api_results['title'], $links);
$api_results['url'] = empty($links) ? '#' : $links[1];
More information about the geeklog-cvs
mailing list