コード例 #1
0
function smarty_function_filePath($params, &$smarty)
{
    $config = session::global_get('config');
    /* Set theme */
    if (isset($config)) {
        $theme = $config->get_cfg_value("theme", "default");
    } else {
        $theme = "default";
    }
    $filename = $params['file'];
    if (file_exists("themes/{$theme}/{$filename}")) {
        return "themes/{$theme}/{$filename}";
    }
    $dir = $smarty->template_dir;
    if (is_array($dir)) {
        $dir = $dir[0];
    }
    if (file_exists("{$dir}/themes/{$theme}/{$filename}")) {
        return "{$dir}/themes/{$theme}/{$filename}";
    }
    if (file_exists("themes/default/{$filename}")) {
        return "themes/default/{$filename}";
    }
    if (file_exists("{$dir}/themes/default/{$filename}")) {
        return "{$dir}/themes/default/{$filename}";
    }
    return $filename;
}
コード例 #2
0
function smarty_function_iconPath($params, &$smarty)
{
    $config = session::global_get('config');
    /* Set theme */
    $theme = IconTheme::$default_theme;
    if (isset($config)) {
        $theme = $config->get_cfg_value("theme");
    }
    return IconTheme::findThemeIcon($theme, $params['context'], $params['icon'], $params['size']);
}
コード例 #3
0
ファイル: index.php プロジェクト: misel228/fusiondirectory
function displayLogin()
{
    global $smarty, $message, $config, $ssl, $error_collector, $error_collector_mailto;
    $lang = session::global_get('lang');
    error_reporting(E_ALL | E_STRICT);
    /* Fill template with required values */
    $username = '';
    if (isset($_POST['username'])) {
        $username = trim($_POST['username']);
    }
    $smarty->assign('date', gmdate("D, d M Y H:i:s"));
    $smarty->assign('username', $username);
    $smarty->assign('personal_img', "geticon.php?context=types&icon=user&size=48");
    $smarty->assign('password_img', "geticon.php?context=status&icon=dialog-password&size=48");
    $smarty->assign('directory_img', "geticon.php?context=places&icon=network-server&size=48");
    $smarty->append('css_files', get_template_path('login.css'));
    /* Some error to display? */
    if (!isset($message)) {
        $message = "";
    }
    $smarty->assign("message", $message);
    /* Displasy SSL mode warning? */
    if ($ssl != "" && $config->get_cfg_value('warnSSL') == 'TRUE') {
        $smarty->assign("ssl", _("Warning") . ": <a style=\"color:red;\" href=\"{$ssl}\">" . _("Session is not encrypted!") . "</a>");
    } else {
        $smarty->assign("ssl", "");
    }
    if (!$config->check_session_lifetime()) {
        $smarty->assign("lifetime", _("Warning") . ": " . _("The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings."));
    } else {
        $smarty->assign("lifetime", "");
    }
    /* Generate server list */
    $servers = array();
    if (isset($_POST['server'])) {
        $selected = $_POST['server'];
    } else {
        $selected = $config->data['MAIN']['DEFAULT'];
    }
    foreach ($config->data['LOCATIONS'] as $key => $ignored) {
        $servers[$key] = $key;
    }
    $smarty->assign("server_options", $servers);
    $smarty->assign("server_id", $selected);
    /* show login screen */
    $smarty->assign("PHPSESSID", session_id());
    if (session::is_set('errors')) {
        $smarty->assign("errors", session::get('errors'));
    }
    if ($error_collector != "") {
        $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>");
    } else {
        $smarty->assign("php_errors", "");
    }
    $smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
    $smarty->assign("usePrototype", "false");
    $smarty->assign("date", date("l, dS F Y H:i:s O"));
    $smarty->assign("lang", preg_replace('/_.*$/', '', $lang));
    $smarty->assign("rtl", language_is_rtl($lang));
    $smarty->display(get_template_path('headers.tpl'));
    $smarty->assign("version", FD_VERSION);
    $smarty->display(get_template_path('login.tpl'));
    exit;
}
コード例 #4
0
ファイル: helpviewer.php プロジェクト: chrlutz/limux-gosa
    $header = "<!-- headers.tpl-->" . $smarty->fetch(get_template_path('headers.tpl'));
    /* I don't know why, but we must use utf8_encode to avoid dispplay errors */
    $display = $header . $smarty->fetch(get_template_path('help.tpl'));
    echo $display;
} elseif (empty($helpdir) || $helpdir == "/") {
    /* Generate Index and display it */
    $smarty->assign("help_contents", genIndex());
    $header = "<!-- headers.tpl-->" . $smarty->fetch(get_template_path('headers.tpl'));
    /* I don't know why, but we must use utf8_encode to avoid dispplay errors */
    $display = utf8_encode($header . $smarty->fetch(get_template_path('help.tpl')));
    echo $display;
} elseif (is_dir($helpdir) && ($fp = opendir($helpdir))) {
    /* Readfile gets the content of the requested file, 
     * parse it, rework links images and so on */
    $index = readfiles($helpdir, $prefix, $suffix, false, $helpobject['file']);
    $lastresults = session::global_get('lastresults');
    /* if this page is result from a search, mark the search strings */
    if (isset($_GET['mark'])) {
        $matches = $lastresults[preg_replace("/^.*\\//i", "", $helpobject['currentplug'])][$helpobject['file']];
        $index[$helpobject['file']]['content'] = markup_page($index[$helpobject['file']]['content'], $matches);
    }
    /* Display the help contents */
    $smarty->assign("help_contents", $index[$helpobject['file']]['content']);
    $header = "<!-- headers.tpl-->" . $smarty->fetch(get_template_path('headers.tpl'));
    /* I don't know why, but we must use utf8_encode to avoid dispplay errors */
    $smarty->assign("backward", $back);
    $smarty->assign("forward", $for);
    $display = utf8_encode($header . $smarty->fetch(get_template_path('help.tpl')));
    echo $display;
} else {
    /* There was a file requested which actually doesn't exists */
コード例 #5
0
        $config = session::global_get('config');
        foreach ($config->department_info as $dn => $info) {
            if (!isset($pathMapping[$dn])) {
                continue;
            }
            if (mb_stristr($info['name'], $search) !== FALSE) {
                $res .= "<li>" . mark($search, $pathMapping[$dn]) . ($info['description'] == '' ? "" : "<span class='informal'> [" . mark($search, $info['description']) . "]</span>") . "</li>";
                continue;
            }
            if (mb_stristr($info['description'], $search) !== FALSE) {
                $res .= "<li>" . mark($search, $pathMapping[$dn]) . ($info['description'] == '' ? "" : "<span class='informal'> [" . mark($search, $info['description']) . "]</span>") . "</li>";
                continue;
            }
            if (mb_stristr($pathMapping[$dn], $search) !== FALSE) {
                $res .= "<li>" . mark($search, $pathMapping[$dn]) . ($info['description'] == '' ? "" : "<span class='informal'> [" . mark($search, $info['description']) . "]</span>") . "</li>";
                continue;
            }
        }
        /* Return results */
        if (!empty($res)) {
            echo "<ul>{$res}</ul>";
        }
    }
} else {
    $ui = session::global_get('ui');
    /* Is there a filter object arround? */
    if (session::is_set("autocomplete")) {
        $filter = session::get("autocomplete");
        $filter->processAutocomplete();
    }
}
コード例 #6
0
ファイル: geticon.php プロジェクト: nimakwan/fusiondirectory
  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, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Basic setup, remove eventually registered sessions */
