/** * Send new item notification emails * * @param string $type plugin name or comment * @param string $category category type (i.e.; for comment it would contain filemgmt, article, etc.) * @param string $track_id id of item being tracked * @param string $post_id id of new item posted (i.e.; comment id, media_id, etc.) * @param int $post_uid user who posted item * @return boolean true on succes, false on fail * @since glFusion v1.3.0 * */ function PLG_sendSubscriptionNotification($type, $category, $track_id, $post_id, $post_uid) { global $_CONF, $_TABLES, $LANG04; USES_lib_html2text(); $function = 'plugin_subscription_email_format_' . $type; if (function_exists($function)) { $args[1] = $category; $args[2] = $track_id; $args[3] = $post_id; $args[4] = $post_uid; list($htmlmsg, $textmsg, $imageData) = PLG_callFunctionForOnePlugin($function, $args); } else { COM_errorLog("PLG_sendSubscriptionNotification() - No plugin_subscription_email_format_ defined"); return false; } if ($track_id == 0) { $sql = "SELECT {$_TABLES['subscriptions']}.uid,email,id FROM {$_TABLES['subscriptions']} LEFT JOIN {$_TABLES['users']} ON {$_TABLES['subscriptions']}.uid={$_TABLES['users']}.uid" . " WHERE {$_TABLES['users']}.status=" . USER_ACCOUNT_ACTIVE . " AND category='" . DB_escapeString($category) . "'" . " AND type='" . DB_escapeString($type) . "'"; } else { $sql = "SELECT {$_TABLES['subscriptions']}.uid,email,id FROM {$_TABLES['subscriptions']} LEFT JOIN {$_TABLES['users']} ON {$_TABLES['subscriptions']}.uid={$_TABLES['users']}.uid" . " WHERE {$_TABLES['users']}.status=" . USER_ACCOUNT_ACTIVE . " AND category='" . DB_escapeString($category) . "'" . " AND id='" . DB_escapeString($track_id) . "'" . " AND type='" . DB_escapeString($type) . "'"; } $result = DB_query($sql); $nrows = DB_numRows($result); $messageData = array(); $messageData['subject'] = $LANG04[184]; $messageData['from'] = $_CONF['noreply_mail']; $messageData['htmlmessage'] = $htmlmsg; $messageData['textmessage'] = $textmsg; if (is_array($imageData) && count($imageData) > 0) { $messageData['embeddedImage'] = $imageData; } $to = array(); while (($S = DB_fetchArray($result)) != NULL) { if ($S['uid'] == $post_uid) { // skip author continue; } if ($S['id'] < 0) { // allows exclude records... continue; } $to[] = $S['email']; } $messageData['to'] = $to; COM_emailNotification($messageData); return true; }
/** * Ask plugins for items they want to include in an XML site map * * @param string $type plugin type (incl. 'article' for stories) * @param int $uid user ID or 0 = current user; should be 1 (= anonymous user) in most cases * @param int $limit the max number of items to be returned (0 = no limit) * @return array array of array( * 'url' => the URL of an item (mandatory), * 'date-modified' => the UNIX timestamp when an item was last modified (optional) * 'change-freq' => one of 'always', 'hourly', 'daily', 'weekly', * 'monthly', 'yearly', 'never' (optional) * 'priority' => a float value showing the priority of an item, must be * between 0.0 (lowest) and 1.0 (highest) (optional) * ) * @since Geeklog-2.1.1 * @link http://wiki.geeklog.net/index.php/PLG_getSitemapItems * */ function PLG_collectSitemapItems($type, $uid = 1, $limit = 0) { global $_CONF; if ($type === 'article' || $type === 'story') { require_once $_CONF['path_system'] . 'lib-story.php'; $type = 'story'; } $uid = intval($uid, 10); $limit = intval($limit, 10); $args = array(1 => $uid, 2 => $limit); if ($type === 'CUSTOM') { // Collect sitemap items from custom function $function = 'CUSTOM_collectSitemapItems'; } else { // Collect sitemap items from a plugin $function = 'plugin_collectSitemapItems_' . $type; } $result = PLG_callFunctionForOnePlugin($function, $args); if (!is_array($result) || count($result) === 0) { $result = array(); } return $result; }
/** * Inform plugins when another plugin's state changed * * Unlike PLG_enableStateChange, this function is called after the state * change. * * NOTE: You can not rely on being informed of state changes for 'installed', * 'uninstalled', and 'upgraded', as these may happen in the plugin's install * script, outside of Geeklog's control. * * @param string $type plugin name * @param string $status new status: 'enabled', 'disabled', 'installed', 'uninstalled', 'upgraded' * @return void * @see PLG_enableStateChange * @since Geeklog 1.6.0 * */ function PLG_pluginStateChange($type, $status) { global $_PLUGINS; $args[1] = $type; $args[2] = $status; foreach ($_PLUGINS as $pi_name) { if ($pi_name != $type) { $function = 'plugin_pluginstatechange_' . $pi_name; PLG_callFunctionForOnePlugin($function, $args); } } $function = 'CUSTOM_pluginstatechange'; if (function_exists($function)) { $function($type, $status); } }