/** * Fix field */ function fixField($table, $field) { global $db; # get variables from config file $database = new database($db['host'], $db['user'], $db['pass'], $db['name']); //get fix $query = "alter table `{$table}` add "; $query .= trim(getFieldFix($table, $field), ","); $query .= ";"; /* execute */ try { $database->executeMultipleQuerries($query); } catch (Exception $e) { die("<div class='alert alert-danger'>" . $e->getMessage() . "</div>"); } # return return true; }
/** * Fix field */ function fixField($table, $field) { global $database; //get fix $query = "alter table `{$table}` add "; $query .= trim(getFieldFix($table, $field), ","); $query .= ";"; /* execute */ try { $database->executeMultipleQuerries($query); } catch (Exception $e) { die("<div class='alert alert-danger'>" . $e->getMessage() . "</div>"); } # return return true; }
print "<div class='alert alert-danger'>" . _("Cannot get fix for table") . " {$table}!</div>"; } else { print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='{$table}' data-fieldid='' data-type='table'><i class='fa fa-magic fa-pad-right'></i>" . _("Fix table") . "</a>"; print "<div id='fix-result-{$table}' style='display:none'></div>"; } print '</li>' . "\n"; } print '</ul>' . "\n"; print '</div>' . "\n"; } //fields if (isset($errors['fieldError'])) { print '<div class="alert alert-danger alert-absolute" style="text-align:left;">' . "\n"; print '<b>' . _('Missing fields') . ':</b>' . "\n"; print '<ul class="fix-field">' . "\n"; foreach ($errors['fieldError'] as $table => $field) { print '<li>'; print 'Table `' . $table . '`: missing field `' . $field . '`;'; //get fix if (!($fix = getFieldFix($table, $field))) { print "<div class='alert alert-danger'>" . _("Cannot get fix for table") . " {$table}!</div>"; } else { print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='{$table}' data-fieldid='{$field}' data-type='field'><i class='fa fa-magic fa-pad-right'></i>" . _("Fix field") . "</a>"; print "<div id='fix-result-{$table}{$field}' style='display:none'></div>"; } print '</li>' . "\n"; } print '</ul>' . "\n"; print '</div>' . "\n"; } }