@(require_once "../include/php_setup.inc");
@(require_once "functions.inc");
@(require_once "variables.inc");
session_cache_limiter("private");
session::start();
session::global_set('errorsAlreadyPosted', array());
$theme = '';
if (session::global_is_set('config')) {
    $config = session::global_get('config');
    $theme = $config->get_cfg_value('theme');
} else {
    header("cache-control: no-cache");
}
IconTheme::$extensions = array('png');
$src = IconTheme::findThemeIcon($theme, $_GET['context'], $_GET['icon'], $_GET['size']);
header("Content-Type: image/png");
if (isset($_GET['disabled']) && $_GET['disabled']) {
    $im = imagecreatefrompng($src);
    imageAlphaBlending($im, TRUE);
    imageSaveAlpha($im, TRUE);
    imagefilter($im, IMG_FILTER_GRAYSCALE);
    imagepng($im);
    imagedestroy($im);
} else {
コード例 #7
0
 static function get_themes()
 {
     #fonction d'update du thème
     $themesdir = 'ihtml/themes/';
     $themes = array_keys(session::global_get(IconTheme::$session_var));
     if ($dir = opendir("{$themesdir}")) {
         while (($file = readdir($dir)) !== FALSE) {
             if (is_dir("{$themesdir}/{$file}") && !preg_match("/^\\./", $file)) {
                 $themes[] = $file;
             }
         }
     }
     return array_unique($themes);
 }
コード例 #8
0
ファイル: logout.php プロジェクト: chrlutz/limux-gosa
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/* Basic setup, remove eventually registered sessions */
require_once "../include/php_setup.inc";
require_once "functions.inc";
header("Content-type: text/html; charset=UTF-8");
/* try to start session, so we can remove userlocks, 
  if the old session is still available */
@session::start();
session::set('errorsAlreadyPosted', array());
if (session::global_is_set('ui')) {
    /* Get config & ui informations */
    $ui = session::global_get("ui");
    /* config used for del_user_locks & some lines below to detect the language */
    $config = session::global_get("config");
    /* Remove all locks of this user */
    del_user_locks($ui->dn);
    /* Write something to log */
    new log("security", "logout", "", array(), "A user logged out");
}
/* Language setup */
if (!isset($config) || $config->get_cfg_value("core", "language") == "") {
    $lang = get_browser_language();
} else {
    $lang = $config->get_cfg_value("core", "language");
}
// Try to keep track of logouts, this will fail if our session has already expired.
// Nothing will be logged if config isn't present anymore.
stats::log('global', 'global', array(), $action = 'logout', $amount = 1, 0);
putenv("LANGUAGE=");
コード例 #9
0
ファイル: main.php プロジェクト: misel228/fusiondirectory
/* React on clicks */
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST['delete_lock']) || isset($_POST['open_readonly'])) {
        /* Set old Post data */
        if (session::global_is_set('LOCK_VARS_USED_GET')) {
            foreach (session::global_get('LOCK_VARS_USED_GET') as $name => $value) {
                $_GET[$name] = $value;
            }
        }
        if (session::global_is_set('LOCK_VARS_USED_POST')) {
            foreach (session::global_get('LOCK_VARS_USED_POST') as $name => $value) {
                $_POST[$name] = $value;
            }
        }
        if (session::global_is_set('LOCK_VARS_USED_REQUEST')) {
            foreach (session::global_get('LOCK_VARS_USED_REQUEST') as $name => $value) {
                $_REQUEST[$name] = $value;
            }
        }
    }
}
/* Load plugin */
if (is_file("{$plugin_dir}/main.inc")) {
    $display = "";
    require "{$plugin_dir}/main.inc";
} else {
    msg_dialog::display(_("Plugin"), sprintf(_("Fatal error: Cannot find any plugin definitions for plugin '%s' ('%s' is not a file)!"), $plug, "{$plugin_dir}/main.inc"), FATAL_ERROR_DIALOG);
    exit;
}
/* Print_out last ErrorMessage repeated string. */
$smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
コード例 #10
0
ファイル: password.php プロジェクト: chrlutz/limux-gosa
    $params .= "&amp;{$index}=" . urlencode(${$index});
}
$params = preg_replace('/^&amp;/', '?', $params);
$smarty->assign('params', $params);
/* Fill template with required values */
$smarty->assign('date', gmdate("D, d M Y H:i:s"));
$smarty->assign('uid', $uid);
$smarty->assign('password_img', get_template_path('images/password.png'));
/* Displasy SSL mode warning? */
if ($ssl != "" && $config->get_cfg_value("core", "warnSSL") == 'true') {
    $smarty->assign("ssl", "<b>" . _("Warning") . ":</b> " . _("Session will not be encrypted.") . " <a style=\"color:red;\" href=\"" . htmlentities($ssl) . "\"><b>" . _("Enter SSL session") . "</b></a>!");
} else {
    $smarty->assign("ssl", "");
}
/* show login screen */
$smarty->assign("JS", session::global_get('js'));
$smarty->assign("PHPSESSID", session_id());
if (session::is_set('errors')) {
    $smarty->assign("errors", session::get('errors'));
}
if ($error_collector != "") {
    $smarty->assign("php_errors", $error_collector . "</div>");
} else {
    $smarty->assign("php_errors", "");
}
$smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
displayPWchanger();
?>

