function content_id() { if (post_id()) { return post_id(); } elseif (product_id()) { return product_id(); } elseif (page_id()) { return page_id(); } elseif (defined('CONTENT_ID')) { return CONTENT_ID; } }
<h3>Pricing</h3> <p>CD Album & Postage (UK) - £<?php product_cost_uk(); ?> <br /><a href="<?php get_option('siteurl'); ?> /buy/<?php product_id(); ?> /go-uk">Buy Now</a></p> <p>CD Album & Postage (Worldwide) - £<?php product_cost_ww(); ?> <br /><a href="<?php get_option('siteurl'); ?> /buy/<?php product_id(); ?> /go-ww">Buy Now</a></p> <p><a href="#" onclick="javascript:window.open('https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"><img src="https://www.paypal.com/en_US/i/logo/PayPal_mark_50x34.gif" border="0" alt="Paypal" style="float: right; margin-left:20px;"></a>When you click Buy Now you will be redirected to Paypal for secure online payment. Then we'll send you back here.</p> </div><!-- .entry-content--> </div><!-- .post --> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); get_footer(); ?>
/** * 完成安装 * * @author Garbin * @return void */ function install_done() { extract($_POST); /* 无实际用途 */ $_code = rand(10000, 99999); setcookie('__INTECODE__', $_code, 0, '/'); /* 连接数据库 */ $con = mysql_connect($db_host . ':' . $db_port, $db_user, $db_pass); if (!$con) { show_process(r(Lang::get('connect_db'), false), 'parent.show_warning("' . Lang::get('connect_db_error') . '")'); return false; } show_process(r(Lang::get('connect_db'), true)); $version = mysql_get_server_info(); $charset = str_replace('-', '', CHARSET); if ($version > '4.1') { if ($charset != 'latin1') { mysql_query("SET character_set_connection={$charset}, character_set_results={$charset}, character_set_client=binary", $con); } if ($version > '5.0.1') { mysql_query("SET sql_mode=''", $con); } } /* 选择数据库 */ $selected_db = mysql_select_db($db_name, $con); if (!$selected_db) { show_process(r(Lang::get('selecte_db'), false), 'parent.show_warning("' . Lang::get('selecte_db_error') . '");'); return false; } /* 建立数据库结构 */ show_process(r(Lang::get('start_setup_db'), true)); $sqls = get_sql(version_data('structure.sql')); foreach ($sqls as $sql) { $sql = replace_prefix('ecm_', $db_prefix, $sql); if (substr($sql, 0, 12) == 'CREATE TABLE') { $name = preg_replace("/CREATE TABLE `{$db_prefix}([a-z0-9_]+)` .*/is", "\\1", $sql); mysql_query(create_table($sql)); show_process(r(sprintf(Lang::get('create_table'), $name), true, 1)); } else { mysql_query($sql, $con); } } /* 安装初始数据 TODO 暂时不完整 */ $sqls = get_sql(version_data('initdata.sql')); $password = md5($admin_pass); $sqls[] = "INSERT INTO `ecm_member`(user_name, email, password, reg_time) VALUES('{$admin_name}', '{$admin_email}', '{$password}', " . gmtime() . ")"; foreach ($sqls as $sql) { $rzt = mysql_query(replace_prefix('ecm_', $db_prefix, $sql), $con); if (!$rzt) { show_process(r(Lang::get('install_initdata'), false), 'parent.show_warning("' . mysql_error() . '");'); return false; } } if (mysql_errno()) { echo mysql_error(); } show_process(r(Lang::get('install_initdata'), true)); /* 安装初始配置 */ $db_config = "mysql://{$db_user}:{$db_pass}@{$db_host}:{$db_port}/{$db_name}"; $ecm_key = get_ecm_key(); $mall_site_id = product_id(); save_config_file(array('SITE_URL' => $site_url, 'DB_CONFIG' => $db_config, 'DB_PREFIX' => $db_prefix, 'LANG' => LANG, 'COOKIE_DOMAIN' => '', 'COOKIE_PATH' => '/', 'ECM_KEY' => $ecm_key, 'MALL_SITE_ID' => $mall_site_id, 'ENABLED_GZIP' => 0, 'DEBUG_MODE' => 0, 'CACHE_SERVER' => 'default', 'MEMBER_TYPE' => 'default', 'ENABLED_SUBDOMAIN' => 0, 'SUBDOMAIN_SUFFIX' => '')); /* 写入系统信息 */ save_system_info(array('version' => VERSION, 'release' => RELEASE)); show_process(r(Lang::get('setup_config'), true)); /* 锁定安装程序 */ touch(LOCK_FILE); show_process(r(Lang::get('lock_install'), true)); if (is_file(ROOT_PATH . '/integrate/index.php')) { /* 跳至整合程序 */ show_process(r(Lang::get('install_done'), true), 'parent.goon_install("' . $site_url . '/integrate/index.php", "' . $_code . '");'); } else { /* 安装完成 */ show_process(r(Lang::get('install_done'), true), 'parent.install_successed();'); return false; } }
/** * Displays a form used for editing or adding a product to database. * * @param string $error Error message from the manage_products form. * @param bool $related_to_release If true then we are passing from adding a release in general so we set the relation to this automatically * @return void */ function ribcage_edit_product_form($error = 0, $related_to_release = 0) { global $artist; global $release, $releases; global $product; if (isset($_REQUEST['product'])) { $product = get_product($_REQUEST['product']); } $releases = list_recent_releases_blurb(); if ($error) { echo '<div id="message" class="error"><p><strong>' . $error . '</strong></p></div>'; } ?> <div class="wrap"> <div id="icon-options-general" class="icon32"><br /></div> <?php if (isset($_REQUEST['product'])) { ?> <h2>Editing <?php product_name(); ?> </h2> <form action="<?php echo home_url(); ?> /wp-admin/admin.php?page=manage_products&product=<?php product_id(); ?> &ribcage_action=edited" method="post" id="ribcage_edit_artist" name="edit_artist"> <?php } else { ?> <h2>Add A Product</h2> <form action="<?php echo home_url(); ?> /wp-admin/admin.php?page=manage_products&ribcage_action=add" method="post" id="ribcage_edit_artist" name="edit_artist"> <?php } ?> <table class="form-table"> <tr valign="top"> <th scope="row"><label for="product_name">Name</label></th> <td> <input type="text" value="<?php product_name(); ?> " name="product_name" id="product_name" class="regular-text"/> </td> </tr> <tr valign="top"> <th scope="row"><label for="product_name">Price</label></th> <td> <input type="text" value="<?php echo $product['product_cost']; ?> " name="product_cost" id="product_cost" class="regular-text"/> </td> </tr> <tr valign="top"> <th scope="row"><label for="product_related_release">Related To Release</label></th> <td> <select name="product_related_release" id="product_related_release"> <option value = "">None</option> <?php while (have_releases()) { the_release(); ?> <?php $artist['artist_name'] = get_artistname_by_id($release['release_artist']); ?> <?php if ($release['release_id'] == $product['product_related_release']) { ?> <option selected value="<?php release_id(); ?> "><?php artist_name(); ?> - <?php release_title(); ?> </option> <?php } else { ?> <option value="<?php release_id(); ?> "><?php artist_name(); ?> - <?php release_title(); ?> </option> <?php } ?> <?php } ?> </select> </td> </tr> <tr valign="top"> <th scope="row"><label for="product_name">Product Description</label></th> <td> <textarea rows="10" cols="100" name="product_description" id="product_description" class="regular-text"><?php product_description(); ?> </textarea> </td> </tr> </table> <p class="submit"> <input type="submit" name="Submit" class="button-primary" value="Save Changes" /> </p> </form> </div> <?php }