Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
VMS-305 VMS-312 #close fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabeel Shahzad committed May 23, 2010
1 parent 63ed3a6 commit f8cdd65
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 110 deletions.
12 changes: 6 additions & 6 deletions admin/modules/PilotAdmin/PilotAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ public function viewpilots()
$retired = false;
}


# Just do this as one call
//PilotData::ChangeName($this->post->pilotid, $this->post->firstname, $this->post->lastname);

$params = array(
'code' => $this->post->code,
'firstname' => $this->post->firstname,
Expand All @@ -138,11 +134,10 @@ public function viewpilots()
'totalflights' => $this->post->totalflights,
'totalpay' => $this->post->totalpay,
'transferhours' => $this->post->transferhours,
'comment' => $this->post->comment,
);

PilotData::updateProfile($this->post->pilotid, $params);
//PilotData::ReplaceFlightData($params); // Called with above now

PilotData::SaveFields($this->post->pilotid, $_POST);

/* Don't calculate a pilot's rank if this is set */
Expand Down Expand Up @@ -536,6 +531,8 @@ protected function ApprovePilot()
$message = Template::GetTemplate('email_registrationaccepted.tpl', true, true, true);

Util::SendEmail($pilot->email, $subject, $message);

CodonEvent::Dispatch('pilot_approved', 'PilotAdmin', $pilot);

LogData::addLog(Auth::$userinfo->pilotid, 'Approved '.PilotData::getPilotCode($pilot->code, $pilot->pilotid).' - ' .$pilot->firstname.' ' .$pilot->lastname);
}
Expand All @@ -555,6 +552,9 @@ protected function RejectPilot()

# Reject in the end, since it's delted
PilotData::RejectPilot($this->post->id);

CodonEvent::Dispatch('pilot_rejected', 'PilotAdmin', $pilot);

LogData::addLog(Auth::$userinfo->pilotid, 'Approved '.PilotData::getPilotCode($pilot->code, $pilot->pilotid).' - ' .$pilot->firstname.' ' .$pilot->lastname);
}

Expand Down
5 changes: 5 additions & 0 deletions admin/templates/pilots_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@

</td>
</tr>
<tr>
<td>Admin Comment</td>
<td><textarea style="width: 100%; height: 70px;" name="comment"><?php echo $pilotinfo->comment;?></textarea>
</tr>
<tr>
<?php
if($customfields)
{
Expand Down
29 changes: 19 additions & 10 deletions core/classes/ezdb/ezdb_base.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,31 +521,40 @@ public function quick_insert($table, $fields, $flags= '', $allowed_cols='')

$sql = 'INSERT '. $flags .' INTO '.$table.' ';

$cols = array();
$col_values = array();

if(is_array($allowed_cols) && count($allowed_cols) > 0)
{
foreach($allowed_cols as $column)
{
$cols .= $column.',';
$col_values .= $this->escape($fields[$column]).',';
$cols[] = "`{$column}`";
$col_values[] = "'".$this->escape($fields[$column])."'";

//$cols .= $column.',';
//$col_values .= $this->escape($fields[$column]).',';
}
}
else
{
if(is_array($fields))
{
foreach($fields as $key=>$value)
foreach($fields as $key => $value)
{
// build both strings
$cols .= $key.',';
$col_values .= $this->escape($value).',';
$cols[] = "`{$key}`";

//$cols .= '`'.$key.'`, ';

if($value == 'NOW()')
$col_values[] = 'NOW()';
else
$col_values[] = "'".$this->escape($value)."'";
}
}
}

$cols[strlen($cols)-1] = ' ';
$col_values[strlen($col_values)-1] = ' ';

$sql .= '('.$cols.') VALUES ('.$col_values.')';

$sql .= '('.implode(', ', $cols).') VALUES ('.implode(', ', $col_values).')';

return $this->query($sql);
}
Expand Down
83 changes: 16 additions & 67 deletions core/common/PIREPData.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,19 +589,10 @@ public static function fileReport($pirepdata)
if($res)
{
self::$lasterror = 'This PIREP was just submitted!';
return;
return $res->pirepid;
}
}

if(isset($pirepdata['log']))
{
$pirepdata['log'] = DB::escape($pirepdata['log']);
}
else
{
$pirepdata['log'] = '';
}


if($pirepdata['depicao'] == '' || $pirepdata['arricao'] == '')
{
self::$lasterror = 'The departure or arrival airports are blank';
Expand Down Expand Up @@ -691,13 +682,6 @@ public static function fileReport($pirepdata)
}
}

