/** * @desc Envía correo de aprobación de publicación * @param Object $res Publicación **/ function mail_approved(RDResource &$res) { global $xoopsModuleConfig, $xoopsConfig; $config_handler =& xoops_gethandler('config'); $mconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER); $errors = ''; $user = new XoopsUser($res->getVar('owner')); $member_handler =& xoops_gethandler('member'); $method = $user->getVar('notify_method'); $mailer = new RMMailer('text/plain'); $mailer->add_xoops_users($user); $mailer->set_subject(sprintf(__('Publication <%s> approved!', 'docs'), $res->getVar('title'))); $mailer->assign('dear_user', $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname')); $mailer->assign('link_to_resource', $res->permalink()); $mailer->assign('site_name', $xoopsConfig['sitename']); $mailer->assign('resource_name', $res->getVar('title')); $mailer->template(RMTemplate::get()->get_template('mail/resource_approved.php', 'module', 'docs')); switch ($method) { case '1': $mailer->set_from_xuser($mconfig['fromuid']); $ret = $mailer->send_pm(); break; case '2': $ret = $mailer->send(); break; } $page = rmc_server_var($_POST, 'page', 1); return $ret; }
/** * desc Elimina de la base de datos los elementos **/ function dt_delete_items() { global $xoopsModuleConfig, $xoopsConfig, $xoopsModule, $xoopsSecurity, $rmc_config, $xoopsUser; $ids = rmc_server_var($_POST, 'ids', array()); $page = rmc_server_var($_POST, 'page', 1); $search = rmc_server_var($_POST, 'search', ''); $sort = rmc_server_var($_POST, 'sort', 'id_soft'); $mode = rmc_server_var($_POST, 'mode', 1); $cat = rmc_server_var($_POST, 'cat', 0); $type = rmc_server_var($_POST, 'type', ''); $params = '?pag=' . $page . '&search=' . $search . '&sort=' . $sort . '&mode=' . $mode . '&cat=' . $cat . '&type=' . $type; //Verificamos que el software sea válido if (!is_array($ids) && $ids <= 0) { redirectMsg('items.php' . $params, __('You must select at least one download item to delete!', 'dtransport'), RMMSG_WARN); } if (!is_array($ids)) { $ids = array($ids); } if (!$xoopsSecurity->check()) { redirectMsg('items.php' . $params, __('Session token expired!', 'dtransport'), RMMSG_ERROR); } $errors = ''; $mailer = new RMMailer('text/html'); $etpl = DT_PATH . '/lang/deletion_' . $rmc_config['lang'] . '.php'; if (!file_exists($etpl)) { $etpl = DT_PATH . '/lang/deletion_en.php'; } $mailer->template($etpl); $mailer->assign('siteurl', XOOPS_URL); $mailer->assign('dturl', $xoopsModuleConfig['permalinks'] ? XOOPS_URL . '/' . trim($xoopsModuleConfig['htbase'], '/') : DT_URL); $mailer->assign('downcp', $xoopsModuleConfig['permalinks'] ? XOOPS_URL . '/' . trim($xoopsModuleConfig['htbase'], '/') . '/cp/' : DT_URL . '/?p=cpanel'); $mailer->assign('dtname', $xoopsModule->name()); $mailer->assign('sitename', $xoopsConfig['sitename']); foreach ($ids as $id) { $sw = new DTSoftware($id); if ($sw->isNew()) { continue; } if (!$sw->delete()) { $errors .= $sw->errors(); continue; } $xu = new XoopsUser($sw->getVar('uid')); $mailer->add_users(array($xu)); $mailer->assign('uname', $xu->name() != '' ? $xu->name() : $xu->uname()); $mailer->assign('download', $sw->getVar('name')); $mailer->assign('email', $xu->getVar('email')); $mailer->assign('method', $xu->getVar('notify_method')); $mailer->set_subject(sprintf(__('Your download %s has been deleted!', 'dtransport'), $sw->getVar('name'))); if ($xu->getVar('notify_method') == 1) { $mailer->set_from_xuser($xoopsUser); $mailer->send_pm(); } else { $mailer->send(); } } if ($errors != '') { redirectMsg('items.php' . $params, __('Errors ocurred while trying to delete selected downloads!', 'dtransport') . '<br />' . $errors, RMMSG_ERROR); } redirectMsg('items.php' . $params, __('Downloads deleted successfully!', 'dtransport'), RMMSG_SUCCESS); }