function add_note($conn, $type) { $validate = array('asset_id' => array('validation' => 'OSS_HEX', 'e_message' => 'illegal:' . _('Asset ID')), 'txt' => array('validation' => 'OSS_TEXT, OSS_PUNC_EXT', 'e_message' => 'illegal:' . _('Note text'))); $validation_errors = validate_form_fields('POST', $validate); if (is_array($validation_errors) && !empty($validation_errors)) { Av_exception::throw_error(Av_exception::USER_ERROR, _('Error! Note could not be added')); } $asset_id = POST('asset_id'); $txt = POST('txt'); // Check Asset Type $asset_types = array('asset' => 'asset_host', 'network' => 'asset_net', 'group' => 'asset_group', 'net_group' => 'net_group'); // Note type $type_tr = array('group' => 'host_group', 'network' => 'net', 'asset' => 'host', 'net_group' => 'net_group'); $class_name = $asset_types[$type]; $asset_type = $type_tr[$type]; // Check Asset Permission if (method_exists($class_name, 'is_allowed') && !$class_name::is_allowed($conn, $asset_id)) { $error = sprintf(_('Error! %s is not allowed'), ucwords($type)); Av_exception::throw_error(Av_exception::USER_ERROR, $error); } $note_id = Notes::insert($conn, $asset_type, gmdate('Y-m-d H:i:s'), $asset_id, $txt); if (intval($note_id) > 0) { $tz = Util::get_timezone(); $data['msg'] = _('Note added successfully'); $data['id'] = $note_id; $data['note'] = $txt; $data['date'] = gmdate('Y-m-d H:i:s', Util::get_utc_unixtime(gmdate('Y-m-d H:i:s')) + 3600 * $tz); $data['user'] = Session::get_session_user(); $data['editable'] = 1; } else { Av_exception::throw_error(Av_exception::USER_ERROR, _('Error! Note could not be added')); } return $data; }
public function store() { if (!Input::has('email', 'password', 'confirmPassword')) { $this->failure("Must fill in the values"); } if (Input::get('password') != Input::get('confirmPassword')) { $this->failure("PASSWORDS NOT THE SAME"); } $rules = array('email' => 'unique:users,email'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { $this->failure('That email address is already registered. You sure you don\'t have an account?'); } if (!filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) { $this->failure("username must be an email"); } $verificationCode = md5(time()); User::insert(array('email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'verification' => $verificationCode)); Image::insert(array('email' => Input::get('email'), 'image' => '')); Notes::insert(array('email' => Input::get('email'), 'notes' => '')); TBD::insert(array('email' => Input::get('email'), 'tbd' => '')); Links::insert(array('email' => Input::get('email'), 'links' => '')); Mail::send('emails.emailMessage', array('code' => $verificationCode, 'email' => Input::get('email')), function ($message) { $message->to('*****@*****.**', 'Jan Ycasas')->subject('Welcome!'); }); echo "Go Log In"; return Redirect::to('/'); }
if (ossim_error()) { die(ossim_error()); } if (Notes::update($conn, $id_note, gmdate('Y-m-d H:i:s'), $txt)) { echo json_encode(array('state' => 'OK')); } else { echo json_encode(array('state' => 'ERR')); } exit; } elseif (POST('action') == 'new_ajax') { $txt = POST('txt'); ossim_valid($txt, OSS_TEXT, OSS_PUNC_EXT, 'illegal:' . _('Note text')); if (ossim_error()) { die(ossim_error()); } if (Notes::insert($conn, $type, gmdate('Y-m-d H:i:s'), Session::get_session_user(), $id, $txt)) { echo json_encode(array('state' => 'OK')); } else { echo json_encode(array('state' => 'ERR')); } exit; } $notes = Notes::get_list($conn, " AND type='{$type}' AND asset_id = UNHEX('{$id}') ORDER BY date DESC"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> <?php echo _("OSSIM Framework"); ?> </title>
public function addNote($id, $note) { $data['parent_name'] = $this->_name; $data['parent_id'] = $id; $data['note'] = $note; $Table = new Notes(); $Table->insert($data); }
public function processRegister() { if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) { return View::make('register')->with('error', "EMAIL NOT VALID"); } $result = User::select('email')->where('email', $_POST["email"])->get(); $result = $result->toArray(); if ($result != null) { exit("Account already exists for " . $_POST["email"] . ". Did you " . "<a href='forgotPass'>forget your password?</a> Please try again to " . "<a href='register'>register</a> or <a href='home'>log in</a>"); } if ($_POST["pass"] == "") { exit("MUST HAVE PASSWORD. " . "<a href='register'>Register</a>"); } if ($_POST["confirmPass"] == "") { exit("MUST HAVE CONFIRM PASS. " . "<a href='register'>Register</a>"); } if ($_POST["pass"] != $_POST["confirmPass"]) { exit("Password Not The Same. " . "<a href='register'>Register</a>"); } // email with link $verificationCode = $this->generateRandomString(10); User::insert(array('email' => $_POST["email"], 'password' => md5($_POST["pass"]), 'verification' => $verificationCode)); $result = User::select('userID')->where('email', $_POST["email"])->first()->toArray(); $userID = $result["userID"]; Image::insert(array('userID' => $userID, 'image' => '')); Notes::insert(array('userID' => $userID, 'notes' => '')); TBD::insert(array('userID' => $userID, 'tbd' => '')); Website::insert(array('userID' => $userID, 'website' => '')); Mail::send('emails.emailMessage', array('code' => $verificationCode, 'email' => $_POST["email"]), function ($message) { $message->to($_POST["email"], 'User')->subject('Welcome!'); }); return View::make('registerComplete'); }