public function register() { if (is_post()) { $this->loadHelper('Validator'); if (captcha()) { $data = ['email' => validate('email', 'email'), 'username' => validate('required', 'username'), 'password' => password_hash(validate('required', 'register_token'), PASSWORD_BCRYPT), 'token' => str_rand(40)]; if (validator($data)) { if ($this->user->checkExistUser($data['email'])) { $data2 = ['firstname' => validate('required', 'firstname'), 'lastname' => validate('required', 'lastname'), 'nickname' => validate('required', 'nickname'), 'major' => validate('required', 'major')]; if (validator($data2)) { $this->user->createUser($data, $data2); $validate = $this->user->validate($data['email'], $_POST['register_token']); if (!empty($validate)) { $_SESSION['auth'] = $validate; $_SESSION['user'] = $this->user->getDetail($validate['id']); cache_forgot('user.members.' . user('major')); cache_forgot('user.get.members.' . user('major')); } } } } } } return redirect(''); }
function login() { $post = $this->post; if (count($post)) { $phone = $post['phone']; $pass = $post['pass']; if (!validate('phone', $phone)) { $this->redirect(_HOST . "login"); } if (!validate('pass', $pass)) { $this->redirect(_HOST . "login"); } $result = $this->load('employee')->login($phone, secret($pass)); if ($result) { $per = $result['permissions']; if (!empty($per)) { $result['permissions'] = array_map("strtolower", unserialize($per)); } $this->session['user'] = $result; $this->redirect('index'); } else { $this->redirect("login"); } } else { return $this->view(V_PATH . "login.html", array("css" => CSS, 'host' => _HOST)); } }
function form_process() { global $forms; if (!isset($_REQUEST['form_id'])) { return; } $f = $forms[$_REQUEST['form_id']]; $valid = true; foreach ($f['params'] as $k => $v) { $t = explode(';', $v['type']); $value = $t[0] == 'file' ? $_FILES[$k] : $_REQUEST[$k]; $result = validate($value, $v['type'], $k); if ($result === true) { $GLOBALS[$k] = $value; } else { form_add_error($_REQUEST['form_id'], $result); $valid = false; } } if ($f['method'] == 'post') { form_validate(); } if ($valid && $f['action']) { $f['action'](); } }
function index() { $id = $this->u['id']; // update password $conf = array('password' => 'required|comparetopwd', 'repassword' => 'required'); $err = validate($conf); if ($err === TRUE) { if (!load('m/user_m')->checkpwd($id, $_POST['oldpassword'])) { redirect(BASE . 'account/', '原密码错误'); } $_POST['post_time'] = $_POST['update_time'] = time(); load('m/user_m')->update_user($id); redirect(BASE . 'account/', '修改成功'); } else { if (isset($_POST['email']) || isset($_POST['username'])) { $_POST['post_time'] = $_POST['update_time'] = time(); load('m/user_m')->update($id); redirect(BASE . 'account', '修改成功'); } else { $param['val'] = array_merge($_POST, load('m/user_m')->get($id)); $param['err'] = $err; $this->display('v/user/add', $param); } } // update password }
public function create($options = array()) { $valid = validate($options, $this->data_types, array('name')); // Make sure all the options are valid if ($valid === true) { // See if this record already exists $options['slug'] = generateSlug($options['name']); $tag = $this->read("tags.slug = '" . $options['slug'] . "'", 1, 1); // If not, add it if (!isset($tag->tag_id)) { $q = $this->db->insert_string($this->table, $options); $res = $this->db->query($q); // Check for errors $this->sendException(); // If good, return full label if ($res === true) { $tag_id = $this->db->insert_id(); return $this->read($tag_id); } // Else return error return false; } // If already exists, just return it return $tag; } return formatErrors($valid); }
function __construct($conn, $peer_id, $prjm_id = 0, $selName = 'prjm_id') { global $_SESSION; global $_REQUEST; $this->dbConn = $conn; $this->peer_id = $peer_id; $this->prjm_id = $prjm_id; $this->selectorName = $selName; if (isset($_SESSION[$this->selectorName])) { $this->prjm_id = $_SESSION[$this->selectorName]; } if (isset($_REQUEST[$this->selectorName])) { $newSelect = validate($_REQUEST[$this->selectorName], 'integer', $this->prjm_id); if ($this->prjm_id != $newSelect) { $this->selectionChanged = true; } $this->prjm_id = $newSelect; } if ($this->prjm_id === 0) { // only guess if undefined. $this->prjm_id = $this->guessPrjMid($this->peer_id); } if (hasCap(CAP_SELECT_ALL)) { $this->isAdmin = 'true'; } else { //$this->whereClause =" tutor_id={$peer_id} "; //$this->extraJoin = " tutor_my_project_milestones({$peer_id}) tmpm on(pm.prjm_id=tmpm.prjm_id) "; } }
public function handleLogin(Request $request, UserRepository $users) { $this->validate($request, ['identification' => 'required', 'password' => 'required|min:6|max:16']); $identification = $request->input('identification'); // guess type of identification $auth_type = validate($identification, 'email') ? "email" : "username"; event(new Events\UserTryToLogin($identification, $auth_type)); // Get user instance from repository. // If the given identification is not registered yet, // it will return a null value. $user = $users->get($identification, $auth_type); if (session('login_fails', 0) > 3) { if (strtolower($request->input('captcha')) != strtolower(session('phrase'))) { return json(trans('auth.validation.captcha'), 1); } } if (!$user) { return json(trans('auth.validation.user'), 2); } else { if ($user->checkPasswd($request->input('password'))) { Session::forget('login_fails'); Session::put('uid', $user->uid); Session::put('token', $user->getToken()); // time in minutes $time = $request->input('keep') == true ? 10080 : 60; event(new Events\UserLoggedIn($user)); return json(trans('auth.login.success'), 0, ['token' => $user->getToken()])->withCookie('uid', $user->uid, $time)->withCookie('token', $user->getToken(), $time); } else { Session::put('login_fails', session('login_fails', 0) + 1); return json(trans('auth.validation.password'), 1, ['login_fails' => session('login_fails')]); } } }
function testDobAgeMin() { $input['dob'] = '01/01/' . (date('Y') - 15); $valid = array('dob' => array('type' => 'dob', 'min' => 18)); validate($valid, $input, $errors); $this->assertTrue(!empty($errors['dob'])); }
function nav() { unset($_SESSION['index_class']); unset($_SESSION['editmix_class']); unset($_SESSION['validate_class']); unset($_SESSION['makemix_class']); unset($_SESSION['mwbedocs_class']); unset($_SESSION['upfiles_class']); if ($_SESSION['action'] == "index") { index(); } elseif ($_SESSION['action'] == "makemix") { makemix(); } elseif ($_SESSION['action'] == "upfiles") { upfiles(); } elseif ($_SESSION['action'] == "verify") { verify(); } elseif ($_SESSION['action'] == "validate") { validate(); } elseif ($_SESSION['action'] == "editmix") { editmix(); } elseif ($_SESSION['action'] == "mwbedocs") { mwbedocs(); } elseif ($_SESSION['action'] == "delmix") { delmix(); } else { index(); } }
private function validateAndSave($options, $overwriteCreatedOn) { $valid = validate($options, $this->data_types, array('title', 'url')); // Make sure all the options are valid if ($valid === true) { // Make sure url doesn't already exist $md5 = md5($options['url']); $mark = $this->read("url_key = '" . $md5 . "'", 1, 1); // If not found, add it if (!isset($mark->mark_id)) { if ($overwriteCreatedOn || empty($options['created_on'])) { $options['created_on'] = date('Y-m-d H:i:s'); } $options['url_key'] = $md5; $q = $this->db->insert_string('marks', $options); $res = $this->db->query($q); // Check for errors $this->sendException(); // Return mark_id if ($res === true) { $mark_id = $this->db->insert_id(); return $this->read($mark_id); } return false; } // If already exists, just return it return $mark; } return formatErrors($valid); }
function calculate($goal, $distance, $isKM, $showKM) { if (!validate($goal)) { echo "Invalid time format. Please enter MM:SS or HH:MM:SS."; return; } $goalInSec = convertToSeconds($goal); $numSplits = getNumSplits($distance, $isKM, $showKM); $averagePaceInSec = getAveragePaceInSeconds($goalInSec, $numSplits); echo "Distance: "; echo $numSplits . ($showKM ? "km" : " miles"); echo "<br/>"; echo "Goal: " . $goal; echo "<br/>"; echo "<br/>"; echo "Average pace: " . convertToHHMMSS($averagePaceInSec); echo "/" . ($showKM ? "km" : "mile"); echo "<br/>"; getSplits($averagePaceInSec, $numSplits); if (floor($numSplits) != $numSplits) { echo "Finish: " . $goal; } }
public function create($options = array()) { $smart_label = isset($options['domain']) ? true : false; // If a smart label, set the required fields if ($smart_label === true) { $required = array('smart_label_id', 'domain', 'smart_key'); } else { $required = array('name', 'slug'); } $valid = validate($options, $this->data_types, $required); // Make sure all the options are valid if ($valid === true) { // If not, add it $options['created_on'] = date('Y-m-d H:i:s'); $q = $this->db->insert_string($this->table, $options); $res = $this->db->query($q); // Check for errors $this->sendException(); // If good, return full label if ($res === true) { $cache_key = isset($options['user_id']) ? $this->cache_id . $options['user_id'] . '-*' : $this->cache_id . 'labels-*'; $this->removeCacheKey($cache_key); $label_id = $this->db->insert_id(); return self::readComplete($label_id); } // Else return error return false; } return formatErrors($valid); }
/** * Creates new token * @param array $options Token data * @return Ambigous <boolean, mixed, array> */ public function create($options = array()) { $required = array('token_type'); $valid = validate($options, $this->data_types, $required); // Make sure all the options are valid if ($valid === true) { // If you made it this far, we need to add the record to the DB $options['created_on'] = date("Y-m-d H:i:s"); $confExpireTime = $this->config->item('forgot_password_token_valid_seconds'); $options['valid_until'] = date("Y-m-d H:i:s", time() + (empty($confExpireTime) ? self::DEFAULT_TOKEN_VALID_TIME_SECONDS : $confExpireTime)); // Generate random token $this->load->library('uuid'); do { $options['token_value'] = $this->uuid->v4(true) . $this->uuid->v4(true); $total = $this->count("token_value = '" . $options['token_value'] . "'"); } while ($total > 0); // This should never happen according to UUID generation // Add record $q = $this->db->insert_string('tokens', $options); $res = $this->db->query($q); // Check for errors $this->sendException(); if ($res === true) { $token_id = $this->db->insert_id(); return $this->read($token_id); } else { return formatErrors('Eek this is akward, sorry. Something went wrong. Please try again.'); } } return formatErrors($valid); }
private function validateAndSave($options, $overwriteCreatedOn) { $valid = validate($options, $this->data_types, array('user_id', 'mark_id')); // Make sure all the options are valid if ($valid === true) { if ($overwriteCreatedOn || empty($options['created_on'])) { $options['created_on'] = date('Y-m-d H:i:s'); } $q = $this->db->insert_string('users_to_marks', $options); $res = $this->db->query($q); // Check for errors $this->sendException(); // If good, return full record if ($res === true) { // Remove cache for this user $this->removeCacheKey($this->cache_id . $options['user_id'] . '-*'); // Get info and return it $user_mark_id = $this->db->insert_id(); return $this->readComplete($user_mark_id); } // Else return error return false; } return formatErrors($valid); }
function get() { $phone = $this->post["phone"]; if (validate("phone", $phone)) { $result = $this->load("guest")->findPhone($phone); if ($result) { //send sms $sms = create_sms_code(6); $this->session["sms"] = $sms; $send_result = send_sms_code($phone, "验证码" . $sms); // ok == 1 if ($send_result == 1) { $this->session['sms'] = $sms; $this->session['phone'] = $phone; return json_encode(array('error_code' => 0)); } else { return json_encode(array('error_code' => 4)); } } else { return json_encode(array("error_code" => 2)); } } else { return json_encode(array("error_code" => 3)); } }
public function send() { $content = array(); $response = array("response" => "fail", "fields" => array()); $send = true; foreach ($_POST as $key => $value) { $v = validate($key, $value); $response["fields"][$key] = $v; $content[$key] = trim($value); if ($v == false) { $send = false; } } if ($send) { $to = "*****@*****.**"; $subject = "Mail enviado desde la pagina"; $body = <<<HTML {$content["name"]} te envio un mail, su numero de telefono es : {$content["tel"]}, <br > su email es : {$content["email"]} <br > <h3>Mensaje:</h3> <p>{$content["userMessage"]}</p> HTML; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; if (mail($to, $subject, $body, $headers)) { $response["response"] = "success"; } } }
/** * * * @return be_vse_data */ function execute() { $registeredEntry = new be_vse_data(); try { $access = "RW"; include './inc/incWebServiceAPIKeyValidation.php'; $entryToAdd = new be_vse_data(); $entryToAdd->app_id = filter_input(INPUT_GET, "app_id"); $entryToAdd->vse_label = filter_input(INPUT_GET, "label"); $entryToAdd->vse_value = filter_input(INPUT_GET, "value"); $entryToAdd->vse_type = filter_input(INPUT_GET, "type"); $entryToAdd->vse_annotations = filter_input(INPUT_GET, "annotations"); $entryToAdd->captured_datetime = filter_input(INPUT_GET, "captured_datetime"); if (!isset($entryToAdd->captured_datetime) || $entryToAdd->captured_datetime == '') { $dateX = new DateTime(); $entryToAdd->captured_datetime = $dateX->format("Y-m-d H:i:s.u"); } if (validate($entryToAdd)) { $registeredEntry = da_vse_data::AddEntry($entryToAdd); } else { die("Parámetros Inválidos"); } } catch (Exception $ex) { die("EXCEPTION " . $ex->getCode()); } return $registeredEntry; }
public function create($options = array()) { $valid = validate($options, $this->data_types, array('tag_id', 'user_id', 'users_to_mark_id')); // Make sure all the options are valid if ($valid === true) { // See if this record already exists $tag = $this->read("tag_id = '" . $options['tag_id'] . "' AND user_id = '" . $options['user_id'] . "' AND users_to_mark_id = '" . $options['users_to_mark_id'] . "'", 1, 1, 'tag_id'); // If not, add it if (!isset($tag->tag_id)) { $q = $this->db->insert_string($this->table, $options); $res = $this->db->query($q); // Check for errors $this->sendException(); if ($res === true) { $mark_to_tag_id = $this->db->insert_id(); return $this->read($mark_to_tag_id); } // Return true or false return false; } // If already exists, just return it return $tag; } return formatErrors($valid); }
/** * Bootstrap the application services. * * @return void */ public function boot() { Validator::extend('custom_array', function ($attribute, $value, $parameters, $validator) { if (!is_array($value)) { if (!is_array(explode(',', $value))) { return FALSE; } $values_array = explode(',', $value); } if (!isset($values_array)) { $values_array = $value; } $validation_rules = preg_split('*:*', $parameters[0]); foreach ($values_array as $input) { foreach ($validation_rules as $rule) { if (!validate($input, $rule)) { return FALSE; } } } return TRUE; }); Validator::replacer('custom_array', function ($message, $attribute, $rule, $parameters) { return "The field {$attribute} was not filled properly."; }); }
public function register() { if (isset($_GET['returnto']) && Strings::startsWith($_GET['returnto'], '/')) { $returnto = $_GET['returnto']; } else { $returnto = (string) new URL(); } $query = db()->table('attribute')->get('writable', array('public', 'groups', 'related', 'me')); $query->addRestriction('required', true); $attributes = $query->fetchAll(); try { if (!$this->request->isPost()) { throw new HTTPMethodException(); } /* * We need to validate the data the user sends. This is a delicate process * and therefore requires quite a lot of attention */ $validatorUsername = validate()->addRule(new MinLengthValidationRule(4, 'Username must be more than 3 characters')); $validatorUsername->addRule(new RegexValidationRule('/^[a-zA-z][a-zA-z0-9\\-\\_]+$/', 'Username must only contain characters, numbers, underscores and hyphens')); $validatorEmail = validate()->addRule(new FilterValidationRule(FILTER_VALIDATE_EMAIL, 'Invalid email found')); $validatorPassword = validate()->addRule(new MinLengthValidationRule(8, 'Password must have 8 or more characters')); validate($validatorEmail->setValue(_def($_POST['email'], '')), $validatorUsername->setValue(_def($_POST['username'], '')), $validatorPassword->setValue(_def($_POST['password'], ''))); if (db()->table('username')->get('name', $_POST['username'])->addRestriction('expires', null, 'IS')->fetch()) { throw new ValidationException('Username is taken', 0, array('Username is taken')); } if (db()->table('user')->get('email', $_POST['email'])->fetch()) { throw new ValidationException('Email is taken', 0, array('Email is already in use')); } /** * Once we validated the data, let's move onto the next step, store the * data. */ $user = db()->table('user')->newRecord(); $user->email = $_POST['email']; $user->password = $_POST['password']; $user->verified = false; $user->created = time(); $user->store(); $username = db()->table('username')->newRecord(); $username->user = $user; $username->name = $_POST['username']; $username->store(); foreach ($attributes as $attribute) { $userattribute = db()->table('user\\attribute')->newRecord(); $userattribute->user = $user; $userattribute->attr = $attribute; $userattribute->value = $_POST[$attribute->_id]; $userattribute->store(); } $s = Session::getInstance(); $s->lock($user->_id); return $this->response->getHeaders()->redirect($returnto); } catch (HTTPMethodException $e) { /*Do nothing, we'll show the form*/ } catch (ValidationException $e) { $this->view->set('messages', $e->getResult()); } $this->view->set('attributes', $attributes); }
/** * Reset users password */ public function resetPassword() { $this->data['success'] = false; $token = isset($this->db_clean->token) ? $this->db_clean->token : null; $password = isset($this->clean->password) ? $this->clean->password : null; $validationResult = validate(array('token' => $token, 'password' => $password), array('token' => 'string', 'password' => 'password'), array('token', 'password')); if ($validationResult === true) { // Checking token $this->load->model('tokens_model', 'token'); $tokenData = $this->token->read("token_value = '{$token}'"); if (!$this->token->isValid($tokenData)) { $this->data['errors'] = formatErrors(91); } else { $hashedPassword = generateHash($this->clean->password); $this->load->model('users_model', 'user'); $user = $this->user->update($tokenData->user_id, array('password' => $hashedPassword)); if (isset($user->password) && $user->password == $hashedPassword) { // Mark token as used if (!$this->token->useToken($token)) { log_message('DEBUG', 'Failed to mark token ' . $token . ' as used in DB'); } // Send email $this->load->library('email'); $this->email->initialize(); $this->data['success'] = $this->email->updatePassword($user->email); } else { $this->data['errors'] = formatErrors(500); } } } else { $this->data['errors'] = $validationResult; } $this->figureView(); }
function update() { $post = $this->post; $progress_id = (int) $post['progress_id']; $business_id = (int) $post['business_id']; $process_id = (int) $post['process_id']; $note = $post['note']; $date_end = $post['date_end']; if ($business_id == 0) { return '请指定客服'; } if ($progress_id == 0) { return "请指定记录"; } if ($process_id == 0) { return '请指定现在进度'; } if (strlen($note) < 3) { return '字符太短'; } if (!validate('date', $date_end)) { return '请指定日期'; } //是否当前登录员工负责 $result = $this->load('business')->findByEmployee($this->session['user']['employee_id'], $business_id); if (!$result) { return '只有负责员工才能操作'; } return $this->load('progress')->update(array('progress_id' => $progress_id, 'process_id' => $process_id, 'note' => $note, 'date_end' => $date_end)); }
function retrieve($var) { global $xoopsModuleConfig; if ($xoopsModuleConfig['site_user_auth'] == 1) { if ($ret = check_for_lock(basename(__FILE__), $username, $password)) { return $ret; } if (!checkright(basename(__FILE__), $username, $password)) { mark_for_lock(basename(__FILE__), $username, $password); return array('ErrNum' => 9, "ErrDesc" => 'No Permission for plug-in'); } } global $xoopsDB; if (strlen($var['tablename']) > 0) { $tbl_id = get_tableid($var['tablename']); } elseif ($var['id'] > 0) { $tbl_id = $var['id']; } else { return array('ErrNum' => 2, "ErrDesc" => 'Table Name or Table ID not specified'); } if (!validate($tbl_id, $var['data'], "allowretrieve")) { return array('ErrNum' => 4, "ErrDesc" => 'Not all fields are allowed retrieve'); } else { $sql = "SELECT "; foreach ($var['data'] as $data) { if ($data['field'] == '*') { return array('ErrNum' => 7, "ErrDesc" => 'Wildcard not accepted'); } $sql_b .= "`" . $data['field'] . "`,"; } if (strlen($var['clause']) > 0) { if (strpos(' ' . strtolower($var['clause']), 'union') > 0) { return array('ErrNum' => 8, "ErrDesc" => 'Union not accepted'); } $sql_c .= 'WHERE ' . $var['clause'] . ""; } global $xoopsModuleConfig; if ($xoopsModuleConfig['site_user_auth'] == 1) { if (!validateuser($var['username'], $var['password'])) { return false; } } //echo $sql." ".substr($sql_b,0,strlen($str_b)-1)." FROM ".$xoopsDB->prefix(get_tablename($tbl_id))." ".$sql_c; $rt = $xoopsDB->queryf($sql . " " . substr($sql_b, 0, strlen($str_b) - 1) . " FROM " . $xoopsDB->prefix(get_tablename($tbl_id)) . " " . $sql_c); if (!$xoopsDB->getRowsNum($rt)) { return array('ErrNum' => 3, "ErrDesc" => 'No Records Returned from Query'); } else { $rtn = array(); while ($row = $xoopsDB->fetchArray($rt)) { $rdata = array(); foreach ($var['data'] as $data) { $rdata[] = array("fieldname" => $data['field'], "value" => $row[$data['field']]); } $rtn[] = $rdata; } } return array("total_records" => $xoopsDB->getRowsNum($rt), "items" => $rtn); } }
function validateOptions($rules, $data) { $valid = false; foreach ($rules as $rule) { $valid |= validate($rule, $data); } return $valid; }
function validateUnderCondition($conditionalParameter, $condition, $string, $validIf = false) { if ($conditionalParameter == $condition) { return validate($string, $validIf); } else { return true; } }
public static function run() { $sessao = new TSessao(true); include 'util/Validacao.php'; $flashes = null; $usuario = $sessao->getVar('usuario'); include 'app.functions/validate.php'; $valida = validate($usuario); //include 'relatorios/teste.php'; if ($valida) { if ($usuario) { $menu = new TMenu($usuario->permissoes, array('gerenciar')); TApplication::setStyle('menu'); TApplication::setStyle('controler_bar'); } if (!$_GET) { if ($usuario == null) { require "app.comuns/app.control/login.php"; TApplication::setStyle('login'); $templatePage = "app.comuns/template/login.phtml"; } else { if ($sessao->getVar('msg1') != null) { if ($sessao->getVar('msg1') == 5) { Flash::addFlash('Você não tem permissão!'); $flashes = Flash::getFlashes(); $sessao->removeVar('msg1'); } } $templatePage = "app.comuns/template/panel.phtml"; } } else { $modulo = isset($_GET['modulo']) ? $_GET['modulo'] : null; $page = isset($_GET['page']) ? $_GET['page'] : null; if (file_exists("modulos/{$modulo}/app.control/{$page}.php")) { require "modulos/{$modulo}/app.control/{$page}.php"; } if (file_exists("modulos/{$modulo}/template/{$page}.phtml")) { $templatePage = "modulos/{$modulo}/template/{$page}.phtml"; } } if (isset($validacao)) { if ($validacao !== true) { $erros = $validacao; } } if (Flash::hasFlashes()) { $flashes = Flash::getFlashes(); } if (!isset($_GET['ajax'])) { TApplication::setStyle('style'); TApplication::setStyle('principal'); TApplication::setStyle('redmond/jquery-ui-1.8.16.custom'); require 'layout/index.phtml'; } } else { header('location: index.php'); } }
public function validate() { $a = true; if (!validate($this->demographic_id, 'index') || !validate($this->user_id, 'index') || !validate($this->ethnicity, 'name') || !validate($this->gender, 'name') || !validate($this->illness, 'text') || !validate($this->dob, 'date')) { $a = false; } $this->valid = $a; return $a; }
function write() { extract($_REQUEST); validate(); $sql = "INSERT INTO cubit.document_types (type_name) VALUES ('{$type_name}')"; $dt_rslt = db_exec($sql) or errDie("Unable to retrieve document types."); $OUTPUT = "<h3>{$title} Document Type</h3>\n\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t<tr>\n\t\t\t<th>Write</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Successfully Saved The Document Type</td>\n\t\t</tr>\n\t</table>"; return $OUTPUT; }
/** * Return true if the given path is valid. This check corelates to the safe_exec() * function in the function.save_exec.php. Paths can be put in strings which can * be executed on the commandline. So the constraints for the $exec_string are also * valid for the paths. * * @author Aaron Mueller <*****@*****.**> * @version 0.1 * @param string a pathname * @return boolean true if there is no special char in it */ function validatePath($localPath, $field = 'path') { $badChars = array(';', '|', '&', '>', '<', '`', '$', '~', '?'); $cleanedPath = validate($localPath, $field); foreach ($badChars as $badChar) { $cleanedPath = str_replace($badChar, '', $cleanedPath); } return $cleanedPath; }
public function validate() { $a = true; if (!validate($this->user_id, 'index') || !validate($this->address_id, 'index') || !validate($this->lvl, 'name') || !validate($this->login, 'email') || !validate($this->pass, 'password') || !validate($this->fn, 'name') || !validate($this->ln, 'name') || !validate($this->created, 'timestamp')) { $a = false; } $this->valid = $a; return $a; }