function getModuleInfo()
 {
     return smart_getModuleInfo($this->_moduleName);
 }
示例#2
0
    define("SMARTMAIL_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTMAIL_DIRNAME . '/');
}
if (!defined("SMARTMAIL_IMAGES_URL")) {
    define("SMARTMAIL_IMAGES_URL", SMARTMAIL_URL . '/images/');
}
/** Include SmartObject framework **/
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartloader.php';
include SMARTOBJECT_ROOT_PATH . "class/smartobjectcategory.php";
/*
 * Including the common language file of the module
 */
$fileName = SMARTMAIL_ROOT_PATH . 'language/' . $GLOBALS['xoopsConfig']['language'] . '/common.php';
if (!file_exists($fileName)) {
    $fileName = SMARTMAIL_ROOT_PATH . 'language/english/common.php';
}
include_once $fileName;
include_once SMARTMAIL_ROOT_PATH . "class/newsletter.php";
include_once SMARTMAIL_ROOT_PATH . "class/subscriber.php";
include_once SMARTMAIL_ROOT_PATH . "include/functions.php";
// Creating the SmartModule object
$smartContentModule =& smart_getModuleInfo('smartmail');
// Find if the user is admin of the module
$smartmail_isAdmin = smart_userIsAdmin('smartmail');
$myts = MyTextSanitizer::getInstance();
$smartmail_moduleName = $smartContentModule->getVar('name');
// Creating the SmartModule config Object
$smartContentConfig =& smart_getModuleConfig('smartmail');
// Creating the Newsletter handler
$smartmail_newsletter_handler = xoops_getmodulehandler('newsletter', 'smartmail');
// Creating the Subscriber handler
$smartmail_subscriber_handler = xoops_getmodulehandler('subscriber', 'smartmail');
示例#3
0
function &smart_getModuleConfig($moduleName = false)
{
    static $smartConfigs;
    if (isset($smartConfigs[$moduleName])) {
        $ret =& $smartConfigs[$moduleName];
        return $ret;
    }
    global $xoopsModule, $xoopsModuleConfig;
    if (!$moduleName) {
        if (isset($xoopsModule) && is_object($xoopsModule)) {
            $smartConfigs[$xoopsModule->getVar('dirname')] =& $xoopsModuleConfig;
            return $smartConfigs[$xoopsModule->getVar('dirname')];
        }
    }
    // if we still did not found the xoopsModule, this is because there is none
    if (!$moduleName) {
        $ret = false;
        return $ret;
    }
    if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) {
        $smartConfigs[$moduleName] =& $xoopsModuleConfig;
    } else {
        $module =& smart_getModuleInfo($moduleName);
        if (!is_object($module)) {
            $ret = false;
            return $ret;
        }
        $hModConfig =& xoops_gethandler('config');
        $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
    }
    return $smartConfigs[$moduleName];
}
示例#4
0
 function getAllowedObjects($asObject = true, $groups, $criteria = null)
 {
     $smartModule = smart_getModuleInfo('smartmail');
     $perm_handler = xoops_gethandler('groupperm');
     $allowed_newsletterids = $perm_handler->getItemIds('smartmail_newsletter_subscribe', $groups, $smartModule->getVar('mid'));
     $nl_criteria = new CriteriaCompo();
     if (!is_null($criteria)) {
         $nl_criteria->add($criteria);
     }
     $nl_criteria->add(new Criteria('newsletter_id', "(" . implode(',', $allowed_newsletterids) . ")", "IN"));
     if ($asObject) {
         return $this->getObjects($nl_criteria, true);
     } else {
         return $this->getList($nl_criteria);
     }
 }
