include 'header.php'; include 'perm.php'; $eid = param('eid'); $exid = param('sub'); $uid = param('uid'); $data = fetch_event($eid, $exid, true); $data['past_register'] = eguide_form_options('enable_past_register', 0); $errs = array(); $now = time(); $member_only = $xoopsModuleConfig['member_only'] != ACCEPT_EMAIL && $uid > 0; if (isset($_POST['eid'])) { include 'reserv_func.php'; $myts =& MyTextSanitizer::getInstance(); $vals = get_opt_values($data['optfield'], $errs, false, false); check_prev_order($data, $vals, $errs, true); $value = serialize_text($vals); $url = EGUIDE_URL . '/receipt.php?eid=' . $eid; if ($exid) { $url .= '&sub=' . $exid; } if (!$errs) { $data['closetime'] = 0; // override close order time $accept = $data['autoaccept']; $strict = $data['strict']; $persons = $data['persons']; $num = 1; $nlab = eguide_form_options('label_persons'); if ($nlab && isset($vals[$nlab])) { $num = intval($vals[$nlab]); if ($num < 1) {
// convert text serialize before 2.30 // $Id: conv230.php,v 1.1 2007/07/18 04:53:43 nobu Exp $ include "admin_header.php"; // note: search text fields special string as ": \"+"\n" $res = $xoopsDB->query("SELECT rvid,eid,info FROM " . RVTBL . " WHERE info LIKE " . $xoopsDB->quoteString("%: \\\\\n%")); $count = $xoopsDB->getRowsNum($res); if (isset($_POST['convert'])) { if ($count) { $opts = array(); while (list($rvid, $eid, $info) = $xoopsDB->fetchRow($res)) { if (!isset($opts[$eid])) { $ost = $xoopsDB->query("SELECT optfield FROM " . OPTBL . " WHERE eid=" . $eid); list($opts[$eid]) = $xoopsDB->fetchRow($ost); } $item = $opts[$eid]; $info = serialize_text(explodeinfo($info, $item)); $xoopsDB->query("UPDATE " . RVTBL . " SET info=" . $xoopsDB->quoteString($info) . " WHERE rvid=" . $rvid); } } redirect_header('index.php', 1, _AM_DBUPDATED); exit; } xoops_cp_header(); echo "<h2>Convert Format before eguide 2.30</h2>"; echo "<div>" . _AM_COUNT . ": {$count}</div>"; if ($count) { echo "<form method='post'><input type='submit' name='convert'/></form>"; } xoops_cp_footer(); // exploding addional informations. // older CSV serialize
function store_message($items, $form) { global $xoopsUser, $xoopsDB, $xoopsModuleConfig; $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; $store = $form['store']; if ($store == _DB_STORE_NONE) { $showaddr = true; // no store to need show address } else { $showaddr = get_attr_value(null, 'notify_with_email'); } $from = $email = ""; $attach = array(); $vals = array(); $rtext = ''; foreach ($items as $item) { if (empty($item['name'])) { continue; } $name = $item['name']; $val = $item['value']; $vals[$name] = $val; $opts =& $item['options']; switch ($item['type']) { case 'mail': if (empty($email)) { // save first email for contact $email = $vals[$name]; $mail_name = $name; if ($showaddr) { $from = $email; break; } continue 2; /* PHP switch catch continue! */ } break; case 'file': $val = $vals[$name]; if ($val) { $vals[$name] = "file=" . $val; $attach[] = $val; } break; case 'radio': case 'select': if (isset($opts[$val])) { $val = strip_tags($opts[$val]); } break; case 'checkbox': foreach ($val as $k => $v) { $val[$k] = isset($opts[$v]) ? strip_tags($opts[$v]) : $v; } $val = join(', ', $val); break; } if (!empty($val) && preg_match('/\\n/', $val)) { $val = "\n\t" . preg_replace('/\\n/', "\n\t", $val); } $rtext .= strip_tags($item['label']) . ": {$val}\n"; } // remove if not show/store email address in database if (!$showaddr && isset($mail_name)) { unset($vals[$mail_name]); } $text = serialize_text($vals); // store value $onepass = $uid == 0 ? cc_onetime_ticket($email) : ""; if ($form['priuid'] < 0) { $touid = empty($form['priuser']) ? 0 : $form['priuser']['uid']; } else { $touid = $form['priuid']; } $now = time(); $values = array('uid' => $uid, 'touid' => $touid, 'ctime' => $now, 'mtime' => $now, 'atime' => $now, 'fidref' => $form['formid'], 'email' => $xoopsDB->quoteString($email), 'onepass' => $xoopsDB->quoteString($onepass)); $parg = $onepass ? "&p=" . urlencode($onepass) : ""; if ($store == _DB_STORE_YES) { $values['body'] = $xoopsDB->quoteString($text); } if ($store != _DB_STORE_NONE) { $res = $xoopsDB->query("INSERT INTO " . CCMES . "(" . join(',', array_keys($values)) . ") VALUES (" . join(',', $values) . ")"); if ($res === false) { return array("Error in DATABASE insert"); } $id = $xoopsDB->getInsertID(); if (empty($id)) { return array("Internal Error in Store Message"); } } else { $id = 0; } $member_handler =& xoops_gethandler('member'); if ($touid) { $toUser = $member_handler->getUser($touid); $toUname = $toUser->getVar('uname'); } else { $toUser = false; $toUname = _MD_CONTACT_NOTYET; } $atext = ""; // reply sender $btext = ""; // to contact and monitors if (count($attach)) { $atext = $btext = "\n" . _MD_ATTACHMENT . "\n"; foreach ($attach as $i => $file) { move_attach_file('', $file, $id); $a = cc_attach_image($id, $file, true); $atext .= "{$a}{$parg}\n"; $btext .= "{$a}\n"; } rmdir(XOOPS_UPLOAD_PATH . cc_attach_path(0, '')); } $dirname = basename(dirname(__FILE__)); $uname = $xoopsUser ? $xoopsUser->getVar('uname') : $GLOBALS['xoopsConfig']['anonymous']; $tags = array('SUBJECT' => $form['title'], 'TO_USER' => $toUname, 'FROM_USER' => $uname, 'FROM_EMAIL' => $email, 'REMOTE_ADDR' => $_SERVER["REMOTE_ADDR"], 'HTTP_USER_AGENT' => $_SERVER["HTTP_USER_AGENT"], 'MSGID' => $id); foreach ($vals as $k => $v) { $tags[$k] = is_array($v) ? implode(', ', $v) : $v; } $tpl = get_attr_value(null, 'from_confirm_tpl', 'form_confirm.tpl'); $msgurl = XOOPS_URL . ($id ? "/modules/{$dirname}/message.php?id={$id}" : '/'); if ($email) { // reply automaticaly $tags['VALUES'] = "{$rtext}{$atext}"; $tags['MSG_URL'] = $store == _DB_STORE_NONE ? '' : "\n" . _MD_NOTIFY_URL . "\n{$msgurl}{$parg}"; cc_notify_mail($tpl, $tags, $email, $toUser ? $toUser->getVar('email') : ''); } $tags['VALUES'] = "{$rtext}{$btext}"; $tags['MSG_URL'] = $store == _DB_STORE_NONE ? '' : "\n" . _MD_NOTIFY_URL . "\n" . $msgurl; $notification_handler =& xoops_gethandler('notification'); $notification_handler->triggerEvent('global', 0, 'new', $tags); $notification_handler->triggerEvent('form', $form['formid'], 'new', $tags); // force subscribe sender and recipient if ($id) { $notification_handler->subscribe('message', $id, 'comment'); } if ($touid) { if ($id) { $notification_handler->subscribe('message', $id, 'comment', null, null, $touid); } cc_notify_mail(get_attr_value(null, 'charge_notify_tpl', $tpl), $tags, $toUser, $from); } elseif ($form['cgroup']) { // contact group notify $users = $member_handler->getUsersByGroup($form['cgroup'], true); cc_notify_mail(get_attr_value(null, 'group_notify_tpl', $tpl), $tags, $users, $from); } if ($id) { $msgurl .= $parg; } $redirect = get_attr_value(null, 'redirect'); if (!empty($redirect)) { $msgurl = preg_match('/^\\//', $redirect) ? XOOPS_URL . $redirect : $redirect; } redirect_header($msgurl, 3, _MD_CONTACT_DONE); exit; }
function post_optvars() { $items = get_form_attribute(_CC_OPTDEFS, '', 'optvar'); $errors = assign_post_values($items); $vars = array(); foreach ($items as $item) { $fname = $item['name']; if ($fname == "others") { foreach (unserialize_vars($item['value']) as $k => $v) { $vars[$k] = $v; } } else { if ($item['value']) { $vars[$fname] = $item['value']; } } } return serialize_text($vars); }