</body>
</html>
コード例 #11
0
ファイル: main.php プロジェクト: chrlutz/limux-gosa
}
$display = "<!-- headers.tpl-->" . $smarty->fetch(get_template_path('headers.tpl')) . $smarty->fetch(get_template_path('framework.tpl'));
/* Save dialog filters and selected base in a cookie. 
   So we may be able to restore the filter an base settings on reload.
*/
$cookie = array();
if (isset($_COOKIE['GOsa_Filter_Settings'])) {
    $cookie = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings']));
} elseif (isset($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])) {
    $cookie = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings']));
}
/* Save filters? */
if ($config->get_cfg_value("core", "storeFilterSettings") == "true") {
    $cookie_vars = array("MultiDialogFilters", "CurrentMainBase");
    foreach ($cookie_vars as $var) {
        if (session::global_is_set($var)) {
            $cookie[$ui->dn][$var] = session::global_get($var);
        }
    }
    if (isset($_GET['plug'])) {
        $cookie[$ui->dn]['plug'] = $_GET['plug'];
    }
    @setcookie("GOsa_Filter_Settings", base64_encode(serialize($cookie)), time() + 60 * 60 * 24);
}
/* Show page... */
echo $display;
/* Save plist and config */
session::global_set('plist', $plist);
session::global_set('config', $config);
session::set('errorsAlreadyPosted', array());
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
コード例 #12
0
ファイル: setup.php プロジェクト: chrlutz/limux-gosa
require_once "../setup/main.inc";
$smarty->assign("title", "GOsa - " . $_SERVER['SERVER_NAME']);
$smarty->assign("date", date("l, dS F Y H:i:s O"));
$header = "<!-- headers.tpl-->" . $smarty->fetch(get_template_path('setup_headers.tpl'));
/* Set focus to the error button if we've an error message */
$focus = "";
if (session::is_set('errors') && session::get('errors') != "") {
    $focus = '<script language="JavaScript" type="text/javascript">';
    $focus .= 'document.forms[0].error_accept.focus();';
    $focus .= '</script>';
}
$focus = '<script language="JavaScript" type="text/javascript">';
$focus .= 'next_msg_dialog();';
$focus .= '</script>';
/* show web frontend */
$setup = session::global_get('setup');
$smarty->assign("contents", $display);
$smarty->assign("navigation", $setup->get_navigation_html());
$smarty->assign("header", $setup->get_header_html());
$smarty->assign("bottom", $focus . $setup->get_bottom_html());
$smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
if ($error_collector != "") {
    $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>");
} else {
    $smarty->assign("php_errors", "");
}
if (function_exists("get_gosa_version")) {
    $smarty->assign("version", get_gosa_version());
} else {
    $smarty->assign("version", "");
}
コード例 #13
0
ファイル: index.php プロジェクト: chrlutz/limux-gosa
$lang = get_browser_language();
putenv("LANGUAGE=");
putenv("LANG={$lang}");
setlocale(LC_ALL, $lang);
$GLOBALS['t_language'] = $lang;
$GLOBALS['t_gettext_message_dir'] = $BASE_DIR . '/locale/';
/* Set the text domain as 'messages' */
$domain = 'messages';
bindtextdomain($domain, LOCALE_DIR);
textdomain($domain);
$smarty->assign('nextfield', 'username');
session::start();
/* Check for existing, alive session */
if (session::global_get('_LAST_PAGE_REQUEST')) {
    $max_life = $config->get_cfg_value("core", "sessionLifetime");
    $request_time = time() - session::global_get('_LAST_PAGE_REQUEST');
    if (!($request_time > $max_life)) {
        // Existing session which has not timed out yet
        $smarty->assign('title', 'GOsa error: existing session!');
        $smarty->assign('date', gmdate("D, d M Y H:i:s"));
        $smarty->display(get_template_path('headers.tpl'));
        $smarty->display(get_template_path('existing_session.tpl'));
        exit;
    }
}
/* Set error handler to own one, initialize time calculation
and start session. */
session::set('errorsAlreadyPosted', array());
$username = "";
/* Reset errors */
session::set('errors', "");