Skip to content

Commit

Permalink
1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nibz committed Jul 26, 2015
0 parents commit 38b887f
Show file tree
Hide file tree
Showing 234 changed files with 23,603 additions and 0 deletions.
131 changes: 131 additions & 0 deletions add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?php

/*
Module developed for the Open Source Content Management System WebsiteBaker (http://websitebaker.org)
Copyright (C) 2007 - 2015, Christoph Marti
LICENCE TERMS:
This module is free software. You can redistribute it and/or modify it
under the terms of the GNU General Public License - version 2 or later,
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html.
DISCLAIMER:
This module is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/


//Prevent this file from being accessed directly
if (defined('WB_PATH') == false) {
exit("Cannot access this file directly");
}


// Look for language File
if (LANGUAGE_LOADED) {
require_once(WB_PATH.'/modules/bakery/languages/EN.php');
if (file_exists(WB_PATH.'/modules/bakery/languages/'.LANGUAGE.'.php')) {
require_once(WB_PATH.'/modules/bakery/languages/'.LANGUAGE.'.php');
}
}


// Set default values for page settings

// Shop
$page_offline = "no";
$offline_text = $MOD_BAKERY['ERR_OFFLINE_TEXT'];
$continue_url = $page_id;

// Layout
$header = $admin->add_slashes('<div class="mod_bakery_main_div_cart_bt_f">
<form action="[SHOP_URL]" method="post">
<input type="submit" name="view_cart" class="mod_bakery_bt_cart_f" value="[VIEW_CART]" />
</form>
</div>
<table cellpadding="5" cellspacing="0" border="0" width="98%">
<tr>
');
$item_loop = $admin->add_slashes('<td class="mod_bakery_main_td_f">
[THUMB]
<br />
<a href="[LINK]"><span class="mod_bakery_main_title_f">[TITLE]</span></a>
<br />
[DESCRIPTION]
<br />
[TXT_PRICE]: [CURRENCY] [PRICE]
<br />
[TXT_STOCK]: [STOCK]
<br />
<form action="[SHOP_URL]" method="post">
[OPTION]
<br />
<input type="text" name="item[ITEM_ID]" class="mod_bakery_main_input_f" value="1" size="2" />
<input type="submit" name="add_to_cart" class="mod_bakery_bt_add_f" value="[ADD_TO_CART]" />
</form>
</td>');
$footer = $admin->add_slashes('</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="98%" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
<tr>
<td colspan="3" align="left"><hr /></td>
</tr>
<tr>
<td width="35%" align="left">[PREVIOUS_PAGE_LINK]</td>
<td width="30%" align="center">[TXT_ITEM] [OF] </td>
<td width="35%" align="right">[NEXT_PAGE_LINK]</td>
</tr>
</table>');
$item_header = $admin->add_slashes('<center>');
$item_footer = $admin->add_slashes('[IMAGE]
<form action="[SHOP_URL]" method="post">
<table border="0" cellspacing="0" cellpadding="5" class="mod_bakery_item_table_f">
<tr>
<td colspan="2" align="left" valign="top"><h2 class="mod_bakery_item_title_f">[TITLE]</h2></td>
</tr>
<tr>
<td align="left" valign="top"><span class="mod_bakery_item_sku_f">[TXT_SKU]:</span></td>
<td align="left" valign="top">[SKU]</td>
</tr>
<tr>
<td align="left" valign="top"><span class="mod_bakery_item_price_f">[TXT_PRICE]:</span></td>
<td align="left" valign="top">[CURRENCY] [PRICE]</td>
</tr>
<tr>
<td align="left" valign="top"><span class="mod_bakery_item_shipping_f">[TXT_SHIPPING]:</span></td>
<td align="left" valign="top">[CURRENCY] [SHIPPING] </td>
</tr>
<tr>
<td align="left" valign="top"><span class="mod_bakery_item_stock_f">[TXT_STOCK]:</span></td>
<td align="left" valign="top">[STOCK]</td>
</tr>
<tr>
<td align="left" valign="top"><span class="mod_bakery_item_full_desc_f"><p>[TXT_FULL_DESC]:</p></span></td>
<td align="left" valign="top">[FULL_DESC]</td>
</tr>
<tr>
<td align="left" valign="top"><span class="mod_bakery_shipping_cost_f">[TXT_SHIPPING_COST]:</span></td>
<td align="left" valign="top">
[TXT_DOMESTIC]: [CURRENCY] [SHIPPING_DOMESTIC]<br />
[TXT_ABROAD]: [CURRENCY] [SHIPPING_ABROAD]</td>
</tr>
[OPTION]
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top">
<input type="text" name="item[ITEM_ID]" class="mod_bakery_item_input_f" value="1" size="2" />
<input type="submit" name="add_to_cart" class="mod_bakery_bt_add_f" value="[ADD_TO_CART]" />
</td>
</tr>
</table>
</form>
[PREVIOUS] | <a href="[BACK]">[TXT_BACK]</a> | [NEXT]
</center>
<br />');


// Insert default values into table page_settings
$database->query("INSERT INTO ".TABLE_PREFIX."mod_bakery_page_settings (section_id, page_id, page_offline, offline_text, continue_url, header, item_loop, footer, item_header, item_footer)
VALUES ('$section_id', '$page_id', '$page_offline', '$offline_text', '$continue_url', '$header', '$item_loop', '$footer', '$item_header', '$item_footer')");
46 changes: 46 additions & 0 deletions add_item.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
Module developed for the Open Source Content Management System WebsiteBaker (http://websitebaker.org)
Copyright (C) 2007 - 2015, Christoph Marti
LICENCE TERMS:
This module is free software. You can redistribute it and/or modify it
under the terms of the GNU General Public License - version 2 or later,
as published by the Free Software Foundation: http://www.gnu.org/licenses/gpl.html.
DISCLAIMER:
This module is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/


require('../../config.php');

// Include WB admin wrapper script
require(WB_PATH.'/modules/admin.php');

// Include the ordering class
require(WB_PATH.'/framework/class.order.php');

// Get new order
$order = new order(TABLE_PREFIX.'mod_bakery_items', 'position', 'item_id', 'section_id');
$position = $order->get_new($section_id);

// Insert new row into database
$database->query("INSERT INTO ".TABLE_PREFIX."mod_bakery_items (section_id,page_id,active,position,created_when,created_by) VALUES ('$section_id','$page_id','1','$position','".@mktime()."','".$admin->get_user_id()."')");

// Get the id
$item_id = $database->get_one("SELECT LAST_INSERT_ID()");

// Say that a new record has been added, then redirect to modify page
if ($database->is_error()) {
$admin->print_error($database->get_error(), WB_URL.'/modules/bakery/modify_item.php?page_id='.$page_id.'&section_id='.$section_id.'&item_id='.$item_id);
} else {
$admin->print_success($TEXT['SUCCESS'], WB_URL.'/modules/bakery/modify_item.php?page_id='.$page_id.'&section_id='.$section_id.'&item_id='.$item_id.'&from=add_item');
}

// Print admin footer
$admin->print_footer();
Loading

0 comments on commit 38b887f

Please sign in to comment.