public static function addData($hd, $tenbang, $id, $ten_thanhphan, $input = null) { date_default_timezone_set("Asia/Bangkok"); $date = new DateTime(); if ($input == null) { $f = new Logfile(); $f->action = $hd; $f->bang = $tenbang; $f->id_ingredient = $id; $f->name_ingredient = $ten_thanhphan; $f->datetime = $date->format("Y-m-d H:i:s"); $f->save(); } else { $thongtincu = ""; $datas = $input[0]; foreach ($datas as $key => $value) { if ($key != "created_at" and $key != "updated_at") { $thongtincu .= "{$key}:{$value} \n"; } } $f = new Logfile(); $f->action = $hd; $f->bang = $tenbang; $f->id_ingredient = $id; $f->ten_thanhphan = $ten_thanhphan; $f->thongtin_cu = $thongtincu; $f->datetime = $date->format("Y-m-d H:i:s"); $f->save(); } }
static function close() { if (isset(self::$logfile)) { fclose(self::$logfile); self::$logfile = NULL; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // delete $inbox = Inbox::find($id); $inbox->delete(); Logfile::addData('Xóa', 'Tin nhắn', $inbox->id, $inbox->name); // redirect Session::flash('message', 'Tin Đã bị xóa!'); return Redirect::to('inboxs'); }
function __destruct() { if (file_exists($this->testrunningfile)) { unlink($this->testrunningfile); } if (file_exists($this->testrunningfile)) { Logfile::writeWhen("ERROR: Application file NOT Deleted: " . $this->testrunningfile); } else { Logfile::writeWhen("File deleted: " . $this->testrunningfile); } }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { var_dump(Input::get('content')); // validate // read more on validation at http://laravel.com/docs/validation $validator = Validator::make(Input::all(), Page::$rules); //var_dump(Input::all()); // process the login if ($validator->fails()) { return Redirect::to('pages/' . $id . '/edit')->withErrors($validator)->withInput(Input::except('password')); } else { $page = Page::find($id); $page->name = Input::get('name'); $page->content = Input::get('content'); $page->save(); Logfile::addData('Sửa', 'Page', $page->id, $page->name); // redirect Session::flash('message', 'Sủa Page thành công!'); return Redirect::to('pages'); } }
function __autoload($class_name) { $lowerclass = strtolower($class_name); $file = "classes"; $len = strlen($class_name); for ($i = 0; $i < $len; $i++) { $a = substr($lowerclass, $i, 1); $b = substr($class_name, $i, 1); if ($a == $b) { $file .= $a; } else { $file .= "/" . $a; } } $file .= ".php"; // echo $file."<br />"; if (file_exists($file)) { require_once $file; } else { Logfile::writeError("Unable to find class file: " . $file); } }
function GetLogfile() { return Logfile::Lookup($this->logfileid()); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // delete $post = Post::find($id); $post->delete(); Logfile::addData('Xóa', 'Tin tức', $post->id, $post->title); if (file_exists('uploads/' . $post->thumb)) { unlink('uploads/' . $post->thumb); } // redirect Session::flash('message', 'Tin Đã bị xóa!'); return Redirect::to('posts'); }
public function delete_all() { Logfile::whereNotNull('id')->delete(); Session::flash('message', 'Đã xóa tất cả logfile!'); return Redirect::to('logfiles'); }
function VerifyPageArguments($argspec, $required) { global $drewheader; if ($drewheader) { trigger_error("PAGEHEADER called before VerifyPageArguments " . "(called by RequiredPageArguments or OptionalPageArguments). " . "Won't be able to return proper HTTP status code on Error " . "in " . $_SERVER['SCRIPT_FILENAME'] . ",", E_USER_WARNING); } $result = array(); while ($argspec and count($argspec) > 1) { $name = array_shift($argspec); $type = array_shift($argspec); $yep = 0; unset($object); switch ($type) { case PAGEARG_EXPERIMENT: if (isset($_REQUEST[URL_EXPERIMENT])) { $idx = $_REQUEST[URL_EXPERIMENT]; $yep = 1; if (ValidateArgument(PAGEARG_EXPERIMENT, $idx)) { $object = Experiment::Lookup($idx); } } elseif (isset($_REQUEST[URL_EXPTIDX])) { $idx = $_REQUEST[URL_EXPTIDX]; $yep = 1; if (ValidateArgument(PAGEARG_EXPERIMENT, $idx)) { $object = Experiment::Lookup($idx); } } elseif (isset($_REQUEST[URL_PID]) && isset($_REQUEST[URL_EID])) { $pid = $_REQUEST[URL_PID]; $eid = $_REQUEST[URL_EID]; $yep = 1; if (ValidateArgument(PAGEARG_PID, $pid) && ValidateArgument(PAGEARG_EID, $eid)) { $object = Experiment::LookupByPidEid($pid, $eid); } } break; case PAGEARG_TEMPLATE: if (isset($_REQUEST[URL_GUID]) && isset($_REQUEST[URL_VERS])) { $guid = $_REQUEST[URL_GUID]; $vers = $_REQUEST[URL_VERS]; $yep = 1; if (ValidateArgument(PAGEARG_GUID, $guid) && ValidateArgument(PAGEARG_VERS, $vers)) { $object = Template::Lookup($guid, $vers); } } elseif (isset($_REQUEST[URL_TEMPLATE])) { $guidvers = $_REQUEST[URL_TEMPLATE]; $yep = 1; if (preg_match("/^([\\d]+)\\/([\\d]+)\$/", $guidvers, $matches)) { $guid = $matches[1]; $vers = $matches[2]; $object = Template::Lookup($guid, $vers); } else { PAGEARGERROR("Invalid argument for '{$type}': {$guidvers}"); } } break; case PAGEARG_INSTANCE: if (isset($_REQUEST[URL_INSTANCE])) { $idx = $_REQUEST[URL_INSTANCE]; $yep = 1; if (ValidateArgument(PAGEARG_INSTANCE, $idx)) { $object = TemplateInstance::LookupByExptidx($idx); } } break; case PAGEARG_METADATA: if (isset($_REQUEST[URL_METADATA])) { $guidvers = $_REQUEST[URL_METADATA]; $yep = 1; if (preg_match("/^([\\d]+)\\/([\\d]+)\$/", $guidvers, $matches)) { $guid = $matches[1]; $vers = $matches[2]; $object = TemplateMetadata::Lookup($guid, $vers); } else { PAGEARGERROR("Invalid argument for '{$type}': {$guidvers}"); } } break; case PAGEARG_PROJECT: if (isset($_REQUEST[URL_PROJECT])) { $idx = $_REQUEST[URL_PROJECT]; $yep = 1; if (ValidateArgument(PAGEARG_PROJECT, $idx)) { $object = Project::Lookup($idx); } } elseif (isset($_REQUEST[URL_PID])) { $pid = $_REQUEST[URL_PID]; $yep = 1; if (ValidateArgument(PAGEARG_PID, $pid)) { $object = Project::Lookup($pid); } } break; case PAGEARG_GROUP: if (isset($_REQUEST[URL_GROUP])) { $idx = $_REQUEST[URL_GROUP]; $yep = 1; if (ValidateArgument(PAGEARG_GROUP, $idx)) { $object = Group::Lookup($idx); } } elseif (isset($_REQUEST[URL_PID]) && isset($_REQUEST[URL_GID])) { $pid = $_REQUEST[URL_PID]; $gid = $_REQUEST[URL_GID]; $yep = 1; if (ValidateArgument(PAGEARG_PID, $pid) && ValidateArgument(PAGEARG_GID, $gid)) { $object = Group::LookupByPidGid($pid, $gid); } } break; case PAGEARG_NODE: if (isset($_REQUEST[URL_NODE])) { $idx = $_REQUEST[URL_NODE]; $yep = 1; if (ValidateArgument(PAGEARG_NODE, $idx)) { $object = Node::Lookup($idx); } } elseif (isset($_REQUEST[URL_NODEID])) { $nodeid = $_REQUEST[URL_NODEID]; $yep = 1; if (ValidateArgument(PAGEARG_NODEID, $nodeid)) { $object = Node::Lookup($nodeid); } } elseif (isset($_REQUEST[URL_NODEID_ALT])) { $nodeid = $_REQUEST[URL_NODEID_ALT]; $yep = 1; if (ValidateArgument(PAGEARG_NODEID, $nodeid)) { $object = Node::Lookup($nodeid); } } break; case PAGEARG_USER: if (isset($_REQUEST[URL_USER])) { $idx = $_REQUEST[URL_USER]; $yep = 1; if (ValidateArgument(PAGEARG_USER, $idx)) { $object = User::Lookup($idx); } } elseif (isset($_REQUEST[URL_UID])) { $uid = $_REQUEST[URL_UID]; $yep = 1; if (ValidateArgument(PAGEARG_UID, $uid)) { $object = User::Lookup($uid); } } break; case PAGEARG_IMAGE: if (isset($_REQUEST[URL_IMAGEID])) { $imageid = $_REQUEST[URL_IMAGEID]; $yep = 1; if (ValidateArgument(PAGEARG_IMAGE, $imageid)) { $object = Image::Lookup($imageid); } } elseif (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") { $imageid = $_REQUEST[$name]; $yep = 1; if (ValidateArgument(PAGEARG_IMAGE, $imageid)) { $object = Image::Lookup($imageid); } } break; case PAGEARG_OSINFO: if (isset($_REQUEST[URL_OSID])) { $osid = $_REQUEST[URL_OSID]; $yep = 1; if (ValidateArgument(PAGEARG_OSINFO, $osid)) { $object = OSinfo::Lookup($osid); } } break; case PAGEARG_BOOLEAN: if (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") { $object = $_REQUEST[$name]; $yep = 1; if (strcasecmp("{$object}", "yes") == 0 || strcasecmp("{$object}", "1") == 0 || strcasecmp("{$object}", "true") == 0 || strcasecmp("{$object}", "on") == 0) { $object = True; } elseif (strcasecmp("{$object}", "no") == 0 || strcasecmp("{$object}", "0") == 0 || strcasecmp("{$object}", "false") == 0 || strcasecmp("{$object}", "off") == 0) { $object = False; } } break; case PAGEARG_INTEGER: case PAGEARG_NUMERIC: case PAGEARG_ARRAY: if (isset($_REQUEST[$name]) && $_REQUEST[$name] != "") { $object = $_REQUEST[$name]; $yep = 1; if (!ValidateArgument($type, $object)) { unset($object); } } break; case PAGEARG_ANYTHING: if (isset($_REQUEST[$name])) { $object = $_REQUEST[$name]; $yep = 1; # Anything allowed, caller BETTER check it. } break; case PAGEARG_ALPHALIST: if (isset($_REQUEST[$name])) { $object = $_REQUEST[$name]; if (!preg_match("/^[\\d\\w\\-\\ \\,]+\$/", $object)) { unset($object); } else { $object = preg_split("/[\\,\\;]+\\s*/", $_REQUEST[$name]); } } break; case PAGEARG_STRING: default: if (isset($_REQUEST[$name])) { $object = $_REQUEST[$name]; $yep = 1; # Pages never get arguments with special chars. Check. if (preg_match("/[\\'\"]/", $object)) { $object = htmlspecialchars($object); PAGEARGERROR("Invalid characters in '{$name}': {$object}"); } } break; case PAGEARG_PASSWORD: default: if (isset($_REQUEST[$name])) { $object = $_REQUEST[$name]; $yep = 1; # Only printable chars. if (!preg_match("/^[ -~]+\$/", $object)) { PAGEARGERROR("Invalid characters in '{$name}'"); } } break; case PAGEARG_LOGFILE: if (isset($_REQUEST[URL_LOGFILE])) { $logid = $_REQUEST[URL_LOGFILE]; $yep = 1; if (ValidateArgument(PAGEARG_LOGFILE, $logid)) { $object = Logfile::Lookup($logid); } } break; } if (isset($object)) { $result[$name] = $object; $GLOBALS[$name] = $object; } elseif ($yep) { # # Value supplied but could not be mapped to object. # Lets make that clear in the error message. # USERERROR("Could not map page arguments to '{$name}'", 1); } elseif ($required) { PAGEARGERROR("Must provide '{$name}' page argument"); } else { unset($GLOBALS[$name]); } } return $result; }
function insertRecord($table, $names, $values) { $query = "Insert into " . $table; $query .= self::createNames($names); $query .= self::createValues($values); $result = $this->mysqli->query($query); if ($result === false) { Logfile::writeError($this->error()); return false; } return true; // we're done for this file }
private function getDirContents($dir, $class, $func) { $files = scandir($dir); foreach ($files as $key => $value) { $path = realpath($dir . DIRECTORY_SEPARATOR . $value); // do not process virtual directories where path!=basePath if ($this->startsWith($path, $this->basePath)) { if (!is_dir($path)) { $extension = self::getExtension($path); if ($this->shouldProcessFile($extension)) { if ($this->resetNo > 1000) { set_time_limit(60); $this->resetNo = 0; } $this->resetNo += 1; $this->no += 1; $subpath = substr($path, $this->basePathLen); $class->{$func}($this->basePath, $subpath); } } else { if (is_dir($path) && $value != "." && $value != "..") { if ($this->processFolder($path)) { $this->getDirContents($path, $class, $func); } else { Logfile::writeWhen("Folder excluded: " . $path); } } } } else { Logfile::write("Virtual path ignored: " . $path); } } }
public function postLienHe() { $validator = Validator::make(Input::all(), Inbox::$rules); var_dump(Input::all()); // process the login if ($validator->fails()) { return Redirect::to('users/lien-he')->withErrors($validator)->withInput(Input::except('password')); } else { $inbox = new Inbox(); $inbox->name = Input::get('name'); $inbox->phone = Input::get('phone'); $inbox->content = Input::get('content'); $inbox->save(); Logfile::addData('Gửi', 'Tin nhắn', $inbox->id, $inbox->name); // redirect Session::flash('message', 'Gửi Tin nhắn thành công!'); return Redirect::to('users/lien-he'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // delete if (count(Post::Where('category', '=', $id)->get()) > 0) { Session::flash('message', 'Không thể xóa vì có Tin tức thuộc Thể loại tin này!'); return Redirect::to('newtypes'); } else { $monk = Newtypes::find($id); $monk->delete(); Logfile::addData('Xóa', 'Loại tin', $monk->id, $monk->name); // redirect Session::flash('message', 'Thể loại da bị xóa!'); return Redirect::to('newtypes'); } }
function sendEmail($lastemailsent, $emailinterval, $alreadyRunning) { $emailreport = false; if ($this->db->getTotals() === 0) { $emailreport = $this->sendEmailAnyway($lastemailsent, $emailinterval); } else { $emailreport = true; } if (Logfile::getNoErrors() > 0) { $emailreport = true; } if ($alreadyRunning) { $emailreport = true; } return $emailreport; }
if ($scan->Connect()) { // check to see if last scan completed correctly if ($alreadyRunning === false) { $scan->scanFiles($path, $skipFolders, $processExtensions, $skipExtensions); } set_time_limit(30); $scan->emailResults($email, $emailinterval, $alreadyRunning); $scan->deleteOldTestedRecords(); $scan = NULL; } else { $text = "Error in running hashscan.php for this domain, consult logfile"; $mailed = mail($email, "WebMonitor: ERROR SCANNING " . $domain, $text); } unset($appStatus); Logfile::writeWhen("Closing Logfile"); Logfile::close(); function formatDateDiff($interval) { $doPlural = function ($nb, $str) { return $nb > 1 ? $str . 's' : $str; }; // adds plurals $format = array(); if ($interval->y !== 0) { $format[] = "%y " . $doPlural($interval->y, "year"); } if ($interval->m !== 0) { $format[] = "%m " . $doPlural($interval->m, "month"); } if ($interval->d !== 0) { $format[] = "%d " . $doPlural($interval->d, "day");
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // delete $temple = Temple::find($id); $temple->delete(); Logfile::addData('Xóa', 'Tự viện', $temple->id, $temple->name); if (file_exists('uploads/thumbs/' . $temple->image)) { unlink('uploads/thumbs/' . $temple->image); } // redirect Session::flash('message', 'Tin Đã bị xóa!'); return Redirect::to('temples'); }
<?php $reader = new Logfile('php'); // $reader = new Logfile('/Users/aziz/Sites/samples/logfile.log'); $logs = $reader->getLogs(20); ?> <ul class="logs"> <?php foreach ($logs as $log) { ?> <!-- TODO: Remove pre and code tags and add css styling --> <li><pre><code><?php echo $log; ?> </code></pre></li> <?php } ?> </ul>
function GetLogfile() { $this->Refresh(); if ($this->logfileid()) { return Logfile::Lookup($this->logfileid()); } return null; }
// } // //var_dump($time); // $input = '2015-07-23 05:08:18'; // $format = 'Y-m-d H:i:s'; // // $date = Carbon::createFromFormat('Y-m-d H:i:s', $input); // var_dump($date); //}); Route::filter("checkUser", function () { if (Session::get('role') != 2) { return Redirect::to("/"); } }); Route::group(array("prefix" => "admin", "before" => "checkUser"), function () { Route::get("/", function () { $log = Logfile::orderBy('id', 'desc')->paginate(25); return View::make('backend.home')->with('log', $log); }); }); Route::get('/', function () { $new = Post::all()->take(3); return View::make('frontend.home')->with('new', $new); }); Route::get('data', function () { return View::make('frontend.ajax'); }); Route::get('ckfinder', function () { return View::make('ckfinder'); }); Route::group(array("prefix" => "check"), function () { Route::post("check-username", function () {
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // delete // $aa = Monk::Where('position','=',3)->get(); // var_dump(count($aa)); // var_dump(count(Monk::Where('position','=',$id)->get())); if (count(Monk::Where('position', '=', $id)->get()) > 0) { Session::flash('message', 'Không thể xóa vì có Tăng Ni thuộc Position này!'); return Redirect::to('positions'); } else { $monk = Position::find($id); $monk->delete(); Logfile::addData('Xóa', 'Ngiệp sư', $monk->id, $monk->name); Session::flash('message', 'positions da bị xóa!'); return Redirect::to('positions'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // delete $monk = Monk::find($id); $monk->delete(); Logfile::addData('Xóa', 'Tăng Ni', $monk->id, $monk->phap_danh); if (file_exists('uploads/' . $monk->image)) { unlink('uploads/' . $monk->image); } // redirect Session::flash('message', ' Đã bị xóa!'); return Redirect::to('monks'); }
public function active($type, $id) { if ($type == 'true') { Member::Where('status', '=', 1)->update(array('status' => 2)); return Redirect::to('members'); } if ($type == 'false') { foreach (User::Where('status', '=', 1)->get() as $val) { User::find($val->id)->roles()->detach(1); } User::Where('status', '=', 1)->delete(); return Redirect::to('members'); } if ($type == 'one') { $member = Member::find($id); $member->status = 2; $member->save(); Logfile::addData('Kích hoạt', 'thành viên', $member->id, $member->name); return Redirect::to('members'); } }
function writefilepost($userkey) { $data = "\tFileUpload WebService" . "\tUserkey:" . $userkey; Logfile::writelog($data); }
$MY_PATH = dirname(__FILE__); if (file_exists("parser.stop")) { die; } require_once "class/mySQL_class.php"; require_once "conf.php"; require_once "include/functions_inc.php"; require_once "class/Entity_abstract.php"; $logto = "std"; if (!$_REQUEST['file']) { $_REQUEST['file'] = $argv[1]; $logto = $argv[2]; } if ($CONF['logging'] == true) { require_once "class/Logfile_class.php"; $log = new Logfile($CONF['logfile'], $logto); } $log->logf("File: '" . $_REQUEST['file'] . "'"); #$log->logf("Starting up... ",false); if (!$_REQUEST['file']) { $log->logf("ERROR: no file given! EXITING!"); $log->close(); die; } //create database connection $DBc = new mySQL($CONF['mysql_error']); $DBc->connect($CONF['mysql_server'], $CONF['mysql_user'], $CONF['mysql_pass'], $CONF['mysql_database']); require_once "class/DataDispatcher_class.php"; require_once "class/DataSourceHandler_class.php"; require_once "class/SourceDriver_abstract.php"; require_once "class/Callback_class.php";
function getLastRunDate() { $tested = ""; $ok = parent::runQuery("SELECT tested FROM tested ORDER BY tested DESC LIMIT 1"); if ($ok) { $result = parent::getResult(); $row = $result->fetch_row(); $tested = $row[0]; } else { Logfile::writeError('Unable to retrieve last test date(' . parent::error()); } Logfile::writeWhen("Last scan date " . $tested); return $tested; }