[Jaws-project-commits] jaws/html/gadgets/Banner Banner.php,1.22,1.23 BannerModel.php,1.9,1.10
Status: Alpha
Brought to you by:
ionmx
|
From: Pablo F. <pab...@us...> - 2005-03-17 07:26:12
|
Update of /cvsroot/jaws-project/jaws/html/gadgets/Banner In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16590 Modified Files: Banner.php BannerModel.php Log Message: Done! Compatible with jaws 0.5: * Debug done * Translation done * Errors are handled by JawsError Index: BannerModel.php =================================================================== RCS file: /cvsroot/jaws-project/jaws/html/gadgets/Banner/BannerModel.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BannerModel.php 17 Mar 2005 01:04:13 -0000 1.9 --- BannerModel.php 17 Mar 2005 07:26:01 -0000 1.10 *************** *** 36,40 **** } else if (!is_writable ($GLOBALS["path"]."/data/banners")) ! return new JawsError (_t("_GLOBAL_ERROR_FAILED_CREATING_DIR", $GLOBALS["path"]."/data/banners")); } else { return new JawsError (_t("_GLOBAL_ERROR_FAILED_DIRECTORY_UNWRITABLE", $GLOBALS["path"])); --- 36,40 ---- } else if (!is_writable ($GLOBALS["path"]."/data/banners")) ! return new JawsError (_t("_GLOBAL_ERROR_FAILED_CREATING_DIR", $GLOBALS["path"]."/data/banners"), _t("_BANNER_NAME")); } else { return new JawsError (_t("_GLOBAL_ERROR_FAILED_DIRECTORY_UNWRITABLE", $GLOBALS["path"])); *************** *** 42,46 **** if (!file_exists ($GLOBALS["path"]."gadgets/Banner/sql/".$GLOBALS["app"]->DB->GetDriverName().".sql")) ! return new JawsError (_t("_GLOBAL_ERROR_SQLFILE_NOT_EXISTS", $GLOBALS["app"]->DB->GetDriverName().".sql")); // Execute the sql file --- 42,46 ---- if (!file_exists ($GLOBALS["path"]."gadgets/Banner/sql/".$GLOBALS["app"]->DB->GetDriverName().".sql")) ! return new JawsError (_t("_GLOBAL_ERROR_SQLFILE_NOT_EXISTS", $GLOBALS["app"]->DB->GetDriverName().".sql"), _t("_BANNER_NAME")); // Execute the sql file *************** *** 49,57 **** if (!trim($q) == '') if(!$GLOBALS["app"]->DB->Execute ($q)) ! return new JawsError (_t("_GLOBAL_ERROR_FAILED_QUERY_FILE", $GLOBALS["app"]->DB->GetDriverName().".sql")); //registry keys. if (!$GLOBALS["app"]->Registry->NewKey ("/gadgets/Banner/limit_random", "5")) ! return new JawsError (_t("_GLOBAL_ERROR_FAILED_ADDING_REGISTRY_KEY", "/gadgets/Banner/limit_random")); --- 49,57 ---- if (!trim($q) == '') if(!$GLOBALS["app"]->DB->Execute ($q)) ! return new JawsError (_t("_GLOBAL_ERROR_FAILED_QUERY_FILE", $GLOBALS["app"]->DB->GetDriverName().".sql"), _t("_BANNER_NAME")); //registry keys. if (!$GLOBALS["app"]->Registry->NewKey ("/gadgets/Banner/limit_random", "5")) ! return new JawsError (_t("_GLOBAL_ERROR_FAILED_ADDING_REGISTRY_KEY", "/gadgets/Banner/limit_random"), _t("_BANNER_NAME")); *************** *** 84,94 **** array ("id" => $id)); ! if ($rs) ! if (isset ($rs["id"])) ! return $rs->FetchRow (); else ! return new JawsError (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS")); ! else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetBanner")); } --- 84,96 ---- array ("id" => $id)); ! if ($rs) { ! $row = $rs->FetchRow (); ! if (isset ($row["id"])) ! return $row; else ! return new JawsError (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS"), _t("_BANNER_NAME")); ! } else { ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetBanner"), _t("_BANNER_NAME")); ! } } *************** *** 110,114 **** return $rs->GetRows (); else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetBanners")); } --- 112,116 ---- return $rs->GetRows (); else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetBanners"), _t("_BANNER_NAME")); } *************** *** 131,135 **** return $rs->GetRows (); else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetVisibleBanners")); } --- 133,137 ---- return $rs->GetRows (); else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetVisibleBanners"), _t("_BANNER_NAME")); } *************** *** 154,177 **** return $rs->GetRows (); else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetRandomBanners")); } /** - * Set the properties of the banner - * - * @access public - * @param int $limit Limit of the banner - * @return boolean True if change was successful, otherwise returns a JawsError - */ - function SetLimit ($limit) - { - $ret = $GLOBALS["app"]->Registry->Set("/gadgets/Banner/limit_random", $limit); - if ($ret) - true; - else - return new JawsError (_t("_BANNER_PROPERTIES_NOT_UPDATED")); - } - - /** * Create a new banner * --- 156,163 ---- return $rs->GetRows (); else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "GetRandomBanners"), _t("_BANNER_NAME")); } /** * Create a new banner * *************** *** 191,195 **** // echo $e; if (!eregi (".*(\.jpg|\.gif|\.swf|\.png|\.jpeg)", strtolower ($filename))) ! return new JawsError (_t("_BANNER_ERROR_IMAGE_BAD_FORMAT")); if (move_uploaded_file ($filename_tmp, $uploadfile)) { $sql = "INSERT INTO [[banner]] --- 177,181 ---- // echo $e; if (!eregi (".*(\.jpg|\.gif|\.swf|\.png|\.jpeg)", strtolower ($filename))) ! return new JawsError (_t("_BANNER_ERROR_IMAGE_BAD_FORMAT"), _t("_BANNER_NAME")); if (move_uploaded_file ($filename_tmp, $uploadfile)) { $sql = "INSERT INTO [[banner]] *************** *** 203,213 **** "display" => $display)); } else { return new JawsError (_t("_BANNER_ERROR_IMAGE_CANT_UPLOAD", $filename)); } ! if ($rs) return true; ! else ! return new JawsError (_t("_BANNER_ERROR_NOT_ADDED")); } --- 189,203 ---- "display" => $display)); } else { + $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_IMAGE_CANT_UPLOAD", $filename), RESPONSE_ERROR); return new JawsError (_t("_BANNER_ERROR_IMAGE_CANT_UPLOAD", $filename)); } ! if ($rs) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ADDED"), RESPONSE_NOTICE); return true; ! } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_NOT_ADDED"), RESPONSE_ERROR); ! return new JawsError (_t("_BANNER_ERROR_NOT_ADDED"), _t("_BANNER_NAME")); ! } } *************** *** 229,233 **** array ("id" => $id)); if ($row = $rs->FetchRow ()) { ! if (isset($row["id"])) { $sql2 = "DELETE FROM [[banner]] WHERE --- 219,223 ---- array ("id" => $id)); if ($row = $rs->FetchRow ()) { ! if (isset($row["image"])) { $sql2 = "DELETE FROM [[banner]] WHERE *************** *** 237,252 **** if ($rs2) { $unlink = @unlink ($GLOBALS["path"]."data/banners/".$row["image"]); ! if ($unlink) return true; ! else return new JawsError (_t("_BANNER_ERROR_CANT_DELETE", $row["image"])); } else { ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "DeleteBanner")); } } else { ! return new JawsError (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS")); } } else { ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "DeleteBanner")); } } --- 227,248 ---- if ($rs2) { $unlink = @unlink ($GLOBALS["path"]."data/banners/".$row["image"]); ! if ($unlink) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_DELETED"), RESPONSE_NOTICE); return true; ! } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_CANT_DELETE", $row["image"]), RESPONSE_ERROR); return new JawsError (_t("_BANNER_ERROR_CANT_DELETE", $row["image"])); + } } else { ! $GLOBALS["session"]->PushLastResponse (_t("_GLOBAL_ERROR_QUERY_FAILED", "DeleteBanner"), RESPONSE_ERROR); ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "DeleteBanner"), _t("_BANNER_NAME")); } } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS"), RESPONSE_ERROR); ! return new JawsError (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS"), _t("_BANNER_NAME")); } } else { ! $GLOBALS["session"]->PushLastResponse (_t("_GLOBAL_ERROR_QUERY_FAILED", "DeleteBanner"), RESPONSE_ERROR); ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "DeleteBanner"), _t("_BANNER_NAME")); } } *************** *** 274,287 **** FROM [[banner]] WHERE ! id= {id}"; $rs = $GLOBALS["app"]->DB->Execute ($sql, array ("id" => $id)); if ($row = $rs->FetchRow ()) { ! if (isset ($row["image"])) $old_image = $row["image"]; ! else ! return new JawsError (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS")); } else { ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "UpdateBanner")); } } --- 270,286 ---- FROM [[banner]] WHERE ! id={id}"; $rs = $GLOBALS["app"]->DB->Execute ($sql, array ("id" => $id)); if ($row = $rs->FetchRow ()) { ! if (isset ($row["image"])) { $old_image = $row["image"]; ! } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS"), RESPONSE_ERROR); ! return new JawsError (_t("_BANNER_ERROR_BANNER_DOES_NOT_EXISTS"), _t("_BANNER_NAME")); ! } } else { ! $GLOBALS["session"]->PushLastResponse (_t("_GLOBAL_ERROR_QUERY_FAILED", "UpdateBanner"), RESPONSE_ERROR); ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "UpdateBanner"), _t("_BANNER_NAME")); } } *************** *** 290,303 **** $uploadfile = $uploaddir.$filename; if (!eregi (".*(\.jpg|\.gif|\.swf|\.png|\.jpeg)", strtolower ($filename))) ! return new JawsError (_t("_BANNER_ERROR_IMAGE_BAD_FORMAT")); if (move_uploaded_file ($filename_tmp, $uploadfile)) { // Don't abort if the old image couldn't be unlinked, just log a warning. if (($old_image != $uploadfile)) { ! $unlink = @unlink ($GLOBALS['path'].$old_image); ! if (!$unlink) ! return new JawsError (_t("_BANNER_ERROR_CANT_UPLOAD", $old_image)); } } else { ! return new JawsError (_t("_BANNER_ERROR_IMAGE_CANT_UPLOAD", $filename)); } } else { --- 289,305 ---- $uploadfile = $uploaddir.$filename; if (!eregi (".*(\.jpg|\.gif|\.swf|\.png|\.jpeg)", strtolower ($filename))) ! return new JawsError (_t("_BANNER_ERROR_IMAGE_BAD_FORMAT"), _t("_BANNER_NAME")); if (move_uploaded_file ($filename_tmp, $uploadfile)) { // Don't abort if the old image couldn't be unlinked, just log a warning. if (($old_image != $uploadfile)) { ! $unlink = @unlink ($GLOBALS['path']."data/banners/".$old_image); ! if (!$unlink) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_CANT_DELETE_OLD", $old_image), RESPONSE_ERROR); ! return new JawsError (_t("_BANNER_ERROR_CANT_DELETE_OLD", $old_image)); ! } } } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_CANT_UPLOAD", $filename), RESPONSE_ERROR); ! return new JawsError (_t("_BANNER_ERROR_CANT_UPLOAD", $filename)); } } else { *************** *** 321,328 **** "visible" => $display, "id" => $id)); ! if ($rs) ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "UpdateBanner")); ! else return true; } --- 323,333 ---- "visible" => $display, "id" => $id)); ! if (!$rs) { ! $GLOBALS["session"]->PushLastResponse (_t("_GLOBAL_ERROR_QUERY_FAILED", "UpdateBanner"), RESPONSE_ERROR); ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "UpdateBanner"), _t("_BANNER_NAME")); ! } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_UPDATED"), RESPONSE_NOTICE); return true; + } } *************** *** 343,347 **** return true; else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "Click")); } --- 348,352 ---- return true; else ! return new JawsError (_t("_GLOBAL_ERROR_QUERY_FAILED", "Click"), _t("_BANNER_NAME")); } *************** *** 355,362 **** function UpdateProperties ($limit) { ! if ($GLOBALS["app"]->Registry->Set ("/gadgets/Banner/limit_random", $limit)) return true; ! else ! return new JawsError (_t("_BANNER_ERROR_PROPERTIES_NOT_UPDATED")); } --- 360,371 ---- function UpdateProperties ($limit) { ! $res = $GLOBALS["app"]->Registry->Set ("/gadgets/Banner/limit_random", $limit); ! if (!JawsError::IsError ($res) || $res) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_PROPERTIES_UPDATED"), RESPONSE_NOTICE); return true; ! } else { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ERROR_PROPERTIES_NOT_UPDATED"), RESPONSE_ERROR); ! return new JawsError (_t("_BANNER_ERROR_PROPERTIES_NOT_UPDATED"), _t("_BANNER_NAME")); ! } } *************** *** 371,375 **** { if (strlen(trim($match)) < 3) ! return new JawsError (_t("_BANNER_ERROR_CANT_SEARCH_LENGTH")); $sql = "SELECT id, url, title, image, updatetime FROM [[banner]] WHERE"; --- 380,384 ---- { if (strlen(trim($match)) < 3) ! return new JawsError (_t("_BANNER_ERROR_CANT_SEARCH_LENGTH"), _t("_BANNER_NAME")); $sql = "SELECT id, url, title, image, updatetime FROM [[banner]] WHERE"; Index: Banner.php =================================================================== RCS file: /cvsroot/jaws-project/jaws/html/gadgets/Banner/Banner.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Banner.php 17 Mar 2005 01:04:13 -0000 1.22 --- Banner.php 17 Mar 2005 07:26:01 -0000 1.23 *************** *** 90,96 **** } } ! } else { ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$banners->GetMessage(), ""); ! } $banners = $this->_Model->GetRandomBanners(); --- 90,94 ---- } } ! } $banners = $this->_Model->GetRandomBanners(); *************** *** 112,117 **** } } - } else { - $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$banners->GetMessage(), ""); } return $tpl->Get(); --- 110,113 ---- *************** *** 128,138 **** if (!JawsError::IsError ($banner)) { $click = $this->_Model->Click ($banner["id"]); ! if (JawsError::IsError ($click)) ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$click->GetMessage(), ""); ! else JawsHeader::Location ($banner["url"]); ! } else { ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$banner->GetMessage(), ""); ! } //by default, redirect to mainpage JawsHeader::Location ("index.php"); --- 124,130 ---- if (!JawsError::IsError ($banner)) { $click = $this->_Model->Click ($banner["id"]); ! if (!JawsError::IsError ($click)) JawsHeader::Location ($banner["url"]); ! } //by default, redirect to mainpage JawsHeader::Location ("index.php"); *************** *** 210,216 **** STOCK_DELETE)); $tpl->SetVariable ("grid", $datagrid->Get ()); ! } else { ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$banners->GetMessage(), ""); ! } ///Config properties --- 202,206 ---- STOCK_DELETE)); $tpl->SetVariable ("grid", $datagrid->Get ()); ! } ///Config properties *************** *** 230,234 **** } ! $limitcombo->SetDefault ($GLOBALS["app"]->Registry->Get("/gadgets/Banner/limit_random")); $fieldset_config->Add ($limitcombo); --- 220,228 ---- } ! $limit = $GLOBALS["app"]->Registry->Get("/gadgets/Banner/limit_random"); ! ! if (JawsError::IsError ($limit) || !$limit) ! $limit = 10; ! $limitcombo->SetDefault ($limit); $fieldset_config->Add ($limitcombo); *************** *** 257,260 **** --- 251,256 ---- $banner_form->Add (new HiddenEntry ("id", $_GET["id"])); $banner = $this->_Model->GetBanner ($_GET["id"]); + if (JawsError::IsError ($banner)) + $banner = array (); } *************** *** 262,274 **** $fieldset_banner->SetDirection ("vertical"); ! $titleentry = new Entry ("title", $banner["title"]); $titleentry->SetTitle (_t("_GLOBAL_NAME")); $fieldset_banner->Add ($titleentry); ! $urlentry = new Entry ("url", $banner["url"]); $urlentry->SetTitle (_t("_GLOBAL_URL")); $fieldset_banner->Add ($urlentry); ! $imageentry = new FileEntry ("image", $banner["image"]); $imageentry->SetTitle (_t("_GLOBAL_FILE")); $fieldset_banner->Add ($imageentry); --- 258,270 ---- $fieldset_banner->SetDirection ("vertical"); ! $titleentry = new Entry ("title", (isset ($banner["title"]) ? $banner["title"] : "")); $titleentry->SetTitle (_t("_GLOBAL_NAME")); $fieldset_banner->Add ($titleentry); ! $urlentry = new Entry ("url", (isset ($banner["url"]) ? $banner["url"] : "")); $urlentry->SetTitle (_t("_GLOBAL_URL")); $fieldset_banner->Add ($urlentry); ! $imageentry = new FileEntry ("image", (isset ($banner["image"]) ? $banner["image"] : "")); $imageentry->SetTitle (_t("_GLOBAL_FILE")); $fieldset_banner->Add ($imageentry); *************** *** 279,284 **** $checkvisible->AddOption (_t("_GLOBAL_NO"), "0"); ! if ($banner["always_visible"] == 0) ! $checkvisible->SetDefault ("0"); else $checkvisible->SetDefault ("1"); --- 275,283 ---- $checkvisible->AddOption (_t("_GLOBAL_NO"), "0"); ! if (isset ($banner["always_visible"])) ! if ($banner["always_visible"] == 0) ! $checkvisible->SetDefault ("0"); ! else ! $checkvisible->SetDefault ("1"); else $checkvisible->SetDefault ("1"); *************** *** 313,317 **** $warning->ParseBlock ("warning"); $tpl->SetVariable ("banner_form", $warning->Get ()); - $GLOBALS["log"]->Log (JAWS_LOG_WARNING, _t("_BANNER_NAME").": "._t("_BANNER_NOTWRITABLE"), ""); } } --- 312,315 ---- *************** *** 348,372 **** { $GLOBALS["session"]->CheckPermission ("Banner", "EditBanner"); ! if ($_FILES["image"]["name"] == '') { ! $update = $this->_Model->UpdateBanner ($_REQUEST["id"], $_REQUEST["url"], $_REQUEST["title"], ! $_REQUEST["allways_visible"]); ! if (!JawsError::IsError ($update)) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_UPDATED"), RESPONSE_NOTICE); ! } else { ! $GLOBALS["session"]->PushLastResponse ($update->GetMessage(), RESPONSE_ERROR); ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$update->GetMessage(), ""); ! } ! } else { ! $update = $this->_Model->UpdateBanner ($_REQUEST["id"], $_REQUEST["url"], $_REQUEST["title"], ! $_REQUEST["allways_visible"], ! $_FILES["image"]["name"], $_FILES["image"]["tmp_name"]); ! if (!JawsError::IsError ($update)) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_UPDATED"), RESPONSE_NOTICE); ! } else { ! $GLOBALS["session"]->PushLastResponse ($update->GetMessage(), RESPONSE_ERROR); ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$update->GetMessage(), ""); ! } ! } ! JawsHeader::Location ("admin.php?gadget=Banner"); } --- 346,358 ---- { $GLOBALS["session"]->CheckPermission ("Banner", "EditBanner"); ! if ($_FILES["image"]["name"] == '') ! $this->_Model->UpdateBanner ($_REQUEST["id"], $_REQUEST["url"], $_REQUEST["title"], ! $_REQUEST["allways_visible"]); ! ! else ! $this->_Model->UpdateBanner ($_REQUEST["id"], $_REQUEST["url"], $_REQUEST["title"], ! $_REQUEST["allways_visible"], ! $_FILES["image"]["name"], $_FILES["image"]["tmp_name"]); ! JawsHeader::Location ("admin.php?gadget=Banner&action=Admin"); } *************** *** 379,392 **** { $GLOBALS["session"]->CheckPermission ("Banner", "AddBanner"); ! $res = $this->_Model->NewBanner ($_REQUEST["url"], $_REQUEST["title"], ! $_REQUEST["allways_visible"], ! $_FILES["image"]["name"], $_FILES["image"]["tmp_name"]); ! if (!JawsError::IsError ($res)) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_ADDED"), RESPONSE_NOTICE); ! } else { ! $GLOBALS["session"]->PushLastResponse ($res->GetMessage(), RESPONSE_ERROR); ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$res->GetMessage(), ""); ! } ! JawsHeader::Location ("admin.php?gadget=Banner"); } --- 365,372 ---- { $GLOBALS["session"]->CheckPermission ("Banner", "AddBanner"); ! $this->_Model->NewBanner ($_REQUEST["url"], $_REQUEST["title"], ! $_REQUEST["allways_visible"], ! $_FILES["image"]["name"], $_FILES["image"]["tmp_name"]); ! JawsHeader::Location ("admin.php?gadget=Banner&action=Admin"); } *************** *** 399,410 **** { $GLOBALS["session"]->CheckPermission ("Banner", "DeleteBanner"); ! $res = $this->_Model->DeleteBanner ($_REQUEST['id']); ! if (!JawsError::IsError ($res)) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_DELETED"), RESPONSE_NOTICE); ! } else { ! $GLOBALS["session"]->PushLastResponse ($res->GetMessage(), RESPONSE_ERROR); ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$res->GetMessage(), ""); ! } ! JawsHeader::Location ("admin.php?gadget=Banner"); } --- 379,384 ---- { $GLOBALS["session"]->CheckPermission ("Banner", "DeleteBanner"); ! $this->_Model->DeleteBanner ($_REQUEST['id']); ! JawsHeader::Location ("admin.php?gadget=Banner&action=Admin"); } *************** *** 417,428 **** { $GLOBALS["session"]->CheckPermission ("Banner", "UpdateProperties"); ! $res = $this->_Model->UpdateProperties ($_POST["limit_random"]); ! if (!JawsError::IsError ($res)) { ! $GLOBALS["session"]->PushLastResponse (_t("_BANNER_PROPERTIES_UPDATED"), RESPONSE_NOTICE); ! } else { ! $GLOBALS["session"]->PushLastResponse ($res->GetMessage(), RESPONSE_ERROR); ! $GLOBALS["log"]->Log (JAWS_LOG_ERR, _t("_BANNER_NAME").": ".$res->GetMessage(), ""); ! } ! JawsHeader::Location ("admin.php?gadget=Banner"); } } --- 391,396 ---- { $GLOBALS["session"]->CheckPermission ("Banner", "UpdateProperties"); ! $this->_Model->UpdateProperties ($_POST["limit_random"]); ! JawsHeader::Location ("admin.php?gadget=Banner&action=Admin"); } } |