ACC SHELL
<?php
require("cropper.php");
require("jobs.php");
function admin_header()
{
/*header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz" lang="cz">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="cache-control" content="no-cache"/>
<link rel="stylesheet" type="text/css" href="admin.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="../style.css" media="screen"/>
<title>AMK Brno - administrační sekce </title>
<?php load_cropper_script() ?>
<?php load_datevalidation_script() ?>
<script type="text/javascript" src="confirm.js"></script>
</head>
<body>
<div class="centered">
<?php
}
function admin_footer()
{
?>
</div>
</body>
</html>
<?php
}
function admin_msgbox($msg)
{
printf("<div class=\"error\">");
printf($msg);
printf("</div>");
}
function admin_display_help($message)
{
echo "<div class=\"help\">";
echo "<h2>Nápověda</h2>";
echo $message;
echo "</div>";
}
function admin_display_warning($message)
{
echo "<div class=\"warning\">";
echo "<h2>Upozornění</h2>";
echo $message;
echo "</div>";
}
function admin_display_menu()
{
echo "<div class=\"admin_menu\">";
if(isset($_SESSION["news_id"]))
{
echo "<a href=\"javascript: redir('Tímto ztratíte rozpracovanou novinku, chcete pokračovat', '?action=" . STATE_ADD_NEWS_INIT . "')\">Přidat novinku</a> | ";
echo "<a href=\"javascript: redir('Tímto ztratíte rozpracovanou novinku, chcete pokračovat', '?action=" . STATE_CHOOSE_FOR_EDITATION . "')\">Editovat novinku</a> | ";
}
else
{
echo "<a href=\"?action=" . STATE_ADD_NEWS_INIT . "\">Přidat novinku</a> | ";
echo "<a href=\"?action=" . STATE_CHOOSE_FOR_EDITATION . "\">Editovat novinku</a> | ";
echo "<a href=\"?action=" . STATE_DISPLAY_ADD_JOB . "\">Přidat brigádu</a> | ";
echo "<a href=\"?action=" . STATE_LIST_JOBS . "\">Editovat brigády</a> | ";
echo "<a href=\"?action=" . STATE_LIST_CARTS . "\">Spravovat MB</a> | ";
}
echo "<a href=\"?action=" . STATE_LOGOUT . "\">Odhlásit se</a> ";
echo "</div>";
}
function admin_display_login_screen()
{
?>
<form method="POST" action="index.php" style="width: 15em; margin-left: auto; margin-right: auto">
<input type="hidden" name="action" value="1">
<table>
<tr><td>jméno</td><td><input name="email" class="font_style" type="text"/></td></tr>
<tr><td>heslo</td><td><input name="password" class="font_style" type="password"></td></tr>
<tr style="text-align: center"><td colspan="2" ><input class="input_button" type="submit" value="přihlásit se"></td></tr>
</table>
</form>
<?php
}
function admin_display_add_news()
{
if(isset($_SESSION["news_id"]))
{
admin_display_filled_add_news();
return;
}
die("obsoletni");
?>
<form method="POST" action="index.php">
<h2>Přidat novinku</h2>
<?php
echo "<input type=\"hidden\" name=\"action\" value=\"" . STATE_ADD_NEWS_PREVIEW . "\"/>";
?>
<input type="hidden" name="perex_image_id" value="0"/>
<table style="width: 100%">
<tr>
<td style="width: 10em">autor</td>
<td>
<?php
echo "<input type=\"hidden\" name=\"user_id\" value=\"" . $_SESSION["user_id"] . "/>";
print_user($_SESSION["user_id"]);
?>
</td>
</tr>
<tr>
<td>umístění obrázku</td>
<td>
<input type="radio" value="'left'" checked name="perex_position">vlevo</input>
<input type="radio" value="'right'" name="perex_position">vpravo</input>
</td>
</tr>
<tr><td>titulek</td><td><input name="headline" type="text"></td></tr>
<tr><td>kategorie</td><td>
<select name="category_id">
<?php print_category_combo("dddcategory_id") ?>
</select>
</td>
</tr>
<tr>
<td>perex</td>
<td><textarea name="perex" rows="3"></textarea></td></tr>
<tr>
<td>text</td>
<td><textarea name="text" rows="10"></textarea></td></tr>
<tr><td colspan="2" style="text-align: center"><input type="submit" value="náhled"></td></tr>
</table>
</form>
<?php
}
function admin_display_filled_add_news()
{
$query = "SELECT headline, perex, body, has_perex_image, image_position, category_id FROM news WHERE news_id = " . $_SESSION["news_id"];
$result = mysql_query($query);
if(!$result || mysql_num_rows($result) != 1)
{
admin_msgbox("Nepodařilo se získat data pro vyplnění formuláře");
die();
}
$row = mysql_fetch_row($result);
?>
<form method="POST" action="index.php">
<h2>Přidat novinku</h2>
<?php
echo "<input type=\"hidden\" name=\"action\" value=\"" . STATE_ADD_NEWS_PREVIEW . "\"/>";
?>
<input type="hidden" name="perex_image_id" value="0"/>
<table style="width: 100%">
<tr>
<td style="width: 10em">autor</td>
<td>
<?php
echo "<input type=\"hidden\" name=\"user_id\" value=\"" . $_SESSION["user_id"] . "\"/>";
print_user($_SESSION["user_id"]);
?>
</td>
</tr>
<tr>
<td>umístění obrázku</td>
<td>
<?php
if($row[3])
{
if($row[4] == "left")
{
echo "<input type=\"radio\" value=\"left\" checked name=\"perex_position\">vlevo</input>";
echo "<input type=\"radio\" value=\"right\" name=\"perex_position\">vpravo</input>";
}
else
{
echo "<input type=\"radio\" value=\"left\" name=\"perex_position\">vlevo</input>";
echo "<input type=\"radio\" value=\"right\" checked name=\"perex_position\">vpravo</input>";
}
}
else
{
echo "<input type=\"radio\" name=\"perex_position\" checked value=\"none\">žádný obrázek</input>";
} ?>
</td>
</tr>
<?php echo "<tr><td>titulek</td><td><input name=\"headline\" type=\"text\" value=\"" . $row[0] . "\"></td></tr>";?>
<tr><td>kategorie</td><td>
<select name="category_id">
<?php print_category_combo($row[5]) ?>
</select>
</td>
</tr>
<tr>
<td>perex</td>
<?php echo "<td><textarea name=\"perex\" rows=\"3\">" . $row[1] . "</textarea></td></tr>"; ?>
<tr>
<td>text</td>
<?php echo "<td><textarea name=\"text\" rows=\"10\">" . $row[2] ."</textarea></td></tr>"; ?>
<tr><td colspan="2" style="text-align: center"><input type="submit" value="náhled"></td></tr>
</table>
</form>
<?php
}
function get_filename()
{
if(!isset($_SESSION["news_id"]) || !isset($_SESSION["ticks"]))
{
admin_msgbox("Identifikace novinky není korektní");
var_dump(debug_backtrace());
echo "ticks: " . $_SESSION["ticks"];
echo "news_id: " . $_SESSION["news_id"];
}
return $_SESSION["news_id"] . "_" . $_SESSION["ticks"];
}
function regenerate_filename()
{
$_SESSION["ticks"] = time();
}
function admin_display_pic_upload()
{
admin_display_help(
"Pokud chcete nahrát vlastní obrázek, vyberte jej pomocí tlačítka vpravo od textového pole." .
"Pokud žádný obrázek nezadáte, vybere se předpřipravený obrázek podle kategorie, do které článek zařadíte"
);
admin_clean_up();
regenerate_filename();
?>
<div class="blue_box">
<form method="POST" action="index.php" enctype="multipart/form-data">
<h2>Nahrát obrázek</h2>
<input type="hidden" name="action" value="
<?php echo STATE_ADD_NEWS_CROP ?>
">
<table style="width: 100%">
<tr><td>Soubor</td><td><input type="file" size="30" name="from_file"/></td></td></tr>
<tr><td colspan="2" style="text-align: center"><input type="submit" value="Nahrát"></td></tr>
</table>
</form>
</div>
<?php
}
function admin_upload_pic()
{
// first check if everything is setup the way it should be
if(
isset($_FILES["from_file"]["name"]) &&
isset($_FILES["from_file"]["type"]) &&
isset($_FILES["from_file"]["tmp_name"]) &&
isset($_FILES["from_file"]["error"]) &&
isset($_FILES["from_file"]["size"]))
{
// check if there have been any difficulties
if($_FILES["from_file"]["error"] == 4)
{
return false;
}
if($_FILES["from_file"]["error"] != 0)
{
admin_msgbox("Při nahrávání souboru vznikla chyba #" . $_FILES["from_file"]["error"]);
die();//return false;
}
// check if it's a supported file type
if(
$_FILES["from_file"]["type"] != "image/jpeg" &&
$_FILES["from_file"]["type"] != "image/pjpeg" &&
$_FILES["from_file"]["type"] != "image/png")
{
admin_msgbox("Soubor, který se snažíte nahrát, není ve formátu PNG nebo JPEG (formát GIF není podporován)" . $_FILES["from_file"]["type"]);
die();//return;
}
// move if from temp to the perex directory
$extension = strrchr($_FILES["from_file"]["name"], ".");
$resuolt = move_uploaded_file($_FILES["from_file"]["tmp_name"], "../gfx/temp/orig" . get_filename() );
// create preview
$image = open_image("../gfx/temp/orig" . get_filename() );
if($image == false)
{
echo "move_uploaded_file vratilo" . ($result ? "true" : "false");
echo file_exists($_FILES["from_file"]["tmp_name"]) ? "tmp soubor existuje" : "tmp soubor neexistuje";
echo file_exists("../gfx/temp/orig" . get_filename()) ? "soubor existuje" : "soubor neexistuje";
admin_msgbox("Chyba při otevírání obrázku (" . get_filename() . "), (" . $_FILES["from_file"]["tmp_name"] . ")");
}
imagejpeg(
resize_image( 0, 0, imagesx($image), imagesy($image), 670, 500, $image),
"../gfx/temp/preview" . get_filename()
);
}
else
{
// the user might have wanted to recrop his image, that's why there where no FILES variables, jus check the files
// alread exist
if(file_exists("../gfx/temp/preview" . get_filename()) && file_exists("../gfx/temp/orig" . get_filename()))
{
// regenerate session id and relocate files
$old_session = get_filename();
regenerate_filename();
rename("../gfx/temp/orig" . $old_session, "../gfx/temp/orig" . get_filename());
rename("../gfx/temp/preview" . $old_session, "../gfx/temp/preview" . get_filename());
return true;
}
admin_msgbox("Při nahrávání souboru vznikla neznámá chyba");
die();//return;
}
return true;
}
function admin_regenerate_orig_and_preview_files()
{
// check if we ever had a file in the first place
if(!file_exists("../gfx/temp/" . get_filename() . ".jpg"))
return;
// make the current crop the original file
copy("../gfx/temp/" . get_filename() . ".jpg", "../gfx/temp/orig" . get_filename());
// regenerate preview
$image = open_image("../gfx/temp/orig" . get_filename());
$preview = imagejpeg(
resize_image( 0, 0, imagesx($image), imagesy($image), 670, 500, $image),
"../gfx/temp/preview" . get_filename()
);
}
function admin_display_gfx_preview()
{
admin_display_help(
"Níže je vidět obrázek, který se použije v perexu, a zmenšenina obrázku, který se použije v textu." .
"Pokud je perex příliš rozmazaný, je potřeba vybrat fotografii s větším rozlišením nebo vybrat větší část fotografie"
);
echo "<div class=\"gray_box\">";
echo "<h2>Náhled obázku pro perex</h2>";
echo "<img src=\"../gfx/temp/" . get_filename() . "_perex.jpg\"/>";
echo "<h2>Náhled zmenšeného obrázku pro použití v článku</h2>";
echo "<img src=\"../gfx/temp/" . get_filename() . "_thumb.jpg\"/>";
echo "<h2>Možnosti</h2>";
echo "<a href=\"index.php?action=" . STATE_ADD_NEWS_FILESELECT . "\">Vybrat jiný obrázek</a> | ";
echo "<a href=\"index.php?action=" . STATE_ADD_NEWS_CROP . "\">Znova oříznout</a> | ";
echo "<a href=\"index.php?action=" . STATE_ADD_NEWS_ARTICLE ."\">Pokračovat</a>";
echo "</div>";
}
function admin_display_preview()
{
if(!isset($_SESSION["news_id"]))
{
admin_msgbox("Nastala chyba při předávání novinky");
die();
}
else
{
echo "<div style=\"width: 580px; margin-left: auto; margin-right: auto\">";
//echo "<h2>Náhled perexu</h2>";
$query = "SELECT headline, perex, body, has_perex_image, category_id FROM news WHERE news_id = " . quote_smart($_SESSION["news_id"]);
$result = mysql_query($query);
if(!$result || mysql_num_rows($result) != 1)
{
admin_msgbox("Nastala chyba při hledání novinky");
die();
}
$row = mysql_fetch_row($result);
if($row[3])
print_news($_SESSION["news_id"], $row[0], $row[1], "../gfx/temp/" . get_filename() . "_perex.jpg");
else
print_news($_SESSION["news_id"], $row[0], $row[1], "../gfx/perex/default/" . $row[4] . ".png");
//echo "<h2>Náhled textu</h2>";
print_article($_SESSION["news_id"], "../gfx/temp/" . get_filename() . "_thumb.jpg");
echo "</div>";
echo "<div class=\"gray_box\">";
echo "<h2>Možnosti</h2>";
echo "<a href=\"index.php?action=" . STATE_ADD_NEWS_ARTICLE . "\">Opravit</a> | ";
echo "<a href=\"index.php?action=" . STATE_ADD_NEWS_PUBLISH . "\">Publikovat</a>";
echo "</div>";
}
}
function admin_clean_up($filename = NULL)
{
if((!isset($_SESSION["news_id"]) || !isset($_SESSION["ticks"])) && $filename == NULL)
return;
if($filename == NULL)
$filename = get_filename();
if(file_exists("../gfx/temp/" . $filename . "_perex.jpg"))
unlink("../gfx/temp/" . $filename . "_perex.jpg");
if(file_exists("../gfx/temp/" . $filename . "_thumb.jpg"))
unlink("../gfx/temp/" . $filename . "_thumb.jpg");
if(file_exists("../gfx/temp/" . $filename . ".jpg"))
unlink("../gfx/temp/" . $filename . ".jpg");
if(file_exists("../gfx/temp/orig" . $filename))
unlink("../gfx/temp/orig" . $filename);
if(file_exists("../gfx/temp/preview" . $filename))
unlink("../gfx/temp/preview" . $filename);
}
function admin_news_list()
{
$query =
"SELECT news.news_id, news.headline, news.added_on, user.name FROM news NATURAL JOIN user WHERE published = 1 ORDER BY news.added_on DESC";
$result = mysql_query($query);
echo "<table class=\"news_list\">";
echo "<tr><th style=\"width: 20px\">id</th>" .
"<th style=\"width: 150px\">titulek</th>" .
"<th style=\"width: 70px\">datum vytvoření</th>" .
"<th style=\"width: 100px\">autor</th>" .
"<th style=\"width: 100px\"> </th>" .
"<th style=\"width: 100px\"> </th>";
while($row = mysql_fetch_row($result))
{
$date = date("j. n. Y (G:i:s)", strtotime($row[2]));
echo "<tr><td>" . $row[0] . "</td>" .
"<td>" . $row[1] . "</td>" .
"<td>" . $date . "</td>" .
"<td>" . $row[3] . "</td>";
?>
<td class="list_button">
<form class="verbose" action="index.php" method="POST">
<input type="hidden" name="news_id" value="<?php echo $row[0]; ?>">
<input type="hidden" name="action" value="<?php echo STATE_EDIT; ?>">
<input type="submit" value="upravit">
</form>
</td>
<td class="list_button">
<form class="verbose" action="index.php" method="POST">
<input type="hidden" name="news_id" value="<?php echo $row[0]; ?>">
<input type="hidden" name="action" value="delete">
<!--<input type="submit" value="odstranit">-->
</form>
</td>
</tr>
<?php
}
echo "</table>";
}
function admin_unpublish_news($id)
{
// make the news unpublished
$query = "UPDATE news SET published = 0 WHERE news_id = " . quote_smart($id);
mysql_query($query);
// setup filename mangling
$_SESSION["news_id"] = $id;
regenerate_filename();
// move gfx back if it exists (ie default image)
echo "pokusim se presunout soubory pro id = " . $id;
if(file_exists("../gfx/perex/" . quote_smart($id) . ".jpg"))
{
echo "soubory nalezeny";
copy("../gfx/perex/" . $_SESSION["news_id"] . ".jpg", "../gfx/temp/" . get_filename() . "_perex.jpg");
copy("../gfx/thumb/" . $_SESSION["news_id"] . ".jpg", "../gfx/temp/" . get_filename() . "_thumb.jpg");
copy("../gfx/img/" . $_SESSION["news_id"] . ".jpg", "../gfx/temp/" . get_filename() . ".jpg");
}
}
function admin_publish_news()
{
// move thumb, big picture and perex (if default imagery hasn't been used)
if(file_exists("../gfx/temp/" . get_filename() . "_perex.jpg"))
{
rename("../gfx/temp/" . get_filename() . "_perex.jpg", "../gfx/perex/" . $_SESSION["news_id"] . ".jpg");
rename("../gfx/temp/" . get_filename() . "_thumb.jpg", "../gfx/thumb/" . $_SESSION["news_id"] . ".jpg");
rename("../gfx/temp/" . get_filename() . ".jpg", "../gfx/img/" . $_SESSION["news_id"] . ".jpg");
}
// make sure the original file is deleted
admin_clean_up();
publish_news($_SESSION["news_id"]);
}
function admin_display_debug()
{
return;
echo "<div class=\"gray_box\">";
echo "user_id: " . $_SESSION["user_id"];
echo "<br>news_id: " . (isset($_SESSION["news_id"]) ? $_SESSION["news_id"] : "not set");
echo "<br>filename: " . get_filename();
echo "</div>";
}
function admin_unset_news()
{
if(isset($_SESSION["news_id"]))
{
admin_msgbox("Editovaná novinka byla odstraněna");
unset($_SESSION["news_id"]);
}
}
function admin_print_time($mysql_time)
{
$time_string = substr($mysql_time, 0, 5);
echo $time_string;
}
function admin_print_date($mysql_time)
{
echo date("j. n. Y", strtotime($mysql_time));
}
function print_id($id)
{
echo strval($id);
}
function admin_display_carts($cart_id)
{
if(!is_numeric($cart_id) || !is_int((int)$cart_id))
{
$cart_id = -1;
}
?>
<h3>Přidat položku do kalendáře</h3>
<table class="news_list">
<tr>
<th style="width: 70px">datum</th>
<th style="width: 50px">čas od</th>
<th style="width: 50px">čas do</th>
<th style="width: 20px">privátní</th>
<th style="width: 350px">text</th>
<th style="width: 110px">přidat</th>
</tr>
<tr>
<form action="index.php" method="POST" onsubmit="return is24Time(document.getElementById('cart_tfrom').value) && is24Time(document.getElementById('cart_tto').value) && isDate(document.getElementById('cart_date').value);">
<td><input id="cart_date" name="cart_date" type="text" size="10" value="<? echo date("j. n. Y"); ?>"/></td>
<td><input id="cart_tfrom" name="cart_tfrom" type="text" size="5" value="10:00"/></td>
<td><input id="cart_tto" name="cart_tto" type="text" size="5" value="11:00"/></td>
<td><input id="cart_private" name="cart_private" type="checkbox"/></td>
<td><input id="cart_title" name="cart_title" type="text" size="50" value="text"/></td>
<td class="list_button">
<input type="hidden" name="action" value="<? echo STATE_ADD_CARTS; ?>"/>
<input type="submit" value="přidat"/>
</td>
</form>
</tr>
</table>
<h3>Správa kalendáře</h3>
<p><span style="background-color: LightGreen"> </span> - Položka byla upravena <span style="background-color: Orange"> </span> - Dnešní akce <span style="background-color: LightPink"> </span> - Staré akce </p>
<table class="news_list">
<tr>
<!-- 760px -->
<th style="width: 30px">id</th>
<th style="width: 120px">datum</th>
<th style="width: 40px">čas od</th>
<th style="width: 40px">čas do</th>
<th style="width: 20px">privátní</th>
<th style="width: 240px">text</th>
<th style="width: 55px">uložit</th>
<th style="width: 55px">smazat</th>
</tr>
<?
$query = "SELECT * FROM carts ORDER BY carts.cart_date ASC, carts.tfrom ASC, carts. tto ASC";
$result = mysql_query($query);
while($row = mysql_fetch_row($result))
{
$idstyle = "";
if($row[0] == $cart_id)
{
$idstyle = " style=\"background: LightGreen\" ";
}
if(date("j. n. Y", strtotime($row[2])) == date("j. n. Y"))
{
echo '<tr style="background: Orange">';
}
else
{
$line_time = strtotime($row[2]);
$current_time = strtotime(date("Y-m-d"));
//echo $line_time; echo "-"; echo $current_time;
if($line_time < $current_time)
{
echo '<tr style="background: LightPink">';
}
else
{
echo '<tr>';
}
}
$id = $row[0];
$is_private = $row[5] == "1";
?>
<form action="index.php" name="update_form_<? print_id($row[0]); ?>" id="update_form_<? print_id($row[0]); ?>" method="POST" onsubmit="return is24Time(GFE('update_form_<? print_id($row[0]); ?>', 'cart_tfrom').value) && is24Time(GFE('update_form_<? print_id($row[0]); ?>', 'cart_tto').value) && isDate(GFE('update_form_<? print_id($row[0]); ?>', 'cart_date').value)">
<td <? echo $idstyle; ?>><? echo $row[0]; ?></td>
<td><input id="cart_date" name="cart_date" type="text" size="10" value="<? echo admin_print_date($row[2]); ?>"/></td>
<td><input id="cart_tfrom" name="cart_tfrom" type="text" size="5" value="<? echo admin_print_time($row[3]); ?>"/></td>
<td><input id="cart_tto" name="cart_tto" type="text" size="5" value="<? echo admin_print_time($row[4]); ?>"/></td>
<td><input id="cart_private" name="cart_private" <? echo ($is_private ? "checked" : ""); ?> type="checkbox"/></td>
<td><input id="cart_title" name="cart_title" type="text" size="40" value="<? echo $row[1]; ?>"/></td>
<td class="list_button">
<input type="hidden" name="action" value="<? echo STATE_EDIT_CARTS; ?>"/>
<input type="hidden" name="cart_id" value="<? echo $row[0]; ?>"/>
<input type="submit" value="upravit"/>
</td>
</form>
<form action="index.php" method="POST">
<td class="list_button">
<input type="submit" value="smazat">
<input type="hidden" name="action" value="<? echo STATE_DELETE_CARTS; ?>"/>
<input type="hidden" name="cart_id" value="<? echo $row[0]; ?>"/>
</td>
</form>
</tr>
<? } ?>
</table>
<?
}
function admin_add_carts($cart_date, $cart_tfrom, $cart_tto, $cart_private, $cart_title)
{
$cart_date = czech_date_to_date($cart_date, True);
if(!is_bool($cart_private))
{
$cart_private = false;
}
$query = "INSERT INTO carts (cart_date, tfrom, tto, cart_private, title) VALUES (" .
quote_smart($cart_date) . ", " .
quote_smart($cart_tfrom) . ", " .
quote_smart($cart_tto) . ", " .
($cart_private ? "true" : "false") . ", " .
quote_smart($cart_title) . ")";
//echo $query;
$result = mysql_query($query) or die(mysql_error());//{ admin_msgbox("Nepodařilo se přidat položku do kalendáře"); return; }
}
function admin_delete_cart($cart_id)
{
if(!is_numeric($cart_id) || !is_int((int)$cart_id))
{
return false;
}
$query = "DELETE FROM carts WHERE id = " . $cart_id;
mysql_query($query);
return true;
}
function admin_update_cart($cart_id, $cart_date, $cart_tfrom, $cart_tto, $cart_private, $cart_title)
{
if(!is_numeric($cart_id) || !is_int((int)$cart_id))
{
return false;
}
if(!is_bool($cart_private))
{
$cart_private = False;
}
$cart_date = czech_date_to_date($cart_date, True);
$query = "UPDATE carts SET cart_date = " . quote_smart($cart_date) .
", tfrom = " . quote_smart($cart_tfrom) .
", tto = " . quote_smart($cart_tto) .
", title = " . quote_smart($cart_title) .
", cart_private = " . ($cart_private ? "true" : "false") . " WHERE id = " . $cart_id;
mysql_query($query);
}
function admin_delete_old_cart()
{
$query = "DELETE FROM carts WHERE ADDDATE(DATE(cart_date), 3) < CURDATE()";
mysql_query($query);
$count = mysql_affected_rows();
if($count > 0)
{
echo "<div style=\"background: LightPink; border: 1px solid maroon; padding: 4px; width: 700px;text-align:center\">Bylo smazáno " . strval($count) . " starých položek</div>";
}
}
?>
ACC SHELL 2018