示例#5
0
 * $Id: common.php,v 1.1 2006/11/02 17:25:05 marcan Exp $
 * Module: SmartClone
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
if (!defined("XOOPS_ROOT_PATH")) {
    die("XOOPS root path not defined");
}
if (!defined("SMARTCLONE_DIRNAME")) {
    define("SMARTCLONE_DIRNAME", 'smartclone');
}
if (!defined("SMARTCLONE_URL")) {
    define("SMARTCLONE_URL", XOOPS_URL . '/modules/' . SMARTCLONE_DIRNAME . '/');
}
if (!defined("SMARTCLONE_ROOT_PATH")) {
    define("SMARTCLONE_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTCLONE_DIRNAME . '/');
}
if (!defined("SMARTCLONE_IMAGES_URL")) {
    define("SMARTCLONE_IMAGES_URL", SMARTCLONE_URL . '/images/');
}
/** Include SmartObject Framework **/
include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php';
include_once SMARTCLONE_ROOT_PATH . "include/functions.php";
// Creating the SmartModule object
$smartclone_module =& smart_getModuleInfo(SMARTCLONE_DIRNAME);
// Find if the user is admin of the module
$smartclone_isAdmin = smart_userIsAdmin(SMARTCLONE_DIRNAME);
$myts = MyTextSanitizer::getInstance();
$smartclone_moduleName = $smartclone_module->getVar('name');
// Creating the SmartModule config Object
$smartclone_config =& smart_getModuleConfig(SMARTCLONE_DIRNAME);
示例#6
0
 function moduleUpgrade(&$module)
 {
     $dirname = $module->getVar('dirname');
     ob_start();
     $table = new SmartDbTable($dirname . '_meta');
     if (!$table->exists()) {
         $table->setStructure("\n\t\t\t  `metakey` varchar(50) NOT NULL default '',\n\t\t\t  `metavalue` varchar(255) NOT NULL default '',\n\t\t\t  PRIMARY KEY (`metakey`)");
         $table->setData("'version',0");
         if (!$this->updateTable($table)) {
             /**
              * @todo trap the errors
              */
         }
     }
     $dbVersion = smart_GetMeta('version', $dirname);
     if (!$dbVersion) {
         $dbVersion = 0;
     }
     $newDbVersion = constant(strtoupper($dirname . '_db_version')) ? constant(strtoupper($dirname . '_db_version')) : 0;
     echo 'Database version : ' . $dbVersion . '<br />';
     echo 'New database version : ' . $newDbVersion . '<br />';
     if ($newDbVersion > $dbVersion) {
         for ($i = $dbVersion + 1; $i <= $newDbVersion; $i++) {
             $upgrade_function = $dirname . '_db_upgrade_' . $i;
             if (function_exists($upgrade_function)) {
                 $upgrade_function();
             }
         }
     }
     echo "<code>" . _SDU_UPDATE_UPDATING_DATABASE . "<br />";
     // if there is a function to execute for this DB version, let's do it
     //$function_
     $module_info = smart_getModuleInfo($dirname);
     $this->automaticUpgrade($dirname, $module_info->modinfo['object_items']);
     echo "</code>";
     $feedback = ob_get_clean();
     if (method_exists($module, "setMessage")) {
         $module->setMessage($feedback);
     } else {
         echo $feedback;
     }
     smart_SetMeta("version", $newDbVersion, $dirname);
     //Set meta version to current
     return true;
 }
 function getPrintAndMailLink($smartObj)
 {
     global $xoopsConfig;
     $printlink = $this->handler->_moduleUrl . "print.php?" . $this->handler->keyName . "=" . $smartObj->getVar($this->handler->keyName);
     $js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);";
     $printlink = '<a href="' . $js . '"><img  src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"/></a>';
     $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName);
     $link = smart_getCurrentPage();
     $mid = $smartModule->getVar('mid');
     $friendlink = "<a href=\"javascript:openWithSelfMain('" . SMARTOBJECT_URL . "sendlink.php?link=" . $link . "&amp;mid=" . $mid . "', ',',',',',','sendmessage', 674, 500);\"><img src=\"" . SMARTOBJECT_IMAGES_ACTIONS_URL . "mail_send.png\"  alt=\"" . _CO_SOBJECT_EMAIL . "\" title=\"" . _CO_SOBJECT_EMAIL . "\" style=\"vertical-align: middle;\"/></a>";
     $ret = '<span id="smartobject_print_button">' . $printlink . "&nbsp;</span>" . '<span id="smartobject_mail_button">' . $friendlink . '</span>';
     return $ret;
 }