Exemple #1
0
         } else {
             $xoopsMailer->assign("REQ_UNAME", '*anonymous*');
             $xoopsMailer->assign("REQ_NAME", $xoopsConfig['anonymous']);
         }
         $tags = array("TITLE" => "{EVENT_DATE} {EVENT_TITLE}", "EVENT_DATE" => eventdate($data['edate']), "EVENT_TITLE" => $data['title'], "EVENT_URL" => $evurl, "RVID" => $rvid, "INFO" => $uinfo . $data['info']);
         $xoopsMailer->assign($tags);
         $xoopsMailer->setSubject(_MD_CANCEL_SUBJ);
         $tpl = 'cancel.tpl';
         $xoopsMailer->setTemplateDir(template_dir($tpl));
         $xoopsMailer->setTemplate($tpl);
         if ($email) {
             $xoopsMailer->setToEmails($email);
         }
         $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
         $xoopsMailer->setFromName(eguide_from_name());
         if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) {
             $xoopsMailer->setToUsers($poster);
         }
         $member_handler =& xoops_gethandler('member');
         if ($xoopsModuleConfig['notify']) {
             $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']);
             $xoopsMailer->setToGroups($notify_group);
         }
         $xoopsMailer->send();
     }
 }
 if (empty($_POST['back'])) {
     $back = $evurl;
 } else {
     $back = $myts->makeTboxData4Edit(trim($_POST['back']));
 }
function order_notify($data, $email, $value)
{
    global $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $poster = new XoopsUser($data['uid']);
    $eid = $data['eid'];
    $exid = $data['exid'];
    $url = EGUIDE_URL . '/event.php?eid=' . $eid . ($exid ? "&sub={$exid}" : '');
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $tplname = $data['autoaccept'] ? "accept%s.tpl" : "order%s.tpl";
    $extra = eguide_form_options('reply_extension');
    $tplfile = sprintf($tplname, '');
    // default template name
    $tmpdir = template_dir($tplfile);
    if ($extra) {
        $vals = unserialize_text($value);
        if (isset($vals[$extra])) {
            $extpl = sprintf($tplname, $vals[$extra]);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    } else {
        $extra = eguide_form_options('reply_tpl_suffix');
        if ($extra) {
            $extpl = sprintf($tplname, $extra);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    }
    $xoopsMailer->setTemplateDir($tmpdir);
    $xoopsMailer->setTemplate($tplfile);
    if ($xoopsModuleConfig['member_only'] && is_object($xoopsUser)) {
        $user = $xoopsUser;
        if (isset($data['reserv_uid'])) {
            $ruid = $data['reserv_uid'];
            $user = new XoopsUser($ruid);
        } else {
            $xoopsMailer->setToUsers($user);
        }
        $uinfo = sprintf("%s: %s (%s)\n", _MD_UNAME, $user->getVar('uname'), $user->getVar('name'));
    } else {
        if (!empty($email)) {
            $xoopsMailer->setToEmails($email);
        }
        $uinfo = "";
    }
    if ($email) {
        $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email);
    }
    $rvid = $data['rvid'];
    $conf = $data['confirm'];
    $edate = eventdate($data['edate']);
    $tags = array("EVENT_URL" => $url, "RVID" => $rvid, "CANCEL_KEY" => $conf, "CANCEL_URL" => EGUIDE_URL . "/reserv.php?op=cancel&rvid={$rvid}&key={$conf}", "INFO" => $uinfo . $value, "TITLE" => $edate . " " . $data['title'], "EVENT_DATE" => $edate, "EVENT_TITLE" => $data['title'], "SUMMARY" => strip_tags($data['summary']));
    $subj = eguide_form_options('reply_subject', _MD_SUBJECT);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    $ret = $xoopsMailer->send();
    // send to order person
    if (!$ret) {
        return $ret;
    }
    $xoopsMailer->reset();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplateDir(template_dir($tplfile));
    $xoopsMailer->setTemplate($tplfile);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    if ($data['notify']) {
        if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) {
            $xoopsMailer->setToUsers($poster);
        }
        $member_handler =& xoops_gethandler('member');
        $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']);
        $xoopsMailer->setToGroups($notify_group);
        $xoopsMailer->send();
    }
    return $ret;
}
Exemple #3
0
/**
* Shows all registered users in a list with filter and manage options
*/
function show_users()
{
    global $xoopsSecurity;
    define('RMCSUBLOCATION', 'allusers');
    RMTemplate::get()->add_style('users.css', 'rmcommon');
    RMTemplate::get()->add_style('js-widgets.css');
    //Scripts
    RMTemplate::get()->add_local_script('users.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_head('<script type="text/javascript">var rmcu_select_message = "' . __('You have not selected any user!', 'rmcommon') . '";
        var rmcu_message = "' . __('Dou you really wish to delete selected users?', 'rmcommon') . '";</script>');
    $form = new RMForm('', '', '');
    // Date Field
    $login1 = new RMFormDate('', 'login1', '');
    $login2 = new RMFormDate('', 'login2', '');
    // Registered Field
    $register1 = new RMFormDate('', 'registered1', '');
    $register2 = new RMFormDate('', 'registered2', '');
    xoops_cp_location(__('Users Management', 'rmcommon'));
    RMFunctions::create_toolbar();
    // Show the theme
    xoops_cp_header();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("users") . " " . formatSQL();
    $page = rmc_server_var($_REQUEST, 'pag', 1);
    $limit = rmc_server_var($_REQUEST, 'limit', 15);
    $order = rmc_server_var($_GET, 'order', 'uid');
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('users.php?limit=' . $limit . '&order=' . $order . '&pag={PAGE_NUM}');
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= "ORDER BY {$order} LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $users = array();
    $user = new XoopsUser();
    $t = array();
    // Temporary
    while ($row = $db->fetchArray($result)) {
        $user->assignVars($row);
        $t = $user->getValues();
        $t['groups'] = $user->groups();
        $t = RMEvents::get()->run_event('rmcommon.loading.users.list', $t);
        $users[] = $t;
        $t = array();
    }
    $xgh = new XoopsGroupHandler($db);
    $users = RMEvents::get()->run_event('rmcommon.users.list.loaded', $users);
    // Users template
    include RMTemplate::get()->get_template('rmc_users.php', 'module', 'rmcommon');
    xoops_cp_footer();
}