Example #1
0
     $out .= content();
     break;
 case "expmenu":
     $out .= expmenu(0);
     break;
 case "extra":
     $out .= extra();
     break;
 case "footer":
     $out .= $set['footer'];
     break;
 case "fullmenu":
     $out .= fullmenu(0);
     break;
 case "search":
     $out .= searchform();
     break;
 case "header":
     $out .= printheader(0, $selected['name'], $selected['description']);
     break;
 case "homelink":
     $out .= '<a href="' . $set['homepath'] . "\">{$langmessage['111']}</a>";
     break;
 case "image":
     $out .= "./templates/" . $selected['template'] . "/images/";
     break;
 case "login":
     $out .= loginout();
     break;
 case "loginform":
     $out .= loginform();
Example #2
0
function &smarty($javascript = array(), $headers = array(), $pagestrings = array(), $extraconfig = array())
{
    global $USER, $SESSION;
    if (!is_array($headers)) {
        $headers = array();
    }
    if (!is_array($pagestrings)) {
        $pagestrings = array();
    }
    if (!is_array($extraconfig)) {
        $extraconfig = array();
    }
    $SIDEBLOCKS = array();
    $smarty = smarty_core();
    $wwwroot = get_config('wwwroot');
    // NOTE: not using jswwwroot - it seems to wreck image paths if you
    // drag them around the wysiwyg editor
    $jswwwroot = json_encode($wwwroot);
    $theme_list = array();
    $smarty->assign('searchform', searchform());
    if (function_exists('pieform_get_headdata')) {
        $headers = array_merge($headers, pieform_get_headdata());
    }
    // Insert the appropriate javascript tags
    $javascript_array = array();
    $jsroot = $wwwroot . 'js/';
    // TinyMCE must be included first for some reason we're not sure about
    $checkarray = array(&$javascript, &$headers);
    $found_tinymce = false;
    foreach ($checkarray as &$check) {
        if (($key = array_search('tinymce', $check)) !== false || ($key = array_search('tinytinymce', $check)) !== false) {
            if (!$found_tinymce) {
                $found_tinymce = $check[$key];
                $javascript_array[] = $jsroot . 'tinymce/tiny_mce.js';
                $content_css = json_encode(theme_get_url('style/tinymce.css'));
                $language = substr(current_language(), 0, 2);
                $execcommand = '';
                if (isset($extraconfig['tinymcecommandcallback'])) {
                    $execcommand = 'execcommand_callback: "' . $extraconfig['tinymcecommandcallback'] . '",';
                }
                if ($check[$key] == 'tinymce') {
                    $tinymce_config = <<<EOF
    mode: "none",
    theme: "advanced",
    plugins: "table,emotions,iespell,inlinepopups,paste",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,hr,emotions,image,iespell,cleanup,separator,link,unlink,separator,code",
    theme_advanced_buttons2 : "bullist,numlist,separator,tablecontrols,separator,cut,copy,paste,pasteword",
    theme_advanced_buttons3 : "fontselect,separator,fontsizeselect,separator,formatselect",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    //width: '512',
EOF;
                } else {
                    $tinymce_config = <<<EOF
    mode: "textareas",
    editor_selector: 'tinywysiwyg',
    theme: "advanced",
    plugins: "fullscreen,inlinepopups",
    theme_advanced_buttons1 : "bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull",
    theme_advanced_buttons2 : "bullist,numlist,separator,link,unlink,separator,code,fullscreen",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    fullscreen_new_window: true,
    fullscreen_settings: {
        theme: "advanced",
        plugins: "table,emotions,iespell,inlinepopups,paste",
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,forecolor,backcolor,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,hr,emotions,image,iespell,cleanup,separator,link,unlink,separator,code",
        theme_advanced_buttons2 : "bullist,numlist,separator,tablecontrols,separator,cut,copy,paste,pasteword",
        theme_advanced_buttons3 : "fontselect,separator,fontsizeselect,separator,formatselect"
    },
EOF;
                }
                $headers[] = <<<EOF
<script type="text/javascript">
tinyMCE.init({
    button_tile_map: true,
    {$tinymce_config}
    {$execcommand}
    extended_valid_elements : "object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode],script[src,type,language],+ul[id|type|compact]",
    urlconverter_callback : "custom_urlconvert",
    language: '{$language}',
    content_css : {$content_css},
    //document_base_url: {$jswwwroot},
    relative_urls: false
});
function custom_urlconvert (url, node, on_save) {
  // Don't convert the url on the skype status buttons.
  if (url.indexOf('skype:') == 0) {
      return url;
  }
  return TinyMCE.prototype.convertURL(url, node, on_save);
}
</script>

EOF;
                unset($check[$key]);
            } else {
                if ($check[$key] != $found_tinymce) {
                    log_warn('Two differently configured tinyMCE instances have been asked for on this page! This is not possible');
                }
                unset($check[$key]);
            }
        }
    }
    if (get_config('developermode') & DEVMODE_UNPACKEDJS) {
        $javascript_array[] = $jsroot . 'MochiKit/MochiKit.js';
        $javascript_array[] = $jsroot . 'MochiKit/Position.js';
        $javascript_array[] = $jsroot . 'MochiKit/Color.js';
        $javascript_array[] = $jsroot . 'MochiKit/Visual.js';
        $javascript_array[] = $jsroot . 'MochiKit/DragAndDrop.js';
        $javascript_array[] = $jsroot . 'MochiKit/Format.js';
    } else {
        $javascript_array[] = $jsroot . 'MochiKit/Packed.js';
    }
    $javascript_array[] = $jsroot . 'keyboardNavigation.js';
    $strings = array();
    foreach ($pagestrings as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $tag) {
                $strings[$tag] = get_raw_string($tag, $k);
            }
        } else {
            $strings[$k] = get_raw_string($k, $v);
        }
    }
    $jsstrings = jsstrings();
    $themepaths = themepaths();
    foreach ($javascript as $jsfile) {
        // For now, if there's no path in the js file, assume it's in
        // $jsroot and append '.js' to the name.  Later we may want to
        // ensure all smarty() calls include the full path to the js
        // file, with the proper extension.
        if (strpos($jsfile, '/') === false) {
            $javascript_array[] = $jsroot . $jsfile . '.js';
            if (isset($jsstrings[$jsfile])) {
                foreach ($jsstrings[$jsfile] as $section => $tags) {
                    foreach ($tags as $tag) {
                        $strings[$tag] = get_raw_string($tag, $section);
                    }
                }
            }
            if (isset($themepaths[$jsfile])) {
                foreach ($themepaths[$jsfile] as $themepath) {
                    $theme_list[$themepath] = theme_get_url($themepath);
                }
            }
        } else {
            // A .js file with a fully specified path
            $javascript_array[] = $wwwroot . $jsfile;
            // If $jsfile is from a plugin (i.e. plugintype/pluginname/js/foo.js)
            // Then get js strings from static function jsstrings in plugintype/pluginname/lib.php
            $bits = explode('/', $jsfile);
            if (count($bits) == 4) {
                safe_require($bits[0], $bits[1]);
                $pluginclass = generate_class_name($bits[0], $bits[1]);
                $name = substr($bits[3], 0, strpos($bits[3], '.js'));
                if (is_callable(array($pluginclass, 'jsstrings'))) {
                    $tempstrings = call_static_method($pluginclass, 'jsstrings', $name);
                    foreach ($tempstrings as $section => $tags) {
                        foreach ($tags as $tag) {
                            $strings[$tag] = get_raw_string($tag, $section);
                        }
                    }
                }
                if (is_callable(array($pluginclass, 'jshelp'))) {
                    $tempstrings = call_static_method($pluginclass, 'jshelp', $name);
                    foreach ($tempstrings as $section => $tags) {
                        foreach ($tags as $tag) {
                            $strings[$tag . '.help'] = get_help_icon($bits[0], $bits[1], null, null, null, $tag);
                        }
                    }
                }
                if (is_callable(array($pluginclass, 'themepaths'))) {
                    $tmpthemepaths = call_static_method($pluginclass, 'themepaths', $name);
                    foreach ($tmpthemepaths as $themepath) {
                        $theme_list[$themepath] = theme_get_url($themepath);
                    }
                }
            }
        }
    }
    $javascript_array[] = $jsroot . 'mahara.js';
    if (get_config('developermode') & DEVMODE_DEBUGJS) {
        $javascript_array[] = $jsroot . 'debug.js';
    }
    if (get_config('developermode') & DEVMODE_FIREBUGLITE && isset($_SERVER['HTTP_USER_AGENT']) && false === stripos($_SERVER['HTTP_USER_AGENT'], 'gecko')) {
        $javascript_array[] = $jsroot . 'firebug/firebug.js';
    }
    foreach ($jsstrings['mahara'] as $section => $tags) {
        foreach ($tags as $tag) {
            $strings[$tag] = get_raw_string($tag, $section);
        }
    }
    if (isset($extraconfig['themepaths']) && is_array($extraconfig['themepaths'])) {
        foreach ($extraconfig['themepaths'] as $themepath) {
            $theme_list[$themepath] = theme_get_url($themepath);
        }
    }
    $stringjs = '<script type="text/javascript">';
    $stringjs .= 'var strings = ' . json_encode($strings) . ';';
    $stringjs .= '</script>';
    // stylesheet set up - if we're in a plugin also get its stylesheet
    $stylesheets = array_reverse(theme_get_url('style/style.css', null, true));
    if (defined('SECTION_PLUGINTYPE') && defined('SECTION_PLUGINNAME') && SECTION_PLUGINTYPE != 'core') {
        if ($pluginsheets = theme_get_url('style/style.css', SECTION_PLUGINTYPE . '/' . SECTION_PLUGINNAME . '/', true)) {
            $stylesheets = array_merge($stylesheets, array_reverse($pluginsheets));
        }
    }
    if (defined('ADMIN') || defined('INSTITUTIONALADMIN')) {
        $stylesheets[] = theme_get_url('style/admin.css');
    }
    if (get_config('developermode') & DEVMODE_DEBUGCSS) {
        $stylesheets[] = get_config('wwwroot') . 'theme/debug.css';
    }
    // look for extra stylesheets
    if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
        foreach ($extraconfig['stylesheets'] as $extrasheet) {
            if ($sheets = theme_get_url($extrasheet, '', true)) {
                $stylesheets = array_merge($stylesheets, array_reverse($sheets));
            }
        }
    }
    $smarty->assign('STRINGJS', $stringjs);
    $smarty->assign('STYLESHEETLIST', $stylesheets);
    if (!empty($theme_list)) {
        // this gets assigned in smarty_core, but do it again here if it's changed locally
        $smarty->assign('THEMELIST', json_encode(array_merge((array) json_decode($smarty->get_template_vars('THEMELIST')), $theme_list)));
    }
    $sitename = get_config('sitename');
    if (!$sitename) {
        $sitename = 'Mahara';
    }
    if (defined('TITLE')) {
        $smarty->assign('PAGETITLE', TITLE . ' - ' . $sitename);
        $smarty->assign('heading', TITLE);
    } else {
        $smarty->assign('PAGETITLE', $sitename);
    }
    $sitename = get_config('sitename');
    $smarty->assign('title', $sitename);
    $smarty->assign('hiddenheading', $sitename);
    if (defined('PUBLIC')) {
        $smarty->assign('PUBLIC', true);
    }
    if (defined('ADMIN')) {
        $smarty->assign('ADMIN', true);
    }
    if (defined('INSTITUTIONALADMIN')) {
        $smarty->assign('INSTITUTIONALADMIN', true);
    }
    $smarty->assign('LOGGEDIN', $USER->is_logged_in());
    if ($USER->is_logged_in()) {
        $smarty->assign('MAINNAV', main_nav());
    } else {
        $smarty->assign('sitedefaultlang', get_string('sitedefault', 'admin') . ' (' . get_string_from_language(get_config('lang'), 'thislanguage') . ')');
        $smarty->assign('LANGUAGES', get_languages());
    }
    $smarty->assign_by_ref('USER', $USER);
    $smarty->assign('SESSKEY', $USER->get('sesskey'));
    $smarty->assign_by_ref('JAVASCRIPT', $javascript_array);
    $smarty->assign_by_ref('HEADERS', $headers);
    if (get_config('siteclosed')) {
        if (get_config('disablelogin')) {
            $smarty->assign('SITECLOSED', get_string('siteclosedlogindisabled', 'mahara', get_config('wwwroot') . 'admin/upgrade.php'));
        } else {
            $smarty->assign('SITECLOSED', get_string('siteclosed'));
        }
    }
    if (!isset($extraconfig['pagehelp']) || $extraconfig['pagehelp'] !== false and $help = has_page_help()) {
        $smarty->assign('PAGEHELPNAME', $help[0]);
        $smarty->assign('PAGEHELPICON', $help[1]);
    }
    if (defined('GROUP')) {
        require_once 'group.php';
        $smarty->assign('GROUP', group_current_group());
        $smarty->assign('GROUPNAV', group_get_menu_tabs());
    }
    // ---------- sideblock stuff ----------
    if (!defined('INSTALLER') && (!defined('MENUITEM') || substr(MENUITEM, 0, 5) != 'admin')) {
        if (get_config('installed')) {
            $data = site_menu();
            if (!empty($data)) {
                $smarty->assign('SITEMENU', site_menu());
                $SIDEBLOCKS[] = array('name' => 'linksandresources', 'weight' => 10, 'data' => $data);
            }
        }
        if ($USER->is_logged_in() && defined('MENUITEM') && substr(MENUITEM, 0, 11) == 'myportfolio') {
            $SIDEBLOCKS[] = array('name' => 'selfsearch', 'weight' => 0, 'data' => array());
        }
        if ($USER->is_logged_in()) {
            $SIDEBLOCKS[] = array('name' => 'profile', 'id' => 'sb_profile', 'weight' => -20, 'data' => profile_sideblock());
            if (get_config('showonlineuserssideblock')) {
                $SIDEBLOCKS[] = array('name' => 'onlineusers', 'id' => 'sb_onlineusers', 'weight' => -10, 'data' => onlineusers_sideblock());
            }
        }
        if (defined('GROUP')) {
            $SIDEBLOCKS[] = array('name' => 'group', 'id' => 'sb_groupnav', 'weight' => -10, 'data' => group_sideblock());
        }
        if (!$USER->is_logged_in()) {
            $SIDEBLOCKS[] = array('name' => 'login', 'weight' => -10, 'id' => 'sb_loginbox', 'data' => array('loginform' => auth_generate_login_form()));
        }
        if (get_config('enablenetworking')) {
            require_once get_config('docroot') . 'api/xmlrpc/lib.php';
            if ($USER->is_logged_in() && ($ssopeers = get_service_providers($USER->authinstance))) {
                $SIDEBLOCKS[] = array('name' => 'ssopeers', 'weight' => 1, 'data' => $ssopeers);
            }
        }
        if (isset($extraconfig['sideblocks']) && is_array($extraconfig['sideblocks'])) {
            foreach ($extraconfig['sideblocks'] as $sideblock) {
                $SIDEBLOCKS[] = $sideblock;
            }
        }
        usort($SIDEBLOCKS, create_function('$a,$b', 'if ($a["weight"] == $b["weight"]) return 0; return ($a["weight"] < $b["weight"]) ? -1 : 1;'));
        $smarty->assign('userauthinstance', $SESSION->get('authinstance'));
        $smarty->assign('MNETUSER', $SESSION->get('mnetuser'));
        $smarty->assign('SIDEBLOCKS', $SIDEBLOCKS);
        if ($USER->get('parentuser')) {
            $smarty->assign('USERMASQUERADING', true);
            $smarty->assign('masqueradedetails', get_string('youaremasqueradingas', 'mahara', hsc(display_name($USER))));
            $smarty->assign('becomeyouagain', ' <a href="' . hsc($wwwroot) . 'admin/users/changeuser.php?restore=1">' . get_string('becomeadminagain', 'admin', $USER->get('parentuser')->name) . '</a>');
        }
    }
    return $smarty;
}
Example #3
0
    $search = sql_query("SELECT * FROM loginattempts WHERE ip LIKE '%{$ip}%'") or sqlerr(__FILE__, __LINE__);
    stdhead("Max. Login Attemps - Search");
    print "<h2>" . $lang_maxlogin['head_failed'] . "</h2>";
    print "<table border=1 cellspacing=0 cellpadding=5 width=100%>\n";
    if (mysql_num_rows($search) == 0) {
        print "<tr><td colspan=2><b>" . $lang_maxlogin['text_nothing'] . "</b></td></tr>\n";
    } else {
        print "<tr><td class=colhead><a href=?order=id>" . $lang_maxlogin['text_id'] . "</a></td><td class=colhead align=left><a href=?order=ip>" . $lang_maxlogin['text_ip'] . "</a></td><td class=colhead align=left><a href=?order=added>" . $lang_maxlogin['text_action_time'] . "</a></td>" . "<td class=colhead align=left><a href=?order=attempts>" . $lang_maxlogin['text_attempts_time'] . "</a></td><td class=colhead align=left><a href=?order=type>" . $lang_maxlogin['text_attempts_type'] . "</a></td><td class=colhead align=left><a href=?order=status>" . $lang_maxlogin['text_status'] . "</a></td></tr>\n";
        while ($arr = mysql_fetch_assoc($search)) {
            $r2 = sql_query("SELECT id,username FROM users WHERE ip=" . sqlesc($arr[ip])) or sqlerr(__FILE__, __LINE__);
            $a2 = mysql_fetch_assoc($r2);
            print "<tr><td align=>{$arr['id']}</td><td align=left>{$arr['ip']} " . ($a2[id] ? get_username($a2[id]) : "") . "</td><td align=left>{$arr['added']}</td><td align=left>{$arr['attempts']}</td><td align=left>" . ($arr[type] == "recover" ? $lang_maxlogin['type_recover'] : $lang_maxlogin['type_login']) . "</td><td align=left>" . ($arr[banned] == "yes" ? "<font color=red><b>" . $lang_maxlogin['status_banned'] . "</b></font> <a href=maxlogin.php?action=unban&id={$arr['id']}><font color=green>[<b>" . $lang_maxlogin['action_unban'] . "</b>]</font></a>" : "<font color=green><b>" . $lang_maxlogin['status_notbanned'] . "</b></font> <a href=maxlogin.php?action=ban&id={$arr['id']}><font color=red>[<b>" . $lang_maxlogin['action_ban'] . "</b>]</font></a>") . "  <a OnClick=\"return confirm('" . $lang_maxlogin['text_notice'] . "');\" href=maxlogin.php?action=delete&id={$arr['id']}>[<b>" . $lang_maxlogin['action_delete'] . "</b></a>] <a href=maxlogin.php?action=edit&id={$arr['id']}><font color=blue>[<b>" . $lang_maxlogin['action_edit'] . "</b></a>]</font></td></tr>\n";
        }
    }
    print "</table>\n";
    searchform();
    stdfoot();
} else {
    stderr("Error", "Invalid Action");
}
function searchform()
{
    global $lang_maxlogin;
    ?>
<br />
<form method=post name=search action=maxlogin.php?>
<input type=hidden name=action value=searchip>
<p class=success align=center><?php 
    print $lang_maxlogin['text_searchip'];
    ?>
<input type=text name=ip size=25> <input type=submit name=submit class=btn></p>
Example #4
0
 * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    mahara
 * @subpackage core
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
define('INTERNAL', 1);
define('PUBLIC', 1);
require 'init.php';
define('TITLE', get_string('about'));
$smarty = smarty();
$smarty->assign('page_content', get_site_page_content('about'));
$smarty->assign('heading', null);
$smarty->assign('searchform', searchform());
$smarty->display('sitepage.tpl');
Example #5
0
<?php

include_once '../config/symbini.php';
include_once $serverRoot . '/classes/AgentManager.php';
Header("Content-Type: text/html; charset=" . $charset);
$lang = array_key_exists("lang", $_REQUEST) ? $_REQUEST["lang"] : $defaultLang;
$spDisplay = "Agent Search";
$name = array_key_exists("name", $_REQUEST) ? $_REQUEST["name"] : "";
pageheader($name);
if (strlen($name) > 0) {
    echo searchform($name);
    echo search($name);
} else {
    echo searchform();
    echo browse();
}
footer();
function search($term)
{
    $am = new AgentManager();
    $result = "<div id='loadedWithPage'><table id='innertable'>\n";
    $result .= $am->agentNameSearch($term);
    $result .= "</table></div>\n";
    return $result;
}
function browse()
{
    $am = new AgentManager();
    $result = "<div id='loadedWithPage'>\n";
    $result .= "<h3>Collector and other agent records</h3>";
    $result .= $am->getNameStats();