* @version $Revision: 2048 $ */ define('CURSCRIPT', 'query'); require "../libraries/common.inc.php"; require "../share.inc.php"; uses("product", "member", "message", "typeoption"); $pms = new Messages(); $typeoption = new Typeoption(); $member = new Members(); $product = new Products(); if (isset($_POST['id']) && !empty($_POST['do']) && !empty($_POST['title'])) { pb_submit_check('inquery'); $vals['type'] = 'inquery'; $vals['title'] = $_POST['title']; $vals['content'] = implode("<br />", $_POST['inquery']); $result = $pms->SendToUser($pb_userinfo['pb_username'], $pdb->GetOne("SELECT username FROM {$tb_prefix}members WHERE id=" . intval($_POST['to_member_id'])), $vals); if (!$result) { flash("failed", '', 0); } else { flash("success", '', 0); } } $pid = intval($_GET['id']); $sql = "SELECT * FROM {$tb_prefix}products WHERE id=" . $pid; $res = $pdb->GetRow($sql); if (empty($res) || !$res) { flash('data_not_exists', 'product/', 0); } else { if (!empty($res['picture'])) { $res['imgsmall'] = "attachment/" . $res['picture'] . ".small.jpg"; $res['imgbig'] = "attachment/" . $res['picture'];
} if (isset($_POST['send']) && !empty($_POST['pms'])) { pb_submit_check('pms'); $vals = array(); $vals = $_POST['pms']; $vals['type'] = 'user'; if (is_int($_POST['to'])) { $to_memberid = intval($_POST['to']); $member_info = $pdb->GetRow("SELECT id,username FROM {$tb_prefix}members WHERE id='" . $to_memberid . "'"); } else { $member_info = $pdb->GetRow("SELECT id,username FROM {$tb_prefix}members WHERE username='******'to'] . "'"); } if (!$member_info || empty($member_info) || $member_info['id'] == $_SESSION['MemberID']) { flash(); } $result = $pms->SendToUser($_SESSION['MemberName'], $member_info['username'], $vals); if (!$result) { flash(); } } if (isset($_POST['del'])) { $result = $pms->del($_POST['id'], "to_member_id=" . $_SESSION['MemberID']); if ($result) { pheader("location:pms.php"); } else { flash(); } } $tpl_file = "pms"; $page->displaypg = 15; $amount = $pms->findCount(null, $conditions);
require "../libraries/common.inc.php"; uses("message"); require PHPB2B_ROOT . 'libraries/page.class.php'; require "session_cp.inc.php"; $message = new Messages(); $page = new Pages(); $conditions = array(); $tpl_file = "message"; if (isset($_POST['del']) && is_array($_POST['id'])) { $deleted = $message->del($_POST['id']); if (!$deleted) { flash(); } } if (isset($_POST['save'])) { $sended = $message->SendToUser($current_adminer, $_POST['to_username'], $_POST['data']['message']); if (!$sended) { flash(null, null, 0); } else { pheader("location:message.php"); } } if (isset($_GET['do'])) { $do = trim($_GET['do']); if (!empty($_GET['id'])) { $id = intval($_GET['id']); } if ($do == 'search') { if (!empty($_GET['q'])) { $conditions[] = "title like '%" . trim($_GET['q']) . "%'"; }
} if (isset($_POST['send']) && !empty($_POST['pms'])) { pb_submit_check('pms'); $vals = array(); $vals = $_POST['pms']; $vals['type'] = 'user'; if (is_int($_POST['to'])) { $to_memberid = intval($_POST['to']); $member_info = $pdb->GetRow("SELECT id,username FROM {$tb_prefix}members WHERE id='" . $to_memberid . "'"); } else { $member_info = $pdb->GetRow("SELECT id,username FROM {$tb_prefix}members WHERE username='******'to'] . "'"); } if (!$member_info || empty($member_info) || $member_info['id'] == $the_memberid) { flash(); } $result = $pms->SendToUser($the_membername, $member_info['username'], $vals); if (!$result) { flash(); } } if (isset($_POST['del'])) { $result = $pms->del($_POST['id'], "to_member_id=" . $the_memberid); if ($result) { pheader("location:pms.php"); } else { flash(); } } $tpl_file = "pms"; $page->displaypg = 15; $amount = $pms->findCount(null, $conditions);
function inquery() { global $viewhelper, $pb_userinfo; using("member", "message", "typeoption"); $typeoption = new Typeoptions(); $member = new Members(); $pms = new Messages(); if (isset($_POST['id']) && !empty($_POST['do']) && !empty($_POST['title'])) { pb_submit_check('inquery'); $vals['type'] = 'inquery'; $vals['title'] = $_POST['title']; $vals['content'] = implode("<br />", $_POST['inquery']); $result = $pms->SendToUser($pb_userinfo['pb_username'], $this->product->dbstuff->GetOne("SELECT username FROM {$this->product->table_prefix}members WHERE id=" . intval($_POST['to_member_id'])), $vals); if (!$result) { flash("failed", '', 0); } else { flash("success", '', 0); } } $pid = intval($_GET['id']); $sql = "SELECT * FROM {$this->product->table_prefix}products WHERE id=" . $pid; $res = $this->product->dbstuff->GetRow($sql); if (empty($res) || !$res) { flash('data_not_exists', 'product/', 0); } else { if (!empty($res['picture'])) { $res['imgsmall'] = "attachment/" . $res['picture'] . ".small.jpg"; $res['imgbig'] = "attachment/" . $res['picture']; $res['image'] = "attachment/" . $res['picture'] . ".small.jpg"; } else { $res['image'] = pb_get_attachmenturl('', '', 'small'); } setvar("ImTypes", cache_read("typeoption", "im_type")); setvar("TelTypes", cache_read("typeoption", "phone_type")); setvar("item", pb_lang_split_recursive($res)); } $viewhelper->setTitle($res['name']); $member_info = $this->product->dbstuff->GetRow("SELECT mf.first_name,mf.last_name,m.email as MemberEmail FROM {$this->product->table_prefix}members m LEFT JOIN {$this->product->table_prefix}memberfields mf ON mf.member_id=m.id WHERE m.id=" . $res['member_id']); setvar("CompanyUser", $member_info['first_name'] . $member_info['last_name']); render("product/inquery"); }