Exemplo n.º 1
0
 function sendNotifications($notifications = array())
 {
     global $smartpartner_partner_handler;
     $partnerObj = $smartpartner_partner_handler->get($this->getVar('partnerid', 'e'));
     $smartModule =& smartpartner_getModuleInfo();
     $module_id = $smartModule->getVar('mid');
     $myts =& MyTextSanitizer::getInstance();
     $notification_handler =& xoops_gethandler('notification');
     $tags = array();
     $tags['MODULE_NAME'] = $myts->displayTarea($smartModule->getVar('name'));
     $tags['PARTNER_NAME'] = $partnerObj->title(20);
     $tags['OFFER_NAME'] = $this->title(20);
     foreach ($notifications as $notification) {
         switch ($notification) {
             case _SPARTNER_NOT_OFFER_NEW:
                 $tags['OFFER_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/partner.php?id=' . $this->getVar('partnerid', 'e');
                 $notification_handler->triggerEvent('global_partner', 0, 'new_offer', $tags);
                 break;
             case -1:
             default:
                 break;
         }
     }
 }
Exemplo n.º 2
0
/**
 * Checks if a user is admin of SmartPartner
 *
 * smartpartner_userIsAdmin()
 *
 * @return boolean : array with userids and uname
 */
function smartpartner_userIsAdmin()
{
    global $xoopsUser;
    $result = false;
    $smartModule = smartpartner_getModuleInfo();
    $module_id = $smartModule->getVar('mid');
    if (!empty($xoopsUser)) {
        $groups = $xoopsUser->getGroups();
        $result = in_array(XOOPS_GROUP_ADMIN, $groups) || $xoopsUser->isAdmin($module_id);
    }
    return $result;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
 /**
  * delete a Partner from the database
  *
  * @param object $partner reference to the Partner to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$partner, $force = false)
 {
     $partnerModule =& smartpartner_getModuleInfo();
     $module_id = $partnerModule->getVar('mid');
     if (strtolower(get_class($partner)) != $this->classname) {
         return false;
     }
     $sql = sprintf("DELETE FROM %s WHERE id = %u", $this->_db->prefix($this->_dbtable), $partner->getVar('id'));
     if (false != $force) {
         $result = $this->_db->queryF($sql);
     } else {
         $result = $this->_db->query($sql);
     }
     if (!$result) {
         return false;
     }
     return true;
 }
Exemplo n.º 5
0
 /**
  * delete a Partner from the database
  *
  * @param object $partner reference to the Partner to delete
  * @param bool $force
  * @return bool FALSE if failed.
  */
 function delete(&$partner, $force = false)
 {
     global $smartpartner_offer_handler, $smartpartner_partner_cat_link_handler;
     $partnerModule =& smartpartner_getModuleInfo();
     $module_id = $partnerModule->getVar('mid');
     if (strtolower(get_class($partner)) != strtolower($this->className)) {
         return false;
     }
     $sql = sprintf("DELETE FROM %s WHERE id = %u", $this->table, $partner->getVar('id'));
     if (false != $force) {
         $result = $this->db->queryF($sql);
     } else {
         $result = $this->db->query($sql);
     }
     if (!$result) {
         return false;
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('partnerid', $partner->getVar('id')));
     $offersObj = $smartpartner_offer_handler->getObjects($criteria);
     foreach ($offersObj as $offerObj) {
         $smartpartner_offer_handler->delete($offerObj, 1);
     }
     $linksObj = $smartpartner_partner_cat_link_handler->getObjects($criteria);
     foreach ($linksObj as $linkObj) {
         $smartpartner_partner_cat_link_handler->delete($linkObj, 1);
     }
     return true;
 }
Exemplo n.º 6
0
if (!defined("SMARTPARTNER_URL")) {
    define("SMARTPARTNER_URL", XOOPS_URL . '/modules/' . SMARTPARTNER_DIRNAME . '/');
}
if (!defined("SMARTPARTNER_ROOT_PATH")) {
    define("SMARTPARTNER_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTPARTNER_DIRNAME . '/');
}
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