$pirepdata['route'] = DB::escape($pirepdata['route']);

if(!empty($pirepdata['route_details']))
{
$pirepdata['route_details'] = DB::escape($pirepdata['route_details']);
}

/* This setting forces the next code to automatically
calculate a load value for this current PIREP */
if(Config::Get('PIREP_OVERRIDE_LOAD') == true)
Expand Down Expand Up @@ -727,69 +711,34 @@ public static function fileReport($pirepdata)
/* Any "raw" parameterized data which needs to be added */
if(isset($pirepdata['rawdata']))
{
$pirepdata['rawdata'] = DB::escape(serialize($pirepdata['rawdata']));
$pirepdata['rawdata'] = serialize($pirepdata['rawdata']);
}
else
{
$pirepdata['rawdata'] = '';
}

/* Escape the comment field */
$pirepdata['log'] = DB::escape($pirepdata['log']);
$comment = DB::escape($pirepdata['comment']);
//$pirepdata['log'] = DB::escape($pirepdata['log']);
if(isset($pirepdata['comment']))
{
$comment = DB::escape($pirepdata['comment']);
unset($pirepdata['comment']);
}

/* Proper timestamp */
$flighttime_stamp = str_replace('.', ':', $pirepdata['flighttime']).':00';
$pirepdata['flighttime'] = str_replace(':', '.', $pirepdata['flighttime']);

/* Export status as 0 */
$pirepdata['exported'] = 0;

$sql = "INSERT INTO ".TABLE_PREFIX."pireps(
`pilotid`,
`code`,
`flightnum`,
`depicao`,
`arricao`,
`route`,
`route_details`,
`distance`,
`aircraft`,
`flighttime`,
`flighttime_stamp`,
`landingrate`,
`submitdate`,
`accepted`,
`log`,
`load`,
`fuelused`,
`expenselist`,
`source`,
`exported`,
`rawdata`)
VALUES ( {$pirepdata['pilotid']},
'{$pirepdata['code']}',
'{$pirepdata['flightnum']}',
'{$pirepdata['depicao']}',
'{$pirepdata['arricao']}',
'{$pirepdata['route']}',
'{$pirepdata['route_details']}',
'{$pirepdata['distance']}',
'{$pirepdata['aircraft']}',
'{$pirepdata['flighttime']}',
'{$flighttime_stamp}',
'{$pirepdata['landingrate']}',
NOW(),
".PIREP_PENDING.",
'{$pirepdata['log']}',
'{$pirepdata['load']}',
'{$pirepdata['fuelused']}',
'0',
'{$pirepdata['source']}',
{$pirepdata['exported']},
'{$pirepdata['rawdata']}')";

$ret = DB::query($sql);
$pirepdata['flighttime_stamp'] = $flighttime_stamp;
$pirepdata['submitdate'] = 'NOW()';
$pirepdata['accepted'] = PIREP_PENDING;
$pirepdata['expenselist'] = '0';

# Do the insert based on the columns here
$ret = DB::quick_insert(TABLE_PREFIX.'pireps', $pirepdata);
$pirepid = DB::$insert_id;

