// Comment callback functions
$modversion['comments']['callbackFile'] = 'include/comment_functions.php';
$modversion['comments']['callback']['approve'] = 'wggalleryCommentsApprove';
$modversion['comments']['callback']['update'] = 'wggalleryCommentsUpdate';
// Global Events Image commented
$modversion['notification']['event'][] = [
'name' => 'img_comment_all',
'category' => 'global',
'admin_only' => 0,
'title' => _MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY,
'caption' => _MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_CAPTION,
'description' => '',
'mail_template' => 'global_img_comment_notify',
'mail_subject' => _MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_SUBJECT,
];
// Album Events Image commented
$modversion['notification']['event'][] = [
'name' => 'image_comment',
'category' => 'albums',
'admin_only' => 0,
'title' => _MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY,
'caption' => _MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_CAPTION,
'description' => '',
'mail_template' => 'global_img_comment_notify',
'mail_subject' => _MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_SUBJECT,
];
define('_MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY', 'Notify me about new comments for images');
define('_MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_CAPTION', 'Notify me about comments for images');
define('_MI_WGGALLERY_GLOBAL_IMG_COMMENT_NOTIFY_SUBJECT', 'Notification about comments for an image');
define('_MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY', 'Notify me about new comments for images in this album');
define('_MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_CAPTION', 'Notify me about comments for images in this album');
define('_MI_WGGALLERY_ALBUMS_IMG_COMMENT_NOTIFY_SUBJECT', 'Notification about new comment for an image');
$helper = XoopsModulesWggalleryHelper::getInstance();
// send notifications
$imgId = $comment->getVar('com_itemid');
$imageObj = $helper->getHandler('Images')->get($imgId);
$albId = $imageObj->getVar('img_albid');
$tags = [];
$tags['IMAGE_NAME'] = $imageObj->getVar('img_name');
$tags['IMAGE_URL'] = XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/images.php?op=show&img_id=' . $imgId . '&alb_id=' . $albId;
$tags['ALBUM_URL'] = XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/albums.php?op=show&alb_id=' . $albId;
$notificationHandler = xoops_getHandler('notification');
$notificationHandler->triggerEvent('global', 0, 'img_comment_all', $tags, [], $comment->getVar('com_modid'));
$notificationHandler->triggerEvent('albums', $albId, 'img_comment', $tags);
'mail_template' => 'global_img_comment_notify'
// Comments
$modversion['hasComments'] = 1;
$modversion['comments']['itemName'] = 'faqid';
$modversion['comments']['pageName'] = 'faq.php';
// Comment callback functions
$modversion['comments']['callbackFile'] = 'include/comment_functions.php';
$modversion['comments']['callback']['approve'] = 'smartfaq_com_approve';
$modversion['comments']['callback']['update'] = 'smartfaq_com_update';
// Notification
$modversion['hasNotification'] = 1;
$modversion['notification']['lookup_file'] = 'include/notification.inc.php';
$modversion['notification']['lookup_func'] = 'smartfaq_notify_iteminfo';
$modversion['notification']['category'][] = [
'name' => 'global_faq',
'title' => _MI_SF_GLOBAL_FAQ_NOTIFY,
'description' => _MI_SF_GLOBAL_FAQ_NOTIFY_DSC,
'subscribe_from' => ['index.php', 'category.php', 'faq.php'],
];
if ($module->getVar('hascomments')) {
$com_config = $module->getInfo('comments');
if (!empty($category['item_name']) && $category['item_name'] == $com_config['itemName']) {
if (!is_dir($dir = XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/mail_template/')) {
$dir = XOOPS_ROOT_PATH . '/language/english/mail_template/';
}
$mail_template_dir = $dir;
include_once $GLOBALS['xoops']->path('include/comment_constants.php');
$config_handler = xoops_getHandler('config');
$com_config = $config_handler->getConfigsByCat(0, $module_id);
if (!$enabled_only) {
$insert_comment = true;
$insert_submit = true;
} else {
$insert_comment = false;
$insert_submit = false;
switch ($com_config['com_rule']) {
case XOOPS_COMMENT_APPROVENONE:
// comments disabled, no comment events
break;
case XOOPS_COMMENT_APPROVEALL:
// all comments are automatically approved, no 'submit'
if (!$override_comment) {
$insert_comment = true;
}
break;
case XOOPS_COMMENT_APPROVEUSER:
case XOOPS_COMMENT_APPROVEADMIN:
// comments first submitted, require later approval
if (!$override_comment) {
$insert_comment = true;
}
if (!$override_commentsubmit) {
$insert_submit = true;
}
break;
}
}
if ($insert_comment) {
$event = array(
'name' => 'comment',
'category' => $category['name'],
'title' => _NOT_COMMENT_NOTIFY,
'caption' => _NOT_COMMENT_NOTIFYCAP,
'description' => _NOT_COMMENT_NOTIFYDSC,
'mail_template_dir' => $mail_template_dir,
'mail_template' => 'comment_notify',
'mail_subject' => _NOT_COMMENT_NOTIFYSBJ);
if (!$enabled_only || notificationEventEnabled($category, $event, $module)) {
$event_array[] = $event;
}
}
if ($insert_submit) {
$event = array(
'name' => 'comment_submit',
'category' => $category['name'],
'title' => _NOT_COMMENTSUBMIT_NOTIFY,
'caption' => _NOT_COMMENTSUBMIT_NOTIFYCAP,
'description' => _NOT_COMMENTSUBMIT_NOTIFYDSC,
'mail_template_dir' => $mail_template_dir,
'mail_template' => 'commentsubmit_notify',
'mail_subject' => _NOT_COMMENTSUBMIT_NOTIFYSBJ,
'admin_only' => 1);
if (!$enabled_only || notificationEventEnabled($category, $event, $module)) {
$event_array[] = $event;
}
}
}
}