예제 #1
0
 public function update_soa_record()
 {
     $today = date('Ymd');
     $r = Record::find('first', array('conditions' => "domain_id=" . Domain::quote($this->id) . " AND type='SOA'"));
     $soa = explode(" ", $r->content);
     if (strncmp($today, $soa[2], 8) === 0) {
         /*
          * Current serial starts with date of today, so we need to update
          * the revision only. To do so, determine current revision first,
          * then update counter.
          */
         $revision = (int) substr($soa[2], -2);
         ++$revision;
     } else {
         /*
          * Current serial did not start of today, so it's either an older
          * serial or a serial that does not adhere the recommended syntax
          * of RFC-1912. In either way, set a fresh serial
          */
         $revision = "00";
     }
     /*
      * Add additional 0 if $revision is 1 .. 9 so we get a nice number like 01, etc..
      */
     $newserial = $today . str_pad($revision, 2, "0", STR_PAD_LEFT);
     $soa[2] = $newserial;
     /*
      * Reconstruct SOA record's content string
      */
     foreach ($soa as $value) {
         $content .= $value . " ";
     }
     $r->content = $content;
     $r->save();
 }
예제 #2
0
 public static function updateRecord($input, $id)
 {
     $answer = [];
     $rules = ['municipality_id' => 'required|integer', 'number_starting' => 'required', 'folio' => 'required', 'file' => 'required', 'date' => 'required', 'interested_m' => 'required', 'interested_f' => 'required', 'starting' => 'required'];
     $validation = Validator::make($input, $rules);
     if ($validation->fails()) {
         $answer['message'] = $validation;
         $answer['error'] = true;
     } else {
         $record = Record::find($id);
         $record->municipality_id = $input['municipality_id'];
         $record->number_starting = $input['number_starting'];
         $record->folio = $input['folio'];
         $record->file = $input['file'];
         $record->date = $input['date'];
         $record->interested_m = $input['interested_m'];
         $record->interested_f = $input['interested_f'];
         $record->starting = $input['starting'];
         $record->description = $input['description'];
         if ($record->save()) {
             $answer['message'] = 'Editado con exito!';
             $answer['error'] = false;
         } else {
             $answer['message'] = 'RECORD UPDATE error, team noob!';
             $answer['error'] = false;
         }
     }
     return $answer;
 }
예제 #3
0
 public function is_unique()
 {
     $result = array('is_ok' => true, 'message' => 'Record is unique!');
     if (Record::find('first', array('conditions' => 'name = ' . Record::quote($this->name) . ' AND type = ' . Record::quote($this->type) . ' AND content = ' . Record::quote($this->content)))) {
         $result['is_ok'] = false;
         $result['message'] = "Record already exists!";
         return $result;
     }
     /*
      * Consistany check for SOA records, only allowed once at a domain
      */
     if ($this->type === SOA) {
         if (Record::find('first', array('conditions' => 'domain_id = ' . Record::quote($this->domain_id) . ' AND type = ' . Record::quote($this->type)))) {
             $result['is_ok'] = false;
             $result['message'] = "Soa record only allowed once at a domain!";
             return $result;
         }
     }
     return $result;
 }
예제 #4
0
 public function index()
 {
     if (fAuthorization::checkLoggedIn()) {
         $this->cache_control('private', 2);
     } else {
         $this->cache_control('private', 5);
     }
     $top = fRequest::get('top', 'integer');
     $this->owner = trim(fRequest::get('owner'));
     $this->problem_id = trim(fRequest::get('problem'));
     $this->language = trim(fRequest::get('language'));
     $this->verdict = trim(fRequest::get('verdict'));
     $this->page = fRequest::get('page', 'integer', 1);
     $this->records = Record::find($top, $this->owner, $this->problem_id, $this->language, $this->verdict, $this->page);
     $this->page_records = $this->records;
     $common_url = SITE_BASE . "/status?owner={$this->owner}&problem={$this->problem_id}&language={$this->language}&verdict={$this->verdict}";
     $this->top_url = "{$common_url}&top=";
     $this->page_url = "{$common_url}&page=";
     $this->nav_class = 'status';
     $this->render('record/index');
 }
