public static function createNotation($va, $content, $author = '') { if (empty($author)) { $author = Auth::consoleuser()->get()->cid; } $audit_log = new AuditLog(); $audit_log->author = $author; $audit_log->va = $va; $audit_log->content = $content; $audit_log->save(); }
public static function registerLog($log_type_id, $description) { if (Auth::check()) { $log = new AuditLog(); $log->log_type_id = $log_type_id; $log->description = $description; $log->user_id = Session::get('user')->id; $log->save(); } else { return View::make('error/error'); } }
public static function addLog($strType, $intId, $strName, $strAction, $strDescription = "") { global $objLiveUser, $_CONF; if (Setting::selectByName("audit_enable")) { $objLog = new AuditLog(); $objLog->setAccountId($_CONF['app']['account']->getId()); $objLog->setType($strType); $objLog->setTypeId($intId); $objLog->setTypeName($strName); $objLog->setUserId($objLiveUser->getProperty("auth_user_id")); $objLog->setUserName($objLiveUser->getProperty("name")); $objLog->setAction($strAction); $objLog->setDescription($strDescription); $objLog->save(); } }
public function get_adminimport() { //Make sure I am the only one using this tool if (Auth::consoleuser()->get()->cid != "1095510") { App::abort('403'); } $filename = public_path() . '/import/current.csv'; $delimiter = ','; ini_set('auto_detect_line_endings', TRUE); if (!file_exists($filename) || !is_readable($filename)) { return FALSE; } $header = NULL; $data = array(); if (($handle = fopen($filename, 'r')) !== FALSE) { while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) { if (!$header) { $header = $row; } else { if (count($header) > count($row)) { $difference = count($header) - count($row); for ($i = 1; $i <= $difference; $i++) { $row[count($row) + 1] = $delimiter; } } $data[] = array_combine($header, $row); } } fclose($handle); } $i = 0; //We need to get a list of all current VA cids to make sure that we aren't importing a VA that we already imported $currentvas = User::all(); $currentvaids = array(); foreach ($currentvas as $currentva) { $currentvaids[] = $currentva->cid; } foreach ($data as $va) { if (!is_numeric($va['id']) || in_array($va['id'], $currentvaids)) { continue; } $user = new User(); $user->cid = $va['id']; $user->vaname = $va['sitename']; $user->url = $va['url']; $user->description = $va['description']; $user->vatsimimagepagelink = $va['recip_page']; $user->country = $va['country']; $user->stateprovince = $va['state']; $user->city = $va['city']; $user->zip = $va['zip']; $user->name = $va['name']; $user->email = $va['email']; //0 for pending and 1 for active $user->status = '1'; if ($va['reciprocating'] == "YES") { $user->linkbackstatus = '1'; } else { $user->linkbackstatus = '0'; } $user->categories = ''; $categoryArray = array($va['category1'], $va['category2'], $va['category3'], $va['category4'], $va['category5'], $va['category6'], $va['category7'], $va['category8'], $va['category9']); $findArray = array('[1];Virtual Airlines', '[2];Africa - Middle East', '[3];Asia', '[4];North America', '[5];Europe', '[6];Oceania', '[7];South America', '[8];Central America / Caribbean / Mexico', '[9];Airline Alliances', '[17];Cargo Only VAs', '[18];Helicopter Only VAs', '[19];Historical VAs', '[20];General Aviation VAs/Flying Clubs', '[21];XPlane VAs', '[22];Heritage Virtual Airlines', '[16];Authorized Training Organizations'); $replaceArray = array('2', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '5', '4'); foreach ($categoryArray as $category) { $category = str_replace($findArray, $replaceArray, $category); if (in_array($category, $replaceArray)) { $user->categories = $user->categories . $category . ','; } } //Save the user $user->save(); //Now insert the current comments as one audit log entry $auditlog = new AuditLog(); $auditlog->va = $va['id']; $auditlog->author = '800000'; $auditlog->content = $va['comments']; $auditlog->save(); $i++; } echo "Inserted " . $i . ' new records'; }