function aa_admin_import_page() { global $keyword, ${$selectedSearchIndex}, $itempage; $appid = get_option('dbaa_amazon_appid'); $coutryCode = get_option('dbaa_amazon_coutnrycode'); $secretKey = get_option('dbaa_amazon_secretkey'); $associatetag = get_option('dbaa_amazon_associatetag'); if ($appid == '' || $coutryCode == '' || $secretKey == '') { echo '<H2>Bitte gehen Sie zu den Einstellungen und geben Sie Ihre Daten zur Kommunikation mit der Amazon Api ein.</H2>'; } else { $defaultOptions = array('AssociateTag' => $associatetag, 'ResponseGroup' => 'Small, OfferFull, ItemAttributes, Images, Variations'); $amazon = new Zend_clicks_Service_Amazon($appid, $coutryCode, $secretKey); $itemResults = array(); if ($_REQUEST['action'] == 'search' && !empty($_POST['keyword']) && empty($_POST['asin'])) { $keyword = $_POST['keyword']; $selectedSearchIndex = $_POST['searchIndex']; $itempage = 1; $options = array('SearchIndex' => $selectedSearchIndex, 'Keywords' => $keyword, 'ItemPage' => $itempage); $options = array_merge($options, $defaultOptions); $itemResults = $amazon->itemSearch($options); } elseif ($_REQUEST['action'] == 'search' && empty($_POST['keyword']) && !empty($_POST['asin'])) { $asin = $_POST['asin']; $selectedSearchIndex = $_POST['searchIndex']; $itemResults = $amazon->itemLookup($asin, $defaultOptions); } elseif ($_REQUEST['action'] == 'back' && !empty($_POST['itempage']) || $_REQUEST['action'] == 'next' && !empty($_POST['itempage'])) { $keyword = $_POST['keyword']; $selectedSearchIndex = $_POST['searchIndex']; $itempage = $_POST['itempage']; $options = array('SearchIndex' => $selectedSearchIndex, 'Keywords' => $keyword, 'ItemPage' => $itempage); $options = array_merge($options, $defaultOptions); $itemResults = $amazon->itemSearch($options); } elseif ($_REQUEST['action'] == 'save' && !empty($_POST['title'])) { if (saveItem($_POST)) { echo '<div class="updated"><p><strong>Produkt erfolgreich importiert</strong></p></div>'; } } echo '<h2>Produkte importieren</h2>'; searchItem($keyword, $asin, $selectedSearchIndex, $itempage); // Suchformular einblenden; foreach ($itemResults as $result) { formatResult($result); } } }
public function saveList($list) { if ($list->id > 0) { //Update or delete if ($list->isDeleted == 1) { $this->dbAdapter->deleteList($list); $list = null; } else { $this->dbAdapter->updateList($list); } } else { //Insert $list->id = $this->dbAdapter->addList($list); } if ($list != null) { foreach ($list->items as $item) { saveItem($item); } } return $list; }
$sResponce = db_affected_rows(); break; case 'save_item': $id = (int) $_POST['id']; if (!$id) { $sResponce = echoMenuEditMsg('Error', 'red'); } else { $aItemFields = array('Name', 'Caption', 'Link', 'Target', 'Icon', 'Script'); $aItem = array(); foreach ($aItemFields as $field) { $aItem[$field] = isset($_POST[$field]) ? $_POST[$field] : null; } if (!$aItem['Icon']) { $aItem['Icon'] = 'member_menu_default.png'; } $res = saveItem($id, $aItem, $sMenuSection); updateLangFile($_POST['Caption'], $_POST['LangCaption']); $res['message'] = MsgBox($res['message']); $oJson = new Services_JSON(); echo $oJson->encode($res); exit; } break; case 'delete_item': $id = (int) $_POST['id']; if (!$id) { $sResponce = 'Item ID is not specified'; } else { $aItem = db_arr("SELECT `Deletable` FROM `sys_menu_member` WHERE `ID` = {$id}"); if (!$aItem) { $sResponce = 'Item not found';
} $aItemFields = array('Name', 'Caption', 'Icon', 'Link', 'Script', 'Target'); $aItem = array(); foreach ($aItemFields as $field) { $aItem[$field] = isset($_POST[$field]) ? $_POST[$field] : null; } $aVis = array(); if ((int) $_POST['Visible_non']) { $aVis[] = 'non'; } if ((int) $_POST['Visible_memb']) { $aVis[] = 'memb'; } $aItem['Visible'] = implode(',', $aVis); $aItem['Target'] = $_POST['Target'] == '_blank' ? '_blank' : ''; $aResult = saveItem($id, $aItem); updateLangFile($_POST['Caption'], $_POST['LangCaption']); $aResult['message'] = MsgBox($aResult['message']); echo json_encode($aResult); exit; break; case 'delete_item': $id = (int) $_POST['id']; if (!$id) { $sResponce = 'Item ID is not specified'; } else { $aItem = db_arr("SELECT `Deletable` FROM `" . $oMenu->sDbTable . "` WHERE `ID` = {$id}"); if (!$aItem) { $sResponce = 'Item not found'; } else { if (!(int) $aItem['Deletable']) {
$aItem = array(); foreach ($aItemFields as $field) { $aItem[$field] = $_POST[$field]; } $aVis = array(); if ((int) $_POST['Visible_non']) { $aVis[] = 'non'; } if ((int) $_POST['Visible_memb']) { $aVis[] = 'memb'; } if (isset($_POST['Url']) and isset($_POST['Num'])) { $aItem['Content'] = $_POST['Url'] . '#' . (int) $_POST['Num']; } $aItem['Visible'] = implode(',', $aVis); $res = saveItem($id, $aItem); updateLangFile($_POST['Caption'], $_POST['LangCaption']); echo $res; exit; case 'delete_item': $id = (int) $_GET['id']; echo deleteItem($id); exit; case 'save_orders': $sTop = $_GET['top']; $aCustom = $_GET['custom']; saveOrders($sTop, $aCustom); echo 'OK'; exit; case 'reset': $res = execSqlFile("{$site['url_admin']}builders_dfl/{$sTableName}.sql");
case 'createNewItem' == $sAction: createNewItem(); break; case 'savePositions' == $sAction: savePositions((int) bx_get('id')); break; case 'loadEditForm' == $sAction: header('Content-Type: text/html; charset=utf-8'); showEditForm((int) bx_get('id'), (int) bx_get('area')); break; case 'dummy' == $sAction: echo 'Dummy!'; break; case true == bx_get('action-save'): case 'Save' == $sAction: saveItem((int) bx_get('area'), $_POST); break; case true == bx_get('action-delete'): case 'Delete' == $sAction: deleteItem((int) bx_get('id'), (int) bx_get('area')); break; } function createNewBlock() { $oFields = new BxDolPFM(1); $iNewID = $oFields->createNewBlock(); header('Content-Type:text/javascript'); echo '{"id":' . $iNewID . '}'; } function createNewItem() {
break; case 'createNewItem': createNewItem(); break; case 'savePositions': savePositions((int) $_REQUEST['id']); break; case 'loadEditForm': showEditForm((int) $_REQUEST['id'], (int) $_REQUEST['area']); break; case 'dummy': echo 'Dummy!'; break; case 'Save': //save item saveItem((int) $_POST['area'], $_POST); break; case 'Delete': //delete item deleteItem((int) $_POST['id'], (int) $_POST['area']); break; } function createNewBlock() { $oFields = new BxDolPFM(1); $iNewID = $oFields->createNewBlock(); header('Content-Type:text/javascript'); echo '{id:' . $iNewID . '}'; } function createNewItem() {
$section = $_REQUEST['section']; $subsection = $_REQUEST['subsection']; $shelfset = $_REQUEST['shelfset']; $shelf = $_REQUEST['shelf']; $location = $_REQUEST['location']; switch ($_REQUEST['ajax']) { case 'get': $output = lookupItem($store, $section, $subsection, $shelfset, $shelf, $location); echo json_encode($output); break; case 'set': if (!isset($_REQUEST['upc']) || !is_numeric($_REQUEST['upc'])) { echo json_encode(array('errors' => 'invalid request')); return; } saveItem($store, $section, $subsection, $shelfset, $shelf, $location, $_REQUEST['upc']); $output = lookupItem($store, $section, $subsection, $shelfset, $shelf, $location + 1); echo json_encode($output); break; case 'default': echo json_encode(array('errors' => 'invalid request')); break; } return; } function lookupItem($store, $sec, $subsec, $sh_set, $shelf, $loc) { global $FANNIE_OP_DB; $dbc = FannieDB::get($FANNIE_OP_DB); $q = $dbc->prepare_statement("SELECT l.upc,p.description FROM prodPhysicalLocation AS l\n " . DTrans::joinProducts('l') . "\n WHERE l.store_id=? AND section=? AND subsection=?\n AND shelf_set=? AND shelf=? AND location=?"); $args = array($store, $sec, $subsec, $sh_set, $shelf, $loc);
function onEndTag($parser, $name) { global $currTag, $item, $itemsCount, $abort, $channelID, $channel, $image; if ($name == 'ITEM') { saveItem($item); ++$itemsCount; $item = null; } elseif ($name == 'IMAGE') { if (is_array($channel)) { $channel['image'] = $image; } $image = false; } elseif ($name == 'RSS') { if (!$abort) { cf\execQuery("UPDATE cf_rss_channel SET added_count=:count WHERE id=:id", array('id' => $channelID, 'count' => $itemsCount)); } } $currTag = null; }
$task = isset($_POST["task"]) ? $_POST["task"] : (isset($_GET["task"]) ? $_GET["task"] : ""); switch ($task) { case "selectAll": selectAll(); case "save": save(); case "delete": delete(); case "copy": copyBylaw(); //------------------------------ //------------------------------ case "selectAllItems": selectAllItems(); case "saveItem": saveItem(); case "deleteItem": deleteItem(); } function selectAll() { $where = "1=1"; $where .= dataReader::makeOrder(); $temp = management_extra_bylaw::GetAll($where); echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]); die; } function save() { $obj = new management_extra_bylaw(); PdoDataAccess::FillObjectByJsonData($obj, $_POST["record"]);
function analyzeItem($html, $yhd_cid) { $pattern = '/<img width="200" height="200".*?"(http:\\/\\/.*?)".*?alt="(.*?)"\\/>/'; if (preg_match($pattern, $html, $reg)) { $imgSrc = $reg[1]; $title = $reg[2]; } $pattern = '/<a class="search_prod_img".*?pmId="(\\d+)".*?href="(.*?)" /'; if (preg_match($pattern, $html, $reg)) { $yhdNumIID = $reg[1]; $link = $reg[2]; } saveItem($yhdNumIID, $title, $imgSrc, $link); saveCategory($yhdNumIID, $yhd_cid); }