// Add the comment if its not blank
Expand Down
2 changes: 1 addition & 1 deletion core/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
936
937
12 changes: 6 additions & 6 deletions install/hashlist
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ fac7c09a2f7b3c46a3c4d20ccb0eb2fb *./install/templates/s2_site_setup.tpl
98159de4e2de83127db1931eb35f818c *./install/update_437.sql
bf00b0a3b459a481cb1e0df47682e8d2 *./install/checkinstall.php
c6384626328e54dd77c534d04ff65a44 *./install/update_700.sql
e460c18046a6c1e3e8de8c74742fc68b *./install/update.sql
fb432315e30287873239e490fbad1766 *./install/update.sql
d41d8cd98f00b204e9800998ecf8427e *./install/index.php
55c3722f079209f61fcfce707f077548 *./install/update_400.sql
56522f3521444add8835afbba7375a11 *./install/update_854.sql
0e366f4d9910ffc37ecb4051a93cf7df *./install/dbtest.php
2ec3b123aa3c9d5f1a733e4dc146fc69 *./install/install.sql
c9a5105dee26f333af0d6eb70ee4746c *./install/install.sql
1ee77934d1a602e9c74861c9391a55d9 *./install/update_628.sql
c272ba4d5e3656768e851f448face751 *./install/loader.inc.php
20aed0ce417ba947f254459309b4ac1f *./install/Installer.class.php
Expand All @@ -27,7 +27,7 @@ d4d204c3560c283fa4d7a3a367473740 *./install/navdata.sql
654a8ef74503b880f8526873986da3af *./install/install.php
0ce9f88088bd78d869525b8b202fb1bd *./core/lang/en.lang.php
02813e8f573062b56012fea15bccde90 *./core/common/MaintenanceData.class.php
3aab365eb7324f024df783f01a7d125b *./core/common/PIREPData.class.php
c14711e118684471adc0197f6c462c09 *./core/common/PIREPData.class.php
38c88cbada3413d09adc5255428fa579 *./core/common/Auth.class.php
26e225d004bd0b758c49f994453aaac7 *./core/common/jqgrid.class.php
d8cc600bc66b4e2afb1cca5b433fdeb7 *./core/common/RegistrationData.class.php
Expand Down Expand Up @@ -153,7 +153,7 @@ cf7005129f40c0b800ed987809debd89 *./core/classes/autoload.php
a9028d246a90f26f329f3c76af93f4a1 *./core/classes/Template.class.php
74f79f15db7476a6ce4a8521996eeeef *./core/classes/CodonCondenser.class.php
b95046044516e5a08b913ac039cc8e0d *./core/classes/ezdb/ezdb.class.php
ef808de18c3f4a218ca2e67fb9f1b952 *./core/classes/ezdb/ezdb_base.class.php
c8e1978d2c561ecd5ed0ac72f2c9bfd4 *./core/classes/ezdb/ezdb_base.class.php
b91d08223cbd16892191af87870e0bcf *./core/classes/ezdb/ezdb_mysqli.class.php
cbc5eb7865a3f59a4f679b386377d0c1 *./core/classes/ezdb/ezdb_mysql.class.php
f45b5714e950fb9f0b7baadb5b1f08d1 *./core/classes/ezdb/ezdb_oracle.class.php
Expand Down Expand Up @@ -207,7 +207,7 @@ bdf27cdf3c6478d9c4f2bfa127d87c13 *./admin/templates/sidebar_aircraft.tpl
96d041a086f80a0eb42c2c7fd5fa8ea0 *./admin/templates/groups_grouplist.tpl
316f9c45b89506a2646a6a1a3c392c92 *./admin/templates/finance_summarysheet.tpl
7eee22e868ad1cfa54c020876b10153c *./admin/templates/sidebar_settings.tpl
3d9dd4fd6f7fca6d9a77ed6aa4ecb71f *./admin/templates/pilots_details.tpl
3855be8636027f25b53057e4350d6ebb *./admin/templates/pilots_details.tpl
43647f7912f986186e1bd6999c535ca9 *./admin/templates/core_message.tpl
285d07b8b358cb79b849ebf2c7a664a2 *./admin/templates/pireps_list.tpl
2e79fc0f2948a8aae1d33b58a7fd60c5 *./admin/templates/downloads_overview.tpl
Expand Down Expand Up @@ -298,7 +298,7 @@ f1c016469d12fd1974599d675da8d97b *./admin/modules/Reports/Reports.php
eb48b61566644404735718c7607dce33 *./admin/modules/VACentral/VACentral.php
1ecd0956f79d08bd574c481560313c62 *./admin/modules/Finance/Finance.php
c1de104017f08ab3f33a2635c0a6acf2 *./admin/modules/Logs/Logs.php
7aed690f41b17227478c751eb4e6168b *./admin/modules/PilotAdmin/PilotAdmin.php
c99a5cd1bc6e7aa4c0f28d9cbe074215 *./admin/modules/PilotAdmin/PilotAdmin.php
36b45668ad6e73826bc8ef7ff02f7e4d *./admin/modules/PilotRanking/PilotRanking.php
7f8afe3dfe944a0a010c23bcbd7e2467 *./admin/modules/Downloads/Downloads.php
2184a2fe0b3e89301b3c0171b9435d0a *./admin/modules/MassMailer/MassMailer.php
Expand Down
1 change: 1 addition & 0 deletions install/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ CREATE TABLE `phpvms_pilots` (
`joindate` datetime NOT NULL default '0000-00-00 00:00:00',
`lastpirep` datetime NOT NULL default '0000-00-00 00:00:00',
`lastip` VARCHAR( 25 ) NULL DEFAULT '',
`comment` TEXT NULL ,
PRIMARY KEY (`pilotid`),
KEY `code` (`code`),
KEY `rank` (`rank`)
Expand Down

0 comments on commit f8cdd65

Please sign in to comment.