Beispiel #1
0
function cs_themebar($source, $string, $mod, $action)
{
    global $cs_main, $account;
    // themebar has some side-effects, so it is forbidden in a few mod/action combinations
    $forbidden = array('abcode/sourcebox', 'errors/500', 'pictures/select', 'clansphere/debug', 'clansphere/navmeta', 'clansphere/themebar', 'clansphere/themebar_light');
    if (!in_array($mod . '/' . $action, $forbidden)) {
        // prevent from double inserting the xsrf protection key
        $xsrf = $cs_main['xsrf_protection'];
        $cs_main['xsrf_protection'] = false;
        $data = array();
        $data['data']['content'] = $string;
        $data['raw']['target'] = 'themes/' . $cs_main['def_theme'] . '/' . $mod . '/' . $action . '.tpl';
        $data['raw']['langfile'] = 'lang/' . $account['users_lang'] . '/' . $mod . '.php';
        $phpsource = str_ireplace($cs_main['def_path'], '', $source);
        $phpsource = str_replace('\\', '/', $phpsource);
        $data['raw']['phpsource'] = ltrim($phpsource, '/');
        // use lightweight version if explorer is not available
        if (empty($account['access_explorer'])) {
            $string = cs_subtemplate(__FILE__, $data, 'clansphere', 'themebar_light');
        } else {
            include_once 'mods/explorer/functions.php';
            $data['link']['target'] = cs_explorer_path($data['raw']['target'], 'escape');
            $data['link']['langfile'] = cs_explorer_path($data['raw']['langfile'], 'escape');
            $data['link']['phpsource'] = cs_explorer_path($data['raw']['phpsource'], 'escape');
            $string = cs_subtemplate(__FILE__, $data, 'clansphere', 'themebar');
        }
        // reset the xsrf protection option
        $cs_main['xsrf_protection'] = $xsrf;
    }
    return $string;
}
Beispiel #2
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('explorer');
include_once 'mods/explorer/functions.php';
$target = empty($_REQUEST['dir']) ? '' : $_REQUEST['dir'];
$target = empty($_POST['data_folder']) ? $target : $_POST['data_folder'];
$dir = cs_explorer_path($target, 'raw');
$lsd = cs_explorer_path($dir, 'escape');
if (empty($_POST['submit'])) {
    $data = array();
    $data['var']['dir'] = $dir;
    echo cs_subtemplate(__FILE__, $data, 'explorer', 'create_dir');
} else {
    if (substr($dir, -1, 1) != '/' && !empty($dir)) {
        $dir .= '/';
    }
    $dir_created = str_replace('..', '', $dir . $_POST['folder_name']);
    $message = mkdir($dir_created, 0755) ? $cs_lang['success'] : $cs_lang['error'];
    cs_redirect($message, 'explorer', 'roots', 'dir=' . $lsd);
}
Beispiel #3
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('explorer');
include_once 'mods/explorer/functions.php';
$dir = cs_explorer_path($_REQUEST['file'], 'raw');
$lsd = cs_explorer_path($dir, 'escape');
$red_lsd = cs_explorer_path($dir, 'escape', 1);
$data = array();
if (empty($_POST['submit'])) {
    if (empty($dir)) {
        cs_redirect($cs_lang['no_file'], 'explorer', 'roots');
    } elseif (!file_exists($cs_main['def_path'] . '/' . $dir)) {
        cs_redirect($cs_lang['not_found'] . ': ' . $dir, 'explorer', 'roots');
    } elseif (!($file = fopen($cs_main['def_path'] . '/' . $dir, 'r'))) {
        cs_redirect($cs_lang['file_not_opened'], 'explorer', 'roots');
    } else {
        $content = fread($file, filesize($cs_main['def_path'] . '/' . $dir));
        fclose($file);
        $ending = strtolower(substr(strrchr($dir, '.'), 1));
        if ($ending == 'php') {
            $data['if']['phpfile'] = true;
            include_once 'mods/explorer/abcode.php';
            $data['abcode']['tools'] = cs_abcode_tools('data_content');
            $data['abcode']['html1'] = cs_abcode_toolshtml('data_content');
            $data['abcode']['sql'] = cs_abcode_sql('data_content');
            $data['abcode']['html2'] = cs_abcode_toolshtml2('data_content');
        } else {
            $data['if']['phpfile'] = false;
        }
Beispiel #4
0
# combine translations of target info file with mods access and modules
$cs_lang = array_merge($cs_lang, $cs_lang_acc, $cs_lang_mod);
$data['mod']['name'] = $mod_info['name'];
$data['mod']['version'] = $mod_info['version'];
$data['mod']['released'] = cs_date('date', $mod_info['released']);
$data['mod']['protected'] = empty($mod_info['protected']) ? $cs_lang['no'] : $cs_lang['yes'];
$data['mod']['creator'] = $mod_info['creator'];
$data['mod']['team'] = $mod_info['team'];
$data['mod']['url'] = cs_html_link('http://' . $mod_info['url'], $mod_info['url']);
$data['mod']['icon_48'] = empty($mod_info['icon']) ? '' : cs_icon($mod_info['icon'], '48');
$data['mod']['icon_16'] = empty($mod_info['icon']) ? '' : cs_icon($mod_info['icon']);
$data['mod']['text'] = $mod_info['text'];
if (!empty($account['access_explorer'])) {
    $data['if']['access_explorer'] = TRUE;
    include_once 'mods/explorer/functions.php';
    $more = 'dir=' . cs_explorer_path('mods/' . $dir, 'escape');
    $data['extended']['link'] = cs_link($cs_lang['jump_to_explorer'], 'explorer', 'roots', $more);
}
if (file_exists('mods/' . $dir . '/access.php')) {
    $sort = empty($_REQUEST['sort']) ? 2 : $_REQUEST['sort'];
    $data['sort']['file'] = cs_sort('modules', 'view', 0, 0, 1, $sort, 'dir=' . $dir);
    $data['sort']['access'] = cs_sort('modules', 'view', 0, 0, 3, $sort, 'dir=' . $dir);
    $axx_file = array();
    include 'mods/' . $dir . '/access.php';
    switch ($sort) {
        case 1:
            krsort($axx_file);
            break;
        case 3:
            arsort($axx_file);
            break;
Beispiel #5
0
    foreach ($folders as $folder) {
        $output_folder .= empty($output_folder) ? $folder : cs_explorer_path('/', 'escape') . $folder;
        $data['path']['show'] .= cs_link($folder, 'explorer', 'roots', 'dir=' . $output_folder) . '/';
    }
}
if (!empty($success)) {
    $img_edit = cs_icon('editpaste');
    $img_access = cs_icon('access');
    $img_del = cs_icon('editdelete');
    $img_info = cs_icon('documentinfo');
    $y = -1;
    require_once 'mods/clansphere/filetype.php';
    for ($x = $start; $x < $count && $y < $max_data; $x++) {
        $y++;
        $file_raw = $dir == '.' ? $datas[$x] : $dir . '/' . $datas[$x];
        $file = cs_explorer_path($file_raw, 'escape');
        chdir($target);
        $type = is_dir($datas[$x]) ? 'dir' : strtolower(substr(strrchr($datas[$x], '.'), 1));
        chdir($cs_main['def_path']);
        $save[$y]['name'] = $datas[$x];
        $save[$y]['chmod'] = substr(sprintf('%o', fileperms($file_raw)), -4);
        $save[$y]['access'] = cs_link($img_access, 'explorer', 'chmod', 'file=' . $file);
        $save[$y]['remove'] = cs_link($img_del, 'explorer', 'remove', 'file=' . $file, 0, $cs_lang['remove']);
        $save[$y]['info'] = cs_link($img_info, 'explorer', 'information', 'file=' . $file);
        $save[$y]['edit'] = $type != 'dir' ? cs_link($img_edit, 'explorer', 'edit', 'file=' . $file) : '';
        $view = cs_link($datas[$x], 'explorer', 'view', 'file=' . $file);
        $save[$y]['symbol'] = cs_filetype($type);
        if ($type == 'jpg' || $type == 'jpeg' || $type == 'png' || $type == 'gif' || $type == 'bmp') {
            $save[$y]['name'] = cs_link($datas[$x], 'explorer', 'view', 'file=' . $file);
        } elseif ($type == 'dir') {
            $save[$y]['name'] = cs_link($datas[$x], 'explorer', 'roots', 'dir=' . $file);