Example #1
0
 function getValidated($template, $id = '')
 {
     $validation = getLib('formvalidation');
     $set = array();
     $errors = array();
     if (!empty($id)) {
         $id .= '_';
     }
     foreach ($template as $key => $value) {
         if (isset($_REQUEST[$id . $key]) || $value->type == 'checkbox') {
             if (!isset($_REQUEST[$id . $key])) {
                 $_REQUEST[$id . $key] = '';
             }
             $result = $validation->validateValue($key, $_REQUEST[$id . $key], $value);
             if (count($result) == 0) {
                 if ($value->name == '') {
                     continue;
                 }
                 if ($value->type == 'checkbox') {
                     $set[$key] = !empty($_REQUEST[$id . $key]);
                 } else {
                     $set[$key] = $value->runValue($_REQUEST[$id . $key]);
                 }
             } else {
                 $errors[$key] = $result;
             }
         }
     }
     return array('errors' => $errors, 'values' => $set, 'success' => count($errors) == 0);
 }
Example #2
0
 function retrieve($id = '')
 {
     global $uid, $db;
     if (!empty($id)) {
         $id .= '_';
     }
     if (!isset($_REQUEST[$id . 'token_key']) || !isset($_REQUEST[$id . 'timestamp']) || !isset($_REQUEST[$id . 'token'])) {
         return false;
     }
     $timestamp = intval($_REQUEST[$id . 'timestamp']);
     if (time() - $timestamp > 3600) {
         return false;
     }
     $sig = sha1($uid . $timestamp . 'binding');
     if ($sig != $_REQUEST[$id . 'token_key']) {
         return false;
     }
     $serial = getLib('encrypt_xor')->decrypt(trim($_REQUEST[$id . 'token']), sha1($uid . $timestamp));
     $token = $db->unserializeToken($serial);
     return $token;
 }
Example #3
0
 function render_file_upload($label, $name, $explanation = '', $caption = '')
 {
     $elements = array(array('name' => 'p', 'attributes' => array('class' => 'upload'), 'value' => array(array('name' => 'label', 'attributes' => array('for' => $name), 'value' => $label), array('name' => 'input', 'attributes' => array('class' => 'fileupload', 'name' => $name, 'type' => 'file')))));
     if (!empty($explanation)) {
         $elements[0]['value'][] = array('name' => 'small', 'value' => $explanation);
     }
     if (!empty($caption)) {
         $elements[0]['value'][] = array('name' => 'span', 'value' => $caption);
     }
     $elements[0]['value'][] = array('name' => 'div', 'attributes' => array('class' => 'clear'), 'value' => ' ');
     return getLib('html')->renderHTMLElements($elements);
 }
    $pieces = explode("/", $_SERVER[SCRIPT_NAME]);
    for ($x = 0; $x < count($pieces); $x++) {
        if (substr_count($pieces[$x], '.') == 0) {
            $path = $path . $pieces[$x] . "/";
        } else {
            $x = count($pieces) + 1;
        }
    }
    $php_url = $start . $base_host . $path;
    return $php_url;
}
//-----setup php code just used for this database
$setup = nuSetup();
$sVariables = recordToHashArray('zzsys_session', 'zzsys_session_id', $_GET['ses']);
//--session values (access level and user etc. )
eval(replaceHashVariablesWithValues($sVariables, getLib()));
//--replace hash variables then run code
//eval(replaceHashVariablesWithValues($sVariables, $setup->set_php_code));                                  //--replace hash variables then run code
//--- see if activity can be run without being logged in
function activityPasswordNeeded($pReportID)
{
    $t = nuRunQuery("SELECT sat_all_zzsys_form_id FROM zzsys_activity WHERE sat_all_code = '{$pReportID}'");
    $r = db_fetch_row($t);
    return passwordNeeded($r[0]);
}
// BEGIN - 2009/06/02 - Michael
setClientTimeZone();
function setClientTimeZone()
{
    global $setup;
    if ($setup->set_timezone) {