summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-01-07 22:43:03 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-01-07 22:43:03 +0000
commit86d9c9e82f10c2c89a58ed3785c6b00a1bf5bc85 (patch)
tree5b0c805e979c6d369e518fcbe11b0221f8c6f69a /frontends/php
parent254ac7ebef85b8e1230d8979afa4d117234f8d58 (diff)
downloadzabbix-86d9c9e82f10c2c89a58ed3785c6b00a1bf5bc85.tar.gz
zabbix-86d9c9e82f10c2c89a58ed3785c6b00a1bf5bc85.tar.xz
zabbix-86d9c9e82f10c2c89a58ed3785c6b00a1bf5bc85.zip
Finished form for image management.
git-svn-id: svn://svn.zabbix.com/trunk@1590 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/config.php11
-rw-r--r--frontends/php/include/config.inc.php32
-rw-r--r--frontends/php/include/local_en.inc.php4
3 files changed, 44 insertions, 3 deletions
diff --git a/frontends/php/config.php b/frontends/php/config.php
index f4876d4e..86f62cf1 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -46,8 +46,8 @@
{
if($_POST["register"]=="add image")
{
- $result=add_image($_POST["imageid"]);
- show_messages($result, S_IMAGE_DELETED, S_CANNOT_DELETE_IMAGE);
+ $result=add_image($_POST["name"],$_POST["imagetype"],$_FILES);
+ show_messages($result, S_IMAGE_ADDED, S_CANNOT_ADD_IMAGE);
if($result)
{
add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,"Image deleted");
@@ -211,6 +211,7 @@
$row=DBfetch($result);
$name=$row["name"];
$imagetype=$row["imagetype"];
+ $imageid=$row["imageid"];
}
$col=0;
@@ -222,6 +223,10 @@
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"config.php\">";
echo "<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".(1024*1024)."\">";
echo "<input class=\"biginput\" name=\"config\" type=\"hidden\" value=\"3\" size=8>";
+ if(isset($imageid))
+ {
+ echo "<input class=\"biginput\" name=\"imageid\" type=\"hidden\" value=\"$imageid\" size=8>";
+ }
echo nbsp(S_NAME);
show_table2_h_delimiter();
echo "<input class=\"biginput\" name=\"name\" value=\"".$name."\" size=64>";
@@ -245,7 +250,7 @@
show_table2_v_delimiter($col++);
echo S_UPLOAD;
show_table2_h_delimiter();
- echo "<input class=\"biginput\" name=\"file\" type=\"file\">";
+ echo "<input class=\"biginput\" name=\"image\" type=\"file\">";
show_table2_v_delimiter2();
echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"add image\">";
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 1060655f..4aa07b0f 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -2354,6 +2354,38 @@ echo "</head>";
}
+ function add_image($name,$imagetype,$files)
+ {
+ global $ERROR_MSG;
+
+ if(isset($files))
+ {
+ if($files["image"]["error"]==0)
+ if($files["image"]["size"]<1024*1024)
+ {
+ $image=addslashes(fread(fopen($files["image"]["tmp_name"],"r"),filesize($files["image"]["tmp_name"])));
+ $sql="insert into images (name,imagetype,image) values ('$name',$imagetype,'$image')";
+ return DBexecute($sql);
+ }
+ else
+ {
+ $ERROR_MSG="Image size must be less than 1Mb";
+ return FALSE;
+ }
+ }
+ else
+ {
+ $ERROR_MSG="Select image to download";
+ return FALSE;
+ }
+ }
+
+ function delete_image($imageid)
+ {
+ $sql="delete from images where imageid=$imageid";
+ return DBexecute($sql);
+ }
+
function add_service_link($servicedownid,$serviceupid,$softlink)
{
global $ERROR_MSG;
diff --git a/frontends/php/include/local_en.inc.php b/frontends/php/include/local_en.inc.php
index a3ae3ea4..4c2a3c89 100644
--- a/frontends/php/include/local_en.inc.php
+++ b/frontends/php/include/local_en.inc.php
@@ -172,6 +172,10 @@
define("S_NO_IMAGES_DEFINED", "No images defined");
define("S_BACKGROUND", "Background");
define("S_UPLOAD", "Upload");
+ define("S_IMAGE_ADDED", "Image added");
+ define("S_CANNOT_ADD_IMAGE", "Cannot add image");
+ define("S_IMAGE_DELETED", "Image deleted");
+ define("S_CANNOT_DELETE_IMAGE", "Cannot delete image");
// Latest values
define("S_LATEST_VALUES", "Latest values");