function saveFeedback() { $feedback = array('name' => '', 'email' => '', 'subject' => '', 'message' => '', 'userid' => $_SESSION['SESS_USER_ID'], 'blocked' => 'false', 'dtoc' => date('Y-m-d H:i:s'), 'dtoe' => date('Y-m-d H:i:s')); foreach ($feedback as $k => $v) { if (isset($_POST[$k])) { $feedback[$k] = trim($_POST[$k]); } } $sql = _db()->_insertQ1('feedbacks', $feedback); $res = _dbQuery($sql); $id = _db()->insert_id(); if ($res) { _dbFree($res); //send email to admin $mailto = "*****@*****.**"; $mailfrom = "*****@*****.**"; $feedback_content = array("name" => $_REQUEST['name'], "email" => $_REQUEST['email'], "subject" => $_REQUEST['subject'], "message" => $_REQUEST['message']); $template = _template("feedback_admin", $profile); loadHelpers('email'); sendMail($mailto, " Feedback", $template, $mailfrom); return "success"; } else { return "error"; } }
function loadComponent($component) { $f1 = APPROOT . APPS_PAGES_FOLDER . "comps/{$component}.php"; $f2 = APPROOT . APPS_PAGES_FOLDER . "comps/{$component}.tpl"; $f3 = APPROOT . APPS_PAGES_FOLDER . "comps/{$component}.htm"; if (file_exists($f1)) { include $f1; } elseif (file_exists($f2)) { _template($f2); } elseif (file_exists($f3)) { readfile($f3); } }
/** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction * @author Bismay Kumar Mohaptra */ function smarty_function_component($params) { $f1 = APPROOT . APPS_PAGES_FOLDER . "components/{$params['src']}.php"; $f2 = APPROOT . APPS_PAGES_FOLDER . "components/{$params['src']}.tpl"; $f3 = APPROOT . APPS_PAGES_FOLDER . "components/{$params['src']}.htm"; if (file_exists($f1)) { include $f1; } elseif (file_exists($f2)) { _template($f2); } elseif (file_exists($f3)) { readfile($f3); } }
/** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction * @author Bismay Kumar Mohaptra */ function smarty_function_viewpage($params) { if (isset($_ENV['PAGECONFIG']['viewpage']) && strlen($_ENV['PAGECONFIG']['viewpage']) > 0) { $viewpage = $_ENV['PAGECONFIG']['viewpage']; } else { $viewpage = PAGE; } $page = explode("/", $viewpage); if (strlen($page[0]) <= 0) { return; } $f1 = APPROOT . APPS_PAGES_FOLDER . "viewpage/{$page[0]}.php"; $f2 = APPROOT . APPS_PAGES_FOLDER . "viewpage/{$page[0]}.tpl"; $f3 = APPROOT . APPS_PAGES_FOLDER . "viewpage/{$page[0]}.htm"; if (file_exists($f1)) { include $f1; } elseif (file_exists($f2)) { _template($f2); } elseif (file_exists($f3)) { readfile($f3); } }
function _templatePage($file, $dataArr = null) { if ($dataArr == null) { $dataArr = []; } if (isset($_ENV['PAGEVAR']) && is_array($_ENV['PAGEVAR'])) { foreach ($_ENV['PAGEVAR'] as $key => $value) { $dataArr['PAGE'][$key] = $value; } } return _template($file, $dataArr); }
$onsuccess = $_POST['onsuccess']; } else { $onsuccess = "Mail Successfully Sent."; } if (isset($_POST['onerror'])) { $onerror = $_POST['onerror']; } else { $onerror = "Error Occured While Sending Mail!"; } if (!isset($_POST['mode'])) { $_POST['mode'] = "bulk"; } unset($_POST['onsuccess']); unset($_POST['onerror']); if (isset($_POST['template'])) { $body = _template($_POST['template']); } elseif (isset($_POST['body'])) { $body = $_POST['body']; } else { $body = EMail::createMailBodyForArray($_POST, $title, $footer); } if (strlen($to) <= 0) { echo "<div width=100% align=center style='color:red'><p>No Recieptants</p></div>"; exit; } if (isset($_FILES['attach']) && $_FILES['attach']['size'] > 0) { $fileName = $_FILES['attach']['name']; $tmpName = $_FILES['attach']['tmp_name']; $ext = substr(strrchr($fileName, "."), 1); $randName = md5(rand() * time()); $target_path .= $destination_path . $randName . '.' . $ext;