Jump to content

[SOLVED] Adding an aircraft error


Steve Bartlett

Recommended Posts

I am getting this error when I try to add an aircraft:

Fatal error: Call to undefined method OperationsData::AddAircaft() in /home/xxxxxxx/public_html/admin/modules/Operations/Operations.php on line 720\

I am using the same skin I have used before with no problems, Both the PHPvms and website are php version 5.5

Here is Line 720 (which matches with what other websites have):

OperationsData::AddAircaft($data);

Link to comment
Share on other sites

  • Members

this error comes from the module

Fatal error: Call to undefined method OperationsData::AddAircaft() in /home/xxxxxxx/public_html/admin/modules/Operations/Operations.php on line 720\

i told you to go to folder core then to folder common and the open the OperationsData.class.php and see if there is a function called addaircraft

it should be around line 375

Link to comment
Share on other sites

Okay, here is what that section shows, in the core/common/operationsdata.class.php:

* Add an aircraft

*

* $data = array( 'icao'=>$this->post->icao,

* 'name'=>$this->post->name,

* 'fullname'=>$this->post->fullname,

* 'registration'=>$this->post->registration,

* 'downloadlink'=>$this->post->downloadlink,

* 'imagelink'=>$this->post->imagelink,

* 'range'=>$this->post->range,

* 'weight'=>$this->post->weight,

* 'cruise'=>$this->post->cruise,

* 'maxpax'=>$this->post->maxpax,

* 'maxcargo'=>$this->post->maxcargo,

* 'enabled'=>$this->post->enabled);

*/

public static function addAircraft($data) {

/*$data = array('icao'=>$this->post->icao,

'name'=>$this->post->name,

'fullname'=>$this->post->fullname,

'registration'=>$this->post->registration,

'downloadlink'=>$this->post->downloadlink,

'imagelink'=>$this->post->imagelink,

'range'=>$this->post->range,

'weight'=>$this->post->weight,

'cruise'=>$this->post->cruise,

'maxpax'=>$this->post->maxpax,

'maxcargo'=>$this->post->maxcargo,

'enabled'=>$this->post->enabled);*/

$data['icao'] = DB::escape(strtoupper($data['icao']));

$data['name'] = DB::escape(strtoupper($data['name']));

$data['registration'] = DB::escape(strtoupper($data['registration']));

$data['range'] = ($data['range'] == '') ? 0 : $data['range'];

$data['weight'] = ($data['weight'] == '') ? 0 : $data['weight'];

$data['cruise'] = ($data['cruise'] == '') ? 0 : $data['cruise'];

$data['range'] = str_replace(',', '', $data['range']);

$data['weight'] = str_replace(',', '', $data['weight']);

$data['cruise'] = str_replace(',', '', $data['cruise']);

$data['maxpax'] = str_replace(',', '', $data['maxpax']);

$data['maxcargo'] = str_replace(',', '', $data['maxcargo']);

if ($data['enabled'] === true || $data['enabled'] == '1') $data['enabled'] = 1;

else $data['enabled'] = 0;

if ($data['minrank'] > 0) {

$data['ranklevel'] = RanksData::getRankLevel($data['minrank']);

} else {

$data['ranklevel'] = '0';

}

$cols = array();

$col_values = array();

foreach ($data as $key => $value) {

$cols[] = "`{$key}`";

$value = DB::escape($value);

$col_values[] = "'{$value}'";

}

$cols = implode(', ', $cols);

$col_values = implode(', ', $col_values);

$sql = "INSERT INTO " . TABLE_PREFIX . "aircraft

({$cols}) VALUES ({$col_values})";

$res = DB::query($sql);

if (DB::errno() != 0) return false;

CodonCache::delete('all_aircraft');

CodonCache::delete('all_aircraft_enabled');

CodonCache::delete('all_aircraft_search');

CodonCache::delete('all_aircraft_search_enabled');

return true;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...