[geeklog-cvs] geeklog: Allow subtypes for PLG_itemSaved and PLG_itemDeleted an...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Mar 29 15:53:26 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/123e4e95721b
changeset: 6871:123e4e95721b
user: Dirk Haun <dirk at haun-online.de>
date: Sun Mar 29 17:38:54 2009 +0200
description:
Allow subtypes for PLG_itemSaved and PLG_itemDeleted and implemented them for links categories
diffstat:
2 files changed, 32 insertions(+), 17 deletions(-)
public_html/admin/plugins/links/category.php | 22 ++++++++++++++-------
system/lib-plugins.php | 27 ++++++++++++++++----------
diffs (117 lines):
diff -r 65e07783f408 -r 123e4e95721b public_html/admin/plugins/links/category.php
--- a/public_html/admin/plugins/links/category.php Sun Mar 29 16:42:32 2009 +0200
+++ b/public_html/admin/plugins/links/category.php Sun Mar 29 17:38:54 2009 +0200
@@ -40,7 +40,7 @@
* @subpackage admin
* @filesource
* @version 2.1
- * @since GL 1.5.0
+ * @since Geeklog 1.5.0
* @copyright Copyright © 2000-2009
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* @author Tony Bibbs, tony AT tonybibbs DOT com
@@ -102,18 +102,19 @@
$defsort_arr = array('field' => 'category', 'direction' => 'asc');
+ $links_url = $_CONF['site_admin_url'] . '/plugins/links';
$menu_arr = array (
- array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php',
+ array('url' => $links_url . '/index.php',
'text' => $LANG_LINKS_ADMIN[53]),
- array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php?mode=edit',
+ array('url' => $links_url . '/index.php?mode=edit',
'text' => $LANG_LINKS_ADMIN[51]),
- array('url' => $_CONF['site_admin_url'] . '/plugins/links/index.php?validate=enabled',
+ array('url' => $links_url . '/index.php?validate=enabled',
'text' => $LANG_LINKS_ADMIN[26]),
- array('url' => $_CONF['site_admin_url'] . '/plugins/links/category.php',
+ array('url' => $links_url . '/category.php',
'text' => $LANG_LINKS_ADMIN[50]),
- array('url' => $_CONF['site_admin_url'] . '/plugins/links/category.php?mode=edit',
+ array('url' => $links_url . '/category.php?mode=edit',
'text' => $LANG_LINKS_ADMIN[52]),
- array('url' => $_CONF['site_admin_url'],
+ array('url' => $_CONF['site_admin_url'],
'text' => $LANG_ADMIN['admin_home'])
);
@@ -431,6 +432,12 @@
'{$perm_group}','{$perm_members}','{$perm_anon}')";
$result = DB_query($sql);
}
+
+ if (($update == 'existing') && ($cid != $old_cid)) {
+ PLG_itemSaved($cid, 'links.category', $old_cid);
+ } else {
+ PLG_itemSaved($cid, 'links.category');
+ }
}
return 10; // success message
@@ -464,6 +471,7 @@
if (($sf == 0) && ($sl == 0)) {
// No subfolder/links so OK to delete
DB_delete($_TABLES['linkcategories'], 'cid', $cid);
+ PLG_itemDeleted($cid, 'links.category');
return 13;
} else {
// Subfolders and/or sublinks exist so return a message
diff -r 65e07783f408 -r 123e4e95721b system/lib-plugins.php
--- a/system/lib-plugins.php Sun Mar 29 16:42:32 2009 +0200
+++ b/system/lib-plugins.php Sun Mar 29 17:38:54 2009 +0200
@@ -2107,17 +2107,18 @@
* for the plugin but since it doesn't know about the plugin's access control,
* it has to ask the plugin to approve / reject such an operation.
*
+* $operation can be one of the following:
+* - 'acceptByID': accept a trackback comment on item with ID $id
+* returns: true for accept, false for reject
+* - 'acceptByURI': accept a pingback comment on item at URL $id
+* returns: the item's ID for accept, false for reject
+* - 'delete': is the current user allowed to delete item with ID $id?
+* returns: true for accept, false for reject
+*
* @param string $type plugin type
* @param string $id an ID or URL, depending on the operation
* @param string $operation operation to perform
-*
-* $operation can be one of the following:
-* 'acceptByID' - accept a trackback comment on item with ID $id
-* returns: true for accept, false for reject
-* 'acceptByURI' - accept a pingback comment on item at URL $id
-* returns: the item's ID for accept, false for reject
-* 'delete' - is the current user allowed to delete item with ID $id?
-* returns: true for accept, false for reject
+* @return mixed depends on $operation
*
*/
function PLG_handlePingComment ($type, $id, $operation)
@@ -2174,9 +2175,12 @@
{
global $_PLUGINS;
+ $t = explode('.', $type);
+ $plg_type = $t[0];
+
$plugins = count($_PLUGINS);
for ($save = 0; $save < $plugins; $save++) {
- if ($_PLUGINS[$save] != $type) {
+ if ($_PLUGINS[$save] != $plg_type) {
$function = 'plugin_itemsaved_' . $_PLUGINS[$save];
if (function_exists($function)) {
$function($id, $type, $old_id);
@@ -2208,9 +2212,12 @@
{
global $_PLUGINS;
+ $t = explode('.', $type);
+ $plg_type = $t[0];
+
$plugins = count($_PLUGINS);
for ($del = 0; $del < $plugins; $del++) {
- if ($_PLUGINS[$del] != $type) {
+ if ($_PLUGINS[$del] != $plg_type) {
$function = 'plugin_itemdeleted_' . $_PLUGINS[$del];
if (function_exists($function)) {
$function($id, $type);
More information about the geeklog-cvs
mailing list