public static function SaveCard() { Funcs::escapePost(); $tree = array('name' => $_SESSION['card']['title']); $id = Tree::addTree(100, $tree, 'cards'); $sql = ' INSERT INTO {{catalog}} SET tree=' . $id . ', description=\'' . $_SESSION['card']['message'] . '\', price=' . $_SESSION['card']['price'] . ', vendor=' . $_SESSION['iuser']['id'] . ' '; DB::exec($sql); $mrh_login = Cards::$mrh_login; $mrh_pass1 = Cards::$mrh_pass1; $inv_id = $id; $_SESSION['card']['id'] = $id; $out_summ = $_SESSION['card']['price']; $shp_item = Cards::$shp_item; $inv_desc = "Подарочная карта, на сумму " . $_SESSION['card']['price']; $in_curr = ""; $culture = "ru"; $encoding = "utf-8"; $crc = md5("{$mrh_login}:{$out_summ}:{$inv_id}:{$mrh_pass1}:Shp_item={$shp_item}"); /*print "<html><script language=JavaScript ". "src='https://merchant.roboxchange.com/Handler/MrchSumPreview.ashx?". "MrchLogin=$mrh_login&OutSum=$out_summ&InvId=$inv_id&IncCurrLabel=$in_curr". "&Desc=$inv_desc&SignatureValue=$crc&Shp_item=$shp_item". "&Culture=$culture&Encoding=$encoding'></script></html>";*/ print "<html><script>" . "document.location.href='http://test.robokassa.ru/index.aspx?" . "MrchLogin={$mrh_login}&OutSum={$out_summ}&InvId={$inv_id}&IncCurrLabel={$in_curr}" . "&Desc={$inv_desc}&SignatureValue={$crc}&Shp_item={$shp_item}" . "&Culture={$culture}&Encoding={$encoding}';</script></html>"; }
public function add() { $model = new Tree(); if (count(Index::getModuleList()) == 0) { Module::createPageContent(); } $model->addTree(); $this->redirect('/'); }
public function add() { $module = Module::getModuleById($_POST['module']); if (!is_numeric($_POST['tree'])) { $tree = Tree::addTree(); } else { $tree = Tree::editTree($_POST['tree']); } if ($_POST['id'] != '0') { $sql = ' INSERT INTO {{catalog}} SET tree=' . $tree . ' '; $dataId = DB::exec($sql); $sql = 'SELECT path FROM {{modules}} WHERE id=' . $module['catalog']; $moduleCtatalog = DB::getOne($sql); if ($moduleCtatalog) { $sql = ' INSERT INTO {{relations}} SET modul1=\'tree\', modul2=\'' . $moduleCtatalog . '\', id1=\'' . $tree . '\', id2=0, cdate=NOW() '; DB::exec($sql); } } else { $dataId = 0; } $sql = ' INSERT INTO {{relations}} SET modul1=\'tree\', modul2=\'' . $module['path'] . '\', id1=\'' . $tree . '\', id2=1, cdate=NOW() '; DB::exec($sql); return $tree; }
public function step4() { $tree = array('name' => $_SESSION['iuser']['upload']['title']); $id = Tree::addTree($_SESSION['iuser']['upload']['spec'], $tree, 'catalog'); if (file_exists($_SESSION['iuser']['upload']['filecover']['path']) && file_exists($_SESSION['iuser']['upload']['filepages']['path'])) { $dir = $_SERVER['DOCUMENT_ROOT'] . IUSER_DIR . md5('fotouser' . $_SESSION['iuser']['id']) . '/'; if (!file_exists($dir)) { mkdir($dir, 0777); } $dir = $dir . md5('fotobook' . $id) . '/'; mkdir($dir, 0777); for ($file2i = 0; $file2i < 2; $file2i++) { if ($file2i == 0) { $filename = explode('.', $_SESSION['iuser']['upload']['filecover']['name']); $filesource = $_SESSION['iuser']['upload']['filecover']['path']; } else { $filename = explode('.', $_SESSION['iuser']['upload']['filepages']['name']); $filesource = $_SESSION['iuser']['upload']['filepages']['path']; } $raz = $filename[count($filename) - 1]; unset($filename[count($filename) - 1]); $filename = implode('', $filename); $filenameraz = Funcs::Transliterate($filename) . '.' . $raz; $dirfile = $dir . $filenameraz; $x = 0; $i = 1; while ($x == 0) { if (file_exists($dirfile)) { $filenameraz = Funcs::Transliterate($filename) . $i . '.' . $raz; $dirfile = $dir . md5($filename) . '/' . $filenameraz; } else { $x = 1; } $i++; } copy($filesource, $dirfile); chmod($dirfile, 0777); unlink($filesource); if ($file2i == 0) { $filename1 = $filenameraz; } else { $filename2 = $filenameraz; } } } $price = Basket::getPrice('session'); $sql = ' INSERT INTO {{catalog}} SET tree=' . $id . ', description=\'' . $_SESSION['iuser']['upload']['description'] . '\', phrase=\'' . $_SESSION['iuser']['upload']['phrase'] . '\', author=\'' . $_SESSION['iuser']['upload']['author'] . '\', private=' . $_SESSION['iuser']['upload']['private'] . ', booksize=' . $_SESSION['iuser']['upload']['booksize'] . ', countpage=' . $_SESSION['iuser']['upload']['countpage'] . ', binding=' . $_SESSION['iuser']['upload']['binding'] . ', paper=' . $_SESSION['iuser']['upload']['paper'] . ', price=' . $price . ', filecover=\'' . $filename1 . '\', filepages=\'' . $filename2 . '\', vendor=' . $_SESSION['iuser']['id'] . ' '; DB::exec($sql); unset($_SESSION['iuser']['upload']); $_SESSION['iuser']['upload']['id'] = $id; $_SESSION['iuser']['upload']['price'] = $price; Upload::addGallery($id, $filename1, $filename2, $dir); Email::uploadSend(); }
function add() { if (!is_numeric($_POST['tree'])) { $tree = Tree::addTree(); } else { $tree = Tree::editTree($_POST['tree']); } $i = 0; if (count($_POST['data']) > 0) { foreach ($_POST['data'] as $key => $item) { Fields::Insert($tree, $_POST['module'], $key, $item, $_POST['fieldtypes'][$i], $i); $i++; } } $sql = 'SELECT * FROM {{modules}} WHERE id=' . $_POST['module']; $module = DB::getRow($sql); $sql = ' INSERT INTO {{relations}} SET modul1=\'tree\', modul2=\'' . $module['path'] . '\', id1=\'' . $tree . '\', id2=1, cdate=NOW() '; DB::exec($sql); $sql = 'SELECT path FROM {{modules}} WHERE id=' . $module['catalog']; $moduleCtatalog = DB::getOne($sql); if ($moduleCtatalog) { $sql = ' INSERT INTO {{relations}} SET modul1=\'tree\', modul2=\'' . $moduleCtatalog . '\', id1=\'' . $tree . '\', id2=0, cdate=NOW() '; DB::exec($sql); } return $tree; }