PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/plugin.php

https://github.com/nlstart/easyshop
PHP | 121 lines | 77 code | 14 blank | 30 comment | 8 complexity | 3a4db6c0a15660be54e6ea9378c4822c MD5 | raw file
  1. <?php
  2. /*
  3. +------------------------------------------------------------------------------+
  4. | EasyShop - an easy e107 web shop | adapted by nlstart
  5. | formerly known as
  6. | jbShop - by Jesse Burns aka jburns131 aka Jakle
  7. | Plugin Support Site: e107.webstartinternet.com
  8. |
  9. | For the e107 website system visit http://e107.org
  10. |
  11. | Released under the terms and conditions of the
  12. | GNU General Public License (http://gnu.org).
  13. +------------------------------------------------------------------------------+
  14. */
  15. // if e107 is not running we won't run this plugin program
  16. if( ! defined('e107_INIT')){ exit(); }
  17. // determine the plugin directory as a global variable
  18. global $PLUGINS_DIRECTORY;
  19. // read the database names array of this plugin from the includes/config file
  20. @include_once('includes/config.php'); // Sometimes require_once blanked out Plugin Manager
  21. @include_once('easyshop_ver.php');
  22. $eplug_folder = "easyshop";
  23. // Get language file (assume that the English language file is always present)
  24. include_lan(e_PLUGIN.'easyshop/languages/'.e_LANGUAGE.'.php');
  25. $eplug_name = "EasyShop";
  26. $eplug_version = THIS_VERSION; // Defined in easyshop_ver.php
  27. $eplug_author = "nlstart";
  28. $eplug_url = EASYSHOP_URL;
  29. $eplug_email = "nlstart@users.sourceforge.net";
  30. $eplug_description = EASYSHOP_DESC;
  31. $eplug_compatible = "e107v0.7+";
  32. $eplug_compliant = TRUE;
  33. $eplug_readme = "readme.txt";
  34. //$eplug_folder = "easyshop";
  35. $eplug_menu_name = "easyshop";
  36. $eplug_conffile = "admin_config.php";
  37. $eplug_icon = $eplug_folder."/images/logo_32.png";
  38. $eplug_icon_small = $eplug_folder."/images/logo_16.png";
  39. $eplug_caption = EASYSHOP_CAPTION;
  40. $eplug_status = TRUE;
  41. // List of preferences
  42. // this stores a default value(s) in the preferences. 0 = Off , 1= On
  43. // Preferences are saved with plugin folder name as prefix to make preferences unique and recognisable
  44. $eplug_prefs = array(
  45. "easyshop_1" => 0
  46. );
  47. // List of table names -----------------------------------------------------------------------------------------------
  48. $eplug_sql = file_get_contents(e_PLUGIN."{$eplug_folder}/{$eplug_folder}_sql.php");
  49. preg_match_all("/CREATE TABLE (.*?)\(/i", $eplug_sql, $matches);
  50. $eplug_table_names = $matches[1];
  51. // List of sql requests to create tables -----------------------------------------------------------------------------
  52. // Apply create instructions for every table you defined in locator_sql.php --------------------------------------
  53. // MPREFIX must be used because database prefix can be customized instead of default e107_
  54. $eplug_tables = explode(";", str_replace("CREATE TABLE ", "CREATE TABLE ".MPREFIX, $eplug_sql));
  55. for ($i=0; $i<count($eplug_tables); $i++) {
  56. $eplug_tables[$i] .= ";";
  57. }
  58. array_pop($eplug_tables); // Get rid of last (empty) entry
  59. // Add pre-defined Shop Preferences into the plugin table array
  60. array_push($eplug_tables,
  61. "INSERT INTO ".MPREFIX."easyshop_preferences (`store_id`, `store_name`, `support_email`, `store_address_1`, `store_address_2`, `store_city`, `store_state`, `store_zip`, `store_country`, `store_welcome_message`, `store_info`, `store_image_path`, `num_category_columns`, `categories_per_page`, `num_item_columns`, `items_per_page`, `paypal_email`, `popup_window_height`, `popup_window_width`, `cart_background_color`, `thank_you_page_title`, `thank_you_page_text`, `thank_you_page_email`, `payment_page_style`, `payment_page_image`, `add_to_cart_button`, `view_cart_button`, `sandbox`, `set_currency_behind`, `minimum_amount`, `always_show_checkout`, `email_order`, `product_sorting`, `page_devide_char`, `icon_width`, `cancel_page_title`, `cancel_page_text`, `enable_comments`, `show_shopping_bag`, `print_shop_address`, `print_shop_top_bottom`, `print_discount_icons`, `shopping_bag_color`, `enable_ipn`, `enable_number_input`, `print_special_instr`, `email_info_level`, `email_additional_text`, `monitor_clean_shop_days`, `monitor_clean_check_days`, `num_main_category_columns`, `main_categories_per_page`, `paypal_primary_email`) VALUES
  62. (1, 'My EasyShop', 'support@yourdomain.com', '1 Some St.', 'Unit 3', 'Some Town', 'OR', '01234', 'USA', 'Thank you for visiting our shop online. We have many products on sale at the moment, make sure you check them out.<br /><br />If you have any questions about our products, please feel free to e-mail us.', '', 'images/', 3, 25, 3, 25, 'someone@somewhere.com', '', '', '', 'Thank you for shopping with us', 'Your transaction has been completed, and a receipt for your purchase has been e-mailed to you.', '', 'custom_payment_page', '', '', '', 1, '0', 0, '0', '0', '', '', 0, 'Sorry', 'Your transaction failed or was canceled. Please inform the webmaster of this website in case you tried to purchase products from our shop.', '0', '0', '0', '0', '0', '0', 0, '0', '0', '0', '', '3', '7', '3', '25', '');"
  63. );
  64. // Create a link in main menu (yes=TRUE, no=FALSE)
  65. $eplug_link = TRUE;
  66. $eplug_link_name = 'EASYSHOP_LINKNAME'; // Store define value for multi-language purposes
  67. $eplug_link_url = $PLUGINS_DIRECTORY.$eplug_folder."/easyshop.php";
  68. $eplug_done = EASYSHOP_DONE1." ".$eplug_name." v".$eplug_version." ".EASYSHOP_DONE2;
  69. // Upgrading from 1.61 to 1.7
  70. $upgrade_add_prefs = "";
  71. $upgrade_remove_prefs = "";
  72. $upgrade_alter_tables = array(
  73. "ALTER TABLE ".MPREFIX."easyshop_items ADD download_datasheet int(11) NOT NULL default '0' AFTER item_minimum;",
  74. "ALTER TABLE ".MPREFIX."easyshop_items ADD download_datasheet_filename varchar(200) NOT NULL default '' AFTER download_datasheet;",
  75. "ALTER TABLE ".MPREFIX."easyshop_items ADD item_quotation int(11) NOT NULL default '0' AFTER download_datasheet_filename"
  76. );
  77. // This separate function is useful as the plugin.php file is read on many occassions,
  78. // so this prevents upgrade only functionality from running when it shouldn't.
  79. if ( ! function_exists('easyshop_upgrade'))
  80. { // The above line prevents the plugin from being declared twice
  81. function easyshop_upgrade()
  82. { // This function is executed by the e107 Plugin Manager before any upgrading action
  83. $path = e_PLUGIN.'easyshop/';
  84. if (file_exists($path.'easyshop_smtp.php'))
  85. { // Remove redundant program easyshop_smtp.php
  86. @unlink($path.'easyshop_smtp.php');
  87. }
  88. if (file_exists($path.'admin_general_preferences_edit.php'))
  89. { // Remove redundant program admin_general_preferences_edit.php
  90. @unlink($path.'admin_general_preferences_edit.php');
  91. }
  92. if (file_exists($path.'admin_categories_edit.php'))
  93. { // Remove redundant program admin_categories_edit.php
  94. @unlink($path.'admin_categories_edit.php');
  95. }
  96. if (file_exists($path.'admin_config_edit.php'))
  97. { // Remove redundant program admin_config_edit.php
  98. @unlink($path.'admin_config_edit.php');
  99. }
  100. if (file_exists($path.'admin_main_categories_edit.php'))
  101. { // Remove redundant program admin_main_categories_edit.php
  102. @unlink($path.'admin_main_categories_edit.php');
  103. }
  104. }
  105. }
  106. $eplug_upgrade_done = EASYSHOP_DONE3." ".$eplug_name." v".$eplug_version.".";
  107. ?>