Esempio n. 1
0
/**
* Include plugin template functions file which may/may not do anything or exist.
* This will currently set any additional css and javascript that is theme specific for a plugin templates
*
* @param    string  $plugin     name of plugin
*
*/
function CTL_plugin_setTemplatesFunctions($plugin)
{
    global $_SCRIPTS, $_CONF;
    $templateFuncutionsLocation = CTL_plugin_themeFindFile($plugin, 'templates', 'functions.php', false);
    if (!empty($templateFuncutionsLocation) and file_exists($templateFuncutionsLocation)) {
        require_once $templateFuncutionsLocation;
        /* Include scripts on behalf of plugin template files that are theme specfic */
        $func = $plugin . "_css_" . $_CONF['theme'];
        if (function_exists($func)) {
            foreach ($func() as $info) {
                $file = !empty($info['file']) ? $info['file'] : '';
                $name = !empty($info['name']) ? $info['name'] : md5(!empty($file) ? $file : strval(time()));
                $constant = !empty($info['constant']) ? $info['constant'] : true;
                $attributes = !empty($info['attributes']) ? $info['attributes'] : array();
                $priority = !empty($info['priority']) ? $info['priority'] : 100;
                $_SCRIPTS->setCssFile($name, $file, $constant, $attributes, $priority, 'theme');
            }
        }
        $func = $plugin . "_js_libs_" . $_CONF['theme'];
        if (function_exists($func)) {
            foreach ($func() as $info) {
                $footer = true;
                if (isset($info['footer']) && !$info['footer']) {
                    $footer = false;
                }
                $_SCRIPTS->setJavaScriptLibrary($info['library'], $footer);
            }
        }
        $func = $plugin . "_js_files_" . $_CONF['theme'];
        if (function_exists($func)) {
            foreach ($func() as $info) {
                $footer = true;
                if (isset($info['footer']) && !$info['footer']) {
                    $footer = false;
                }
                $priority = !empty($info['priority']) ? $info['priority'] : 100;
                $_SCRIPTS->setJavaScriptFile(md5($info['file']), $info['file'], $footer, $priority);
            }
        }
    }
}
Esempio n. 2
0
/**
* Include plugin template functions file which may/may not do anything or exist.
* This will currently set any additional css and javascript that is theme specific for a plugin templates
*
* @param    string  $plugin     name of plugin
*
*/
function CTL_plugin_setTemplatesFunctions($plugin)
{
    global $_SCRIPTS, $_CONF;
    $templateFuncutionsLocation = CTL_plugin_themeFindFile($plugin, 'templates', 'functions.php', false);
    if (!empty($templateFuncutionsLocation) and file_exists($templateFuncutionsLocation)) {
        require_once $templateFuncutionsLocation;
        // Workaround since we don't know the theme name of the functions.php file we are using
        // It would have been checked in the following order. When found then quit
        $themes[] = $_CONF['theme'];
        $themes[] = $_CONF['theme_default'];
        $themes[] = 'default';
        $function_found = false;
        foreach ($themes as $theme) {
            /* Include scripts on behalf of plugin template files that are theme specific */
            $func = $plugin . "_css_" . $theme;
            if (function_exists($func)) {
                $function_found = true;
                foreach ($func() as $info) {
                    $file = !empty($info['file']) ? $info['file'] : '';
                    $name = !empty($info['name']) ? $info['name'] : md5(!empty($file) ? $file : strval(time()));
                    $constant = !empty($info['constant']) ? $info['constant'] : true;
                    $attributes = !empty($info['attributes']) ? $info['attributes'] : array();
                    $priority = !empty($info['priority']) ? $info['priority'] : 100;
                    $_SCRIPTS->setCssFile($name, $file, $constant, $attributes, $priority, 'theme');
                }
            }
            $func = $plugin . "_js_libs_" . $theme;
            if (function_exists($func)) {
                $function_found = true;
                foreach ($func() as $info) {
                    $footer = true;
                    if (isset($info['footer']) && !$info['footer']) {
                        $footer = false;
                    }
                    $_SCRIPTS->setJavaScriptLibrary($info['library'], $footer);
                }
            }
            $func = $plugin . "_js_files_" . $theme;
            if (function_exists($func)) {
                $function_found = true;
                foreach ($func() as $info) {
                    $footer = true;
                    if (isset($info['footer']) && !$info['footer']) {
                        $footer = false;
                    }
                    $priority = !empty($info['priority']) ? $info['priority'] : 100;
                    $_SCRIPTS->setJavaScriptFile(md5($info['file']), $info['file'], $footer, $priority);
                }
            }
            if ($function_found) {
                break;
            }
        }
    }
}
Esempio n. 3
0
        // Check to see if user has this topic or complete forum is selected for notifications
        $fields1 = array('topic_id', 'uid');
        $values1 = array($id, $edittopic['uid']);
        $fields2 = array('topic_id', 'forum_id', 'uid');
        $values2 = array(0, $edittopic['forum'], $edittopic['uid']);
        // Check if there are any notification records for the topic or the forum - topic_id = 0
        if (DB_count($_TABLES['forum_watch'], $fields1, $values1) > 0 or DB_count($_TABLES['forum_watch'], $fields2, $values2) > 0) {
            $notify_val = 'checked="checked"';
        }
    } else {
        $display .= alertMessage($LANG_GF02['msg72'], $LANG_GF02['msg191']);
        exit;
    }
}
// Add JavaScript
$_SCRIPTS->setJavaScriptFile('forum_creattopic', CTL_plugin_themeFindFile('forum', 'javascript', 'createtopic.js'));
// PREVIEW TOPIC
if ($preview == 'Preview') {
    $previewitem = array();
    if ($method == 'edit') {
        $previewitem['uid'] = $edittopic['uid'];
        $previewitem['name'] = $edittopic['name'];
    } else {
        if ($uid > 1) {
            $previewitem['name'] = stripslashes($aname);
            $previewitem['uid'] = $_USER['uid'];
        } else {
            $previewitem['name'] = stripslashes(urldecode($aname));
            $previewitem['uid'] = 1;
        }
    }