本文整理汇总了PHP中isValidDate函数的典型用法代码示例。如果您正苦于以下问题:PHP isValidDate函数的具体用法?PHP isValidDate怎么用?PHP isValidDate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isValidDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($date = null, $u_id = null)
{
if (@$this->input->post('picking_date')) {
return redirect(site_url('admin/picking-lists/' . str_replace('/', '-', $this->input->post('picking_date'))));
}
$this->load->model('order_model');
$this->layout->set_title('Picking Lists')->set_breadcrumb('Picking Lists', '/admin/picking-lists');
$this->load->helper('dates_helper');
if (isset($date) && isValidDate($date, '_')) {
$this->data['date'] = strtotime(str_replace('_', '-', $date));
//get relevant confirmed orders
$search = array('oi_delivery_date' => date('Y-m-d', $this->data['date']), 'oi_status' => 'Confirmed', 'order' => array('bg_name', 'u_sname', 'u_fname'));
$notes_where = " AND on_delivery_date = '" . date('Y-m-d', $this->data['date']) . "' ";
if (isset($u_id)) {
$this->data['search_u_id'] = $u_id;
$search['oi_u_id'] = $u_id;
$notes_where .= " AND on_u_id = '" . $u_id . "' ";
}
//permission override?
if (!$this->auth->is_allowed_to('view_picking_lists', 'all')) {
if ($this->auth->is_allowed_to('view_picking_lists', 'bg', $this->session->userdata('u_bg_id'))) {
$search['u_bg_id'] = $this->session->userdata('u_bg_id');
}
if ($this->auth->is_allowed_to('view_picking_lists', 's', $this->session->userdata('u_s_id'))) {
$search['oi_s_id'] = $this->session->userdata('u_s_id');
}
}
//get them...
$this->data['orders'] = $this->order_model->get_orders($search);
$this->data['search'] = $search;
//for displaying what we've filtered on.
$this->data['order_notes'] = $this->order_model->get_notes($notes_where);
$date_str = date('jS M Y', $this->data['date']);
$this->layout->set_title($date_str)->set_breadcrumb($date_str, 'admin/picking-lists/' . $date);
if (isset($u_id)) {
if (isset($this->data['orders'][0])) {
$title = $this->data['orders'][0]['u_title'] . ' ' . $this->data['orders'][0]['u_fname'] . ' ' . $this->data['orders'][0]['u_sname'];
$this->layout->set_title($title)->set_breadcrumb($title);
} else {
//oh crumbs, we don't have the user's name to put in the breadcrumb
$this->load->model('users_model');
$member = $this->users_model->get_user($u_id);
$title = $member['u_title'] . ' ' . $member['u_fname'] . ' ' . $member['u_sname'];
$this->layout->set_title($title)->set_breadcrumb($title);
}
}
$this->load->vars($this->data);
$this->view = 'admin/picking_lists/view';
} else {
if (isset($date) && !isValidDate($date, '_')) {
$this->data['error_message'] = "Not a valid date";
}
$this->layout->set_js(array('views/admin/picking_lists/index', 'plugins/jquery.validate'));
$this->load->vars($this->data);
$this->view = 'admin/picking_lists/index';
}
}
示例2: check_fieldsFormatting_partyRegistrationAsGraduate
function check_fieldsFormatting_partyRegistrationAsGraduate($data_form)
{
$error = "";
// Überprüfe, ob die Anzahl Gäste nur aus einer Zahl besteht
if (!preg_match("/^[0-9]+\$/iu", $data_form['anzahl_gaeste'])) {
$error = $error . "Als Anzahl an Gästen sind nur Ziffern erlaubt.<br>\n";
}
// Überprüfe das Abschlussdatum auf korrektes Format
if (!isValidDate($data_form['studienabschluss'])) {
$error = $error . "Das eingegebene Abschlussdatum ist kein korrektes Datum. Die Eingabe muss die Form TT.MM.JJJJ haben.<br>\n";
}
return $error;
}
示例3: check_fields_format_register
function check_fields_format_register($data_form)
{
$error = "";
// Überprüfe ob die Namensfelder nur Buchstaben enthalten
if (!preg_match("/^[a-zäöüß]+\$/iu", $data_form['vorname'])) {
$error = $error . "Als Vorname sind nur Buchstaben erlaubt.<br>\n";
}
if (!preg_match("/^[a-zäöüß]+\$/iu", $data_form['nachname'])) {
$error = $error . "Als Nachname sind nur Buchstaben erlaubt.<br>\n";
}
// Überprüfe das Geburtsdatum auf korrektes Format
if (!isValidDate($data_form['geburtstag'])) {
$error = $error . "Das eingegebene Geburtsdatum ist kein korrektes Datum. Die Eingabe muss die Form TT.MM.JJJJ haben.<br>\n";
}
// Überprüfe die Email-Adresse auf korrektes Format
if (!filter_var($data_form['email'], FILTER_VALIDATE_EMAIL)) {
$error = $error . "Die eingegebene Email-Adresse ist ungültig.<br>\n";
}
// Überprüfe die IBAN
if (!checkIBAN($data_form['iban'])) {
$error = $error . "Die eingegebene IBAN ist ungültig.<br>\n";
}
// Überprüfe die BIC
if (!checkBIC($data_form['bic'])) {
$error = $error . "Die eingegebene BIC ist ungültig.<br>\n";
}
// falls die Checkbox "newsletter" nicht(!) ausgewählt wurde, muss eine Adresse eingegeben werden
if (!isset($data_form['newsletter'])) {
//Straße und Hausnummer überprüfen macht keinen Sinn (Zu viele Ausnahmefälle)
if (!preg_match("/^[0-9]+\$/", $data_form['plz'])) {
$error = $error . "Als PLZ sind nur Ziffern erlaubt.<br>\n";
}
if ($data_form['land'] === 'Deutschland') {
if (!preg_match("/^[0-9]{5}\$/", $data_form['plz'])) {
$error = $error . "Keine korrekte deutsche PLZ.<br>\n";
}
}
if ($data_form['land'] === 'Deutschland') {
if (!preg_match("/^[a-zäöüß]+\$/iu", $data_form['ort'])) {
$error = $error . "Als Ort sind nur Buchstaben erlaubt.<br>\n";
}
}
if (!preg_match("/^[a-zäöüß]+\$/iu", $data_form['land'])) {
$error = $error . "Als Land sind nur Buchstaben erlaubt.<br>\n";
}
}
// Gib die Fehlermeldungen zurück, leer falls alles ok.
return $error;
}
示例4: remove
public static function remove($product_id)
{
DB::transaction(function () use($product_id) {
$product = static::findOrFail($product_id);
if (isValidDate($product->billed_till)) {
$billed_till = new Carbon\Carbon($product->billed_till);
$today = new Carbon\Carbon();
if ($billed_till > $today) {
return;
}
}
$history = ['user_id' => $product->user_id, 'name' => $product->name, 'start_date' => isValidDate($product->billed_till) ? $product->billed_till : $product->assigned_on, 'stop_date' => date('Y-m-d H:i:s'), 'price' => $product->price, 'taxable' => $product->taxable, 'tax_rate' => $product->tax_rate, 'billed_every' => $product->billing_cycle . $product->billing_unit];
if (!APUserRecurringProductHistory::create($history)) {
throw new Exception("Could not add to history");
}
if (!$product->delete()) {
throw new Exception("Could not delete product.");
}
});
}
示例5: getData
function getData()
{
parent::getData();
$param =& $this->param;
$user = $this->site->username();
if (empty($user)) {
$user = "none";
}
$error = false;
// echo "<pre>"; print_r ($_POST); echo "</pre>";
if (isset($_GET['key'])) {
$data_src = 'key';
$data_key = $_GET['key'];
} else {
$data_src = $_POST['datasrc'];
}
$data_source_is_dates = $data_src == "dates";
if ($data_source_is_dates) {
$start_date = $_POST['startdate'];
$end_date = $_POST['enddate'];
$error = !isValidDate($start_date) or !empty($end_date) and !isValidDate($end_date);
} elseif ($data_src == 'key') {
$commitsfiles = array($data_key);
} else {
@($commitsmonthfiles = $_POST['commitsmonthfiles']);
if (isset($commitsmonthfiles)) {
$commitsfiles = array();
while (list($y, $v_yfiles) = each($commitsmonthfiles)) {
while (list($m, $v_mfiles) = each($v_yfiles)) {
while (list($d, $v_file) = each($v_mfiles)) {
$commitsfiles[] = $v_file;
}
}
}
}
$error = count($commitsfiles) == 0;
}
// @$commitsfiles = $_POST['commitsfiles'];
$param['DIS_GET_SelectedYear'] = "";
if (isset($_POST['selected_years'])) {
$selected_years = $_POST['selected_years'];
while (list($k, $y) = each($selected_years)) {
$param['DIS_GET_SelectedYear'] .= "{$y}:";
}
}
if (!isset($commitsfiles)) {
$commitsfiles = array();
}
// if (isset ($_GET['key'])) { $commitsfiles[] = $_GET['key']; };
$param['DIS_Application'] = "show";
$param['DIS_Command'] = "cmd";
$param['DIS_Result'] = "Result";
if (!$error) {
@($operation = $_POST['show']);
if (!isset($operation)) {
$operation = 'ShowLogs';
}
$param['DIS_Parameters'] = "Login used = {$user} <BR>";
@($filter = $_POST['filter']);
if (!isset($filter) or strlen($filter) == 0) {
$filter = 'profil';
} else {
$param['DIS_Parameters'] .= "Filter used = {$filter} <BR>";
if ($filter == 'text') {
@($filter_text = $_POST['textfilters']);
$filter_text = cleanedTextModule($filter_text);
$filter_file_tempo_name = tempnam($SCMLOGS['tmpdir'], "FILTER_TEMPO_");
$filter_file_tempo = fopen($filter_file_tempo_name, "w");
fwrite($filter_file_tempo, $filter_text);
fclose($filter_file_tempo);
$param['DIS_Parameters'] .= "Filter text = {$filter_text} <BR>";
}
}
@($format = $_POST['format']);
if (!isset($format) or strlen($format) == 0) {
$format = 'html';
} else {
$param['DIS_Parameters'] .= "Formating used = {$format} <BR>";
}
@($type = $_POST['type']);
if (!isset($type) or strlen($type) == 0) {
$type = 'filtered';
} else {
$param['DIS_Parameters'] .= "Output type used = {$type} <BR>";
}
@($only_user = $_POST['only_user']);
if (!isset($only_user) or strlen($only_user) == 0) {
$only_user = '';
} else {
$param['DIS_Parameters'] .= "Only commits from user = {$only_user} <BR>";
}
@($only_tag = $_POST['only_tag']);
if (!isset($only_tag) or strlen($only_tag) == 0) {
$only_tag = '';
} else {
$param['DIS_Parameters'] .= "Only commits about TAG = {$only_tag} <BR>";
}
$is_mail_operation = FALSE;
switch ($operation) {
case 'EmailLogs':
//.........这里部分代码省略.........
示例6: ajax_insertHandler
function ajax_insertHandler($auth)
{
if (!isset($_POST['insert'])) {
return;
}
$request = $_POST['insert'];
$response;
if ($request['what'] == 'duration') {
$values = $request['values'];
//TODO: More thorough validation and sanitisation(make sure id is valid, etc)
if (!isset($values['content_id']) || $values['content_id'] < 1) {
json_die_error('Bad or missing content id');
}
//TODO: confirm content is real and visible to user
if (!isset($values['player_id']) || $values['player_id'] < 1) {
json_die_error('Bad or missing player id');
}
//TODO: confirm player is real
if (!isset($values['date_start']) || $values['date_start'] == -1 || !isValidDate($values['date_start'])) {
json_die_error('Bad or missing date');
}
if (!isset($values['date_end']) || $values['date_end'] == -1 || !isValidDate($values['date_end'])) {
json_die_error('Bad or missing date');
}
//TODO: enforce positive datespan
if (!isset($values['duration_name']) || empty($values['duration_name'])) {
$values['duration_name'] = 'Untitled duration';
} else {
$values['duration_name'] = sanitise_string($values['duration_name']);
}
$values['user_id'] = $auth['user']['user_id'];
//TODO: also check that user can see that content?
if (!APP_CAN_WRITE_INVISIBLE && account_getDurationVisibility($auth, $values) < PRIV_MINE) {
json_die_error('You need permission to view content in order to schedule content on this player!');
}
if (account_getDurationWriteability($auth, $values) < PRIV_MINE) {
json_die_error('You do not have permission to schedule content on this player!');
}
$dbh = db_connect();
$result = db_insertDuration($dbh, $values);
$response['result'] = $result;
$response['error'] = false;
if ($result == -1) {
$response['error'] = true;
}
}
$json = json_encode($response);
die($json);
}
示例7: getDetailViewOutputHtml
//.........这里部分代码省略.........
} elseif (count($image_array) == 1) {
$label_fld[] = '<a href="' . $imagepath_array[0] . $image_id_array[0] . "_" . base64_encode_filename($image_array[0]) . '" target="_blank" ><img src="' . $imagepath_array[0] . $image_id_array[0] . "_" . base64_encode_filename($image_array[0]) . '" border="0" width="150" height="150"></a>';
} else {
$label_fld[] = '';
}
}
if ($tabid == 4) {
//$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname];
$sql = "select ec_attachments.* from ec_attachments inner join ec_seattachmentsrel on ec_seattachmentsrel.attachmentsid = ec_attachments.attachmentsid where (ec_attachments.type like '%image%' or ec_attachments.type like '%img%') and ec_seattachmentsrel.crmid='" . $col_fields['record_id'] . "'";
$image_res = $adb->query($sql);
$image_id = $adb->query_result($image_res, 0, 'attachmentsid');
$image_path = $adb->query_result($image_res, 0, 'path');
$image_name = $adb->query_result($image_res, 0, 'name');
$imgpath = $image_path . $image_id . "_" . base64_encode_filename($image_name);
$width = 160;
$height = get_scale_height($imgpath, $width);
if ($image_name != '') {
$label_fld[] = '<img src="' . $imgpath . '" width="' . $width . '" height="' . $height . '" class="reflect" alt="">';
} else {
$label_fld[] = '';
}
}
} elseif ($uitype == 63) {
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = $col_fields[$fieldname] . 'h ' . $col_fields['duration_minutes'] . 'm';
} elseif ($uitype == 6) {
$label_fld[] = $mod_strings[$fieldlabel];
if ($col_fields[$fieldname] == '0') {
$col_fields[$fieldname] = '';
}
if ($col_fields['time_start'] != '') {
$start_time = $col_fields['time_start'];
}
if (!isValidDate($col_fields[$fieldname])) {
$displ_date = '';
} else {
$displ_date = getDisplayDate($col_fields[$fieldname]);
}
$label_fld[] = $displ_date . ' ' . $start_time;
} elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) {
$label_fld[] = $mod_strings[$fieldlabel];
$cur_date_val = $col_fields[$fieldname];
$end_time = "";
if (isset($col_fields['time_end']) && $col_fields['time_end'] != '' && ($tabid == 9 || $tabid == 16) && $uitype == 23) {
$end_time = $col_fields['time_end'];
}
if (!isValidDate($cur_date_val)) {
$display_val = '';
} else {
$display_val = getDisplayDate($cur_date_val);
}
$label_fld[] = $display_val . ' ' . $end_time;
} elseif ($uitype == 1007) {
$label_fld[] = isset($mod_strings[$fieldlabel]) ? $mod_strings[$fieldlabel] : $fieldlabel;
$cur_approve_val = $col_fields[$fieldname];
$label_fld[] = getApproveStatusById($cur_approve_val);
} elseif ($uitype == 1008) {
if (isset($mod_strings[$fieldlabel])) {
$label_fld[] = $mod_strings[$fieldlabel];
} else {
$label_fld[] = $fieldlabel;
}
$value = $col_fields[$fieldname];
$label_fld[] = getUserName($value);
} elseif ($uitype == 71 || $uitype == 72) {
$label_fld[] = $mod_strings[$fieldlabel];
示例8: addData
function addData($name, $id)
{
$flag = "";
$caseId = "";
$username = "";
$des = "";
$description = "";
$caseid = "";
$name = "";
$age = "";
$sex = "";
$address1 = "";
$address2 = "";
$pincode = "";
$disease = "";
$fatal = "";
$district = "";
$reportedon = "";
$diedon = "";
$date = "";
$createdon = "";
$newpostoffice = "";
$caseDate = "";
$username = "";
$usertype = "";
if ($id == 'add') {
$username = trim($_SESSION['userName']);
$usertype = trim($_SESSION['userType']);
$hospitalid = trim($_POST['cmbHospital']);
$name = trim($_POST['txtName']);
$age = trim($_POST['txtAge']);
$sex = trim($_POST['rdoSex']);
$address1 = trim($_POST['txtAddress1']);
$address2 = trim($_POST['txtAddress2']);
$pincode = trim($_POST['txtPincode']);
$disease = trim($_POST['cmbDisease']);
$fatal = trim($_POST['cmbFatal']);
$district = trim($_POST['cmbDistrict']);
$reportedon = trim($_POST['txtReportedOn']);
$createdon = date("d/m/Y");
$date = trim($_POST['txtCaseDate']);
if (strlen($name) < 1) {
$flag = 'phpValidError';
}
if (isInvalidName($name)) {
$flag = 'phpValidError';
}
if (strlen($address1) < 1) {
$flag = 'phpValidError';
}
if (isInvalidName($address1)) {
$flag = 'phpValidError';
}
if (isInvalidAddress($address2)) {
$flag = 'phpValidError';
}
if (isInvalidNumber($hospitalid)) {
$flag = 'phpValidError';
}
if (isInvalidNumber($age)) {
$flag = 'phpValidError';
}
if (isInvalidNumber($disease)) {
$flag = 'phpValidError';
}
if (isInvalidNumber($district)) {
$flag = 'phpValidError';
}
if (strlen($pincode) > 0) {
if (strlen($pincode) != 6) {
$flag = 'phpValidError';
}
if (isInvalidNumber($pincode)) {
$flag = 'phpValidError';
}
}
if ($_POST['cmbPostOffice'] == 1 && $_POST['cmbNearPostOffice'] != "select") {
$postofficeid = trim($_POST['cmbNearPostOffice']);
} else {
$postofficeid = trim($_POST['cmbPostOffice']);
}
if ($_POST['txtDiedOn'] == "") {
$diedon = "";
} else {
$diedon = trim($_POST['txtDiedOn']);
if (!isValidDate($diedon)) {
$flag = 'phpValidError';
}
$diedon = getDateToDb($diedon);
}
if (isInvalidNumber($postofficeid)) {
$flag = 'phpValidError';
}
if (!isValidDate($date)) {
$flag = 'phpValidError';
}
if (!isValidDate($reportedon)) {
$flag = 'phpValidError';
}
$result = mysql_query("select * from casereport where name='" . $name . "' and age='" . $age . "'\n\t\t\t\tand sex='" . $sex . "' and fatal='" . $fatal . "' and casedate='" . getDateToDb($date) . "'\n\t\t\t\tand reportedon='" . getDateToDb($reportedon) . "'\t") or die(mysql_error());
//.........这里部分代码省略.........
示例9: process_bulk_revert_request
protected function process_bulk_revert_request()
{
if (isset($_POST['revert_name']) && !empty($_POST['revert_name'])) {
$revert_name = $_POST['revert_name'];
} else {
$revert_name = null;
}
if (isset($_POST['revert_ip']) && !empty($_POST['revert_ip'])) {
$revert_ip = filter_var($_POST['revert_ip'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE);
if ($revert_ip === false) {
// invalid ip given.
$this->theme->display_admin_block('Invalid IP');
return;
}
} else {
$revert_ip = null;
}
if (isset($_POST['revert_date']) && !empty($_POST['revert_date'])) {
if (isValidDate($_POST['revert_date'])) {
$revert_date = addslashes($_POST['revert_date']);
// addslashes is really unnecessary since we just checked if valid, but better safe.
} else {
$this->theme->display_admin_block('Invalid Date');
return;
}
} else {
$revert_date = null;
}
set_time_limit(0);
// reverting changes can take a long time, disable php's timelimit if possible.
// Call the revert function.
$this->process_revert_all_changes($revert_name, $revert_ip, $revert_date);
// output results
$this->theme->display_revert_ip_results();
}
示例10: validate
function validate(&$key, &$value, $error_array = array(), $index = 0, $array_key = NULL)
{
// echo "Switch Test \$key: " . $key . " \$value: " . $value . " <br>\n" ;
switch ($key) {
case "numauthors":
case "numpages":
// echo "Switch Number \$key: " . $key . " \$value: " . $value . " <br>\n" ;
isIntegerMoreThanZero($value, &$error_array, &$index);
break;
case "email":
case "emailHome":
case "ConferenceContact":
// echo "Switch Email \$key: " . $key . " \$value: " . $value . " <br>\n" ;
valid_email($value, &$error_array, &$index);
break;
case "faxno":
case "phoneno":
// echo "Switch Phone \$key: " . $key . " \$value: " . $value . " <br>\n" ;
isValidPhoneNumber($value, &$error_array, &$index);
break;
case "phonenoHome":
// echo "Switch Phone \$key: " . $key . " \$value: " . $value . " <br>\n" ;
isValidPhoneNumber($value, &$error_array, &$index);
break;
case "userfile":
case "state":
case "commentfile":
// echo "Switch File \$key: " . $key . " \$value: " . $value . " <br>\n" ;
isValidFile($value, &$error_array, &$index, &$array_key);
break;
case "logofile":
isValidLogoFile($value, &$error_array, &$index, &$array_key);
break;
case "country":
isValidCountryCode($value, &$error_array, &$index);
break;
case "password":
case "newpwd":
isValidPassword($value, &$error_array, &$index);
break;
case "date":
case "ConferenceStartDate":
case "ConferenceEndDate":
case "arrStartDate":
case "arrEndDate":
if (isValidDate($value, &$error_array, &$index)) {
//is_date_expired( $value , date ( "j/m/Y" , time() ) , &$error_array , &$index ) ;
is_date_expired($value, date("Y-m-d", time()), &$error_array, &$index);
}
break;
default:
// echo "Default \$key: " . $key . " \$value: " . $value . " <br>\n" ;
break;
}
}
示例11: UpdateEmployee
function UpdateEmployee($fields)
{
$statusMessage = "";
//-------------------------------------------------------------------------
// Validate Input parameters
//-------------------------------------------------------------------------
$inputIsValid = TRUE;
$validID = false;
$countOfFields = 0;
foreach ($fields as $key => $value) {
if ($key == EMP_ID) {
$record = RetrieveEmployeeByID($value);
if ($record != NULL) {
$validID = true;
$countOfFields++;
}
} else {
if ($key == EMP_NAME) {
$countOfFields++;
if (isNullOrEmptyString($value)) {
$statusMessage .= "Employee name can not be blank.</br>";
error_log("Invalid EMP_NAME passed to UpdateEmployee.");
$inputIsValid = FALSE;
}
} else {
if ($key == EMP_EMAIL) {
$countOfFields++;
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
$statusMessage .= "Email address is not in a valid format.</br>";
error_log("Invalid email address passed to UpdateEmployee.");
$inputIsValid = FALSE;
}
} else {
if ($key == EMP_PASSWORD) {
//No validation on password, since this is an MD5 encoded string.
$countOfFields++;
} else {
if ($key == EMP_DATEJOINED) {
$countOfFields++;
if (!isValidDate($value)) {
$statusMessage .= "Date Joined value is not a valid date</br>";
error_log("Invalid EMP_DATEJOINED passed to UpdateEmployee.");
$inputIsValid = FALSE;
}
} else {
if ($key == EMP_LEAVE_ENTITLEMENT) {
$countOfFields++;
if (!is_numeric($value)) {
$statusMessage .= "Employee Leave Entitlement must be a numeric value.</br>";
error_log("Invalid EMP_LEAVE_ENTITLEMENT passed to UpdateEmployee.");
$inputIsValid = FALSE;
}
} else {
if ($key == EMP_MAIN_VACATION_REQ_ID) {
if ($value != NULL) {
$record = RetrieveMainVacationRequestByID($value);
if ($record == NULL) {
$statusMessage .= "Main Vacation Request ID not found in database.</br>";
error_log("Invalid EMP_MAIN_VACATION_REQ_ID passed to UpdateEmployee.");
$inputIsValid = FALSE;
}
}
} else {
if ($key == EMP_COMPANY_ROLE) {
$countOfFields++;
$record = RetrieveCompanyRoleByID($value);
if ($record == NULL) {
$statusMessage .= "Company Role ID not found in database.</br>";
error_log("Invalid EMP_COMPANY_ROLE passed to UpdateEmployee.");
$inputIsValid = FALSE;
}
} else {
if ($key == EMP_ADMIN_PERM) {
$countOfFields++;
} else {
if ($key == EMP_MANAGER_PERM) {
$countOfFields++;
} else {
$statusMessage .= "Unrecognised field of {$key} encountered.</br>";
error_log("Invalid field passed to UpdateEmployee. {$key}=" . $key);
$inputIsValid = FALSE;
}
}
}
}
}
}
}
}
}
}
}
if (!$validID) {
$statusMessage .= "No valid ID supplied.</br>";
error_log("No valid ID supplied in call to UpdateEmployee.");
$inputIsValid = FALSE;
}
if ($countOfFields < 2) {
$statusMessage .= "Insufficent fields supplied.</br>";
error_log("Insufficent fields supplied in call to UpdateEmployee.");
//.........这里部分代码省略.........
示例12: getDataForNoticesReport
/**
* getDataForNoticesReport
*/
public function getDataForNoticesReport($date_from, $date_to)
{
// set to last 7 days if no dates given
if (!isValidDate($date_from)) {
$date_from = date("Y-m-d", time() - 3600 * 24 * 7);
}
if (!isValidDate($date_to)) {
$date_to = date("Y-m-d", time());
}
// add quotes and escape
$date_from = $this->db->quote($date_from);
$date_to = $this->db->quote($date_to);
$sql = "SELECT \n\t\t\t\tnotice.id AS id,\n\t\t\t\tnotice.created AS created,\n\t\t\t\tnotice.modified AS modified,\n\t\t\t\tnotice.other_data AS other_data,\n\t\t\t\tnotice.publish AS publish,\n\t\t\t\tstore.id AS store_id,\n\t\t\t\tstore.code AS store_code,\n\t\t\t\tstore.title AS store_title,\n\t\t\t\tstore.manager_name AS store_manager_name,\n\t\t\t\tstore.email AS store_email\n\t\t\tFROM common_node AS notice\n\t\t\tLEFT JOIN common_node AS parent ON parent.id = notice.parent\n\t\t\tLEFT JOIN ecommerce_store AS store ON store.id = parent.content::int\n\t\t\tWHERE notice.node_controller = 'notice' AND notice.created BETWEEN {$date_from} AND {$date_to}\n\t\t";
$records = $this->executeSql($sql);
$result = array();
foreach ($records as $record) {
$item = array();
$data = unserialize($record['other_data']);
$item['Web Store Id'] = $record['store_id'];
$item['Store Code'] = $record['store_code'];
$item['Store Title'] = $record['store_title'];
$item['Store Manager'] = $record['store_manager_name'];
$item['Store Email'] = $record['store_email'];
$item['Notice Id'] = $record['id'];
$item['Notice Created'] = $record['created'];
$item['Is Published'] = $record['publish'] ? 'yes' : 'no';
$item['Notice Text'] = $data['text'];
$item['Visible From'] = $data['visible_from'];
$item['Visible To'] = $data['visible_to'];
$item['Image'] = $data['image'] ? 'yes' : 'no';
$result[] = $item;
}
return $result;
}
示例13: getDetailViewOutputHtml
/** This function returns the detail view form ec_field and and its properties in array format.
* Param $uitype - UI type of the ec_field
* Param $fieldname - Form ec_field name
* Param $fieldlabel - Form ec_field label name
* Param $col_fields - array contains the ec_fieldname and values
* Param $generatedtype - Field generated type (default is 1)
* Param $tabid - ec_tab id to which the Field belongs to (default is "")
* Return type is an array
*/
function getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields, $generatedtype, $tabid = '')
{
global $log;
$log->debug("Entering getDetailViewOutputHtml() method ...");
global $adb;
global $mod_strings;
global $app_strings;
global $current_user;
//$fieldlabel = from_html($fieldlabel);
$custfld = '';
$value = '';
$arr_data = array();
$label_fld = array();
$data_fld = array();
if ($generatedtype == 2) {
$mod_strings[$fieldlabel] = $fieldlabel;
}
if (!isset($mod_strings[$fieldlabel])) {
$mod_strings[$fieldlabel] = $fieldlabel;
}
if ($col_fields[$fieldname] == '--None--') {
$col_fields[$fieldname] = '';
}
if ($uitype == 116) {
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = $col_fields[$fieldname];
} elseif ($uitype == 13) {
$label_fld[] = $mod_strings[$fieldlabel];
$temp_val = $col_fields[$fieldname];
$label_fld[] = $temp_val;
$linkvalue = getComposeMailUrl($temp_val);
$label_fld["link"] = $linkvalue;
} elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) {
$label_fld[] = $mod_strings[$fieldlabel];
$cur_date_val = $col_fields[$fieldname];
if (!isValidDate($cur_date_val)) {
$display_val = '';
} else {
$display_val = getDisplayDate($cur_date_val);
}
$label_fld[] = $display_val;
} elseif ($uitype == 15 || $uitype == 16 || $uitype == 115 || $uitype == 111) {
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = $col_fields[$fieldname];
} elseif ($uitype == 10) {
if (isset($app_strings[$fieldlabel])) {
$label_fld[] = $app_strings[$fieldlabel];
} elseif (isset($mod_strings[$fieldlabel])) {
$label_fld[] = $mod_strings[$fieldlabel];
} else {
$label_fld[] = $fieldlabel;
}
$value = $col_fields[$fieldname];
$module_entityname = "";
if ($value != '') {
$query = "SELECT ec_entityname.* FROM ec_crmentityrel inner join ec_entityname on ec_entityname.modulename=ec_crmentityrel.relmodule inner join ec_tab on ec_tab.name=ec_crmentityrel.module WHERE ec_tab.tabid='" . $tabid . "' and ec_entityname.entityidfield='" . $fieldname . "'";
$fldmod_result = $adb->query($query);
$rownum = $adb->num_rows($fldmod_result);
if ($rownum > 0) {
$rel_modulename = $adb->query_result($fldmod_result, 0, 'modulename');
$rel_tablename = $adb->query_result($fldmod_result, 0, 'tablename');
$rel_entityname = $adb->query_result($fldmod_result, 0, 'fieldname');
$rel_entityid = $adb->query_result($fldmod_result, 0, 'entityidfield');
$module_entityname = getEntityNameForTen($rel_tablename, $rel_entityname, $fieldname, $value);
}
}
$label_fld[] = $module_entityname;
$label_fld["secid"] = $value;
$label_fld["link"] = "index.php?module=" . $rel_modulename . "&action=DetailView&record=" . $value;
} elseif ($uitype == 33) {
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = str_ireplace(' |##| ', ', ', $col_fields[$fieldname]);
} elseif ($uitype == 17) {
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = $col_fields[$fieldname];
//$label_fld[] = '<a href="http://'.$col_fields[$fieldname].'" target="_blank">'.$col_fields[$fieldname].'</a>';
} elseif ($uitype == 19) {
//$tmp_value = str_replace("<","<",nl2br($col_fields[$fieldname]));
//$tmp_value = str_replace(">",">",$tmp_value);
//$col_fields[$fieldname]= make_clickable($tmp_value);
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = $col_fields[$fieldname];
} elseif ($uitype == 20 || $uitype == 21 || $uitype == 22 || $uitype == 24) {
//$col_fields[$fieldname]=nl2br($col_fields[$fieldname]);
$label_fld[] = $mod_strings[$fieldlabel];
$label_fld[] = $col_fields[$fieldname];
} elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) {
$account_id = $col_fields[$fieldname];
$account_name = "";
if ($account_id != '') {
$account_name = getAccountName($account_id);
//.........这里部分代码省略.........
示例14: UpdateDate
function UpdateDate($fields)
{
//--------------------------------------------------------------------------------
// Validate Input parameters
//--------------------------------------------------------------------------------
$inputIsValid = TRUE;
$validID = false;
$countOfFields = 0;
foreach ($fields as $key => $value) {
if ($key == DATE_TABLE_DATE_ID) {
$record = RetrieveDateByID($value);
if ($record != NULL) {
$validID = true;
$countOfFields++;
}
} else {
if ($key == DATE_TABLE_DATE) {
$countOfFields++;
if (!isValidDate($value)) {
error_log("Invalid DATE_TABLE_DATE passed to UpdateDate.");
$inputIsValid = FALSE;
}
} else {
if ($key == DATE_TABLE_PUBLIC_HOL_ID) {
$countOfFields++;
if ($value != NULL) {
$record = RetrievePublicHolidayByID($value);
if ($record == NULL) {
error_log("Invalid DATE_TABLE_PUBLIC_HOL_ID passed to UpdateDate.");
$inputIsValid = FALSE;
}
}
} else {
error_log("Invalid field passed to UpdateDate. {$key}=" . $key);
$inputIsValid = FALSE;
}
}
}
}
if (!$validID) {
error_log("No valid ID supplied in call to UpdateDate.");
$inputIsValid = FALSE;
}
if ($countOfFields < 2) {
error_log("Insufficent fields supplied in call to UpdateDate.");
$inputIsValid = FALSE;
}
//--------------------------------------------------------------------------------
// Only attempt to update a record in the database if the input parameters are ok.
//--------------------------------------------------------------------------------
$success = false;
if ($inputIsValid) {
$success = performSQLUpdate(DATE_TABLE, DATE_TABLE_DATE_ID, $fields);
}
return $success;
}
示例15: DateTime
$nowDate = new DateTime();
if ($validDate > $nowDate || date_format($nowDate, "Y-m-d") === $valid_to) {
return TRUE;
}
return FALSE;
}
$servername = "localhost";
$username = "clingy_viewer";
$password = "clingy_viewer_pass_!";
$db = "clingy_crush";
$conn = mysqli_connect($servername, $username, $password, $db);
!$conn && error("Connection failed: " . mysql_error());
//execute the SQL query and return records
$sql = "SELECT email, name, password, valid_to, active, last_login FROM Users WHERE email='" . $email . "'";
$result = mysqli_query($conn, $sql);
$isValid = FALSE;
$user = null;
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
if ($row["email"] === $email && $row["password"] === $pass) {
$user = $row;
if (isValidDate($row["valid_to"])) {
$isValid = TRUE;
}
}
// Free result set
mysqli_free_result($result);
$data = array('isPrime' => $isValid, 'user' => $user);
print json_encode($data);
//close the connection
mysql_close($conn);
////clingy_admin 89fVSlE$~9t}