/** * Gestion de l'upload */ function formulaire_upload($indice, $dstpath, $destname, $permittedtypes, $maxUploadSize) { // global $destname; //$permittedtypes = array("image/gif","image/pjpeg","image/jpeg","image/x-png") ; $permittedtypes = $allowed_mimetypes; if (isset($_POST['xoops_upload_file'])) { include_once XOOPS_ROOT_PATH . '/class/uploader.php'; if (isset($_FILES[$_POST['xoops_upload_file'][$indice]])) { $fldname = $_FILES[$_POST['xoops_upload_file'][$indice]]; $fldname = get_magic_quotes_gpc() ? stripslashes($fldname['name']) : $fldname['name']; if (xoops_trim($fldname != '')) { $uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $maxUploadSize); if ($uploader->fetchMedia($_POST['xoops_upload_file'][$indice])) { if ($uploader->upload()) { return true; } else { echo _ERRORS . ' ' . $uploader->getErrors(); echo "indice :" . $indice . "<br> dstpath :" . $dstpath . "<br> destname :" . $destname . " - " . $uploadDestName . "<br> permittedtypes :" . $permittedtypes[0] . "-" . $permittedtypes[1] . "-" . $permittedtypes[2] . "-" . $permittedtypes[3] . "<br>Max upload file:" . $maxUploadSize; exit; } } else { echo $uploader->getErrors(); } } } } return false; }
function listCart() { global $xoopsTpl, $uid; $cartForTemplate = $discountsDescription = array(); $emptyCart = false; $shippingAmount = $commandAmount = $vatAmount = $commandAmountTTC = $discountsCount = 0; $goOn = ''; $reductions = new myshop_reductions(); $reductions->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription, $discountsCount); $myshop_Currency =& myshop_Currency::getInstance(); $xoopsTpl->assign('emptyCart', $emptyCart); // Empty $xoopsTpl->assign('caddieProducts', $cartForTemplate); // Products $xoopsTpl->assign('shippingAmount', $myshop_Currency->amountForDisplay($shippingAmount)); $xoopsTpl->assign('commandAmount', $myshop_Currency->amountForDisplay($commandAmount)); $xoopsTpl->assign('vatAmount', $myshop_Currency->amountForDisplay($vatAmount)); $xoopsTpl->assign('discountsCount', $discountsCount); $xoopsTpl->assign('goOn', $goOn); $xoopsTpl->assign('commandAmountTTC', $myshop_Currency->amountForDisplay($commandAmountTTC, 'l')); $xoopsTpl->assign('discountsDescription', $discountsDescription); $showOrderButton = true; if (xoops_trim(myshop_utils::getModuleOption('paypal_email')) == '' && myshop_utils::getModuleOption('offline_payment') == 0) { $showOrderButton = false; } $showRegistredOnly = false; if (myshop_utils::getModuleOption('restrict_orders', false) && $uid == 0) { $showRegistredOnly = true; $showOrderButton = false; } $xoopsTpl->assign('showRegistredOnly', $showRegistredOnly); $xoopsTpl->assign('showOrderButton', $showOrderButton); }
/** * Renvoie les éléments à ajouter au formulaire en tant que zones cachées * * @param integer $commmandId * @param float $ttc */ function getFormContent($commandId, $ttc, $emailClient) { global $xoopsConfig; $ret = array(); $ret['cmd'] = '_xclick'; $ret['upload'] = '1'; $ret['currency_code'] = $this->moneyCode; $ret['business'] = $this->email; $ret['return'] = MYSHOP_URL . 'thankyou.php'; // Page (générique) de remerciement après paiement $ret['image_url'] = XOOPS_URL . '/images/logo.gif'; $ret['cpp_header_image'] = XOOPS_URL . '/images/logo.gif'; $ret['invoice'] = $commandId; $ret['item_name'] = _MYSHOP_COMMAND . $commandId . ' - ' . $xoopsConfig['sitename']; $ret['item_number'] = $commandId; $ret['tax'] = 0; // ajout 25/03/2008 $ret['amount'] = $this->formatAmount($ttc); $ret['custom'] = $commandId; //$ret['rm'] = 2; // Return data by POST (normal) $ret['email'] = $emailClient; // paypal_pdt if (xoops_trim($this->passwordCancel) != '') { // URL à laquelle le navigateur du client est ramené si le paiement est annulé $ret['cancel_return'] = MYSHOP_URL . 'cancel-payment.php?id=' . $this->passwordCancel; } if ($this->useIpn == 1) { $ret['notify_url'] = MYSHOP_URL . 'paypal-notify.php'; } return $ret; }
function fetch() { parent::fetch(); $t_queries = array(); $myts =& MyTextSanitizer::getInstance(); if ($this->get('andor') == 'exact' && strlen($this->get('query')) >= $this->_mKeywordMin) { $this->mQueries[] = $myts->addSlashes($this->get('query')); } else { $query = $this->get('query'); if (defined('XOOPS_USE_MULTIBYTES')) { $query = xoops_trim($query); } $separator = '/[\\s,]+/'; if (defined('_MD_LEGACY_FORMAT_SEARCH_SEPARATOR')) { $separator = _MD_LEGACY_FORMAT_SEARCH_SEPARATOR; } $tmpArr = preg_split($separator, $query); foreach ($tmpArr as $tmp) { if (strlen($tmp) >= $this->_mKeywordMin) { $this->mQueries[] = $myts->addSlashes($tmp); } } } $this->set('query', implode(" ", $this->mQueries)); }
function userCheck($uname, $email, $pass, $vpass) { global $myxoopsConfigUser; $xoopsDB =& Database::getInstance(); $stop = ''; if (!checkEmail($email)) { $stop .= _US_INVALIDMAIL . '<br />'; } foreach ($myxoopsConfigUser['bad_emails'] as $be) { if (!empty($be) && preg_match('/' . $be . '/i', $email)) { $stop .= _US_INVALIDMAIL . '<br />'; break; } } if (strrpos($email, ' ') > 0) { $stop .= _US_EMAILNOSPACES . '<br />'; } $uname = xoops_trim($uname); $restrictions = array(0 => '/[^a-zA-Z0-9\\_\\-]/', 1 => '/[^a-zA-Z0-9\\_\\-\\<\\>\\,\\.\\$\\%\\#\\@\\!\\\'\\"]/', 2 => '/[\\000-\\040]/'); $restriction = $restrictions[$myxoopsConfigUser['uname_test_level']]; if (empty($uname) || preg_match($restriction, $uname)) { $stop .= _US_INVALIDNICKNAME . '<br />'; } if (strlen($uname) > $myxoopsConfigUser['maxuname']) { $stop .= sprintf(_US_NICKNAMETOOLONG, $myxoopsConfigUser['maxuname']) . '<br />'; } if (strlen($uname) < $myxoopsConfigUser['minuname']) { $stop .= sprintf(_US_NICKNAMETOOSHORT, $myxoopsConfigUser['minuname']) . '<br />'; } foreach ($myxoopsConfigUser['bad_unames'] as $bu) { if (!empty($bu) && preg_match('/' . $bu . '/i', $uname)) { $stop .= _US_NAMERESERVED . '<br />'; break; } } if (strrpos($uname, ' ') > 0) { $stop .= _US_NICKNAMENOSPACES . '<br />'; } $u_handler =& xoonips_getormhandler('xoonips', 'xoops_users'); $criteria = new Criteria('uname', addslashes($uname)); if ($u_handler->getCount($criteria) > 0) { $stop .= _US_NICKNAMETAKEN . "<br />"; } if ($email) { $criteria = new Criteria('email', addslashes($email)); if ($u_handler->getCount($criteria) > 0) { $stop .= _US_EMAILTAKEN . "<br />"; } } if (!isset($pass) || $pass == '' || !isset($vpass) || $vpass == '') { $stop .= _US_ENTERPWD . '<br />'; } if (isset($pass) && $pass != $vpass) { $stop .= _US_PASSNOTSAME . '<br />'; } elseif ($pass != '' && strlen($pass) < $myxoopsConfigUser['minpass']) { $stop .= sprintf(_US_PWDTOOSHORT, $myxoopsConfigUser['minpass']) . '<br />'; } return $stop; }
/** * Indique si l'image de la catégorie existe * * @return boolean Vrai si l'image existe sinon faux */ public function pictureExists() { $return = false; if (xoops_trim($this->getVar('payment_image')) != '' && file_exists(OLEDRION_PICTURES_PATH . DIRECTORY_SEPARATOR . $this->getVar('payment_image'))) { $return = true; } return $return; }
/** * Display if category image exists * * @return boolean */ function pictureExists() { $return = false; if (xoops_trim($this->getVar('cat_imgurl')) != '' && file_exists(MYSHOP_PICTURES_PATH . DIRECTORY_SEPARATOR . $this->getVar('cat_imgurl'))) { $return = true; } return $return; }
/** * Retourne une option de l'attribut * * @param string $valueToGet * @param string $format * @return array * @since 2.3.2009.03.11 */ function getOption($valueToGet, $format = 'e') { $names = array(); if (xoops_trim($this->getVar($valueToGet, $format)) != '') { $names = explode(OLEDRION_ATTRIBUTE_SEPARATOR, $this->getVar($valueToGet, $format)); } return $names; }
/** * Retourne la passerelle de paiement en cours d'utilisation * * @return string Le nom de la passerelle de paiement (en fait le nom de son répertoire) */ function getCurrentGateway() { $return = xoops_trim(oledrion_utils::getModuleOption('used_gateway')); if ($return == '') { $return = 'paypal'; // Valeur par défaut } return $return; }
function giveMimetype($filename = '') { $cmimetype = new cmimetype(); $workingfile = $this->downloadname; if (xoops_trim($filename) != '') { $workingfile = $filename; return $cmimetype->getType($workingfile); } else { return ''; } }
/** * Indique si une des 5 images du fabricant existe * * @param integer $pictureNumber Le numéro (de 1 à 5) de l'image que l'on souhaite récupérer * @return boolean Vrai si l'image existe sinon faux */ public function pictureExists($pictureNumber) { $pictureNumber = intval($pictureNumber); $return = false; if ($pictureNumber > 0 && $pictureNumber < 6) { if (xoops_trim($this->getVar('manu_photo' . $pictureNumber)) != '' && file_exists(OLEDRION_PICTURES_PATH . DIRECTORY_SEPARATOR . $this->getVar('manu_photo' . $pictureNumber))) { $return = true; } } return $return; }
function saveParametersForm($data) { if (xoops_trim($this->languageFilename) != '' && file_exists($this->languageFilename)) { require $this->languageFilename; } $gatewayName = $this->gatewayInformation['foldername']; $this->handlers->h_oledrion_gateways_options->deleteGatewayOptions($gatewayName); if (!$this->handlers->h_oledrion_gateways_options->setGatewayOptionValue($gatewayName, 'parsian_mid', $data['parsian_mid'])) { return false; } return true; }
/** * Add one or many keywords */ function addkeywords($keyword) { $myts =& MyTextSanitizer::getInstance(); if (is_array($keyword)) { foreach ($keyword as $onekeyword) { $onekeyword = xoops_trim($myts->htmlSpecialChars($onekeyword)); $this->keywords[$onekeyword] = $onekeyword; } } else { $keyword = xoops_trim($myts->htmlSpecialChars($keyword)); $this->keywords[$keyword] = $keyword; } }
function b_marquee_mydownloads($limit, $dateformat, $itemssize) { include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; $block = array(); $myts =& MyTextSanitizer::getInstance(); $db =& Database::getInstance(); $result = $db->query("SELECT m.lid, m.cid, m.title, m.date, m.hits, m.submitter, c.title as catitle, u.name, u.uname FROM " . $db->prefix("mydownloads_downloads") . " m, " . $db->prefix("mydownloads_cat") . " c, " . $db->prefix("users") . " u WHERE (c.cid=m.cid) AND (m.submitter=u.uid) AND (m.status>0) ORDER BY m.date DESC", $limit, 0); while ($myrow = $db->fetchArray($result)) { $title = $myts->htmlSpecialChars($myrow["title"]); if ($itemssize > 0) { $title = xoops_substr($title, 0, $itemssize + 3); } $author = $myts->htmlSpecialChars($myrow["uname"]); if (xoops_trim($myrow["catitle"]) != '') { $author = $myts->htmlSpecialChars($myrow["name"]); } $category = $myts->htmlSpecialChars($myrow["catitle"]); $block[] = array('date' => formatTimestamp($myrow['date'], $dateformat), 'category' => $category, 'author' => $author, 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/mydownloads/singlefile.php?cid=' . $myrow['cid'] . "&lid=" . $myrow['lid'] . "'>" . $title . '</a>'); } return $block; }
function grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $items = $h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => 0, 'limit' => $this->grab))); $i = 0; if (false != $items && count($items) > 0) { foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); if (xoops_trim($item->getVar('product_summary')) != '') { $description = $item->getVar('product_summary'); } else { $description = $item->getVar('product_description'); } $ret[$i]['description'] = $description; $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } return $ret; }
*/ // On récupère les ID des attributs valorisés foreach ($data as $key => $value) { $attributesIds[] = oledrion_utils::getId($key); } if (count($attributesIds) == 0) { return _OLEDRION_NA; } // Puis les attributs $attributes = $handlers->h_oledrion_attributes->getItemsFromIds($attributesIds); if (count($attributes) == 0) { return _OLEDRION_NA; } // Et on recalcule le prix foreach ($attributes as $attribute) { $attributeNameInForm = xoops_trim($attribute->getVar('attribute_name') . '_' . $attribute->getVar('attribute_id')); if (isset($data[$attributeNameInForm])) { $attributeValues = $data[$attributeNameInForm]; if (is_array($attributeValues)) { foreach ($attributeValues as $attributeValue) { $optionName = oledrion_utils::getName($attributeValue); $optionPrice = $attribute->getOptionPriceFromValue($optionName); $productPrice += $optionPrice; } } else { $optionPrice = $attribute->getOptionPriceFromValue(oledrion_utils::getName($attributeValues)); $productPrice += $optionPrice; } } } // Mise en template
/** * oledrion * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Hervé Thouzard (http://www.herve-thouzard.com/) * @author Hossein Azizabadi (azizabadi@faragostaresh.com) * @version $Id: functions_update.php 12290 2014-02-07 11:05:17Z beckmi $ */ function xoops_module_update_oledrion($module, $version) { global $xoopsDB; // Présence des nouvelles tables et nouvelles zones dans la base de données // Nouvelle table oledrion_gateways_options $tableName = $xoopsDB->prefix('oledrion_gateways_options'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE " . $tableName . " (\n `option_id` int(10) unsigned NOT NULL auto_increment,\n `option_gateway` varchar(50) NOT NULL COMMENT 'nom de la passerelle de paiement',\n `option_name` varchar(50) NOT NULL,\n `option_value` text NOT NULL,\n PRIMARY KEY (`option_id`),\n KEY `option_gateway` (`option_gateway`),\n KEY `option_name` (`option_name`),\n KEY `option_gateway_name` (`option_gateway`,`option_name`)\n ) ENGINE=InnoDB"; $xoopsDB->queryF($sql); } // Nouveau champ cmd_comment dans oledrion_commands $tableName = $xoopsDB->prefix('oledrion_commands'); if (!oledrion_utils::fieldExists('cmd_comment', $tableName)) { oledrion_utils::addField('`cmd_comment` TEXT NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_vat_number', $tableName)) { oledrion_utils::addField('`cmd_vat_number` VARCHAR( 255 ) NOT NULL', $tableName); } /** * Nouvelle table oledrion_lists * @since 2.2.2009.01.29 */ $tableName = $xoopsDB->prefix('oledrion_lists'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE " . $tableName . " (\n `list_id` int(10) unsigned NOT NULL auto_increment,\n `list_uid` mediumint(8) unsigned NOT NULL,\n `list_title` varchar(255) NOT NULL,\n `list_date` int(10) unsigned NOT NULL,\n `list_productscount` mediumint(8) unsigned NOT NULL,\n `list_views` mediumint(8) unsigned NOT NULL,\n `list_password` varchar(50) NOT NULL,\n `list_type` tinyint(3) unsigned NOT NULL,\n `list_description` text NOT NULL,\n PRIMARY KEY (`list_id`),\n KEY `list_uid` (`list_uid`)\n ) ENGINE=InnoDB"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_lists * @since 2.2.2009.01.29 */ $tableName = $xoopsDB->prefix('oledrion_products_list'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE " . $tableName . " (\n `productlist_id` int(10) unsigned NOT NULL auto_increment,\n `productlist_list_id` int(10) unsigned NOT NULL,\n `productlist_product_id` int(10) unsigned NOT NULL,\n PRIMARY KEY (`productlist_id`),\n KEY `productlist_list_id` (`productlist_list_id`),\n KEY `productlist_product_id` (`productlist_product_id`)\n ) ENGINE=InnoDB"; $xoopsDB->queryF($sql); } if (!oledrion_utils::fieldExists('productlist_date', $tableName)) { oledrion_utils::addField('productlist_date DATE NOT NULL', $tableName); } /** * Nouvelle table oledrion_attributes * @since 2.3.2009.03.09 */ $tableName = $xoopsDB->prefix('oledrion_attributes'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `attribute_id` int(10) unsigned NOT NULL auto_increment,\n `attribute_weight` mediumint(7) unsigned default NULL,\n `attribute_title` varchar(255) default NULL,\n `attribute_name` varchar(255) NOT NULL,\n `attribute_type` tinyint(3) unsigned default NULL,\n `attribute_mandatory` tinyint(1) unsigned default NULL,\n `attribute_values` text,\n `attribute_names` text,\n `attribute_prices` text,\n `attribute_stocks` text,\n `attribute_product_id` int(11) unsigned default NULL,\n `attribute_default_value` varchar(255) default NULL,\n `attribute_option1` mediumint(7) unsigned default NULL,\n `attribute_option2` mediumint(7) unsigned default NULL,\n PRIMARY KEY (`attribute_id`),\n KEY `attribute_product_id` (`attribute_product_id`),\n KEY `attribute_weight` (`attribute_weight`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_caddy_attributes * @since 2.3.2009.03.10 */ $tableName = $xoopsDB->prefix('oledrion_caddy_attributes'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `ca_id` int(10) unsigned NOT NULL auto_increment,\n `ca_cmd_id` int(10) unsigned NOT NULL,\n `ca_caddy_id` int(10) unsigned NOT NULL,\n `ca_attribute_id` int(10) unsigned NOT NULL,\n `ca_attribute_values` text NOT NULL,\n `ca_attribute_names` text NOT NULL,\n `ca_attribute_prices` text NOT NULL,\n PRIMARY KEY (`ca_id`),\n KEY `ca_cmd_id` (`ca_cmd_id`),\n KEY `ca_caddy_id` (`ca_caddy_id`),\n KEY `ca_attribute_id` (`ca_attribute_id`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Augmentation des types numéraires pour accepter le million * @since 2.3.2009.04.20 */ $definition = oledrion_utils::getFieldDefinition('product_price', $xoopsDB->prefix('oledrion_products')); if ($definition != '') { if (xoops_trim($definition['Type']) == 'decimal(7,2)') { $tablesToUpdates = array('oledrion_products' => array('product_price', 'product_shipping_price', 'product_discount_price', 'product_ecotaxe'), 'oledrion_caddy' => array('caddy_price'), 'oledrion_commands' => array('cmd_shipping'), 'oledrion_discounts' => array('disc_price_degress_l1total', 'disc_price_degress_l2total', 'disc_price_degress_l3total', 'disc_price_degress_l4total', 'disc_price_degress_l5total')); foreach ($tablesToUpdates as $tableName => $fields) { foreach ($fields as $field) { $sql = 'ALTER TABLE ' . $xoopsDB->prefix($tableName) . ' CHANGE `' . $field . '` `' . $field . '` DECIMAL( 16, 2 ) NOT NULL'; $xoopsDB->queryF($sql); } } } } /** * Add product_property * @since 2.3.2012.08.03 */ $tableName = $xoopsDB->prefix('oledrion_products'); if (!oledrion_utils::fieldExists('product_property1', $tableName)) { oledrion_utils::addField('`product_property1` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property2', $tableName)) { oledrion_utils::addField('`product_property2` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property3', $tableName)) { oledrion_utils::addField('`product_property3` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property4', $tableName)) { oledrion_utils::addField('`product_property4` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property5', $tableName)) { oledrion_utils::addField('`product_property5` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property6', $tableName)) { oledrion_utils::addField('`product_property6` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property7', $tableName)) { oledrion_utils::addField('`product_property7` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property8', $tableName)) { oledrion_utils::addField('`product_property8` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property9', $tableName)) { oledrion_utils::addField('`product_property9` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('product_property10', $tableName)) { oledrion_utils::addField('`product_property10` varchar(255) NOT NULL', $tableName); } /** * Nouvelle table oledrion_packing * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_packing'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `packing_id` int(5) unsigned NOT NULL auto_increment,\n `packing_title` varchar(255) NOT NULL default '',\n `packing_width` varchar(50) NOT NULL,\n `packing_length` varchar(50) NOT NULL,\n `packing_weight` varchar(50) NOT NULL,\n `packing_image` varchar(255) NOT NULL,\n `packing_description` text,\n `packing_price` decimal(16,2) NOT NULL,\n `packing_online` tinyint(1) NOT NULL default '1',\n PRIMARY KEY (`packing_id`),\n KEY `packing_title` (`packing_title`),\n KEY `packing_online` (`packing_online`),\n KEY `packing_price` (`packing_price`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_location * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_location'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `location_id` int(5) unsigned NOT NULL auto_increment,\n `location_pid` int(5) unsigned NOT NULL default '0',\n `location_title` varchar(255) NOT NULL default '',\n `location_online` tinyint(1) NOT NULL default '1',\n `location_type` enum('location','parent') NOT NULL,\n PRIMARY KEY (`location_id`),\n KEY `location_title` (`location_title`),\n KEY `location_pid` (`location_pid`),\n KEY `location_online` (`location_online`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_delivery * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_delivery'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `delivery_id` int(10) unsigned NOT NULL auto_increment,\n `delivery_title` varchar(255) NOT NULL default '',\n `delivery_description` text,\n `delivery_online` tinyint(1) NOT NULL default '1',\n `delivery_image` varchar(255) NOT NULL,\n PRIMARY KEY (`delivery_id`),\n KEY `delivery_title` (`delivery_title`),\n KEY `delivery_online` (`delivery_online`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_payment * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_payment'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `payment_id` int(10) unsigned NOT NULL auto_increment,\n `payment_title` varchar(255) NOT NULL default '',\n `payment_description` text,\n `payment_online` tinyint(1) NOT NULL default '1',\n `payment_type` enum('online','offline') NOT NULL,\n `payment_gateway` varchar(64) NOT NULL default '',\n `payment_image` varchar(255) NOT NULL,\n PRIMARY KEY (`payment_id`),\n KEY `payment_title` (`payment_title`),\n KEY `payment_online` (`payment_online`),\n KEY `payment_type` (`payment_type`),\n KEY `payment_gateway` (`payment_gateway`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_location_delivery * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_location_delivery'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `ld_id` int(5) unsigned NOT NULL auto_increment,\n `ld_location` int(5) unsigned NOT NULL,\n `ld_delivery` int(5) unsigned NOT NULL,\n `ld_price` decimal(16,2) NOT NULL,\n `ld_delivery_time` mediumint(8) unsigned NOT NULL,\n PRIMARY KEY (`ld_id`),\n KEY `ld_location` (`ld_location`),\n KEY `ld_delivery` (`ld_delivery`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_delivery_payment * @since 2.3.4 2013.03.5 */ $tableName = $xoopsDB->prefix('oledrion_delivery_payment'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `dp_id` int(5) unsigned NOT NULL auto_increment,\n `dp_delivery` int(5) unsigned NOT NULL,\n `dp_payment` int(5) unsigned NOT NULL,\n PRIMARY KEY (`dp_id`),\n KEY `dp_delivery` (`dp_delivery`),\n KEY `dp_payment` (`dp_payment`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Nouvelle table oledrion_delivery_payment * @since 2.3.4 2013.03.15 */ $tableName = $xoopsDB->prefix('oledrion_payment_log'); if (!oledrion_utils::tableExists($tableName)) { $sql = "CREATE TABLE `{$tableName}` (\n `log_id` int(10) unsigned NOT NULL auto_increment,\n `log_create` int(10) unsigned NOT NULL,\n `log_status` tinyint(1) unsigned NOT NULL,\n `log_ip` varchar(32) NOT NULL,\n `log_type` enum('online','offline') NOT NULL,\n `log_payment` int(10) unsigned NOT NULL,\n `log_gateway` varchar(64) NOT NULL default '',\n `log_uid` int(10) unsigned NOT NULL,\n `log_command` int(10) unsigned NOT NULL,\n `log_amount` double(16,2) NOT NULL,\n `log_authority` varchar(255) NOT NULL,\n PRIMARY KEY (`log_id`),\n KEY `log_uid` (`log_uid`),\n KEY `log_command` (`log_command`),\n KEY `log_status` (`log_status`)\n ) ENGINE=InnoDB;"; $xoopsDB->queryF($sql); } /** * Add New fields to oledrion_commands * @since 2.3.2013.03.15 */ $tableName = $xoopsDB->prefix('oledrion_commands'); if (!oledrion_utils::fieldExists('cmd_create', $tableName)) { oledrion_utils::addField('`cmd_create` int(10) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_packing', $tableName)) { oledrion_utils::addField('`cmd_packing` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_packing_id', $tableName)) { oledrion_utils::addField('`cmd_packing_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_location', $tableName)) { oledrion_utils::addField('`cmd_location` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_location_id', $tableName)) { oledrion_utils::addField('`cmd_location_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_delivery', $tableName)) { oledrion_utils::addField('`cmd_delivery` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_delivery_id', $tableName)) { oledrion_utils::addField('`cmd_delivery_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_payment', $tableName)) { oledrion_utils::addField('`cmd_payment` varchar(255) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_payment_id', $tableName)) { oledrion_utils::addField('`cmd_payment_id` int(5) unsigned NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_status', $tableName)) { oledrion_utils::addField('`cmd_status` tinyint(1) unsigned NOT NULL default "1"', $tableName); } if (!oledrion_utils::fieldExists('cmd_mobile', $tableName)) { oledrion_utils::addField('`cmd_mobile` varchar(30) NOT NULL', $tableName); } if (!oledrion_utils::fieldExists('cmd_packing_price', $tableName)) { oledrion_utils::addField('`cmd_packing_price` decimal(16,2) NOT NULL', $tableName); } /** * Add/update product urls * @since 2.3.2013.08.03 */ $tableName = $xoopsDB->prefix('oledrion_products'); if (!oledrion_utils::fieldExists('product_url2', $tableName)) { oledrion_utils::addField('`product_url2` VARCHAR( 255 ) NOT NULL AFTER `product_url`', $tableName); } if (!oledrion_utils::fieldExists('product_url3', $tableName)) { oledrion_utils::addField('`product_url3` VARCHAR( 255 ) NOT NULL AFTER `product_url`', $tableName); } /** * Add cmd_track * @since 2014.01.03 */ $tableName = $xoopsDB->prefix('oledrion_commands'); if (!oledrion_utils::fieldExists('cmd_track', $tableName)) { oledrion_utils::addField('`cmd_track` VARCHAR( 255 ) NOT NULL', $tableName); } /** * Add cmd_track * @since 2014.01.10 */ $tableName = $xoopsDB->prefix('oledrion_related'); if (!oledrion_utils::fieldExists('related_product_percent', $tableName)) { oledrion_utils::addField('`related_product_percent` INT( 4 ) NOT NULL', $tableName); } }
exit; } } $forumpost = new ForumPosts(); $forumpost->setForum($forum); if (isset($pid) && $pid != "") { $forumpost->setParent($pid); } if (!empty($topic_id)) { $forumpost->setTopicId($topic_id); $isreply = 1; } $forumpost->setIp($HTTP_SERVER_VARS['REMOTE_ADDR']); $forumpost->setUid($uid); } $subject = xoops_trim($HTTP_POST_VARS['subject']); $subject = $subject == '' ? _NOTITLE : $subject; $forumpost->setSubject($subject); $forumpost->setText($HTTP_POST_VARS['message']); $forumpost->setNohtml($HTTP_POST_VARS['nohtml']); $forumpost->setNosmiley($HTTP_POST_VARS['nosmiley']); $forumpost->setIcon($HTTP_POST_VARS['icon']); $forumpost->setAttachsig($HTTP_POST_VARS['attachsig']); if (!($postid = $forumpost->store())) { include_once XOOPS_ROOT_PATH . '/header.php'; xoops_error('Could not insert forum post'); include_once XOOPS_ROOT_PATH . '/footer.php'; exit; } if (is_object($xoopsUser) && !empty($isnew)) { $xoopsUser->incrementPost();
// Duplication d'une réduction // **************************************************************************************************************** xoops_cp_header(); $id = isset($_GET['id']) ? intval($_GET['id']) : 0; if (empty($id)) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5); } $opRedirect = 'discounts'; $item = null; $item = $h_oledrion_discounts->get($id); if (is_object($item)) { $newDiscount = $item->xoopsClone(); if (OLEDRION_DUPLICATED_PLACE == 'right') { $newDiscount->setVar('disc_title', xoops_trim($item->getvar('disc_title')) . ' ' . _AM_OLEDRION_DUPLICATED); } else { $newDiscount->setVar('disc_title', _AM_OLEDRION_DUPLICATED . ' ' . xoops_trim($item->getvar('disc_title'))); } $newDiscount->setVar('disc_id', 0); $newDiscount->setNew(); $res = $h_oledrion_discounts->insert($newDiscount, true); if ($res) { oledrion_utils::updateCache(); oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); } else { oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); } } else { oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); } // **************************************************************************************************************** // ****************************************************************************************************************
$uid_ids = $article->getWhosWho(news_getmoduleoption('restrictindex')); if (count($uid_ids) > 0) { $lst_uid = implode(',', $uid_ids); $member_handler =& xoops_gethandler('member'); $critere = new Criteria('uid', '(' . $lst_uid . ')', 'IN'); $tbl_users = $member_handler->getUsers($critere); foreach ($tbl_users as $one_user) { $uname = ''; switch ($option) { case 1: // Username $uname = $one_user->getVar('uname'); break; case 2: // Display full name (if it is not empty) if (xoops_trim($one_user->getVar('name')) != '') { $uname = $one_user->getVar('name'); } else { $uname = $one_user->getVar('uname'); } break; } $xoopsTpl->append('whoswho', array('uid' => $one_user->getVar('uid'), 'name' => $uname, 'user_avatarurl' => XOOPS_URL . '/uploads/' . $one_user->getVar('user_avatar'))); } } $xoopsTpl->assign('advertisement', news_getmoduleoption('advertisement')); /** * Manage all the meta datas */ news_CreateMetaDatas($article); $xoopsTpl->assign('xoops_pagetitle', _AM_NEWS_WHOS_WHO);
/** * Notes about the spotlight : * If you have restricted topics on index page (in fact if the program must completly respect the permissions) and if * the news you have selected to be viewed in the spotlight can't be viewed by someone then the spotlight is not visible ! * This is available in the classical and in the tabbed view. * But if you have uncheck the option "Restrict topics on index page", then the news will be visible but users without * permissions will be rejected when they will try to read news content. * * Also, if you have selected a tabbed view and wanted to use the Spotlight but did not choosed a story, then the block * will switch to the "most recent news" mode (the visible news will be searched according to the permissions) */ function b_news_top_show($options) { global $xoopsConfig; include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; $myts =& MyTextSanitizer::getInstance(); $block = array(); $displayname = news_getmoduleoption('displayname'); $tabskin = news_getmoduleoption('tabskin'); if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) { include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php'; } else { include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php'; } $block['displayview'] = $options[8]; $block['tabskin'] = $tabskin; $block['imagesurl'] = XOOPS_URL . '/modules/news/images/'; $restricted = news_getmoduleoption('restrictindex'); $dateformat = news_getmoduleoption('dateformat'); $infotips = news_getmoduleoption('infotips'); $newsrating = news_getmoduleoption('ratenews'); if ($dateformat == '') { $dateformat = 's'; } $perm_verified = false; $news_visible = true; // Is the spotlight visible ? if ($options[4] == 1 && $restricted && $options[5] == 0) { $perm_verified = true; $permittedtopics = news_MygetItemIds(); $permstory = new NewsStory($options[6]); if (!in_array($permstory->topicid(), $permittedtopics)) { $usespotlight = false; $news_visible = false; $topicstitles = array(); } $options[4] == 0; } // Try to see what tabs are visibles (if we are in restricted view of course) if ($options[8] == 2 && $restricted && $options[14] != 0) { $topics2 = array(); $permittedtopics = news_MygetItemIds(); $topics = array_slice($options, 14); foreach ($topics as $onetopic) { if (in_array($onetopic, $permittedtopics)) { $topics2[] = $onetopic; } } $before = array_slice($options, 0, 14); $options = array_merge($before, $topics2); } if ($options[8] == 2) { // Tabbed view ******************************************************************************************** $defcolors[1] = array('#F90', '#FFFFFF', '#F90', '#C60', '#999'); // Bar Style $defcolors[2] = array('#F90', '#FFFFFF', '#F90', '#AAA', '#666'); // Beveled $defcolors[3] = array('#F90', '#FFFFFF', '', '#789', '#789'); // Classic $defcolors[4] = array('#F90', '#FFFFFF', '', '', ''); // Folders $defcolors[5] = array('#F90', '#FFFFFF', '#CCC', 'inherit', '#999'); // MacOs $defcolors[6] = array('#F90', '#FFFFFF', '#FFF', '#DDD', '#999'); // Plain $defcolors[7] = array('#F90', '#FFFFFF', '', '', ''); // Rounded $defcolors[8] = array('#F90', '#FFFFFF', '#F90', '#930', '#C60'); // ZDnet $myurl = $_SERVER['PHP_SELF']; if (substr($myurl, strlen($myurl) - 1, 1) == '/') { $myurl .= 'index.php'; } $myurl .= '?'; foreach ($_GET as $key => $value) { if ($key != 'NewsTab') { $myurl .= $key . '=' . $value . '&'; } } $block['url'] = $myurl; $tabscount = 0; $usespotlight = false; if (isset($_GET['NewsTab'])) { $_SESSION['NewsTab'] = intval($_GET['NewsTab']); $currenttab = intval($_GET['NewsTab']); } elseif (isset($_SESSION['NewsTab'])) { $currenttab = intval($_SESSION['NewsTab']); } else { $currenttab = 0; } $tmpstory = new NewsStory(); $topic = new NewsTopic(); $topicstitles = array(); if ($options[4] == 1) { // Spotlight enabled $topicstitles[0] = _MB_NEWS_SPOTLIGHT_TITLE; $tabscount++; $usespotlight = true; } if ($options[5] == 0 && $restricted) { // Use a specific news and we are in restricted mode if (!$perm_verified) { $permittedtopics = news_MygetItemIds(); $permstory = new NewsStory($options[6]); if (!in_array($permstory->topicid(), $permittedtopics)) { $usespotlight = false; $topicstitles = array(); } //unset($permstory); } else { if (!$news_visible) { $usespotlight = false; $topicstitles = array(); } } } $block['use_spotlight'] = $usespotlight; if (isset($options[14]) && $options[14] != 0) { // Topic to use $topics = array_slice($options, 14); $tabscount += count($topics); $topicstitles = $topic->getTopicTitleFromId($topics, $topicstitles); } $tabs = array(); if ($usespotlight) { $tabs[] = array('id' => 0, 'title' => _MB_NEWS_SPOTLIGHT_TITLE); } if (count($topics) > 0) { foreach ($topics as $onetopic) { if (isset($topicstitles[$onetopic])) { $tabs[] = array('id' => $onetopic, 'title' => $topicstitles[$onetopic]['title'], 'picture' => $topicstitles[$onetopic]['picture']); } } } $block['tabs'] = $tabs; $block['current_is_spotlight'] = false; $block['current_tab'] = $currenttab; $block['use_rating'] = $newsrating; if ($currenttab == 0 && $usespotlight) { // Spotlight or not ? $block['current_is_spotlight'] = true; if ($options[5] == 0 && $options[6] == 0) { // If the story to use was no selected then we switch to the "recent news" mode. $options[5] = 1; } if ($options[5] == 0) { // Use a specific news if (!isset($permstory)) { $tmpstory->NewsStory($options[6]); } else { $tmpstory = $permstory; } } else { // Use the most recent news $stories = array(); $stories = $tmpstory->getAllPublished(1, 0, $restricted, 0, 1, true, $options[0]); if (count($stories) > 0) { $firststory = $stories[0]; $tmpstory->NewsStory($firststory->storyid()); } else { $block['use_spotlight'] = false; } } $spotlight = array(); $spotlight['title'] = $tmpstory->title(); if ($options[7] != '') { $spotlight['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), $myts->displayTarea($options[7], $tmpstory->nohtml)); } $spotlight['text'] = $tmpstory->hometext(); // Added 16 february 2007 ***************************************** $story_user = null; $story_user = new XoopsUser($tmpstory->uid()); if (is_object($story_user)) { $spotlight['avatar'] = XOOPS_UPLOAD_URL . '/' . $story_user->getVar('user_avatar'); } // **************************************************************** $spotlight['id'] = $tmpstory->storyid(); $spotlight['date'] = formatTimestamp($tmpstory->published(), $dateformat); $spotlight['hits'] = $tmpstory->counter(); $spotlight['rating'] = number_format($tmpstory->rating(), 2); $spotlight['votes'] = $tmpstory->votes(); if (strlen(xoops_trim($tmpstory->bodytext())) > 0) { $spotlight['read_more'] = true; } else { $spotlight['read_more'] = false; } $spotlight['readmore'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), _MB_READMORE); $spotlight['title_with_link'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $tmpstory->storyid(), $tmpstory->title()); if ($tmpstory->votes() == 1) { $spotlight['number_votes'] = _NW_ONEVOTE; } else { $spotlight['number_votes'] = sprintf(_NW_NUMVOTES, $tmpstory->votes()); } $spotlight['votes_with_text'] = sprintf(_NW_NUMVOTES, $tmpstory->votes()); $spotlight['topicid'] = $tmpstory->topicid(); $spotlight['topic_title'] = $tmpstory->topic_title(); // Added, topic's image and description $spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $tmpstory->topic_imgurl(); $spotlight['topic_description'] = $myts->displayTarea($tmpstory->topic_description, 1); if ($displayname != 3) { $spotlight['author'] = sprintf("%s %s", _POSTEDBY, $tmpstory->uname()); $spotlight['author_with_link'] = sprintf("%s <a href='%s'>%s</a>", _POSTEDBY, XOOPS_URL . '/userinfo.php?uid=' . $tmpstory->uid(), $tmpstory->uname()); } else { $spotlight['author'] = ''; $spotlight['author_with_link'] = ''; } $spotlight['author_id'] = $tmpstory->uid(); // Create the summary table under the spotlight text if (isset($options[14]) && $options[14] == 0) { // Use all topics $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, 0, 1, true, $options[0]); } else { // Use some topics $topics = array_slice($options, 14); $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $topics, 1, true, $options[0]); } if (count($stories) > 0) { foreach ($stories as $key => $story) { $news = array(); $title = $story->title(); if (strlen($title) > $options[2]) { $title = xoops_substr($title, 0, $options[2] + 3); } $news['title'] = $title; $news['id'] = $story->storyid(); $news['date'] = formatTimestamp($story->published(), $dateformat); $news['hits'] = $story->counter(); $news['rating'] = number_format($story->rating(), 2); $news['votes'] = $story->votes(); $news['topicid'] = $story->topicid(); $news['topic_title'] = $story->topic_title(); $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color); if ($displayname != 3) { $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname()); } else { $news['author'] = ''; } if ($options[3] > 0) { $html = $story->nohtml() == 1 ? 0 : 1; $news['teaser'] = news_truncate_tagsafe($myts->displayTarea($story->hometext(), $html), $options[3] + 3); } else { $news['teaser'] = ''; } if ($infotips > 0) { $news['infotips'] = ' title="' . news_make_infotips($story->hometext()) . '"'; } else { $news['infotips'] = ''; } $news['title_with_link'] = sprintf("<a href='%s'%s>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $news['infotips'], $title); $spotlight['news'][] = $news; } } $block['spotlight'] = $spotlight; } else { if ($tabscount > 0) { $topics = array_slice($options, 14); $thetopic = $currenttab; $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $thetopic, 1, true, $options[0]); $topic->getTopic($thetopic); // Added, topic's image and description $block['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $topic->topic_imgurl(); $block['topic_description'] = $topic->topic_description(); $smallheader = array(); $stats = $topic->getTopicMiniStats($thetopic); $smallheader[] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/index.php?storytopic=' . $thetopic, _MB_READMORE); $smallheader[] = sprintf("%u %s", $stats['count'], _NW_ARTICLES); $smallheader[] = sprintf("%u %s", $stats['reads'], _READS); if (count($stories) > 0) { foreach ($stories as $key => $story) { $news = array(); $title = $story->title(); if (strlen($title) > $options[2]) { $title = news_truncate_tagsafe($title, $options[2] + 3); } if ($options[7] != '') { $news['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $myts->displayTarea($options[7], $story->nohtml)); } if ($options[3] > 0) { $html = $story->nohtml() == 1 ? 0 : 1; $news['text'] = news_truncate_tagsafe($myts->displayTarea($story->hometext(), $html), $options[3] + 3); } else { $news['text'] = ''; } if ($story->votes() == 1) { $news['number_votes'] = _NW_ONEVOTE; } else { $news['number_votes'] = sprintf(_NW_NUMVOTES, $story->votes()); } if ($infotips > 0) { $news['infotips'] = ' title="' . news_make_infotips($story->hometext()) . '"'; } else { $news['infotips'] = ''; } $news['title'] = sprintf("<a href='%s' %s>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $news['infotips'], $title); $news['id'] = $story->storyid(); $news['date'] = formatTimestamp($story->published(), $dateformat); $news['hits'] = $story->counter(); $news['rating'] = number_format($story->rating(), 2); $news['votes'] = $story->votes(); $news['topicid'] = $story->topicid(); $news['topic_title'] = $story->topic_title(); $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color); if ($displayname != 3) { $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname()); } else { $news['author'] = ''; } $news['title_with_link'] = sprintf("<a href='%s'%s>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $news['infotips'], $title); $block['news'][] = $news; } $block['smallheader'] = $smallheader; } } } $block['lang_on'] = _ON; // on $block['lang_reads'] = _READS; // reads // Default values $block['color1'] = $defcolors[$tabskin][0]; $block['color2'] = $defcolors[$tabskin][1]; $block['color3'] = $defcolors[$tabskin][2]; $block['color4'] = $defcolors[$tabskin][3]; $block['color5'] = $defcolors[$tabskin][4]; if (xoops_trim($options[9]) != '') { $block['color1'] = $options[9]; } if (xoops_trim($options[10]) != '') { $block['color2'] = $options[10]; } if (xoops_trim($options[11]) != '') { $block['color3'] = $options[11]; } if (xoops_trim($options[12]) != '') { $block['color4'] = $options[12]; } if (xoops_trim($options[13]) != '') { $block['color5'] = $options[13]; } } else { // ************************ Classical view ************************************************************************************************************** $tmpstory = new NewsStory(); if (isset($options[14]) && $options[14] == 0) { $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, 0, 1, true, $options[0]); } else { $topics = array_slice($options, 14); $stories = $tmpstory->getAllPublished($options[1], 0, $restricted, $topics, 1, true, $options[0]); } if (!count($stories)) { return ''; } $topic = new NewsTopic(); foreach ($stories as $key => $story) { $news = array(); $title = $story->title(); if (strlen($title) > $options[2]) { $title = xoops_substr($title, 0, $options[2] + 3); } //if spotlight is enabled and this is either the first article or the selected one if ($options[5] == 0 && $options[4] == 1 && ($options[6] > 0 && $options[6] == $story->storyid() || $options[6] == 0 && $key == 0)) { $spotlight = array(); $visible = true; if ($restricted) { $permittedtopics = news_MygetItemIds(); if (!in_array($story->topicid(), $permittedtopics)) { $visible = false; } } if ($visible) { $spotlight['title'] = $title; if ($options[7] != '') { $spotlight['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(), $myts->displayTarea($options[7], $story->nohtml)); } // Added 16 february 2007 ***************************************** $story_user = null; $story_user = new XoopsUser($story->uid()); if (is_object($story_user)) { $spotlight['avatar'] = XOOPS_UPLOAD_URL . '/' . $story_user->getVar('user_avatar'); } // **************************************************************** $spotlight['text'] = $story->hometext(); $spotlight['id'] = $story->storyid(); $spotlight['date'] = formatTimestamp($story->published(), $dateformat); $spotlight['hits'] = $story->counter(); $spotlight['rating'] = $story->rating(); $spotlight['votes'] = $story->votes(); $spotlight['topicid'] = $story->topicid(); $spotlight['topic_title'] = $story->topic_title(); $spotlight['topic_color'] = '#' . $myts->displayTarea($story->topic_color); // Added, topic's image and description $spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $story->topic_imgurl(); $spotlight['topic_description'] = $myts->displayTarea($story->topic_description, 1); if (strlen(xoops_trim($story->bodytext())) > 0) { $spotlight['read_more'] = true; } else { $spotlight['read_more'] = false; } if ($displayname != 3) { $spotlight['author'] = sprintf("%s %s", _POSTEDBY, $story->uname()); } else { $spotlight['author'] = ''; } } $block['spotlight'] = $spotlight; } else { $news['title'] = $title; $news['id'] = $story->storyid(); $news['date'] = formatTimestamp($story->published(), $dateformat); $news['hits'] = $story->counter(); $news['rating'] = $story->rating(); $news['votes'] = $story->votes(); $news['topicid'] = $story->topicid(); $news['topic_title'] = $story->topic_title(); $news['topic_color'] = '#' . $myts->displayTarea($story->topic_color); if ($displayname != 3) { $news['author'] = sprintf("%s %s", _POSTEDBY, $story->uname()); } else { $news['author'] = ''; } if ($options[3] > 0) { $html = $story->nohtml() == 1 ? 0 : 1; $news['teaser'] = news_truncate_tagsafe($myts->displayTarea($story->hometext(), $html), $options[3] + 3); $news['infotips'] = ''; } else { $news['teaser'] = ''; if ($infotips > 0) { $news['infotips'] = ' title="' . news_make_infotips($story->hometext()) . '"'; } else { $news['infotips'] = ''; } } $block['stories'][] = $news; } } // If spotlight article was not in the fetched stories if (!isset($spotlight) && $options[4]) { $block['use_spotlight'] = true; $visible = true; if ($options[5] == 0 && $restricted) { // Use a specific news and we are in restricted mode $permittedtopics = news_MygetItemIds(); $permstory = new NewsStory($options[6]); if (!in_array($permstory->topicid(), $permittedtopics)) { $visible = false; } unset($permstory); } if ($options[5] == 0) { // Use a specific news if ($visible) { $spotlightArticle = new NewsStory($options[6]); } else { $block['use_spotlight'] = false; } } else { // Use the most recent news $stories = array(); $stories = $tmpstory->getAllPublished(1, 0, $restricted, 0, 1, true, $options[0]); if (count($stories) > 0) { $firststory = $stories[0]; $spotlightArticle = new NewsStory($firststory->storyid()); } else { $block['use_spotlight'] = false; } } if ($block['use_spotlight'] == true) { $spotlight = array(); $spotlight['title'] = xoops_substr($spotlightArticle->title(), 0, $options[2] - 1); if ($options[7] != '') { $spotlight['image'] = sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/modules/news/article.php?storyid=' . $spotlightArticle->storyid(), $myts->displayTarea($options[7], $spotlightArticle->nohtml)); } // Added 16 february 2007 ***************************************** $story_user = null; $story_user = new XoopsUser($spotlightArticle->uid()); if (is_object($story_user)) { $spotlight['avatar'] = XOOPS_UPLOAD_URL . '/' . $story_user->getVar('user_avatar'); } // **************************************************************** $spotlight['topicid'] = $spotlightArticle->topicid(); $spotlight['topic_title'] = $spotlightArticle->topic_title(); $spotlight['topic_color'] = '#' . $myts->displayTarea($spotlightArticle->topic_color); $spotlight['text'] = $spotlightArticle->hometext(); $spotlight['id'] = $spotlightArticle->storyid(); $spotlight['date'] = formatTimestamp($spotlightArticle->published(), $dateformat); $spotlight['hits'] = $spotlightArticle->counter(); $spotlight['rating'] = $spotlightArticle->rating(); $spotlight['votes'] = $spotlightArticle->votes(); // Added, topic's image and description $spotlight['topic_image'] = XOOPS_URL . '/modules/news/images/topics/' . $spotlightArticle->topic_imgurl(); $spotlight['topic_description'] = $myts->displayTarea($spotlightArticle->topic_description, 1); if ($displayname != 3) { $spotlight['author'] = sprintf("%s %s", _POSTEDBY, $spotlightArticle->uname()); } else { $spotlight['author'] = ''; } if (strlen(xoops_trim($spotlightArticle->bodytext())) > 0) { $spotlight['read_more'] = true; } else { $spotlight['read_more'] = false; } $block['spotlight'] = $spotlight; } } } if (isset($permstory)) { unset($permstory); } $block['lang_read_more'] = $myts->htmlSpecialChars(_MB_READMORE); // Read More... $block['lang_orderby'] = $myts->htmlSpecialChars(_MB_NEWS_ORDER); // "Order By" $block['lang_orderby_date'] = $myts->htmlSpecialChars(_MB_NEWS_DATE); // Published date $block['lang_orderby_hits'] = $myts->htmlSpecialChars(_MB_NEWS_HITS); // Number of Hits $block['lang_orderby_rating'] = $myts->htmlSpecialChars(_MB_NEWS_RATE); // Rating $block['sort'] = $options[0]; // "published" or "counter" or "rating" return $block; }
/** * This function indicates if the current Xoops version needs to add asterisks to required fields in forms * * @return boolean Yes = we need to add them, false = no */ function needsAsterisk() { if (self::isX23()) { return false; } if (strpos(strtolower(XOOPS_VERSION), 'impresscms') !== false) { return false; } if (strpos(strtolower(XOOPS_VERSION), 'legacy') === false) { $xv = xoops_trim(str_replace('XOOPS ', '', XOOPS_VERSION)); if (intval(substr($xv, 4, 2)) >= 17) { return false; } } return true; }
xoops_cp_footer(); } else { $message = $_POST['message']; $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; $post_handler =& xoops_getmodulehandler('post', 'xforum'); $forumpost =& $post_handler->get($post_id); $topic_status = $topic_handler->get($topic_id, 'topic_status'); $delete_attach = isset($_POST['delete_attach']) ? $_POST['delete_attach'] : ''; if (count($delete_attach)) { $forumpost->deleteAttachment($delete_attach); } $forumpost->setVar('approved', 0); $forumpost->setVar('forum_id', $forum->getVar('forum_id')); $subject = xoops_trim($_POST['subject']); $subject = $subject == '' ? _NOTITLE : $subject; $poster_name = isset($_POST['poster_name']) ? xoops_trim($_POST['poster_name']) : ''; $dohtml = isset($_POST['dohtml']) ? intval($_POST['dohtml']) : 0; $dosmiley = isset($_POST['dosmiley']) ? intval($_POST['dosmiley']) : 0; $doxcode = isset($_POST['doxcode']) ? intval($_POST['doxcode']) : 0; $icon = isset($_POST['icon']) ? intval($_POST['icon']) : 0; $attachsig = isset($_POST['attachsig']) ? 1 : 0; $view_require = isset($_POST['view_require']) ? $_POST['view_require'] : ''; $post_karma = $view_require == 'require_karma' && isset($_POST['post_karma']) ? intval($_POST['post_karma']) : 0; $require_reply = $view_require == 'require_reply' ? 1 : 0; $forumpost->setVar('subject', $subject); $forumpost->setVar('post_text', $message); $forumpost->setVar('post_karma', $post_karma); $forumpost->setVar('require_reply', $require_reply); $forumpost->setVar('poster_name', $poster_name); $forumpost->setVar('dohtml', $dohtml); $forumpost->setVar('dosmiley', $dosmiley);
/** * Retourne la liste des URLs de téléchargement liés à une commande * * @param object $order La commande en question * @return array Les URL */ function getOrderUrls(myshop_commands $order) { global $h_myshop_caddy, $h_myshop_products; $retval = array(); // Recherche des produits du caddy associés à cette commande $carts = $productsList = $products = array(); $carts = $h_myshop_caddy->getObjects(new Criteria('caddy_cmd_id', $order->getVar('cmd_id'), '=')); foreach ($carts as $item) { $productsList[] = $item->getVar('caddy_product_id'); } if (count($productsList) > 0) { $products = $h_myshop_products->getObjects(new Criteria('product_id', '(' . implode(',', $productsList) . ')', 'IN'), true); if (count($products) > 0) { foreach ($carts as $item) { $produit = null; if (isset($products[$item->getVar('caddy_product_id')])) { $produit = $products[$item->getVar('caddy_product_id')]; if (xoops_trim($produit->getVar('product_download_url')) != '') { $retval[] = MYSHOP_URL . 'download.php?download_id=' . $item->getVar('caddy_pass'); } } } } } return $retval; }
/** * Retourne le libellé d'une option en fonction de son nom * * @param string $optionName * @return string */ function getOptionNameFromValue($optionName) { $ret = ''; $format = 's'; $counter = 0; $values = $this->getOption('attribute_values', $format); $names = $this->getOption('attribute_names', $format); foreach ($values as $value) { if (xoops_trim($value) == $optionName) { if (isset($names[$counter])) { return $names[$counter]; } } $counter++; } return $ret; }
// Recherche du produit associé $product = null; $product = $h_oledrion_products->get($caddy->getVar('caddy_product_id')); if ($product == null) { oledrion_utils::redirect(_OLEDRION_ERROR15, OLEDRION_URL, 5); } // On vérifie que la commande associée est payée $order = null; $order = $h_oledrion_commands->get($caddy->getVar('caddy_cmd_id')); if ($order == null) { oledrion_utils::redirect(_OLEDRION_ERROR16, OLEDRION_URL, 5); } // Tout est bon, on peut envoyer le fichier au navigateur, s'il y a un fichier à télécharger, et s'il existe $file = ''; $file = $product->getVar('product_download_url'); if (xoops_trim($file) == '') { oledrion_utils::redirect(_OLEDRION_ERROR17, OLEDRION_URL, 5); } if (!file_exists($file)) { oledrion_utils::redirect(_OLEDRION_ERROR18, OLEDRION_URL, 5); } // Mise à jour, le fichier n'est plus disponible au téléchargement $h_oledrion_caddy->markCaddyAsNotDownloadableAnyMore($caddy); $fileContent = file_get_contents($file); // Plugins ************************************************ $plugins = oledrion_plugins::getInstance(); $parameters = new oledrion_parameters(array('fileContent' => $fileContent, 'product' => $product, 'order' => $order, 'fullFilename' => $file)); $parameters = $plugins->fireFilter(oledrion_plugins::EVENT_ON_PRODUCT_DOWNLOAD, $parameters); if (trim($parameters['fileContent']) != '') { $fileContent = $parameters['fileContent']; }
$call_updatefunc = true; // RMV-NOTIFY $notify_event = 'comment'; break; case XOOPS_COMMENT_APPROVEADMIN: case XOOPS_COMMENT_APPROVEUSER: default: $comment->setVar('com_status', XOOPS_COMMENT_PENDING); // RMV-NOTIFY $notify_event = 'comment_submit'; break; } } $comment->setVar('com_uid', $uid); } $com_title = xoops_trim($com_title); $com_title = $com_title == '' ? _NOTITLE : $com_title; $comment->setVar('com_title', $com_title); $comment->setVar('com_text', $com_text); $comment->setVar('dohtml', $dohtml); $comment->setVar('dosmiley', $dosmiley); $comment->setVar('doxcode', $doxcode); $comment->setVar('doimage', $doimage); $comment->setVar('dobr', $dobr); $icon = isset($com_icon) ? $com_icon : ''; $comment->setVar('com_icon', $icon); $comment->setVar('com_modified', time()); $comment->setVar('com_modid', $com_modid); if (isset($extra_params)) { $comment->setVar('com_exparams', $extra_params); }
/** * Retourne les éléments à ajouter au formulaire en tant que zones cachées * * @param array $order La commande client * @param array */ function getCheckoutFormContent($order) { global $xoopsConfig; $gatewayName = $this->gatewayInformation['foldername']; $paypal_money = $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($gatewayName, 'paypal_money'); $paypal_email = $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($gatewayName, 'paypal_email'); $use_ipn = intval($this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($gatewayName, 'use_ipn')); $ret = array(); $ret['cmd'] = '_xclick'; $ret['upload'] = '1'; $ret['currency_code'] = $paypal_money; $ret['business'] = $paypal_email; $ret['return'] = OLEDRION_URL . 'thankyou.php'; // Page (générique) de remerciement après paiement $ret['image_url'] = XOOPS_URL . '/images/logo.gif'; $ret['cpp_header_image'] = XOOPS_URL . '/images/logo.gif'; $ret['invoice'] = $order->getVar('cmd_id'); $ret['item_name'] = _OLEDRION_COMMAND . $order->getVar('cmd_id') . ' - ' . oledrion_utils::makeHrefTitle($xoopsConfig['sitename']); $ret['item_number'] = $order->getVar('cmd_id'); $ret['tax'] = 0; // ajout 25/03/2008 $ret['amount'] = $this->formatAmount(floatval($order->getVar('cmd_total', 'n'))); $ret['custom'] = $order->getVar('cmd_id'); //$ret['rm'] = 2; // Renvoyer les données par POST (normalement) $ret['email'] = $order->getVar('cmd_email'); if (xoops_trim($order->getVar('cmd_cancel')) != '') { // URL à laquelle le navigateur du client est ramené si le paiement est annulé $ret['cancel_return'] = OLEDRION_URL . 'cancel-payment.php?id=' . $order->getVar('cmd_cancel'); } if ($use_ipn == 1) { $ret['notify_url'] = OLEDRION_URL . 'gateway-notify.php'; // paypal-notify.php } return $ret; }
$submit_btn->setExtra('accesskey="s"'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); //Hidden variables if (isset($storyid)) { $sform->addElement(new XoopsFormHidden('storyid', $storyid)); } if (!isset($returnside)) { $returnside = isset($_POST['returnside']) ? intval($_POST['returnside']) : 0; if (empty($returnside)) { $returnside = isset($_GET['returnside']) ? intval($_GET['returnside']) : 0; } } if (!isset($returnside)) { $returnside = 0; } $sform->addElement(new XoopsFormHidden('returnside', $returnside), false); if (!isset($type)) { if ($approveprivilege) { $type = "admin"; } else { $type = "user"; } } $type_hidden = new XoopsFormHidden('type', $type); $sform->addElement($type_hidden); echo '<h1>' . _NW_SUBMITNEWS . '</h1>'; if (xoops_trim(news_getmoduleoption('submitintromsg')) != '') { echo "<div class='infotext'><br /><br />" . nl2br(news_getmoduleoption('submitintromsg')) . "<br /><br /></div>"; } $sform->display();
$call_updatefunc = true; // RMV-NOTIFY $notify_event = 'comment'; break; case XOOPS_COMMENT_APPROVEADMIN: case XOOPS_COMMENT_APPROVEUSER: default: $comment->setVar('com_status', XOOPS_COMMENT_PENDING); // RMV-NOTIFY $notify_event = 'comment_submit'; break; } } $comment->setVar('com_uid', $uid); } $com_title = xoops_trim($_POST['com_title']); $com_title = $com_title == '' ? _NOTITLE : $com_title; $comment->setVar('com_title', $com_title); $comment->setVar('com_text', $_POST['com_text']); $comment->setVar('dohtml', $dohtml); $comment->setVar('dosmiley', $dosmiley); $comment->setVar('doxcode', $doxcode); $comment->setVar('doimage', $doimage); $comment->setVar('dobr', $dobr); $comment->setVar('com_icon', $com_icon); $comment->setVar('com_modified', time()); $comment->setVar('com_modid', $com_modid); if (isset($extra_params)) { $comment->setVar('com_exparams', $extra_params); } if (false != $comment_handler->insert($comment)) {