예제 #1
0
function contact_form()
{
    global $smarty, $lang, $fp_config;
    if (empty($_POST)) {
        $smarty->assign('success', system_geterr('contact'));
        $smarty->assign_by_ref('panelstrings', $lang['contact']);
        // new form, we (re)set the session data
        SmartyValidate::connect($smarty, true);
        // register our validators
        SmartyValidate::register_validator('name', 'name', 'notEmpty', false, false, 'trim');
        SmartyValidate::register_validator('email', 'email', 'isEmail', true, false, 'trim');
        SmartyValidate::register_validator('www', 'url', 'isURL', true, false, 'trim');
        SmartyValidate::register_validator('content', 'content', 'notEmpty', false, false);
    } else {
        utils_nocache_headers();
        // validate after a POST
        SmartyValidate::connect($smarty);
        if (!empty($_POST['url']) && strpos($_POST['url'], 'http://') === false) {
            $_POST['url'] = 'http://' . $_POST['url'];
        }
        // custom hook here!!
        // we'll use comment actions, anyway
        if (SmartyValidate::is_valid($_POST) && ($arr = contact_form_validate())) {
            $msg = "Name: \n{$arr['name']} \n\n";
            if (isset($arr['email'])) {
                $msg .= "Email: {$arr['email']}\n\n";
            }
            if (isset($arr['url'])) {
                $msg .= "WWW: {$arr['url']}\n\n";
            }
            $msg .= "Content:\n{$arr['content']}\n";
            $success = @utils_mail(isset($arr['email']) ? $arr['email'] : $fp_config['general']['email'], "Contact sent through {$fp_config['general']['title']} ", $msg);
            system_seterr('contact', $success ? 1 : -1);
            utils_redirect(basename(__FILE__));
        } else {
            $smarty->assign('values', $_POST);
        }
    }
}
예제 #2
0
require '../libs/SmartyValidate.class.php';
class Validator
{
    public function test_password($value, $empty, &$params, &$formvars)
    {
        echo "test_password() was called, test succeeded!";
        return true;
    }
}
session_start();
$smarty =& new Smarty();
$myobj = new Validator();
if (empty($_POST)) {
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_object('myobj', $myobj);
    SmartyValidate::register_criteria('isPass', 'myobj->test_password');
    SmartyValidate::register_validator('validator_id_passwordfield', 'form_input_password', 'isPass', false, false, 'trim');
    $smarty->display('form.tpl');
} else {
    SmartyValidate::connect($smarty);
    SmartyValidate::register_object('myobj', $myobj);
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        $smarty->display('success.tpl');
    } else {
        $smarty->assign($_POST);
        $smarty->display('form.tpl');
    }
}
?>
 
         $tpl->assign('posted', 'Permission removed.');
         break;
     } else {
         $tpl->assign('sql_error', $db->ErrorMsg());
     }
 case 'N':
 default:
     if (empty($_REQUEST['submit'])) {
         SmartyValidate::connect($tpl);
         SmartyValidate::register_form('conf_user_permissions', true);
         SmartyValidate::register_criteria('isValueUnique', 'validate_unique', 'conf_user_permissions');
         SmartyValidate::register_criteria('isNotEqual', 'validate_not_equal', 'conf_user_permissions');
         SmartyValidate::register_criteria('isNotSubCat', 'validate_not_sub_category', 'conf_user_permissions');
         SmartyValidate::register_validator('v_CATEGORY_ID', 'CATEGORY_ID:0', 'isNotEqual', true, false, null, 'conf_user_permissions');
         SmartyValidate::register_validator('v_CATEGORY_ID_U', "CATEGORY_ID:user_permission:0:USER_ID", 'isValueUnique', false, false, null, 'conf_user_permissions');
         SmartyValidate::register_validator('v_CATEGORY_ID_S', "CATEGORY_ID", 'isNotSubCat', false, false, null, 'conf_user_permissions');
     } else {
         SmartyValidate::connect($tpl);
         $data = get_table_data('user_permission');
         $data['USER_ID'] = $u;
         if (SmartyValidate::is_valid($data, 'conf_user_permissions')) {
             // Check if category is parent to existing categories.
             $child_categories = find_child_categories();
             if ($child_categories > 0) {
                 $tpl->assign('CHILD_CATEGORIES', $child_categories);
                 $tpl->assign('WARN', true);
                 $category = $db->GetOne("SELECT `TITLE` FROM `{$tables['category']['name']}` WHERE `ID` = " . $db->qstr($data['CATEGORY_ID']));
                 $tpl->assign('CATEGORY', $category);
             } else {
                 $id = $db->GenID($tables['user_permission']['name'] . '_SEQ');
                 $data['ID'] = $id;
예제 #4
0
파일: add.php 프로젝트: hiroyalty/mhealth
$obj = new Functions();
$category = R::find('groups', '1');
$smarty = new Smarty();
$view = $top;
if (empty($_POST)) {
    $smarty->assign('title', 'mHealth::Admin Registration');
    $smarty->assign('topic', 'Admin Registration');
    $smarty->assign('view', $view);
    $smarty->assign('category', $category);
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_firstname', 'firstname', 'notEmpty');
    SmartyValidate::register_validator('v_lastname', 'lastname', 'notEmpty');
    SmartyValidate::register_validator('v_mobile_number', 'mobile_number', 'isNumber');
    SmartyValidate::register_validator('v_email', 'email', 'isEmail');
    SmartyValidate::register_validator('v_password', 'password', 'notEmpty');
    SmartyValidate::register_validator('v_confirm_password', 'password:confirm_password', 'isEqual');
    $smarty->display('add.tpl');
} else {
    SmartyValidate::connect($smarty);
    // validate after a POST
    if (SmartyValidate::is_valid($_POST)) {
        // no errors, done with SmartyValidate
        if (array_key_exists('submit', $_POST)) {
            //var_dump($_POST); exit;
            $_SESSION['firstname'] = $_POST['firstname'];
            $_SESSION['lastname'] = $_POST['lastname'];
            $_SESSION['mobile_number'] = $_POST['mobile_number'];
            $_SESSION['email'] = $_POST['email'];
            $_SESSION['password'] = $_POST['password'];
            $_SESSION['group'] = $_POST['role'];
            $obj->insertAuditTrail($_SESSION['login'], 'ADD_USER', $_SESSION['firstname'] . ' ' . $_SESSION['lastname'] . ' added as user');
예제 #5
0
파일: setup.php 프로젝트: systemfirez/poMMo
function check_charset($value, $empty, &$params, &$formvars)
{
    $validCharsets = array('UTF-8', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-7', 'ISO-8859-15', 'cp1251', 'KOI8-R', 'GB2312', 'EUC-JP', 'ISO-2022-JP');
    return in_array($value, $validCharsets);
}
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    // register custom criteria
    SmartyValidate::register_criteria('isCharSet', 'check_charset');
    SmartyValidate::register_validator('fromname', 'fromname', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('subject', 'subject', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('fromemail', 'fromemail', 'isEmail', false, false, 'trim');
    SmartyValidate::register_validator('frombounce', 'frombounce', 'isEmail', false, false, 'trim');
    SmartyValidate::register_validator('mailgroup', 'mailgroup:/(all|\\d+)/i', 'isRegExp', false, false, 'trim');
    SmartyValidate::register_validator('list_charset', 'list_charset', 'isCharSet', false, false, 'trim');
    $vMsg = array();
    $vMsg['fromname'] = $vMsg['subject'] = Pommo::_T('Cannot be empty.');
    $vMsg['charset'] = Pommo::_T('Invalid Character Set');
    $vMsg['fromemail'] = $vMsg['frombounce'] = Pommo::_T('Invalid email address');
    $vMsg['ishtml'] = $vMsg['mailgroup'] = Pommo::_T('Invalid Input');
    $smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
예제 #6
0
 SmartyValidate::register_validator('subscribe_msg', 'subscribe_msg', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('subscribe_web', 'subscribe_web', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('unsubscribe_sub', 'unsubscribe_sub', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('unsubscribe_msg', 'unsubscribe_msg', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('unsubscribe_web', 'unsubscribe_web', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('confirm_sub', 'confirm_sub', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('confirm_msg', 'confirm_msg:!\\[\\[URL\\]\\]!i', 'isRegExp', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('activate_sub', 'activate_sub', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('activate_msg', 'activate_msg:!\\[\\[URL\\]\\]!i', 'isRegExp', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('update_sub', 'update_sub', 'notEmpty', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('update_msg', 'update_msg:!\\[\\[URL\\]\\]!i', 'isRegExp', false, false, 'trim', 'messages');
 SmartyValidate::register_validator('notify_email', 'notify_email', 'isMails', false, false, false, 'messages');
 SmartyValidate::register_validator('notify_subscribe', 'notify_subscribe:!^(on|off)$!', 'isRegExp', false, false, false, 'messages');
 SmartyValidate::register_validator('notify_unsubscribe', 'notify_unsubscribe:!^(on|off)$!', 'isRegExp', false, false, false, 'messages');
 SmartyValidate::register_validator('notify_update', 'notify_update:!^(on|off)$!', 'isRegExp', false, false, false, 'messages');
 SmartyValidate::register_validator('notify_pending', 'notify_pending:!^(on|off)$!', 'isRegExp', false, false, false, 'messages');
 $vMsg = array();
 $vMsg['subscribe_sub'] = $vMsg['subscribe_msg'] = $vMsg['subscribe_web'] = $vMsg['unsubscribe_sub'] = $vMsg['unsubscribe_msg'] = $vMsg['unsubscribe_web'] = $vMsg['confirm_sub'] = $vMsg['update_sub'] = $vMsg['activate_sub'] = Pommo::_T('Cannot be empty.');
 $vMsg['confirm_msg'] = $vMsg['update_msg'] = $vMsg['activate_msg'] = Pommo::_T('You must include "[[URL]]" for the confirm link');
 $smarty->assign('vMsg', $vMsg);
 // populate _POST with info from database (fills in form values...)
 $dbvalues = PommoAPI::configGet(array('messages', 'notices'));
 $notices = unserialize($dbvalues['notices']);
 $messages = unserialize($dbvalues['messages']);
 if (empty($messages)) {
     $messages = PommoHelperMessages::resetDefault('all');
 }
 if (empty($notices)) {
     $notices = array('email' => $pommo->_config['admin_email'], 'subject' => Pommo::_T('[poMMo Notice]'), 'subscribe' => 'off', 'unsubscribe' => 'off', 'update' => 'off', 'pending' => 'off');
 }
 $p = array();
require_once 'init.php';
$script_root = substr($_SERVER["SCRIPT_NAME"], 0, strrpos($_SERVER["SCRIPT_NAME"], '/'));
define('DOC_ROOT', substr($script_root, 0, strrpos($script_root, '/')));
if (empty($_POST['submit']) && !empty($_SERVER['HTTP_REFERER'])) {
    $_SESSION['return'] = $_SERVER['HTTP_REFERER'];
}
if (empty($_REQUEST['submit'])) {
    SmartyValidate::disconnect();
    SmartyValidate::connect($tpl, true);
    SmartyValidate::register_criteria('checkEmail', 'check_email');
    SmartyValidate::register_criteria('isNotEqual', 'validate_not_equal');
    SmartyValidate::register_validator('v_TITLE', 'TITLE', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('v_URL', 'URL', 'isURL', false, false, 'trim');
    SmartyValidate::register_validator('v_EMAIL', 'EMAIL', 'isEmail', false, false, 'trim');
    SmartyValidate::register_validator('v_check_email', 'EMAIL', 'checkEmail', false, false, null);
    SmartyValidate::register_validator('v_CATEGORY_ID', 'CATEGORY_ID:0', 'isNotEqual', true, false, 'trim');
} else {
    SmartyValidate::connect($tpl);
    $data = get_table_data('email');
    $data['DATE_SENT'] = gmdate('Y-m-d H:i:s');
    if (strlen(trim($data['URL'])) > 0 && !preg_match('#^http[s]?:\\/\\/#i', $data['URL'])) {
        $data['URL'] = "http://" . $data['URL'];
    }
    $full_data = $data;
    $full_data['CATEGORY_ID'] = $_REQUEST['CATEGORY_ID'];
    $full_data['DESCRIPTION'] = $_REQUEST['DESCRIPTION'];
    if (SmartyValidate::is_valid($full_data)) {
        // Generate Link ID first
        $link_id = $db->GenID($tables['link']['name'] . '_SEQ');
        $email_data = $full_data;
        $email_data['ADD_RECIPROCAL_URL'] = "http://" . $_SERVER['HTTP_HOST'] . DIRECTORY_ROOT . "/add_reciprocal.php?id=" . $link_id;
예제 #8
0
 case 'N':
 default:
     if (empty($_REQUEST['submit'])) {
         if ($action == 'N') {
             $data = array();
         }
         SmartyValidate::connect($tpl);
         SmartyValidate::register_form('conf_users_edit', true);
         SmartyValidate::register_criteria('isValueUnique', 'validate_unique', 'conf_users_edit');
         SmartyValidate::register_validator('v_LOGIN', 'LOGIN:4:25', 'isLength', false, false, 'trim', 'conf_users_edit');
         SmartyValidate::register_validator('v_LOGIN_U', 'LOGIN:user:'******'isValueUnique', false, false, false, 'conf_users_edit');
         SmartyValidate::register_validator('v_NAME', 'NAME:4:25', 'isLength', false, false, 'trim', 'conf_users_edit');
         SmartyValidate::register_validator('v_PASSWORD', 'PASSWORD:4:25', 'isLength', true, false, 'trim', 'conf_users_edit');
         SmartyValidate::register_validator('v_PASSWORDC', 'PASSWORD:PASSWORDC', 'isEqual', true, false, 'trim', 'conf_users_edit');
         SmartyValidate::register_validator('v_EMAIL', 'EMAIL', 'isEmail', false, false, 'trim', 'conf_users_edit');
         SmartyValidate::register_validator('v_EMAIL_U', 'EMAIL:user:'******'isValueUnique', false, false, 'trim', 'conf_users_edit');
     } else {
         SmartyValidate::connect($tpl);
         $data = get_table_data('user');
         if (!isset($data['SUBMIT_NOTIF'])) {
             $data['SUBMIT_NOTIF'] = 0;
         }
         if (!isset($data['PAYMENT_NOTIF'])) {
             $data['PAYMENT_NOTIF'] = 0;
         }
         $data['PASSWORDC'] = $_REQUEST['PASSWORDC'];
         if (SmartyValidate::is_valid($data, 'conf_users_edit')) {
             unset($data['PASSWORDC']);
             if (empty($id)) {
                 $id = $db->GenID($tables['user']['name'] . '_SEQ');
             }
예제 #9
0
파일: call.php 프로젝트: hiroyalty/mhealth
    $smarty->assign('reg_id', $reg_id);
    $smarty->assign('status', $status);
    $smarty->assign('user', $user);
    //$smarty->assign('view', $view);
    $smarty->assign('fname', $fname);
    $smarty->assign('lname', $lname);
    $smarty->assign('mobile', $mobile);
    $smarty->assign('email', $email);
    $smarty->assign('states', $states);
    $smarty->assign('language', $languages);
    //$smarty->assign('category', $category);
    $smarty->assign('info', $info);
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_firstname', 'firstname', 'notEmpty');
    SmartyValidate::register_validator('v_lastname', 'lastname', 'notEmpty');
    SmartyValidate::register_validator('v_mobile_number', 'mobile_number', 'isNumber');
    $smarty->display('call.tpl');
} else {
    SmartyValidate::connect($smarty);
    // validate after a POST
    if (SmartyValidate::is_valid($_POST)) {
        // no errors, done with SmartyValidate
        if (array_key_exists('submit', $_POST)) {
            //var_dump($_POST); exit;
            $_SESSION['firstname'] = $_POST['firstname'];
            $_SESSION['lastname'] = $_POST['lastname'];
            $_SESSION['mobile_number'] = $_POST['mobile_number'];
            $_SESSION['email'] = $_POST['email'];
            $_SESSION['password'] = "******";
            $_SESSION['language'] = $_POST['language'];
            $_SESSION['location'] = $_POST['state'];
예제 #10
0
        }
    }
    if (count($count) <= 4 && count($count) > 0) {
        return TRUE;
    }
    return FALSE;
}
if (empty($_POST)) {
    $smarty->assign('title', 'MHealth::Living Healthy goes mobile');
    $smarty->assign('topic', 'About mHealth Application');
    $smarty->assign('view', $view);
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_mobile_number', 'mobile_number', 'isNumber');
    SmartyValidate::register_validator('v_period', 'period', 'notEmpty');
    SmartyValidate::register_criteria('isPass', 'checkCheckbox');
    SmartyValidate::register_validator('v_pass', 'general', 'isPass', false, false, 'trim');
    $smarty->display('advert.tpl');
} else {
    SmartyValidate::connect($smarty);
    // validate after a POST
    if (SmartyValidate::is_valid($_POST)) {
        // no errors, done with SmartyValidate
        if (array_key_exists('submit', $_POST)) {
            //var_dump(checkCheckbox()); exit;
            $mobile_number = $_POST['mobile_number'];
            $period = $_POST['period'];
            $exist = $obj->getFreeUser($obj->appendCountryCode($mobile_number));
            //var_dump($exist); exit;
            if ($exist) {
                $dnrr = $obj->appendCountryCode($mobile_number);
                $msg = "Sorry, your free trial period has ended. To subscribe fully to this service text 'Category name' to 35123 e.g. 'CANCER' to 35125.";
예제 #11
0
    return in_array($value, $validCharsets);
}
SmartyValidate::connect($smarty);
if (!SmartyValidate::is_registered_form('mailings') || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::register_form('mailings', true);
    // register custom criteria
    SmartyValidate::register_criteria('isCharSet', 'check_charset', 'mailings');
    SmartyValidate::register_validator('list_fromname', 'list_fromname', 'notEmpty', false, false, 'trim', 'mailings');
    SmartyValidate::register_validator('list_fromemail', 'list_fromemail', 'isEmail', false, false, false, 'mailings');
    SmartyValidate::register_validator('list_frombounce', 'list_frombounce', 'isEmail', false, false, false, 'mailings');
    SmartyValidate::register_validator('list_charset', 'list_charset', 'isCharSet', false, false, 'trim', 'mailings');
    SmartyValidate::register_validator('public_history', 'public_history:!^(on|off)$!', 'isRegExp', false, false, false, 'mailings');
    SmartyValidate::register_validator('demo_mode', 'demo_mode:!^(on|off)$!', 'isRegExp', false, false, false, 'mailings');
    SmartyValidate::register_validator('list_fromname', 'list_fromname', 'notEmpty', false, false, 'trim', 'mailings');
    SmartyValidate::register_validator('maxRuntime', 'maxRuntime', 'isInt', false, false, 'trim', 'mailings');
    $vMsg = array();
    $vMsg['maxRuntime'] = Pommo::_T('Enter a number.');
    $vMsg['list_fromname'] = Pommo::_T('Cannot be empty.');
    $vMsg['list_fromemail'] = $vMsg['list_frombounce'] = Pommo::_T('Invalid email address');
    $smarty->assign('vMsg', $vMsg);
    // populate _POST with info from database (fills in form values...)
    $dbVals = PommoAPI::configGet(array('list_fromname', 'list_fromemail', 'list_frombounce', 'list_charset', 'public_history', 'maxRuntime'));
    $dbVals['demo_mode'] = !empty($pommo->_config['demo_mode']) && $pommo->_config['demo_mode'] == "on" ? 'on' : 'off';
    $smarty->assign($dbVals);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
예제 #12
0
    }
}
if (PAY_NORMAL_ADV > 0) {
    $price[$link_type_int['normal_plus']] = PAY_NORMAL_PLUS;
}
if (PAY_RECPR > 0) {
    $price[$link_type_int['reciprocal']] = PAY_RECPR;
}
if ($action == 'pay') {
    if (empty($_REQUEST['submit'])) {
        if (!empty($_SERVER['HTTP_REFERER'])) {
            $_SESSION['return'] = $_SERVER['HTTP_REFERER'];
        }
        SmartyValidate::connect($tpl);
        SmartyValidate::register_form('pay_link', true);
        SmartyValidate::register_validator('v_quantity', 'quantity', 'isInt', false, false, 'trim', 'pay_link');
    } else {
        SmartyValidate::connect($tpl);
        if (SmartyValidate::is_valid($_REQUEST, 'pay_link')) {
            $pay_data = array();
            $pay_id = $db->GenID($tables['payment']['name'] . '_SEQ');
            $pay_data['ID'] = $pay_id;
            $pay_data['LINK_ID'] = $data['ID'];
            $pay_data['IPADDRESS'] = get_client_ip();
            $pay_data['QUANTITY'] = $_REQUEST['quantity'];
            $pay_data['AMOUNT'] = $price[$data['LINK_TYPE']];
            $pay_data['TOTAL'] = (int) $pay_data['QUANTITY'] * (double) $pay_data['AMOUNT'];
            $pay_data['UM'] = PAY_UM;
            $pay_data['PAY_DATE'] = gmdate('Y-m-d H:i:s');
            $pay_data['CONFIRMED'] = -1;
            if (db_replace('payment', $pay_data, 'ID') > 0) {
예제 #13
0
     SmartyValidate::connect($tpl);
     SmartyValidate::register_form('dir_links_edit', true);
     SmartyValidate::register_criteria('isValueUnique', 'validate_unique', 'dir_links_edit');
     SmartyValidate::register_criteria('isNotEqual', 'validate_not_equal', 'dir_links_edit');
     SmartyValidate::register_validator('v_TITLE', 'TITLE', 'notEmpty', false, false, 'trim', 'dir_links_edit');
     SmartyValidate::register_validator('v_TITLE_U', "TITLE:link:{$id}:CATEGORY_ID", 'isValueUnique', false, false, null, 'dir_links_edit');
     SmartyValidate::register_validator('v_URL', 'URL', 'isURL', false, false, 'trim', 'dir_links_edit');
     SmartyValidate::register_validator('v_URL_U', 'URL:link:' . $id . (ALLOW_MULTIPLE ? ':CATEGORY_ID' : ''), 'isValueUnique', false, false, null, 'dir_links_edit');
     SmartyValidate::register_validator('v_CATEGORY_ID', 'CATEGORY_ID:0', 'isNotEqual', true, false, null, 'dir_links_edit');
     SmartyValidate::register_validator('v_RECPR_URL', 'RECPR_URL', 'isURL', true, false, 'trim', 'dir_links_edit');
     SmartyValidate::register_validator('v_OWNER_NAME', 'OWNER_NAME', 'notEmpty', true, false, 'trim', 'dir_links_edit');
     SmartyValidate::register_validator('v_OWNER_EMAIL', 'OWNER_EMAIL', 'isEmail', true, false, 'trim', 'dir_links_edit');
     SmartyValidate::register_validator('v_EXPIRY_DATE', 'EXPIRY_DATE', 'isDate', true, false, 'trim', 'dir_links_edit');
     // Deeplink URL Validation
     for ($dl = 1; $dl <= 5; $dl++) {
         SmartyValidate::register_validator('v_DEEPLINK_URL' . $dl, 'URL' . $dl, 'isURL', true, false, 'trim', 'dir_links_edit');
     }
 } else {
     SmartyValidate::connect($tpl);
     $data = get_table_data('link');
     if ($action == 'N') {
         $data['IPADDRESS'] = get_client_ip();
         $data['VALID'] = 1;
         $data['RECPR_VALID'] = 1;
         $data['DATE_ADDED'] = gmdate('Y-m-d H:i:s');
         $data['DATE_MODIFIED'] = gmdate('Y-m-d H:i:s');
     }
     if (FTR_ENABLE == 1) {
         $data['FEATURED'] = $_POST['FEATURED'] == '1' ? '1' : '0';
     }
     $data['NOFOLLOW'] = $_POST['NOFOLLOW'] == '1' ? '1' : '0';
예제 #14
0
파일: reset.php 프로젝트: hiroyalty/mhealth
session_start();
set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/smarty/libs/' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/smartyValidate/libs/' . PATH_SEPARATOR . dirname(__FILE__) . '/lib/rb/' . PATH_SEPARATOR . get_include_path());
require 'Smarty.class.php';
require 'SmartyValidate.class.php';
require 'rb.php';
require 'models/functions.php';
$smarty = new Smarty();
$myobj = new Functions();
if (empty($_POST)) {
    $smarty->assign('title', 'mHealth::Reset Password');
    $smarty->assign('topic', 'Reset Password');
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_username', 'username', 'isEmail');
    SmartyValidate::register_object('myobj', $myobj);
    SmartyValidate::register_criteria('isPass', 'myobj->reset');
    SmartyValidate::register_validator('v_user', 'username', 'isPass', false, false, 'trim');
    $smarty->display('reset.tpl');
} else {
    SmartyValidate::connect($smarty);
    SmartyValidate::register_object('myobj', $myobj);
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        $message = 'Click this link to reset password http://v2nportal.com/mhealth/back.php?u=' . $_POST['username'] . '&idd=' . base64_encode($_POST['username']);
        mail($_POST['username'], 'mHealth Password Reset', $message);
        $smarty->assign('title', 'mHealth::Password Reset');
        $smarty->assign('topic', 'Password Reset Success');
        $smarty->assign('view', '<p>Password reset link has been send to ' . $_POST['username'] . ', thank you for using mHealth.</p>');
        $smarty->display('plainview.tpl');
    } else {
        $smarty->assign('title', 'mHealth::Password Reset');
        $smarty->assign('topic', 'Password Reset Failed');
예제 #15
0
# @projectManager David DuVal <*****@*****.**>
# @package        PHPLinkDirectory
# ######################################################################
*/
require_once 'init.php';
if (empty($_REQUEST['submit'])) {
    $sql = "SELECT * FROM `{$tables['user']['name']}` WHERE `ID` = " . $db->qstr($_SESSION['user_id']);
    $row = $db->GetRow($sql);
    $tpl->assign($row);
    SmartyValidate::connect($tpl);
    SmartyValidate::register_form('conf_profile', true);
    SmartyValidate::register_validator('v_LOGIN', 'LOGIN:4:25', 'isLength', false, false, 'trim', 'conf_profile');
    SmartyValidate::register_validator('v_NAME', 'NAME:4:25', 'isLength', false, false, 'trim', 'conf_profile');
    SmartyValidate::register_validator('v_PASSWORD', 'PASSWORD:4:25', 'isLength', true, false, 'trim', 'conf_profile');
    SmartyValidate::register_validator('v_PASSWORDC', 'PASSWORD:PASSWORDC', 'isEqual', true, false, 'trim', 'conf_profile');
    SmartyValidate::register_validator('v_EMAIL', 'EMAIL', 'isEmail', false, false, 'trim', 'conf_profile');
} else {
    SmartyValidate::connect($tpl);
    $data = get_table_data('user');
    $error = 0;
    if (!isset($data['SUBMIT_NOTIF'])) {
        $data['SUBMIT_NOTIF'] = 0;
    }
    if (!isset($data['PAYMENT_NOTIF'])) {
        $data['PAYMENT_NOTIF'] = 0;
    }
    $data['ID'] = $_SESSION['user_id'];
    $data['PASSWORDC'] = $_REQUEST['PASSWORDC'];
    if (SmartyValidate::is_valid($data, 'conf_profile')) {
        unset($data['PASSWORDC']);
        if (empty($data['PASSWORD'])) {
예제 #16
0
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->prepareForForm();
SmartyValidate::connect($smarty);
if (!SmartyValidate::is_registered_form('users') || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::register_form('users', true);
    // register custom criteria
    SmartyValidate::register_validator('admin_username', 'admin_username', 'notEmpty', false, false, 'trim', 'users');
    SmartyValidate::register_validator('admin_password2', 'admin_password:admin_password2', 'isEqual', TRUE, false, false, 'users');
    SmartyValidate::register_validator('admin_email', 'admin_email', 'isEmail', false, false, false, 'users');
    $vMsg = array();
    $vMsg['admin_username'] = Pommo::_T('Cannot be empty.');
    $vMsg['admin_email'] = Pommo::_T('Invalid email address');
    $vMsg['admin_password2'] = Pommo::_T('Passwords must match.');
    $smarty->assign('vMsg', $vMsg);
    // populate _POST with info from database (fills in form values...)
    $dbVals = PommoAPI::configGet(array('admin_username'));
    $dbVals['admin_email'] = $pommo->_config['admin_email'];
    $smarty->assign($dbVals);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    Pommo::requireOnce($pommo->_baseDir . 'inc/classes/json.php');
예제 #17
0
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$smarty->prepareForForm();
// validate field ID
$field = current(Pommo_Fields::get(array('id' => $_REQUEST['field_id'])));
if ($field['id'] != $_REQUEST['field_id']) {
    die('bad field ID');
}
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('field_name', 'field_name', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('field_prompt', 'field_prompt', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('field_required', 'field_required:!^(on|off)$!', 'isRegExp');
    SmartyValidate::register_validator('field_active', 'field_active:!^(on|off)$!', 'isRegExp');
    $vMsg = array();
    $vMsg['field_name'] = $vMsg['field_prompt'] = Pommo::_T('Cannot be empty.');
    $smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        // __ FORM IS VALID
        // TODO -> Which below logic is better? the computed diff, or send all fields for update?
        /*
예제 #18
0
<?php
$allowed = array('admin','poster');
require("../site_init.php");
require("site_credentials.php");
$smarty->caching = 0;
require('../libs/SmartyValidate.class.php');
$smarty->assign('titulo', 'Change Password');

if(!SmartyValidate::is_registered_form('default') || empty($_POST)) {
	// new form, we (re)set the session data
    SmartyValidate::connect($smarty, true);
    // register our validators
    SmartyValidate::register_validator('vpassword', 'password:password2', 'isEqual');
    SmartyValidate::register_validator('vpassword2', 'password', 'notEmpty',false, false, 'trim');
    $smarty->display('admin/change_password.tpl');
} else { 
       // validate after a POST
       SmartyValidate::connect($smarty);
       /*TODO VALIDAR CAPCHA*/
       if(SmartyValidate::is_valid($_POST)) {
			$result = mysql_query("SELECT username FROM users WHERE password=MD5('{$_POST['old_password']}')");
			$row = mysql_fetch_assoc($result);
			if ($row['username'] != $current_user) {
		       $smarty->assign('old_error', 'Invalid Password');
		       $smarty->display('admin/change_password.tpl');exit;
			}
       		
			// no errors, done with SmartyValidate
			$sql = "UPDATE `users` SET `password` = MD5( '{$_POST['password']}' ) WHERE `username` = '$current_user' LIMIT 1 ;";
			$result = mysql_query($sql);
			$rows = mysql_affected_rows();
<?php

#include_once("./classes/formGen/classListbox.php");
#db users
$usrSQL = "SELECT username,firstname,lastname FROM sionapros_users WHERE account_status = 'Active' AND username != 'SADMIN'";
$users = $db->execute($usrSQL);
$smarty->assign('users', $users);
if (empty($_POST)) {
    // new form, we (re)set the session data
    Smartyvalidate::connect($smarty, true);
    // register our validators
    SmartyValidate::register_validator('usr', 'users', 'notEmpty');
    SmartyValidate::register_validator('password1', 'newpassword', 'notEmpty');
    SmartyValidate::register_validator('password2', 'newpassword:confpassword', 'isEqual');
    #SmartyValidate::register_validator('newprof', 'newname', 'notEmpty');
    // display form
} else {
    // validate after a POST
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        #require_once('./classes/main/tm0.security.class.php');
        #get $_POST info
        $username = $_POST['users'];
        $newPass = trim($_POST['newpassword']);
        $cryptedPass = crypt($newPass, 'yxpijaui93');
        $passSQL = "UPDATE sionapros_users SET password = '******',change_password = '******' WHERE username = '******'";
        #$security = new Security($db);
        if ($db->query($passSQL)) {
            #get users name
            $nmSQL = "SELECT firstname,lastname FROM sionapros_users WHERE username = '******'";
    $chkSQL = "SELECT * FROM sionapros_profiles WHERE profile = '{$_POST['newname']}'";
    $chkSQL .= " AND profile_id != {$_POST['profiles']}";
    if (count($db->execute($chkSQL)) == 0) {
        return true;
    } else {
        return false;
    }
}
if (empty($_POST)) {
    // new form, we (re)set the session data
    SmartyValidate::connect($smarty, true);
    #register criteria
    SmartyValidate::register_criteria('alreadyExists', 'check');
    // register our validators
    SmartyValidate::register_validator('prof', 'profiles', 'notEmpty');
    SmartyValidate::register_validator('newprof', 'newname', 'notEmpty');
    // display form
} else {
    // validate after a POST
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        require_once './classes/security.class.php';
        #get $_POST info
        $profile_id = $profile->get_selectedItemKey();
        $new_name = trim($_POST['newname']);
        #get the old profile name first
        $oldSQL = "SELECT profile FROM sionapros_profiles WHERE profile_id = {$profile_id}";
        $old = $db->execute($oldSQL);
        $security = new Security($db);
        if ($security->updateProfile($profile_id, $new_name)) {
예제 #21
0
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/mailings.php');
$pommo->init(array('keep' => TRUE));
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->prepareForForm();
$current = PommoMailing::isCurrent();
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('email', 'email', 'isEmail', false, false, 'trim');
    $vMsg = array();
    $vMsg['email'] = Pommo::_T('Invalid email address');
    $smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST) && !$current) {
        // __ FORM IS VALID
        Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/validate.php');
        // get a copy of the message state
        // composition is valid (via preview.php)
        $state = $pommo->_session['state']['mailing'];
        // create temp subscriber
예제 #22
0
require 'models/functions.php';
$obj = new Functions();
$page = $obj->getPageName();
if (!$obj->pageAccess($_SESSION['login'], $page)) {
    header('location: dashboard.php');
}
$smarty = new Smarty();
$myobj = new Functions();
$states = R::find('state', '1');
if (empty($_POST)) {
    $smarty->assign('info', '');
    $smarty->assign('title', 'mHealth::Add Location');
    $smarty->assign('topic', 'Add Location');
    $smarty->assign('states', $states);
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_name', 'name', 'notEmpty');
    $smarty->display('location.tpl');
} else {
    SmartyValidate::connect($smarty);
    SmartyValidate::register_object('myobj', $myobj);
    if (SmartyValidate::is_valid($_POST)) {
        //var_dump($_POST); exit;
        $name = $_POST['name'];
        $stateID = $_POST['state'];
        $myobj->addLocation($name, $stateID);
        SmartyValidate::disconnect();
        $smarty->assign('info', '');
        $smarty->assign('title', 'mHealth::Add Location');
        $smarty->assign('topic', 'Add Location');
        $smarty->assign('states', $states);
        $smarty->assign('view', "<p>{$name} has been added to the mHealth coverage locations.</p>");
예제 #23
0
 * Date: 2009-02-17
 */
require_once 'inc/initialise.php';
// Defaults
$valid = false;
$success = false;
$page = 'index';
// Start Twitter Perch
$tp = new twitterPerch();
// Initialise Form Validators
if (empty($_POST)) {
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('keyword', 'keyword', 'notEmpty');
    SmartyValidate::register_validator('username', 'username', 'isWord', false, true);
    SmartyValidate::register_validator('password', 'password:6', 'isLength', false, true);
    SmartyValidate::register_validator('accValid', 'username:password', 'isValid');
} else {
    SmartyValidate::connect($smarty);
    SmartyValidate::register_object('tp', $tp);
    SmartyValidate::register_criteria('isValid', 'tp->isValidTwitterCredentials');
    if ($valid = SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        // Clean Values
        $formVars = array('keyword' => cleanValue($_POST['keyword']), 'username' => cleanValue($_POST['username']), 'password' => cleanValue($_POST['password']));
        // Add To List
        $success = $tp->add($formVars);
    }
}
// Assign Variables
$smarty->assign('text', $lang[$page]);
$smarty->assign('success', $success);
예제 #24
0
require '../bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Mailing_Template.php';
Pommo::init();
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$smarty->prepareForForm();
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('name', 'name', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('description', 'description', 'dummyValid', false, false, 'trim');
    $vMsg = array();
    $vMsg['name'] = Pommo::_T('Cannot be empty.');
    $smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        // __ FORM IS VALID
        $t = Pommo_Mailing_Template::make(array('name' => $_POST['name'], 'description' => $_POST['description'], 'body' => Pommo::$_session['state']['mailing']['body'], 'altbody' => Pommo::$_session['state']['mailing']['altbody']));
        $id = Pommo_Mailing_Template::add($t);
        if ($id) {
            $logger->addMsg(sprintf(Pommo::_T('Template %s saved.'), '<strong>' . $_POST['name'] . '</strong>'));
            $smarty->assign('success', true);
        } else {
            $logger->addMsg(Pommo::_T('Error with addition.'));
예제 #25
0
$specialists = R::find('specialization', 1);
$smarty = new Smarty();
$view = $top;
if (empty($_POST)) {
    $smarty->assign('title', 'mHealth::Doctor\'s Report');
    $smarty->assign('topic', 'Doctor\'s Report');
    $smarty->assign('view', $view);
    $smarty->assign('data', $data);
    $smarty->assign('category', $category);
    $smarty->assign('states', $states);
    $smarty->assign('specialists', $specialists);
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_history', 'history', 'notEmpty');
    SmartyValidate::register_validator('v_complaint', 'complaint', 'notEmpty');
    SmartyValidate::register_validator('v_diagnosis', 'diagnosis', 'notEmpty');
    SmartyValidate::register_validator('v_intervention', 'intervention', 'notEmpty');
    $smarty->display('write_report.tpl');
} else {
    SmartyValidate::connect($smarty);
    // validate after a POST
    if (SmartyValidate::is_valid($_POST)) {
        // no errors, done with SmartyValidate
        if (array_key_exists('submit', $_POST)) {
            //var_dump($_POST); exit;
            $history = $_POST['history'];
            $complaint = $_POST['complaint'];
            $diagnosis = $_POST['diagnosis'];
            $intervention = $_POST['intervention'];
            //$_SESSION['user_id'] = 21;
            $return = $obj->updateConsult($item, $_SESSION['user_id'], $user->mobile_number, $diagnosis, $history, $intervention, $complaint);
            //var_dump($return); exit;
예제 #26
0
파일: tips.php 프로젝트: hiroyalty/mhealth
$top = $top . $feedy;
if (empty($_POST)) {
    $smarty->assign('title', 'mHealth::Tips Upload');
    $smarty->assign('topic', 'Tips Upload');
    $smarty->assign('top', $top);
    $smarty->assign('hours', $hours);
    $smarty->assign('minutes', $minutes);
    $smarty->assign('category', $myobj->get_assoc('category', 'id,name', 'name'));
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_date', 'date', 'isDate');
    SmartyValidate::register_validator('v_tips', 'tips', 'notEmpty');
    SmartyValidate::register_object('myobj', $myobj);
    SmartyValidate::register_criteria('db_date', 'myobj->date');
    SmartyValidate::register_criteria('db_tip', 'myobj->tip');
    SmartyValidate::register_validator('v_date_db', 'date', 'db_date', false, false, 'trim');
    SmartyValidate::register_validator('v_tip_db', 'tips', 'db_tip', false, false, 'trim');
    $smarty->display('tips.tpl');
} else {
    SmartyValidate::connect($smarty);
    SmartyValidate::register_object('myobj', $myobj);
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        $f_date = $myobj->insertTip();
        $cat = $myobj->selectcategory($_SESSION['cat_id']);
        if ($f_date) {
            $response_title = "Tips Schedule Successfully!";
            $text = "Tip scheduled successfully for this date ({$f_date}) under {$cat} category ";
            $myobj->insertAuditTrail($_SESSION['login'], 'SCHEDULE_TIP', 'User Schedule tip successfully');
        } else {
            $response_title = "Tips Schedule Failed!";
            $text = "Tip has already been schedule for this date ({$f_date}) under {$cat} category. Please select another date.";
예제 #27
0
    Pommo::kill();
}
if (isset($_REQUEST['disableDebug'])) {
    unset($_REQUEST['debugInstall']);
} elseif (isset($_REQUEST['debugInstall'])) {
    $smarty->assign('debug', TRUE);
}
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('list_name', 'list_name', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('site_name', 'site_name', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('site_url', 'site_url', 'isURL');
    SmartyValidate::register_validator('admin_password', 'admin_password', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('admin_password2', 'admin_password:admin_password2', 'isEqual');
    SmartyValidate::register_validator('admin_email', 'admin_email', 'isEmail');
    $formError = array();
    $formError['list_name'] = $formError['site_name'] = $formError['admin_password'] = Pommo::_T('Cannot be empty.');
    $formError['admin_password2'] = Pommo::_T('Passwords must match.');
    $formError['site_url'] = Pommo::_T('Must be a valid URL');
    $formError['admin_email'] = Pommo::_T('Must be a valid email');
    $smarty->assign('formError', $formError);
} else {
    // ___ USER HAS SENT FORM ___
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        // __ FORM IS VALID
        if (isset($_POST['installerooni'])) {
            // drop existing poMMo tables
            foreach (array_keys($dbo->table) as $key) {
                $table = $dbo->table[$key];
$profSQL .= " user.profile_id = profiles.profile_id WHERE user.username = '******'";
$profiles = new classListBox($db, "userprofiles");
$profiles->set_query($profSQL, "profile_id", "profile");
$profiles->set_postback(true);
$userProf = $profiles->display();
$smarty->assign('userProf', $userProf);
if ($profiles->get_selectedItemKey() != '') {
    $smarty->assign('button', 'visible');
    unset($_SESSION['userprofiles']);
}
if (!isset($_POST['submit'])) {
    // new form, we (re)set the session data
    SmartyValidate::connect($smarty, true);
    // register our validators
    SmartyValidate::register_validator('usr', 'users', 'notEmpty');
    SmartyValidate::register_validator('prof', 'userprofiles', 'notEmpty');
    // display form
} else {
    // validate after a POST
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST)) {
        SmartyValidate::disconnect();
        require_once './classes/security.class.php';
        #get $_POST info
        $profile_id = $profiles->get_selectedItemKey();
        $username = $user->get_selectedItemKey();
        $security = new Security($db);
        if ($security->removeUser($username, $profile_id)) {
            #profile name
            $nmpSQL = "SELECT profile FROM sionapros_profiles WHERE profile_id = {$profile_id}";
            $nmp = $db->execute($nmpSQL);
예제 #29
0
require '../bootstrap.php';
Pommo::init();
$logger =& Pommo::$_logger;
$dbo =& Pommo::$_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$smarty = new Pommo_Template();
$smarty->prepareForForm();
$exchanger = current(Pommo_Api::configGet(array('list_exchanger')));
SmartyValidate::connect($smarty);
if (!SmartyValidate::is_registered_form('exchanger') || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::register_form('exchanger', true);
    SmartyValidate::register_validator('email', 'email', 'isEmail', false, false, false, 'exchanger');
    $vMsg = array();
    $vMsg['email'] = Pommo::_T('Invalid email address');
    $smarty->assign('vMsg', $vMsg);
    $dbvals = array('exchanger' => $exchanger, 'email' => Pommo::$_config['admin_email']);
    $smarty->assign($dbvals);
} else {
    // ___ USER HAS SENT FORM ___
    /**********************************
    		JSON OUTPUT INITIALIZATION
    	 *********************************/
    require_once Pommo::$_baseDir . 'classes/Pommo_Json.php';
    $json = new Pommo_Json();
    if (SmartyValidate::is_valid($_POST, 'exchanger')) {
        // __ FORM IS VALID
        require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
예제 #30
0
파일: tell.php 프로젝트: hiroyalty/mhealth
        $randomString .= $characters[rand(0, strlen($characters) - 1)];
    }
    return $randomString;
}
$random = generateRandomString(8);
$_SESSION['random'] = $random;
if (empty($_POST)) {
    $smarty->assign('info', '');
    $smarty->assign('title', 'mHealth::Tell A Doctor');
    $smarty->assign('topic', 'Tell A Doctor');
    $smarty->assign('random', $_SESSION['random']);
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('v_email', 'email', 'isEmail');
    SmartyValidate::register_validator('v_name', 'name', 'notEmpty');
    SmartyValidate::register_validator('v_message', 'message', 'notEmpty');
    SmartyValidate::register_validator('v_validate', 'validate:validate2', 'isEqual');
    $smarty->display('tell.tpl');
} else {
    SmartyValidate::connect($smarty);
    SmartyValidate::register_object('myobj', $myobj);
    if (SmartyValidate::is_valid($_POST)) {
        //var_dump($_POST); exit;
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $subject = $_POST['subject'];
        $m_subject = $subject . " From mHealth from " . $name;
        $m_email = "*****@*****.**";
        $m_message = $message . "<br><br><br> Reply Email: " . $email;
        $mailheaders = "From: mHealth <*****@*****.**>";
        $mailheaders .= "Reply-To: " . $email;