예제 #5
0
    $start = $_GET["start"];
}
print $display->header();
if (!preg_match('/^\\d+$/', $_GET['id'])) {
    print $display->error("You hacker!");
    print $display->footer();
    exit(1);
}
try {
    $d = Domain::find($_GET['id']);
    $result = ActiveRecord::query("SELECT COUNT(*) AS count FROM records WHERE domain_id={$d->id}");
    $rCount = (int) $result[0]['count'];
    if ($rCount > $rowamount) {
        $findResult = Record::find('all', array('limit' => "{$rowamount}", 'offset' => "{$offset}", 'conditions' => 'domain_id = ' . Record::quote($d->id), 'order' => 'name'));
    } else {
        $findResult = Record::find('all', array('conditions' => 'domain_id = ' . Record::quote($d->id), 'order' => 'name'));
    }
} catch (Exception $e) {
    print $e->getMessage();
    print $display->footer();
    exit(0);
}
?>

<script language="JavaScript" src="http://www.mattkruse.com/javascript/datadumper/datadumper.js"></script>

<script type="text/javascript">

	function queue_record_edit_all() { 
		$$('form').each(function(form) {
				if(form.disabled == undefined) { 
예제 #6
0
 static function find($params = null, $class = __CLASS__)
 {
     return parent::find($params, $class);
 }
예제 #7
0
<?php

if (PHP_SAPI !== 'cli') {
    die("Testscript may only run in CLI-mode");
}
set_include_path(get_include_path() . PATH_SEPARATOR . '..');
require_once 'Record.php';
require_once 'Domain.php';
$test_domain = mt_rand() . '.example.com';
$test_name = 'record' . mt_rand();
$test_content = '127.0.0.1';
$d = new Domain(array('name' => $test_domain, 'master' => null, 'last_check' => null, 'type' => 'NATIVE', 'notified_serial' => null, 'account' => null));
$d->save();
$d->type = 'MASTER';
$d->save();
$r = new Record(array('name' => $test_name, 'type' => 'A', 'content' => $test_content, 'ttl' => '3600', 'prio' => '0', 'change_date' => date("U")));
$d->records_push($r);
foreach (Record::find('all', array('conditions' => 'name LIKE ' . ActiveRecord::quote($test_name . '%') . ' AND ' . 'content = ' . ActiveRecord::quote($test_content))) as $f) {
    $f->update_attributes(array('name' => $f->name . '1'));
    $f->destroy();
}
$d->destroy();
예제 #8
0
 public static function findByPageId($id, $class = __CLASS__)
 {
     $params['where'] = sprintf('page_id=%d', $id);
     return parent::find($params, $class);
 }
예제 #9
0
<input type="text" name="query" value="<?php 
echo isset($_GET['query']) ? $_GET['query'] : '';
?>
">
<input type="submit" name="submit" value="Search">
</form>

<?php 
if ($_GET["query"]) {
    $dFindResult = Domain::get_all(array('conditions' => 'd.name LIKE ' . Domain::quote($_GET['query'])));
    if (is_array($dFindResult) && count($dFindResult) > 0) {
        print '<h2>Domains (' . count($dFindResult) . ')</h2>';
        print $display->domains_header();
        foreach ($dFindResult as $domain) {
            print $display->domain($domain);
        }
        print $display->domains_footer();
        print '<br>';
    }
    flush();
    $rFindResult = Record::find('all', array('conditions' => 'name LIKE ' . Record::quote($_GET['query']) . ' OR ' . 'content LIKE ' . Record::quote($_GET['query']), 'order' => 'name'));
    if (is_array($rFindResult) && count($rFindResult) > 0) {
        print '<h2>Records (' . count($rFindResult) . ')</h2>';
        print $display->records_header();
        foreach ($rFindResult as $record) {
            print $display->record($record);
        }
        print $display->records_footer();
    }
}
print $display->footer();
예제 #10
0
    $json = [];
    $records = App\Record::where(function ($subquery) use($query) {
        $subquery->where('mrn', 'LIKE', '%' . $query . '%')->orWhere('name', 'LIKE', '%' . $query . '%')->orWhere('btn', 'LIKE', '%' . $query . '%');
    })->get();
    if (count($records) > 0) {
        foreach ($records as $record) {
            $json['items'][] = array('title' => 'Patient\'s Name: ' . $record->name, 'description' => 'MRN: ' . $record->mrn . '<br>' . 'Phone Number: ' . $record->btn, 'html_url' => route('record.show', $record->id));
        }
        return $json;
    } else {
        $json['items'][] = array('title' => "\"{$query}\" doesn't exist", 'description' => 'Record doesn\'t exist in our database.', 'html_url' => '#');
        return $json;
    }
});
get('record/show/{record_id}', ['as' => 'show_record', function ($record) {
    $record = Record::find($record);
    return view('medical_record_number.show', compact('record'));
}]);
// Ajax for updating status
get('user/update_status/{record}/{status}', function ($record, $status) {
    $user = App\User::find($record->user_id);
    $user->addStatus($status, $record->id);
    return;
});
get('user/update_status_break/{user}/{status}', function ($user, $status) {
    $user->addStatus($status);
    return;
});
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
Route::bind('records_2nd_list', function ($id) {
    return App\Record2ndList::whereId($id)->first();
예제 #11
0
 function archivesByDay($year = 'all')
 {
     $tablename = TABLE_PREFIX . 'page';
     $out = array();
     $res = Record::find(array('select' => "DISTINCT(DATE_FORMAT(created_on, '%Y/%m/%d')) AS date", 'from' => $tablename, 'where' => 'parent_id = :parent_id AND status_id != :status', 'order_by' => 'created_on DESC', 'values' => array(':parent_id' => $this->page->id, ':status' => Page::STATUS_HIDDEN)));
     foreach ($res as $r) {
         $out[] = $r->date;
     }
     return $out;
 }
예제 #12
0
 /**
  * Show the form for editing the specified record.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $record = Record::find($id);
     return View::make('records.edit', compact('record'));
 }
예제 #13
0
파일: Tag.php 프로젝트: albertobraschi/toad
 static function findByPageId($id, $class = __CLASS__)
 {
     $params['sql'] = sprintf("SELECT tag.id AS id, tag.name AS name \n                                  FROM %s AS page_tag, %s AS tag\n                                  WHERE page_tag.page_id=%d AND page_tag.tag_id = tag.id", Record::tableize('PageTag'), Record::tableize('Tag'), $id);
     return parent::find($params, $class);
 }
예제 #14
0
 public function record_delete($p)
 {
     $dDeps = $this->get_DepsBeforeCommit($p);
     $domain_id = $dDeps["domain_id"];
     /*
      * Check if we received record_id else it's not possible to edit this record
      */
     if ($p->record_id != NULL) {
         $record_id = $p->record_id;
     } else {
         throw new Exception('Unable to remove this record, no valid record_id!');
     }
     $r = Record::find($p->record_id);
     $r->destroy();
     return true;
 }
예제 #15
0
파일: history.php 프로젝트: nk53/Job-Ticket
        $year = '<option>' . date('Y', $time) . '</option>';
        $month = '<option>' . date('F', $time) . '</option>';
        $day = '<option>' . date('j', $time) . '</option>';
        $desc = $req->description;
        $checked = $req->approved ? 'checked="checked"' : '';
        // Get estimate information
        $asn = new Assign();
        $asn->rid = $id;
        $asn->find();
        $est_hours = $asn->hours;
        $est_cost = $asn->cost;
        // Get actual spending information
        $rec = new Record();
        // FIX THIS!!!
        $rec->uid = $asn->rid;
        $rec->find(false);
        // Sum spending information together
        while ($rec->rows()) {
            $act_hours += $rec->hours;
            $act_cost += $rec->cost;
        }
    }
    ?>
<!DOCTYPE html>
<head>
<title>Job History</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jquery-1.7.min.js"></script>
<script type="text/javascript" src="validator.js"></script>
<script type="text/javascript" src="validate_history.js"></script>
예제 #16
0
파일: record.php 프로젝트: nk53/Job-Ticket
 if ($aid) {
     $asn = new Assign();
     $asn->id = $aid;
     $asn->find();
     $req = new Request();
     $req->id = $asn->rid;
     $req->find();
     $requestor = $req->name;
     $requestor_phone = parse_phone($req->phone);
     $deadline = $asn->complete;
     $description = $req->description;
 } else {
     if ($id) {
         $rec = new Record();
         $rec->id = $id;
         $rec->find();
         $asn = new Assign();
         $asn->id = $rec->aid;
         $asn->find();
         $req = new Request();
         $req->id = $asn->rid;
         $req->find();
         $requestor = $req->name;
         $requestor_phone = parse_phone($req->phone);
         $deadline = $asn->complete;
         $description = $req->description;
         $hours = $rec->hours;
         $materials = $rec->materials;
         $cost = '$' . $rec->cost;
     }
 }