function b_scrolling_partner_show($options) { include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php"; // Creating the partner handler object $smartpartner_partner_handler =& smartpartner_gethandler('partner'); //$smartpartner_category_handler =& smartpartner_gethandler('category'); // Randomize $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE); if (count($partnersObj) > 1) { $key_arr = array_keys($partnersObj); $key_rand = array_rand($key_arr, count($key_arr)); for ($i = 0; $i < count($partnersObj) && ($options[0] == 0 || $i < $options[0]); $i++) { $newObjs[$i] = $partnersObj[$key_rand[$i]]; } $partnersObj = $newObjs; } /* $cat_id = array(); foreach($partnersObj as $partnerObj){ $p_cats = $partnerObj->categoryid(); $p_cat_rand = array_rand($p_cats); if(!in_array($p_cats[$p_cat_rand],$cat_id)){ $cat_id[] = $p_cats[$p_cat_rand]; } } */ $block = array(); if ($partnersObj) { for ($i = 0; $i < count($partnersObj); $i++) { if ($partnersObj[$i]->image() != "" && $partnersObj[$i]->image() != "blank.png") { //$partner['id'] = $partnersObj[$i]->id(); $partner['urllink'] = $partnersObj[$i]->getUrlLink('block'); $partner['image'] = $partnersObj[$i]->getImageUrl(); $partner['title'] = $partnersObj[$i]->title(); $smartConfig =& smartpartner_getModuleConfig(); $image_info = smartpartner_imageResize($partnersObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); $block['partners'][] = $partner; } } } $block['width'] = $options[1]; $block['height'] = $options[2]; $block['speed'] = $options[3]; $block['space'] = $options[4]; $block['background'] = isset($options[5]) && $options[5] != '' ? $options[5] : 'FFFFFF'; return $block; }
function b_marquee_smartpartner($limit, $dateformat, $itemssize) { $block = array(); if (!defined("SMARTPARTNER_DIRNAME")) { define("SMARTPARTNER_DIRNAME", 'smartpartner'); } include_once XOOPS_ROOT_PATH . "/modules/" . SMARTPARTNER_DIRNAME . "/include/common.php"; // Creating the partner handler object $smartpartner_partner_handler =& smartpartner_gethandler('partner'); $smartpartner_category_handler =& smartpartner_gethandler('category'); // Randomize $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE); if (count($partnersObj) > 1) { $key_arr = array_keys($partnersObj); $key_rand = array_rand($key_arr, count($key_arr)); for ($i = 0; $i < count($partnersObj) && $i < $limit; $i++) { $newObjs[$i] = $partnersObj[$key_rand[$i]]; } $partnersObj = $newObjs; } $cat_id = array(); foreach ($partnersObj as $partnerObj) { if (!in_array($partnerObj->categoryid(), $cat_id)) { $cat_id[] = $partnerObj->categoryid(); } } if ($partnersObj) { for ($j = 0; $j < count($cat_id); $j++) { $categoryObj = $smartpartner_category_handler->get($cat_id[$j]); for ($i = 0; $i < count($partnersObj); $i++) { if ($partnersObj[$i]->categoryid() == $cat_id[$j]) { $smartConfig =& smartpartner_getModuleConfig(); if ($itemssize > 0) { $title = xoops_substr($partnersObj[$i]->title(), 0, $itemssize + 3); } else { $title = $partnersObj[$i]->title(); } $block[] = array('date' => '', 'category' => '', 'author' => '', 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/smartpartner/partner.php?id=' . $partnersObj[$i]->id() . "'>" . $title . '</a>'); } } } } return $block; }
/** * $Id: random_offer.php,v 1.1 2007/09/18 14:00:53 marcan Exp $ * Module: SmartPartner * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ function b_random_offer_show($options) { include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php"; // Creating the partner handler object $smartpartner_offer_handler =& smartpartner_gethandler('offer'); $smartpartner_partner_handler =& smartpartner_gethandler('partner'); include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php'; $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler); //var_dump($smartpermissions_handler->handler);exit; $grantedItems = $smartpermissions_handler->getGrantedItems('full_view'); if (!empty($grantedItems)) { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('partnerid', '(' . implode(', ', $grantedItems) . ')', 'IN')); $criteria->add(new Criteria('date_pub', time(), '<')); $criteria->add(new Criteria('date_end', time(), '>')); $criteria->add(new Criteria('status', _SPARTNER_STATUS_ONLINE)); // Randomize $offersObj =& $smartpartner_offer_handler->getObjects($criteria); if (count($offersObj) > 0) { $key_arr = array_keys($offersObj); $key_rand = array_rand($key_arr, 1); $offerObj = $offersObj[$key_rand]; } $block = array(); if (isset($offerObj) && is_object($offerObj)) { $block['offers'][] = $offerObj->toArray('e'); $smartConfig =& smartpartner_getModuleConfig(); //$image_info = smartpartner_imageResize($partnerObj->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); if ($options[0] == 1) { $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"'; } $block['see_all'] = $options[2]; $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL_OFFERS; $block['smartpartner_url'] = SMARTPARTNER_URL; } } return $block; }
/** * $Id: moving_partner.php,v 1.1 2007/09/18 14:00:53 marcan Exp $ * Module: SmartPartner * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ function b_random_partner_show($options) { include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php"; // Creating the partner handler object $partner_handler =& smartpartner_gethandler('partner'); // Randomize $partnersObj =& $partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE); if (count($partnersObj) > 0) { $key_arr = array_keys($partnersObj); $key_rand = array_rand($key_arr, 1); $partnerObj = $partnersObj[$key_rand]; } $block = array(); if ($partnerObj) { $partner['id'] = $partnerObj->id(); $partner['urllink'] = $partnerObj->getUrlLink('block'); if ($partnerObj->image() && ($options[1] == 1 || $options[1] == 3)) { $partner['image'] = $partnerObj->getImageUrl(); } if ($partnerObj->image() && ($options[1] == 2 || $options[1] == 3)) { $partner['title'] = $partnerObj->title(); } else { $partner['title'] = ''; } $smartConfig =& smartpartner_getModuleConfig(); $image_info = smartpartner_imageResize($partnerObj->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); $partner['img_attr'] = $image_info[3]; $partner['extendedInfo'] = $partnerObj->extentedInfo(); if ($options[0] == 1) { $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"'; } $block['see_all'] = $options[2]; $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL; $block['smartpartner_url'] = SMARTPARTNER_URL; } return $block; }
function smartpartner_getHelpPath() { $smartConfig =& smartpartner_getModuleConfig(); switch ($smartConfig['helppath_select']) { case 'docs.xoops.org': return 'http://docs.xoops.org/help/spartnerh/index.htm'; break; case 'inside': return SMARTPARTNER_URL . "doc/"; break; case 'custom': return $smartConfig['helppath_custom']; break; } }
/** * $Id: partners_list.php,v 1.6 2005/04/21 15:09:31 malanciault Exp $ * Module: SmartPartner * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ function b_partners_list_show($options) { // This must contain the name of the folder in which reside SmartPartner if (!defined("SMARTPARTNER_DIRNAME")) { define("SMARTPARTNER_DIRNAME", 'smartpartner'); } include_once XOOPS_ROOT_PATH . "/modules/" . SMARTPARTNER_DIRNAME . "/include/common.php"; // Creating the partner handler object $partner_handler =& smartpartner_gethandler('partner'); if ($options[2]) { // Randomize $partnersObj =& $partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE); if (count($partnersObj) > 1) { $key_arr = array_keys($partnersObj); $key_rand = array_rand($key_arr, count($key_arr)); for ($i = 0; $i < count($partnersObj) && $i < $options[3]; $i++) { $newObjs[$i] = $partnersObj[$key_rand[$i]]; } $partnersObj = $newObjs; } } else { $partnersObj =& $partner_handler->getPartners($options[3], 0, _SPARTNER_STATUS_ACTIVE, $options[5], $options[6]); if (count($partnersObj) > 1 && $options[2] == 1) { $key_arr = array_keys($partnersObj); $key_rand = array_rand($key_arr, count($key_arr)); for ($i = 0; $i < count($partnersObj); $i++) { $newObjs[$i] = $partnersObj[$key_rand[$i]]; } $partnersObj = $newObjs; } } $block = array(); if ($partnersObj) { for ($i = 0; $i < count($partnersObj); $i++) { $partner['id'] = $partnersObj[$i]->id(); $partner['urllink'] = $partnersObj[$i]->getUrlLink('block'); if ($partnersObj[$i]->image() && ($options[4] == 1 || $options[4] == 3)) { $partner['image'] = $partnersObj[$i]->getImageUrl(); } if ($partnersObj[$i]->image() && ($options[4] == 2 || $options[4] == 3)) { $partner['title'] = $partnersObj[$i]->title(); } else { $partner['title'] = ''; } $smartConfig =& smartpartner_getModuleConfig(); $image_info = smartpartner_imageResize($partnersObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); $partner['img_attr'] = $image_info[3]; $partner['extendedInfo'] = $partnersObj[$i]->extentedInfo(); $block['partners'][] = $partner; } if ($options[0] == 1) { $block['insertBr'] = true; } if ($options[1] == 1) { $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"'; } $block['see_all'] = $options[7]; $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL; $block['smartpartner_url'] = SMARTPARTNER_URL; } return $block; }
function smartpartner_modFooter() { global $xoopsUser, $xoopsDB, $xoopsConfig; $hModule =& xoops_gethandler('module'); $smartModule = smartpartner_getModuleInfo(); $module_id = $smartModule->getVar('mid'); $module_name = $smartModule->getVar('dirname'); $smartConfig = smartpartner_getModuleConfig(); $module_id = $smartModule->getVar('mid'); $versioninfo =& $hModule->get($smartModule->getVar('mid')); $modfootertxt = "Module " . $versioninfo->getInfo('name') . " - Version " . $versioninfo->getInfo('version') . ""; $modfooter = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . SMARTPARTNER_URL . "images/spcssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'/></a>"; return $modfooter; }
function storeUpload($post_field, $allowed_mimetypes = null, &$errors) { global $xoopsUser, $xoopsDB, $xoopsModule; include_once SMARTPARTNER_ROOT_PATH . 'class/uploader.php'; $config =& smartpartner_getModuleConfig(); $id = $this->getVar('id'); if (!isset($allowed_mimetypes)) { $hMime =& xoops_getmodulehandler('mimetype'); $allowed_mimetypes = $hMime->checkMimeTypes($post_field); if (!$allowed_mimetypes) { return false; } } /*$maxfilesize = $config['xhelp_uploadSize']; $maxfilewidth = $config['xhelp_uploadWidth']; $maxfileheight = $config['xhelp_uploadHeight'];*/ $maxfilesize = $config['maximum_filesize']; $maxfilewidth = 100000; //$config['maximum_image_width']; $maxfileheight = 100000; //$config['maximum_image_height']; if (!is_dir(smartpartner_getUploadDir())) { mkdir(smartpartner_getUploadDir(), 0757); } $uploader = new XoopsMediaUploader(smartpartner_getUploadDir() . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($post_field)) { $file_title = $this->purifyText($uploader->getMediaName()); $uploader->setTargetFileName($id . "_" . $file_title); if ($uploader->upload()) { $this->setVar('filename', $uploader->getSavedFileName()); if ($this->getVar('name') == '') { $this->setVar('name', $this->getNameFromFilename()); } $this->setVar('mimetype', $uploader->getMediaType()); return true; } else { $errors = array_merge($errors, $uploader->getErrors(false)); return false; } } else { $errors = array_merge($errors, $uploader->getErrors(false)); return false; } }
function toArray($partner = array()) { $smartConfig = smartpartner_getModuleConfig(); $partner['id'] = $this->id(); $partner['hits'] = $this->hits(); $partner['hits_page'] = $this->hits_page(); $partner['url'] = $this->url(); $partner['urllink'] = $this->getUrlLink('partner'); $partner['image'] = $this->getImageUrl(); $partner['title'] = $this->title(); $partner['clean_title'] = $partner['title']; $partner['summary'] = $this->summary(); if ($this->description() != '') { $partner['description'] = $this->description(); } else { $partner['description'] = $this->summary(); } $partner['contact_name'] = $this->contact_name(); $partner['contact_email'] = $this->contact_email('x'); $partner['contact_phone'] = $this->contact_phone(); $partner['adress'] = $this->adress(); $image_info = smartpartner_imageResize($this->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); $partner['img_attr'] = $image_info[3]; $partner['readmore'] = $this->extentedInfo(); // Hightlighting searched words $highlight = true; if ($highlight && isset($_GET['keywords'])) { $myts =& MyTextSanitizer::getInstance(); $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords']))); $h = new SmartpartnerKeyhighlighter($keywords, true, 'smartpartner_highlighter'); $partner['title'] = $h->highlight($partner['title']); $partner['summary'] = $h->highlight($partner['summary']); $partner['description'] = $h->highlight($partner['description']); $partner['contact_name'] = $h->highlight($partner['contact_name']); $partner['contact_email'] = $h->highlight($partner['contact_email']); $partner['contact_phone'] = $h->highlight($partner['contact_phone']); $partner['adress'] = $h->highlight($partner['adress']); } return $partner; }
function b_partners_list_show($options) { include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php"; // Creating the partner handler object $smartpartner_partner_handler =& smartpartner_gethandler('partner'); $smartpartner_category_handler =& smartpartner_gethandler('category'); // Randomize $partnersObj =& $smartpartner_partner_handler->getPartners(0, 0, _SPARTNER_STATUS_ACTIVE); if (count($partnersObj) > 1) { $key_arr = array_keys($partnersObj); $key_rand = array_rand($key_arr, count($key_arr)); for ($i = 0; $i < count($partnersObj) && ($options[2] == 0 || $i < $options[2]); $i++) { $newObjs[$i] = $partnersObj[$key_rand[$i]]; } $partnersObj = $newObjs; } $cat_id = array(); foreach ($partnersObj as $partnerObj) { $p_cats = $partnerObj->categoryid(); $p_cat_rand = array_rand(explode('|', $p_cats)); if (!in_array($p_cats[$p_cat_rand], $cat_id)) { $cat_id[] = $p_cats[$p_cat_rand]; } //partner belong to only one category in the block $partnerObj->setVar('categoryid', $p_cats[$p_cat_rand]); } $block = array(); if ($partnersObj) { for ($j = 0; $j < count($cat_id); $j++) { $categoryObj = $smartpartner_category_handler->get($cat_id[$j]); $block['categories'][$cat_id[$j]]['link'] = $cat_id[$j] != 0 ? $categoryObj->getCategoryLink() : false; for ($i = 0; $i < count($partnersObj); $i++) { //if(in_array($cat_id[$j], explode('|', $partnersObj[$i]->categoryid()))){ if ($partnersObj[$i]->categoryid() == $cat_id[$j]) { $partner['id'] = $partnersObj[$i]->id(); $partner['urllink'] = $partnersObj[$i]->getUrlLink('block'); if ($partnersObj[$i]->image() && ($options[3] == 1 || $options[3] == 3)) { $partner['image'] = $partnersObj[$i]->getImageUrl(); } if ($partnersObj[$i]->image() && ($options[3] == 2 || $options[3] == 3)) { $partner['title'] = $partnersObj[$i]->title(); } else { $partner['title'] = ''; } $smartConfig =& smartpartner_getModuleConfig(); $image_info = smartpartner_imageResize($partnersObj[$i]->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); $partner['img_attr'] = $image_info[3]; $partner['extendedInfo'] = $partnersObj[$i]->extentedInfo(); $block['categories'][$cat_id[$j]]['partners'][] = $partner; } } } if ($options[0] == 1) { $block['insertBr'] = true; } if ($options[1] == 1) { $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"'; } $block['see_all'] = $options[6]; $block['lang_see_all'] = _MB_SPARTNER_LANG_SEE_ALL; $block['smartpartner_url'] = SMARTPARTNER_URL; } return $block; }
function toArray($url_link_type = 'partner') { $smartConfig = smartpartner_getModuleConfig(); $partner['id'] = $this->id(); $partner['categoryid'] = $this->categoryid(); $partner['hits'] = $this->hits(); $partner['hits_page'] = $this->hits_page(); $partner['url'] = $this->url(); $partner['urllink'] = $this->getUrlLink($url_link_type); $partner['image'] = $this->getImageUrl(); $partner['title'] = $this->title(); $partner['datesub'] = $this->datesub(); $partner['clean_title'] = $partner['title']; $partner['summary'] = $this->summary(); $partner['contact_name'] = $this->contact_name(); $partner['contact_email'] = $this->contact_email(); $partner['contact_phone'] = $this->contact_phone(); $partner['adress'] = $this->adress(); $partner['email_priv'] = $this->email_priv(); $partner['phone_priv'] = $this->phone_priv(); $partner['adress_priv'] = $this->adress_priv(); $image_info = smartpartner_imageResize($this->getImagePath(), $smartConfig['img_max_width'], $smartConfig['img_max_height']); $partner['img_attr'] = $image_info[3]; $partner['readmore'] = $this->extentedInfo(); if (time() - $this->datesub('e') < $smartConfig['updated_period'] * 24 * 3600) { $partner['update_status'] = 'new'; } elseif (time() - $this->getVar('last_update') < $smartConfig['updated_period'] * 24 * 3600) { $partner['update_status'] = 'updated'; } else { $partner['update_status'] = 'none'; } //-------------- global $smartpermissions_handler, $smartpartner_partner_handler, $xoopsUser; include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php'; if (!$smartpartner_partner_handler) { $smartpartner_partner_handler =& smartpartner_gethandler('partner'); } $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler); $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $this->id()); $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $this->id()); $userGroups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); if (array_intersect($userGroups, $grantedGroups)) { $partner['display_type'] = 'full'; } elseif (array_intersect($userGroups, $partGrantedGroups)) { $partner['display_type'] = 'part'; } else { $partner['display_type'] = 'none'; } if ($this->description() != '' && $partner['display_type'] == 'full') { $partner['description'] = $this->description(); } else { //$partner['description'] = $this->summary(); } $partner['showsummary'] = $this->getVar('showsummary'); //-------------- // Hightlighting searched words $highlight = true; if ($highlight && isset($_GET['keywords'])) { $myts =& MyTextSanitizer::getInstance(); $keywords = $myts->htmlSpecialChars(trim(urldecode($_GET['keywords']))); $h = new SmartpartnerKeyhighlighter($keywords, true, 'smartpartner_highlighter'); $partner['title'] = $h->highlight($partner['title']); $partner['summary'] = $h->highlight($partner['summary']); $partner['description'] = $h->highlight($partner['description']); $partner['contact_name'] = $h->highlight($partner['contact_name']); $partner['contact_email'] = $h->highlight($partner['contact_email']); $partner['contact_phone'] = $h->highlight($partner['contact_phone']); $partner['adress'] = $h->highlight($partner['adress']); } return $partner; }
} include_once SMARTPARTNER_ROOT_PATH . "include/functions.php"; include_once SMARTPARTNER_ROOT_PATH . "include/seo_functions.php"; include_once SMARTPARTNER_ROOT_PATH . "include/metagen.php"; include_once SMARTPARTNER_ROOT_PATH . "class/keyhighlighter.class.php"; include_once SMARTPARTNER_ROOT_PATH . "class/session.php"; /** Include SmartObject framework **/ include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartloader.php'; include_once SMARTOBJECT_ROOT_PATH . "class/smartobjectcategory.php"; // Creating the SmartModule object $smartModule =& smartpartner_getModuleInfo(); // Find if the user is admin of the module $smartpartner_isAdmin = smartpartner_userIsAdmin(); $myts = MyTextSanitizer::getInstance(); $smartpartner_moduleName = $smartModule->getVar('name'); // Creating the SmartModule config Object $smartConfig =& smartpartner_getModuleConfig(); // Creating the partner handler object $smartpartner_partner_handler =& smartpartner_gethandler('partner'); // Creating the category handler object $smartpartner_category_handler =& smartpartner_gethandler('category'); // Creating the category link handler object $smartpartner_partner_cat_link_handler =& smartpartner_gethandler('partner_cat_link'); // Creating the offer handler object $smartpartner_offer_handler =& smartpartner_gethandler('offer'); // Creating the file handler object $smartpartner_file_handler =& smartpartner_gethandler('file'); define('_SPARTNER_STATUS_OFFLINE', 0); define('_SPARTNER_STATUS_ONLINE', 1); $statusArray = array(_SPARTNER_STATUS_OFFLINE => _CO_SPARTNER_STATUS_OFFLINE, _SPARTNER_STATUS_ONLINE => _CO_SPARTNER_STATUS_ONLINE); include_once SMARTPARTNER_ROOT_PATH . "class/smarttree.php";