forked from science-ation/science-ation
warnings and errors
This commit is contained in:
parent
bc588358ee
commit
4c698b29e1
@ -77,7 +77,7 @@
|
||||
echo "<a href=\"cms.php\"><< Back to file list</a><br />\n";
|
||||
echo "<form method=\"post\" action=\"cms.php\">";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
if($_GET['filename'])
|
||||
if(get_value_from_array($_GET,'filename', ''))
|
||||
echo "<input type=\"hidden\" name=\"filename\" value=\"".htmlspecialchars($_GET['filename'])."\">\n";
|
||||
else
|
||||
echo "Choose filename to create: /web/<input type=\"text\" name=\"filename\" size=\"15\">.html<hr />";
|
||||
@ -88,7 +88,7 @@
|
||||
echo "<table class=\"tableview\" width=\"100%\">";
|
||||
echo "<tr><th colspan=\"2\">";
|
||||
|
||||
$q = $pdo->prepare("SELECT * FROM cms WHERE filename='".$_GET['filename']."' AND lang='$lang' ORDER BY dt DESC LIMIT 1");
|
||||
$q = $pdo->prepare("SELECT * FROM cms WHERE filename='".get_value_from_array($_GET, 'filename', '')."' AND lang='$lang' ORDER BY dt DESC LIMIT 1");
|
||||
$q->execute();
|
||||
if($r=$q->fetch(PDO::FETCH_OBJ)) {
|
||||
if($r->dt=="0000-00-00 00:00:00" || !$r->dt) $dt="Never";
|
||||
@ -112,12 +112,12 @@
|
||||
echo "<b>$langname</b><br />"; // ".i18n("Last updated").": $dt<br />";
|
||||
}
|
||||
echo "</th></tr>\n";
|
||||
echo "<tr><td width=\"100\">".i18n("Page Title").":</td><td><input type=\"text\" name=\"title_$lang\" style=\"width: 99%;\" value=\"".htmlspecialchars($r->title)."\"></td></tr>\n";
|
||||
echo "<tr><td width=\"100\">".i18n("Page Title").":</td><td><input type=\"text\" name=\"title_$lang\" style=\"width: 99%;\" value=\"".htmlspecialchars(get_value_property_or_default($r, 'title', ''))."\"></td></tr>\n";
|
||||
echo "<tr><td width=\"100\">".i18n("Show Logo").":</td><td>";
|
||||
if($r->showlogo) $ch="checked=\"checked\""; else $ch="";
|
||||
if(get_value_property_or_default($r, 'showlogo')) $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"radio\" name=\"showlogo_$lang\" value=\"1\"> ".i18n("Yes");
|
||||
echo " ";
|
||||
if(!$r->showlogo) $ch="checked=\"checked\""; else $ch="";
|
||||
if(!get_value_property_or_default($r, 'showlogo')) $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"radio\" name=\"showlogo_$lang\" value=\"0\"> ".i18n("No");
|
||||
|
||||
echo "</td></tr>\n";
|
||||
@ -126,7 +126,7 @@
|
||||
|
||||
$oFCKeditor = new FCKeditor("text_$lang") ;
|
||||
$oFCKeditor->BasePath = "../fckeditor/";
|
||||
$oFCKeditor->Value = $r->text;
|
||||
$oFCKeditor->Value = get_value_property_or_default($r, 'text');
|
||||
$oFCKeditor->Width="100%";
|
||||
$oFCKeditor->Height=400;
|
||||
$oFCKeditor->Create() ;
|
||||
@ -138,13 +138,13 @@
|
||||
echo "</td><td width=\"130\" valign=\"top\">";
|
||||
echo "<table class=\"tableview\" width=\"130\">";
|
||||
|
||||
if($_GET['historylimit']) $historylimit=intval($_GET['historylimit']);
|
||||
if(get_value_from_array($_GET, 'historylimit','')) $historylimit=intval(get_value_from_array($_GET, 'historylimit', ''));
|
||||
else $historylimit=30;
|
||||
|
||||
echo "<tr><th>".i18n("File History")."</th></tr>\n";
|
||||
|
||||
|
||||
$q = $pdo->prepare("SELECT DISTINCT(dt) FROM cms WHERE filename='".$_GET['filename']."' ORDER BY dt DESC LIMIT $historylimit");
|
||||
$q = $pdo->prepare("SELECT DISTINCT(dt) FROM cms WHERE filename='".get_value_from_array($_GET, 'filename','')."' ORDER BY dt DESC LIMIT $historylimit");
|
||||
$q->execute();
|
||||
$first=true;
|
||||
if($q->rowCount()) {
|
||||
|
@ -42,7 +42,7 @@ case 'remove_report':
|
||||
exit;
|
||||
case 'reload':
|
||||
$edit_mode = true;
|
||||
$reports_id = intval($_POST['reports_id']);
|
||||
$reports_id = intval(get_value_from_array($_POST, 'reports_id'));
|
||||
exit;
|
||||
|
||||
case 'load_report':
|
||||
|
@ -142,8 +142,9 @@
|
||||
{
|
||||
$buttontext="Add";
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$categoryr->id\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"".get_value_property_or_default($categoryr, 'id', ' ')."\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"20\" name=\"category\" value=\"$categoryr->category\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"5\" name=\"category_shortform\" value=\"$categoryr->category_shortform\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"mingrade\" value=\"$categoryr->mingrade\"></td>";
|
||||
|
@ -155,7 +155,7 @@ class FCKeditor
|
||||
*/
|
||||
public function CreateHtml()
|
||||
{
|
||||
$HtmlValue = htmlspecialchars( $this->Value ) ;
|
||||
$HtmlValue = htmlspecialchars( get_value_property_or_default($this, 'Value', 'sdf') ) ;
|
||||
|
||||
$Html = '' ;
|
||||
|
||||
|
@ -25,6 +25,11 @@ function get_value_or_default(mixed $var, mixed $default = null) : mixed {
|
||||
return isset($var) ? $var : $default;
|
||||
}
|
||||
|
||||
function get_value_property_or_default(mixed $var, mixed $property, mixed $default = null) : mixed {
|
||||
|
||||
return $var && property_exists($var, $property) ? $var->$property : $default;
|
||||
}
|
||||
|
||||
function show_pdo_errors_if_any($pdo)
|
||||
{// Check for errors after the query execution
|
||||
$errorInfo = $pdo->errorInfo();
|
||||
|
@ -252,7 +252,7 @@ class TableEditor
|
||||
|
||||
function sortField()
|
||||
{
|
||||
if($_SESSION["TableEditorSort{$this->table}"])
|
||||
if(get_value_from_array($_SESSION, "TableEditorSort{$this->table}"))
|
||||
return $_SESSION["TableEditorSort{$this->table}"];
|
||||
else
|
||||
return $this->sortDefault;
|
||||
@ -537,13 +537,13 @@ class TableEditor
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['TableEditorAction']=="page" && $_GET['page'])
|
||||
if(get_value_from_array($_GET, 'TableEditorAction') == "page" && get_value_from_array($_GET, 'page'))
|
||||
{
|
||||
$this->setActivePage($_GET['page']);
|
||||
}
|
||||
|
||||
if( ($_POST['TableEditorAction']=="editsave" && $_POST['editsave'])
|
||||
|| ($_POST['TableEditorAction']=="addsave") )
|
||||
if( (get_value_from_array($_POST, 'TableEditorAction') == "editsave") && get_value_from_array($_POST, 'editsave')
|
||||
|| (get_value_from_array($_POST, 'TableEditorAction') == "addsave") )
|
||||
{
|
||||
if($_POST['TableEditorAction']=="addsave") {
|
||||
if($this->classname)
|
||||
@ -961,7 +961,7 @@ class TableEditor
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
else if($_GET['TableEditorAction']=="export")
|
||||
else if(get_value_from_array($_GET, 'TableEditorAction') == "export")
|
||||
{
|
||||
//fixme: how to do an export? we cant send headers because its possible that output has already started!
|
||||
|
||||
@ -1015,7 +1015,7 @@ class TableEditor
|
||||
$query .= " FROM ";
|
||||
foreach($from as $f) $query .= "$f ";
|
||||
$query .= " WHERE 1 ";
|
||||
|
||||
|
||||
if(is_array($where)) {
|
||||
foreach($where as $w) $query .= "AND $w ";
|
||||
}
|
||||
@ -1041,6 +1041,7 @@ class TableEditor
|
||||
|
||||
if($this->DEBUG) echo $query;
|
||||
|
||||
echo $query;
|
||||
$q = $pdo->prepare($query);
|
||||
$q->execute();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user