public function addcompany() { $errors = Error::get("error"); if (!count($errors) || $errors == "") { $db = new Db(); if (Session::read("userid")) { $user_id = Session::read("userid"); //print_r($user_id); exit(); // $user_id=$db->quote($this->user_id); $name = $db->quote($this->name); $email = $db->quote($this->email); $website = $db->quote($this->website); $phone = $db->quote($this->phone); $city = $db->quote($this->city); $location = $db->quote($this->location); $specialization = $db->quote($this->specialization); $description = $db->quote($this->description); $query = "INSERT INTO " . $this->tableName() . " (user_id,name,city,location,website,email,phone,specialization,description,active) \n VALUES({$user_id},{$name},{$city},{$location},{$website},{$email},{$phone},{$specialization},{$description},1)"; if ($db->query($query)) { //print_r($query); exit(); if ($db->affectedRows()) { return true; } } } } return false; }
public function success() { if (empty($this->error) && !Error::get(str_ireplace(STATIC_ACCESS, '', __CLASS__))) { if (!empty($this->success)) { return $this->success; } else { return lang('Success', 'success'); } } else { return false; } }
public function delete(SS_HTTPRequest $request) { $hash = $_REQUEST['hash']; $error = Error::get()->filter('Hash', $hash)->first(); if ($error) { $error->delete(); } foreach (ErrorOccurance::get()->filter('Hash', $hash) as $errorOccurance) { /* @var $errorOccurance ErrorOccurance */ $errorOccurance->delete(); } return $this->redirect('dev/logs'); }
protected function _write($event) { // parse event $file = $event['message']['errfile']; $line = $event['message']['errline']; $message = $event['message']['errstr']; $data = print_r($event, true); $stack = ''; foreach ($event['message']['errcontext'] as $stackPart) { if (isset($stackPart['file']) && isset($stackPart['line'])) { $stack .= $stackPart['file'] . '#' . $stackPart['line'] . PHP_EOL; } } // error unique-ness $hash = Error::generateHash($file, $line); // get/create error $error = Error::get()->filter('Hash', $hash)->limit(1); if ($error->exists()) { $error = $error->first(); $error->write(); } else { $error = new Error(); $error->Hash = $hash; $error->write(); } // create occurance $errorOccurance = new ErrorOccurance(); $errorOccurance->Hash = $hash; $errorOccurance->Message = $message; $errorOccurance->Stack = $stack; $errorOccurance->File = $file; $errorOccurance->Line = $line; $errorOccurance->IP = $_SERVER['REMOTE_ADDR']; $errorOccurance->RequestMethod = $_SERVER['REQUEST_METHOD']; $errorOccurance->RequestURI = $_SERVER['REQUEST_URI']; $errorOccurance->Data = $data; $errorOccurance->write(); }
Given: pagetitle, pageurl, course: title, code, descr courses, searchresults, actions */ ?> <html> <head> <title><?php echo $args['pagetitle']; ?></title> </head> <body> <?php if($errors=Error::get()) { ?> <div style="border: 1px solid #F00; background-color: #fff5f5;"> <ul> <?php foreach($errors as $error) { ?> <li><?php echo Error::format_error($error); ?></li> <?php } ?> </ul> </div> <?php } ?> <center><img src="<?php echo $HTMLROOT; ?>/images/logo.png" /></center> <?php $args['actions']['search']->FORM_BEGIN(); ?> Enter the course code: <input type="text" id="terms" name="terms" value="<?php echo $args['course']['code']; ?>" /><br/> Tags (comma-delimited): <textarea cols=30 rows=3 id="tags" name="tags" /><?php echo $args['course']['tags']; ?></textarea><br/> <input type="submit" value="Find resources" /> <?php $args['actions']['search']->FORM_END(); ?>
function editProfile($user_id) { $errors = Error::get("error"); if (!count($errors) || $errors == "") { $db = new Db(); if (Session::read("userid")) { $user_id = Session::read("userid"); //$user_id= $db->quote($this->user_id); $name = $db->quote($this->name); $website = $db->quote($this->website); //$mobile = $db->quote($this->mobile); $add = $db->quote($this->add); $city = $db->quote($this->city); $location = $db->quote($this->location); $education = $db->quote($this->education); $experience = $db->quote($this->experince); $specialization = $db->quote($this->specialization); $pra_court = $db->quote($this->practicing_court); $query = "update user set Name={$name}, Website={$website}, Address={$add},\n City={$city}, Location={$location}, Education={$education}, Experiance={$experience}, Specialization={$specialization},\n PracticingCourt={$pra_court} where UserId={$user_id}"; if ($db->query($query)) { if ($db->affectedRows()) { return true; } } } } }