/** * Determine if we should show the 'Proceed to Checkout' button, as well * as fetch any other checkout links for alt. checkout methods such as * Google Checkout, PayPal Website Payments Express. */ public function generateAdditionalCheckoutButtons() { $GLOBALS['AdditionalCheckoutButtons'] = ''; $GLOBALS['HideCheckoutButton'] = ''; $GLOBALS['HideMultipleAddressShipping'] = 'display: none'; // Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined $showCheckoutButton = false; foreach(getAvailableModules('checkout', true, true) as $module) { if(isset($module['object']->_showBothButtons) && $module['object']->_showBothButtons) { $showCheckoutButton = true; $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->getCheckoutButton(); } elseif (method_exists($module['object'], 'GetCheckoutButton')) { $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->getCheckoutButton(); } else { $showCheckoutButton = true; } } if(gzte11(ISC_MEDIUMPRINT) && $this->quote->getNumPhysicalItems() > 1 && $showCheckoutButton && getConfig("MultipleShippingAddresses")) { $GLOBALS['HideMultipleAddressShipping'] = ''; } if($this->quote->getNumItems() == 0 || $showCheckoutButton == false) { $GLOBALS['HideCheckoutButton'] = 'display: none'; $GLOBALS['HideMultipleAddressShippingOr'] = 'display: none'; return; } }
/** * Returns an array of all available shopping comparison modules * * @return array */ static public function getAllModules() { $return = array(); $modules = getAvailableModules('shoppingcomparison'); foreach ($modules as $module) { $return[] = $module['object']; } return $return; }
/** * Gets menu badge counts * * @since 1.1 * @package facileManager * * @return array */ function getBadgeCounts($type) { global $fm_name; $badge_count = 0; if (!defined('INSTALL') && !defined('UPGRADE')) { if ($type == 'modules') { /** Get fM badge counts */ $modules = getAvailableModules(); foreach ($modules as $module_name) { /** Include module variables */ @(include ABSPATH . 'fm-modules/' . $module_name . '/variables.inc.php'); /** Upgrades waiting */ $module_version = getOption('version', 0, $module_name); if ($module_version !== false) { if (version_compare($module_version, $__FM_CONFIG[$module_name]['version'], '<')) { $badge_count++; continue; } } else { $module_version = $__FM_CONFIG[$module_name]['version']; } /** New versions available */ if (isNewVersionAvailable($module_name, $module_version)) { $badge_count++; } } } } return $badge_count; }
echo "Please enter a release of the form " . implode(".", array_slice($last_release_comps, 0, 2)) . ".X where X > " . $next_release_comps[2] . "\n"; } //we have something valid break; } } } } } } $last_release[$matches[1]] = array('revno' => $revno, 'release' => $release, 'topmodulevers' => $matches2[1], 'next_release' => $next_release); } if (!array_key_exists('I2CE', $last_release)) { die("I2CE is not present\n"); } getAvailableModules(); $top_mod_dirs = array(); foreach ($found_modules as $module => $top_module) { if ($module != $top_module) { continue; } $config_file = false; if (!$storage->setIfIsSet($config_file, "/config/data/{$module}/file")) { I2CE::raiseError("No config file for {$module} -- Skipping"); continue; } $config_dir = rtrim(dirname($config_file), '/'); foreach ($top_dirs as $dir) { if (strpos($dir, $config_dir) === 0) { $top_mod_dirs[$module] = $dir; continue 2;
/** * Manages a module * * @since 1.0 * @package facileManager */ function manageModule($module_name = null, $action = null) { global $__FM_CONFIG; if (!$module_name || !in_array($module_name, getAvailableModules())) { return false; } $current_active_modules = getOption('fm_active_modules', $_SESSION['user']['account_id']); $command = is_array($current_active_modules) ? 'update' : 'insert'; switch ($action) { case 'activate': /** Ensure $module_name is not already active */ if (in_array($module_name, getActiveModules())) { return; } /** Ensure $module_name is installed */ if (getOption('version', 0, $module_name) === false) { return; } $current_active_modules[] = $module_name; return setOption('fm_active_modules', $current_active_modules, 'auto', true, $_SESSION['user']['account_id']); break; case 'deactivate': /** Ensure $module_name is not already deactivated */ if (!in_array($module_name, getActiveModules())) { return; } $new_array = array(); foreach ($current_active_modules as $module) { if ($module == $module_name) { continue; } $new_array[] = $module; } return setOption('fm_active_modules', $new_array, 'update', true, $_SESSION['user']['account_id']); break; case 'uninstall': if (!in_array($module_name, getAvailableModules())) { return; } if (function_exists('uninstallModuleSchema')) { $output = uninstallModuleSchema($__FM_CONFIG['db']['name'], $module_name); } if ($output != 'Success') { return false; } return true; break; } return false; }
} } } $base_vers = trim($base_vers); $base_vers_comps = explode('.', $base_vers); if (count($base_vers_comps) != $bump_type + 1) { die("Invalid target version ({$base_vers})\n"); } $check_vers_comps = $base_vers_comps; $check_vers_comps[$bump_type]--; $check_vers = implode('.', $check_vers_comps); $check_short_vers = implode('.', array_slice($base_vers_comps, 0, $bump_type)); $new_vers_comps = $base_vers_comps; $new_vers_comps[] = '0'; $new_vers = implode('.', $new_vers_comps); $found_modules = array_keys(getAvailableModules()); $always_update = array(); foreach ($found_modules as $module) { $mod_file = false; $storage->setIfIsSet($mod_file, "/config/data/{$module}/file"); if (!$mod_file) { I2CE::raiseError("No file recored for {$module}"); continue; } $loc_files = glob(dirname($mod_file) . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . basename($mod_file)); $loc_files[] = $mod_file; foreach ($loc_files as $file) { $template = new I2CE_TemplateMeister(); if (!$template->loadRootFile($file)) { echo "\tCould not load\n"; continue;
/** fM v1.2-beta1 **/ function fmUpgrade_1201($database) { global $fmdb, $fm_name; $success = true; /** Prereq */ $success = $GLOBALS['running_db_version'] < 28 ? fmUpgrade_107($database) : true; if ($success) { /** Schema change */ $table[] = "ALTER TABLE {$database}.`fm_options` ADD `module_name` VARCHAR( 255 ) NULL AFTER `account_id` "; $table[] = "ALTER TABLE `fm_users` ADD `user_caps` TEXT NULL AFTER `user_auth_type` "; /** Create table schema */ if (count($table) && $table[0]) { foreach ($table as $schema) { $fmdb->query($schema); if (!$fmdb->result || $fmdb->sql_errors) { return false; } } } $inserts = null; if (count($inserts) && $inserts[0] && $success) { foreach ($inserts as $query) { $fmdb->query($query); if ($fmdb->last_error) { echo $fmdb->last_error; return false; } } } /** Update fm_options */ $version_check = getOption($fm_name . '_version_check'); if ($version_check !== false) { if (!setOption('version_check', $version_check, 'auto', true, 0, $fm_name)) { return false; } $query = "DELETE FROM {$database}.`fm_options` WHERE option_name='{$fm_name}_version_check'"; $fmdb->query($query); if (!$fmdb->result || $fmdb->sql_errors) { return false; } } $modules = getAvailableModules(); if (count($modules)) { foreach ($modules as $module_name) { $module_version = getOption($module_name . '_version'); if ($module_version !== false) { if (!setOption('version', $module_version, 'auto', false, 0, $module_name)) { return false; } } $module_version_check = getOption($module_name . '_version_check'); if ($module_version_check !== false) { if (!setOption('version_check', $module_version_check, 'auto', true, 0, $module_name)) { return false; } } $module_client_version = getOption($module_name . '_client_version'); if ($module_client_version !== false) { if (!setOption('client_version', $module_client_version, 'auto', false, 0, $module_name)) { return false; } } $query = "DELETE FROM {$database}.`fm_options` WHERE option_name LIKE '{$module_name}%_version%'"; $fmdb->query($query); if (!$fmdb->result || $fmdb->sql_errors) { return false; } } } /** Update user capabilities */ $fm_user_caps[$fm_name] = array('do_everything' => '<b>Super Admin</b>', 'manage_modules' => 'Module Management', 'manage_users' => 'User Management', 'run_tools' => 'Run Tools', 'manage_settings' => 'Manage Settings'); if (!setOption('fm_user_caps', $fm_user_caps)) { return false; } $fmdb->get_results("SELECT * FROM `fm_users`"); if ($fmdb->num_rows) { $count = $fmdb->num_rows; $result = $fmdb->last_result; for ($i = 0; $i < $count; $i++) { $user_caps = null; /** Update user capabilities */ $j = 1; foreach ($fm_user_caps[$fm_name] as $slug => $trash) { if ($j & $result[$i]->user_perms) { $user_caps[$fm_name][$slug] = 1; } $j = $j * 2; } $fmdb->query("UPDATE fm_users SET user_caps = '" . serialize($user_caps) . "' WHERE user_id=" . $result[$i]->user_id); if (!$fmdb->result || $fmdb->sql_errors) { return false; } } } $fmdb->query("ALTER TABLE `fm_users` DROP `user_perms`;"); if (!$fmdb->result || $fmdb->sql_errors) { return false; } /** Temporarily move the module user capabilities to fm_users */ $fmdb->get_results("SELECT * FROM `fm_perms`"); if ($fmdb->num_rows) { $count = $fmdb->num_rows; $result = $fmdb->last_result; for ($i = 0; $i < $count; $i++) { if (!($user_info = getUserInfo($result[$i]->user_id))) { continue; } /** Update user capabilities */ $user_caps = isSerialized($user_info['user_caps']) ? unserialize($user_info['user_caps']) : $user_info['user_caps']; $user_caps[$result[$i]->perm_module] = isSerialized($result[$i]->perm_extra) ? unserialize($result[$i]->perm_extra) : $result[$i]->perm_extra; $user_caps[$result[$i]->perm_module]['imported_perms'] = $result[$i]->perm_value; $fmdb->query("UPDATE fm_users SET user_caps = '" . serialize($user_caps) . "' WHERE user_id=" . $result[$i]->user_id); if (!$fmdb->result || $fmdb->sql_errors) { return false; } } } $fmdb->query("DROP TABLE `fm_perms`"); if (!$fmdb->result || $fmdb->sql_errors) { return false; } } upgradeConfig('fm_db_version', 32, false); return $success; }
$create_redirects = simple_prompt("Redirect all pages to this version?"); $versions = array('i2ce' => $main_version, 'manage' => $main_version, 'common' => $main_version, 'qualify' => $main_version, 'textlayout' => $main_version); foreach ($versions as $pkg => $vers) { $versions[$pkg] = $vers . '-release'; $packages[$pkg]['bzr'] = 'https://launchpad.net/' . $packages[$pkg]['pkg_name']; $packages[$pkg]['bzr_files'] = "http://bazaar.launchpad.net/~intrahealth+informatics/" . $packages[$pkg]['pkg_name'] . "/{$vers}-release/files/head:"; $packages[$pkg]['bzr_annotate_files'] = "http://bazaar.launchpad.net/~intrahealth+informatics/" . $packages[$pkg]['pkg_name'] . "/{$vers}-release/annotate/head:"; $packages[$pkg]['bzr_translate'] = "http://translations.launchpad.net/" . $packages[$pkg]['pkg_name'] . "/trunk/+pots/"; } } /************************************* * * processing of modules * *******************************************/ $found_modules = getAvailableModules(); I2CE::longExecution(); /*********************************************** * * go througgh each of the module and pull out the magic data nodes when/where they are defined. * ************************************/ function processConfigFile($module, $top_module, $file, &$md_nodes, &$child_nodes) { global $packages, $module_packages; $mod_file = basename($file); $current_pkg = false; foreach ($packages as $pkg => $info) { if ($top_module == $info['top_module']) { $module_packages[$module] = $pkg; $current_pkg = $pkg;
function getTranslatableDocuments($show_bad = true) { global $categories; global $found_modules; I2CE::raiseError("Getting Translate-able Documents"); getAvailableModules(); I2CE::raiseError("Will attempt to template files for the following modules:\n\t" . implode(",", array_keys($found_modules))); $factory = I2CE_ModuleFactory::instance(); $templates = array(); foreach ($found_modules as $module => $top_module) { I2CE::setupFileSearch(); //reset the file search. $fileSearch = I2CE::getFileSearch(); $good_paths = array(); $bad_paths = array(); foreach ($categories as $cat) { $fileSearch->setPreferredLocales($cat, I2CE_Locales::DEFAULT_LOCALE); //only search the en_US locale $factory->loadPaths($module, $cat, true, $fileSearch); //load all template paths $ordered_paths = $fileSearch->getSearchPath($cat, true); //get the paths found with their localization; if (count($ordered_paths) == 0) { //echo "\tNo $cat directories for $module. -- Skipping\n"; continue; } foreach ($ordered_paths as $paths) { foreach ($paths as $path => $locale) { if ($locale !== I2CE_Locales::DEFAULT_LOCALE) { //should not happen. var_dump($locale); die("Yell at Carl -- you have locale {$locale} instead of " . I2CE_Locales::DEFAULT_LOCALE . "\n"); } $dir = basename($path); if ($dir != I2CE_Locales::DEFAULT_LOCALE) { $bad_paths[] = $path; } else { $good_paths[$path] = I2CE_Locales::DEFAULT_LOCALE; } } } } if ($show_bad && count($bad_paths) > 0) { I2CE::raiseError("The following template paths for {$module} were not localized:\n\t" . implode("\n\t", $bad_paths)); } if (count($good_paths) == 0) { //echo "\tNo localized template files for $module -- Skipping\n"; continue; } foreach ($good_paths as $path => $locale) { $rec_path = $path . DIRECTORY_SEPARATOR . '**'; //do a recursive search $files = $fileSearch->resolve(array('/^.*\\.html?$/'), array($rec_path => I2CE_Locales::DEFAULT_LOCALE), true); if (is_array($files) && count($files) > 0) { $templates[$module][$path] = $files; } } } if (count($templates) == 0) { I2CE::raiseError("None of the modules available are setup with localized tempaltes. Nothing to do."); } else { I2CE::raiseError("The following modules has translatable templates:\n\t" . implode(",", array_keys($templates))); } return $templates; }
/** * Show the form to create a new shipment from one or more items in an order. */ public function CreateShipment() { if(!isset($_REQUEST['orderId'])) { exit; } $order = GetOrder($_REQUEST['orderId']); if(!$order || !isset($order['orderid'])) { exit; } if ($order['ordisdigital'] == 1) { $this->template->display('modal.basic.tpl', array( 'title' => GetLang('CreateShipmentFromOrder'), 'message' => GetLang('DigitalOrderNoShipping'), )); exit; } if ($order['ordtotalqty'] - $order['ordtotalshipped'] <= 0) { $this->template->display('modal.basic.tpl', array( 'title' => GetLang('CreateShipmentFromOrder'), 'message' => GetLang('AllItemsShipped'), )); exit; } if(empty($_REQUEST['addressId'])) { $addressWhere = 'order_id='.$order['orderid']; } else { $addressWhere = 'order_id='.$order['orderid'].' AND id='.(int)$_REQUEST['addressId']; } // Fetch the address associated with this order $query = " SELECT * FROM [|PREFIX|]order_addresses WHERE ".$addressWhere." LIMIT 1 "; $result = $this->db->query($query); $address = $this->db->fetch($result); if(!$address) { exit; } $query = " SELECT * FROM [|PREFIX|]order_shipping WHERE order_address_id='".$address['id']."' "; $result = $this->db->query($query); $shipping = $this->db->fetch($result); $this->template->assign('address', $address); $this->template->assign('shipping', $shipping); $shipmentModules = array(); $shippingModules = getAvailableModules('shipping'); foreach($shippingModules as $module) { $shipmentModules[$module['id']] = $module['object']->getName(); } $this->template->assign('shippingModules', $shipmentModules); $GLOBALS['OrderId'] = $order['orderid']; $GLOBALS['OrderDate'] = CDate($order['orddate']); $GLOBALS['ShippingMethod'] = isc_html_escape($shipping['method']); $GLOBALS['OrderComments'] = isc_html_escape($order['ordcustmessage']); // Fetch out any items that have already been shipped for this order $shippedItems = array(); $query = " SELECT itemid, itemqty, itemordprodid FROM [|PREFIX|]shipment_items i INNER JOIN [|PREFIX|]shipments s ON ( s.shiporderid='".(int)$order['orderid']."' AND i.shipid=s.shipmentid ) INNER JOIN [|PREFIX|]order_products op ON (op.orderprodid = i.itemordprodid) WHERE op.order_address_id='".$address['id']."' "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while($shippedItem = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { if(!isset($shippedItems[$shippedItem['itemordprodid']])) { $shippedItems[$shippedItem['itemordprodid']] = 0; } $shippedItems[$shippedItem['itemordprodid']] += $shippedItem['itemqty']; } // OK, now loop through all of the items going to this address and see what we can ship $query = " SELECT * FROM [|PREFIX|]order_products WHERE order_address_id='".$address['id']."' "; $result = $this->db->query($query); $GLOBALS['ProductList'] = ''; while($product = $this->db->fetch($result)) { $shippableQuantity = $product['ordprodqty']; if(isset($shippedItems[$product['orderprodid']])) { $shippableQuantity = $product['ordprodqty'] - $shippedItems[$product['orderprodid']]; } // Completely skip over this item if there's nothing to ship if($shippableQuantity <= 0 || $product['ordprodtype'] != 'physical') { continue; } $doneProducts = true; $GLOBALS['ProductName'] = isc_html_escape($product['ordprodname']); $GLOBALS['ProductId'] = $product['ordprodid']; $GLOBALS['HideGiftWrapping'] = 'display: none'; $GLOBALS['WrappingName'] = ''; $GLOBALS['WrappingMessage'] = ''; if($product['ordprodwrapid'] > 0) { $GLOBALS['HideGiftWrapping'] = ''; $GLOBALS['WrappingName'] = isc_html_escape($product['ordprodwrapname']); if($product['ordprodwrapmessage']) { $GLOBALS['WrappingMessage'] = nl2br(isc_html_escape($product['ordprodwrapmessage'])); } else { $GLOBALS['HideGiftWrappingMessage'] = 'display: none'; } } // Show the quantity as a dropdown if(GetConfig('TagCartQuantityBoxes') == 'dropdown') { $GLOBALS['QuantityInput'] = '<select class="QtyEntry" name="quantity['.$product['orderprodid'].']">'; for($i = $shippableQuantity; $i >= 0; --$i) { $sel = ''; if($i == $shippableQuantity) { $sel = 'selected="selected"'; } $GLOBALS['QuantityInput'] .= '<option value="'.$i.'" '.$sel.'>'.$i.'</option>'; } $GLOBALS['QuantityInput'] .= '</select>'; } // As a textbox else { $GLOBALS['QuantityInput'] = '<input class="QtyEntry Field50 MaxValue'.$shippableQuantity.'" type="text" value="'.$shippableQuantity.'" name="quantity['.$product['orderprodid'].']" style="text-align: center;" />'; } $GLOBALS['ProductList'] .= $this->template->render('Snippets/CreateShipmentItem.html'); } if(!isset($doneProducts)) { exit; } $this->template->display('shipments.create.tpl'); exit; }
function installDatabase($link, $database) { global $fm_version, $fm_name; $db_selected = @mysql_select_db($database, $link); if (!$db_selected) { $query = sanitize("CREATE DATABASE IF NOT EXISTS {$database} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"); $result = mysql_query($query, $link); $output = displayProgress(_('Creating Database'), $result); } else { $output = true; } if ($output == true) { $output = installSchema($link, $database); } if ($output == true) { $modules = getAvailableModules(); if (count($modules)) { printf('<tr><td colspan="2" id="install_module_list"><p><b>%s</b><br />%s</p></td></tr>', _('The following modules were installed as well:'), _('(They can always be uninstalled later.)')); foreach ($modules as $module_name) { if (file_exists(dirname(__FILE__) . '/../' . $module_name . '/install.php')) { include dirname(__FILE__) . '/../' . $module_name . '/install.php'; $function = 'install' . $module_name . 'Schema'; if (function_exists($function)) { $output = $function($link, $database, $module_name); } if ($output == true) { addLogEntry(sprintf(_('%s %s was born.'), $module_name, $fm_version), $module_name, $link); } } } } } return $output == true ? true : false; }