protected function registerEItemsChanges($id_list) { if ($id_list == '') { return; } $result = mysql_query("SELECT GID FROM prodbinds WHERE PID IN ({$id_list})"); while ($row = mysql_fetch_row($result)) { $lastchange = new Kiwi_LastChange(array('eshopitems', $row[0]), 'j.n. Y - H:i'); $lastchange->register(); $lastchange = null; } }
protected function saveData() { $flds = array('title', 'code', 'shortdesc', 'longdesc', 'collection', 'original_cost', 'new_cost', 'ws_cost', 'photo', 'discount', 'sellout', 'action', 'novelty', 'exposed', 'active'); $ue = $this->rights->Admin || $this->rights->EShop['EditURLs']; if ($ue || !$this->id) { $flds[] = 'url'; $flds[] = 'htitle'; if ($this->auto || !$this->id && !$ue) { $this->generateURL(); $this->generateTitle(); } } foreach ($flds as $fld) { ${$fld} = mysql_real_escape_string($this->{$fld}); } if ($this->id) { $xp_sql = $photo ? ", Photo='{$photo}'" : ''; $ue_sql = $ue ? ", URL='{$url}', PageTitle='{$htitle}'" : ''; mysql_query("UPDATE products SET Title='{$title}', Code='{$code}', ShortDesc='{$shortdesc}'{$ue_sql}, LongDesc='{$longdesc}', Collection='{$collection}', OriginalCost='{$original_cost}', NewCost='{$new_cost}', WSCost='{$ws_cost}'{$xp_sql}, Discount='{$discount}', Sellout='{$sellout}', Action='{$action}', Novelty='{$novelty}', Exposed='{$exposed}', Active='{$active}', LastChange=CURRENT_TIMESTAMP WHERE ID={$this->id}"); mysql_query("UPDATE prodbinds SET LastChange=CURRENT_TIMESTAMP WHERE PID={$this->id}"); } elseif ($this->eshop_item) { $result = mysql_query("SELECT Count(ID) FROM eshop WHERE ID={$this->eshop_item} AND Subgroup=0"); $row = mysql_fetch_row($result); if ($row[0] != 1) { throw new Exception("Neplatná hodnota parametru \"ei\""); } $result = mysql_query("SELECT MAX(Priority) FROM prodbinds WHERE GID={$this->eshop_item}"); $row = mysql_fetch_row($result); $priority = (int) $row[0] + 1; if ($ue) { $ue_sql1 = ', URL, PageTitle'; $ue_sql2 = ",'{$url}', '{$htitle}'"; } else { $ue_sql1 = $ue_sql2 = ''; } mysql_query("INSERT INTO products(Title, Code, ShortDesc{$ue_sql1}, LongDesc, Collection, OriginalCost, NewCost, WSCost, Photo, Discount, Sellout, Action, Novelty, Exposed, Active) VALUES ('{$title}', '{$code}', '{$shortdesc}'{$ue_sql2}, '{$longdesc}', '{$collection}', {$original_cost}, {$new_cost}, {$ws_cost}, '{$photo}', {$discount}, {$sellout}, {$action}, {$novelty}, {$exposed}, {$active})"); $this->id = mysql_insert_id(); mysql_query("INSERT INTO prodbinds(PID, GID, Priority) VALUES ({$this->id}, {$this->eshop_item}, {$priority})"); $mi_lastchange = new Kiwi_LastChange(array('eshopitems', $this->eshop_item)); $mi_lastchange->register(); $mi_lastchange = null; } else { if ($ue) { $ue_sql1 = ', URL, PageTitle'; $ue_sql2 = ",'{$url}', '{$htitle}'"; } else { $ue_sql1 = $ue_sql2 = ''; } mysql_query("INSERT INTO products(Title, Code, ShortDesc{$ue_sql1}, LongDesc, Collection, OriginalCost, NewCost, WSCost, Photo, Discount, Sellout, Action, Novelty, Exposed, Active) VALUES ('{$title}', '{$code}', '{$shortdesc}'{$ue_sql2}, '{$longdesc}', '{$collection}', {$original_cost}, {$new_cost}, {$ws_cost}, '{$photo}', {$discount}, {$sellout}, {$action}, {$novelty}, {$exposed}, {$active})"); $this->id = mysql_insert_id(); } if (array_key_exists('new', $this->photo_extra)) { $filename = mysql_real_escape_string($this->photo_extra['new']['FileName']); mysql_query("INSERT INTO prodepics(PID, FileName) VALUES ({$this->id}, '{$filename}')"); } if (array_key_exists('new', $this->photo_illustrative)) { $filename = mysql_real_escape_string($this->photo_illustrative['new']['FileName']); mysql_query("INSERT INTO prodipics(PID, FileName) VALUES ({$this->id}, '{$filename}')"); } }
protected function saveData() { $name = mysql_real_escape_string($this->name); $count = (int) $this->perpage; $showpages = $this->showpages ? 1 : 0; $detaillink = mysql_real_escape_string($this->detaillink); $type = MODT_NEWS; if ($this->id) { mysql_query("UPDATE modules SET Name='{$name}', LastChange=CURRENT_TIMESTAMP WHERE ID={$this->id}"); mysql_query("UPDATE mod_news SET NGID={$this->ngid}, Count={$count}, ListMode='{$this->listmode}', ShowPages={$showpages}, DetailLink='{$detaillink}' WHERE ID={$this->id}"); mysql_query("UPDATE modbinds SET LastChange=CURRENT_TIMESTAMP WHERE ModID={$this->id}"); } elseif ($this->menu_item) { $result = mysql_query("SELECT Count(ID) FROM menuitems WHERE ID={$this->menu_item} AND Submenu=0"); $row = mysql_fetch_row($result); if ($row[0] != 1) { throw new Exception("Neplatná hodnota parametru \"mi\""); } $result = mysql_query("SELECT MAX(Priority) FROM modbinds WHERE MIID={$this->menu_item}"); $row = mysql_fetch_row($result); $priority = (int) $row[0] + 1; mysql_query("INSERT INTO modules(Name, Type) VALUES ('{$name}', {$type})"); $this->id = mysql_insert_id(); mysql_query("INSERT INTO mod_news(ID, NGID, Count, ListMode, ShowPages, DetailLink) VALUES ({$this->id}, {$this->ngid}, {$count}, '{$this->listmode}', {$showpages}, '{$detaillink}')"); mysql_query("INSERT INTO modbinds(ModID, MIID, Priority) VALUES ({$this->id}, {$this->menu_item}, {$priority})"); $mi_lastchange = new Kiwi_LastChange(array('menuitems', $this->menu_item)); $mi_lastchange->register(); $mi_lastchange = null; $qs = "?m={$this->id}"; $this->redirection = KIWI_EDIT_MODULE . $qs; } else { mysql_query("INSERT INTO modules(Name, Type) VALUES ('{$name}', {$type})"); $this->id = mysql_insert_id(); mysql_query("INSERT INTO mod_news(ID, NGID, Count, ListMode, ShowPages, DetailLink) VALUES ({$this->id}, {$this->ngid}, {$count}, '{$this->listmode}', {$showpages}, '{$detaillink}')"); $qs = "?m={$this->id}"; $this->redirection = KIWI_EDIT_MODULE . $qs; } }
protected function saveData() { $name = mysql_real_escape_string($this->name); $content = mysql_real_escape_string($this->content); $type = MODT_TEXT; if ($this->id) { mysql_query("UPDATE modules SET Name='{$name}', LastChange=CURRENT_TIMESTAMP WHERE ID={$this->id}"); mysql_query("UPDATE mod_text SET Content='{$content}' WHERE ID={$this->id}"); mysql_query("UPDATE modbinds SET LastChange=CURRENT_TIMESTAMP WHERE ModID={$this->id}"); } elseif ($this->menu_item) { $result = mysql_query("SELECT Count(ID) FROM menuitems WHERE ID={$this->menu_item} AND Submenu=0"); $row = mysql_fetch_row($result); if ($row[0] != 1) { throw new Exception("Neplatná hodnota parametru \"mi\""); } $result = mysql_query("SELECT MAX(Priority) FROM modbinds WHERE MIID={$this->menu_item}"); $row = mysql_fetch_row($result); $priority = (int) $row[0] + 1; mysql_query("INSERT INTO modules(Name, Type) VALUES ('{$name}', {$type})"); $this->id = mysql_insert_id(); mysql_query("INSERT INTO mod_text(ID, Content) VALUES ({$this->id}, '{$content}')"); mysql_query("INSERT INTO modbinds(ModID, MIID, Priority) VALUES ({$this->id}, {$this->menu_item}, {$priority})"); $mi_lastchange = new Kiwi_LastChange(array('menuitems', $this->menu_item)); $mi_lastchange->register(); $mi_lastchange = null; $qs = "?m={$this->id}"; $this->redirection = KIWI_EDIT_MODULE . $qs; } else { mysql_query("INSERT INTO modules(Name, Type) VALUES ('{$name}', {$type})"); $this->id = mysql_insert_id(); mysql_query("INSERT INTO mod_text(ID, Content) VALUES ({$this->id}, '{$content}')"); $qs = "?m={$this->id}"; $this->redirection = KIWI_EDIT_MODULE . $qs; } }