Example #1
0
function check_fields(&$fields, $show_messages = true)
{
    // VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
    $system_fields = array('sid' => array(T_ZBX_STR, O_OPT, P_SYS, HEX(), null), 'triggers_hash' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, null), 'print' => array(T_ZBX_INT, O_OPT, P_SYS, IN('1'), null), 'page' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'ddreset' => array(T_ZBX_INT, O_OPT, P_SYS, null, null));
    $fields = zbx_array_merge($system_fields, $fields);
    $err = ZBX_VALID_OK;
    foreach ($fields as $field => $checks) {
        $err |= check_field($fields, $field, $checks);
    }
    unset_not_in_list($fields);
    unset_if_zero($fields);
    if ($err != ZBX_VALID_OK) {
        unset_action_vars($fields);
    }
    $fields = null;
    if ($err & ZBX_VALID_ERROR) {
        invalid_url();
    }
    if ($show_messages && $err != ZBX_VALID_OK) {
        show_messages($err == ZBX_VALID_OK, null, _('Page received incorrect data'));
    }
    return $err == ZBX_VALID_OK;
}
Example #2
0
            $valid = calc_exp($fields, $field, $validation);
        }
        if (!$valid) {
            if ($flags & P_SYS) {
                info("Critical error. Incorrect value for [" . $field . "] = '" . $_REQUEST[$field] . "'");
                return ZBX_VALID_ERROR;
            } else {
                info("Warning. Incorrect value for [" . $field . "]");
                return ZBX_VALID_WARNING;
            }
        }
    }
    return ZBX_VALID_OK;
}
//		VAR							TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$system_fields = array('sid' => array(T_ZBX_STR, O_OPT, P_SYS, HEX(), NULL), 'switch_node' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'triggers_hash' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, NULL), 'print' => array(T_ZBX_INT, O_OPT, P_SYS, IN('1'), NULL), 'sort' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'sortorder' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL));
function invalid_url($msg = S_INVALID_URL_PARAMS)
{
    include_once 'include/page_header.php';
    unset_all();
    show_error_message($msg);
    include_once 'include/page_footer.php';
}
function check_fields(&$fields, $show_messages = true)
{
    global $system_fields;
    $err = ZBX_VALID_OK;
    $fields = array_merge($fields, $system_fields);
    foreach ($fields as $field => $checks) {
        $err |= check_field($fields, $field, $checks);
    }
Example #3
0
	/**
	  * keresés az acymailing subscriber táblában
	  * @param pbject kapccsolatok rekord
	  * @return integer
	  */
	protected function getSubId($item, $email) {
		$db = JFactory::getDBO();
		$result = 0;
		$db->setQuery('select subid
		from #__acymailing_subscriber
		where email='.$db->quote($email));
		$res = $db->loadObject();
		if ($res) {
			$result = $res->subid;
		} else {
			if ($email == $item->email)
			  $key = HEX(1234 * '.$item->kapcs_id.');
		    else
			  $key = HEX(1212 * '.$item->kapcs_id.');
			$db->setQuery('INSERT INTO #__acymailing_subscriber 
				(`subid`, 
				`email`, 
				`userid`, 
				`name`, 
				`created`, 
				`confirmed`, 
				`enabled`, 
				`accept`, 
				`ip`, 
				`html`, 
				`key`, 
				`confirmed_date`, 
				`confirmed_ip`, 
				`lastopen_date`, 
				`lastclick_date`, 
				`lastopen_ip`, 
				`lastsent_date`, 
				`source`
				)
				VALUES
				(0, 
				'.$db->quote($email).', 
				0, 
				'.$db->quote($item->nev1.' '.$item->nev2.' '.$item->nev3).', 
				'.time().', 
				'.time().', 
				1, 
				1, 
				"", 
				1, 
				'.$key.', 
				0, 
				"", 
				0, 
				0, 
				"", 
				0, 
				""
				);
			');
			$db->query();
			$result = $db->insertid();
		}
		return $result;
	}