Esempio n. 1
0
 */
$tab = sumo_get_user_info($_GET['id'], 'id', FALSE);
if (sumo_verify_permissions(4, $tab['group'])) {
    if ($SUMO['user']['id'] == $_GET['id'] || $SUMO['user']['user'] == 'sumo') {
        $validate[0] = '';
        // If id not exist
        if (!$tab['id']) {
            $tpl['MESSAGE:H'] = sumo_get_message('W00001C', $_GET['id']);
        } else {
            sumo_delete_user_image($_GET['id']);
        }
        if ($validate[0]) {
            $tpl['MESSAGE:M'] = $validate[1];
        }
        $tpl['GET:UpdateForm'] = "<form action='?module=users&action=editimg&id=" . $tab['id'] . "' " . "name='UpdateUserImg' method='POST' enctype='multipart/form-data'>";
        $tpl['IMG:User'] = "******" . $tab['id'] . "' alt='" . $tab['username'] . "' class='user'>";
        $tpl['PUT:UserImage'] = "<input type='hidden' name='MAX_FILE_SIZE' value='30720'>" . "<input type='file' size='20' class='file' name='user_image' >";
        $tpl['GET:DeleteForm'] = "<form action='?module=users&action=deleteimg&id=" . $tab['id'] . "' name='DeleteUserImg' method='POST'>\n" . "<input type='submit' class='button' value='" . $language['Delete'] . "'>\n" . "</form>";
        // Note: not using sumo_show_window() function
        // because for this event a window is external
        $tpl_file = SUMO_PATH_MODULE . '/templates/editimg.tpl';
        if (sumo_verify_file($tpl_file)) {
            $content = implode('', file($tpl_file));
        }
        echo sumo_process_template($content, $tpl);
        exit;
    }
} else {
    $action_error = true;
    $tpl['MESSAGE:H'] = $language['AccessDenied'];
}
Esempio n. 2
0
}
// Initialize windows
$tpl['GET:ModulesWindows'] .= "<!-- -->\n\n<script type='text/javascript'>\n<!--\n\tSET_DHTML(\n";
for ($m = 0; $m < $num_modules; $m++) {
    $m_name = $modules[$m];
    // Verify permissions
    if (sumo_verify_permissions($_level[$m_name], $_group[$m_name], $_user[$m_name])) {
        $tpl['GET:ModulesWindows'] .= "\t\t'" . $m_name . "'" . "+MAXOFFTOP+" . ($yw[$m_name] - 18) . "+MAXOFFLEFT+" . $xw[$m_name] . "+SCROLL";
        if ($m < $num_modules - 1) {
            $tpl['GET:ModulesWindows'] .= ",\n";
        }
    }
}
$tpl['GET:ModulesWindows'] .= "\n\t);\n" . "-->\n</script>\n";
//----------------
// Reload last window opened
for ($m = 0; $m < $num_modules; $m++) {
    if ($desktop['settings'][$modules[$m]]['s']) {
        $m_name = $modules[$m];
        // Verify permissions
        if (sumo_verify_permissions($_level[$m_name], $_group[$m_name], $_user[$m_name])) {
            $tpl['GET:ModulesWindows'] .= sumo_get_module_start($m_name, $desktop['settings'][$m_name]['action']);
        }
    }
}
//----------------
// Splashscreen
$tpl['GET:Splashscreen'] = sumo_get_splashscreen();
// Display Desktop
echo sumo_process_template($desktop['template'], $tpl);
Esempio n. 3
0
/**
 * Function to parsing template file
 * if $tpl_file = 1  load template file, not process content.
 *
 * @global resource $SUMO
 * @author Alberto Basso <*****@*****.**>
 */
function sumo_process_template($template_file, $assign, $tpl_file = 0, $theme = '')
{
    global $SUMO, $language;
    if (!$theme) {
        $theme = $SUMO['page']['theme'];
    }
    if ($tpl_file == 1) {
        $template_file = @file_get_contents(SUMO_PATH . '/themes/' . $theme . '/' . $template_file);
        /*
        $tpl_file_in  = SUMO_PATH.'/themes/'.$theme.'/'.$template_file;
        $tpl_file_out = SUMO_PATH.'/tmp/templates/'.($template_file);
        
        if (($SUMO['server']['time'] - @filemtime($tpl_file_out)) < 60)
        {
        	$template_file = @file_get_contents($tpl_file_out);			
        }
        else 
        {
        	$template_file = @file_get_contents($tpl_file_in);
        	$template_file = html_compress($template_file);
        	
        	$fp = @fopen  ($tpl_file_out, 'w+') OR die (sumo_get_message('XXXXXX', $tpl_file_in));
            	  @fwrite ($fp, $template_file);
        		  @fclose ($fp);
        }
        */
    }
    preg_match_all('/{{.[\\/_\\-:a-z0-9.]+}}/i', $template_file, $match);
    $e_tpl_new = $element = array();
    foreach ($match[0] as $element) {
        $e_tpl_new[] = str_replace('{{', '', str_replace('}}', '', $element));
    }
    $num_e_tpl_new = count($e_tpl_new);
    for ($el = 0; $el < $num_e_tpl_new; $el++) {
        // standard template
        if (array_key_exists($e_tpl_new[$el], $assign)) {
            $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', $assign[$e_tpl_new[$el]], $template_file);
            $template_file = $str_new;
        } elseif (substr($e_tpl_new[$el], 0, 5) == 'LANG:') {
            $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', $language[str_replace("LANG:", "", $e_tpl_new[$el])], $template_file);
            $template_file = $str_new;
        } elseif (substr($e_tpl_new[$el], 0, 4) == 'TIP:') {
            if ($SUMO['config']['console']['tip']) {
                $help = str_replace("'", "&rsquo;", $language[str_replace("TIP:", "", $e_tpl_new[$el])]);
                $help = str_replace('"', "&quot;", $help);
                $help = sumo_process_template($help, $assign);
                $id = sumo_get_simple_rand_string();
                $tip = "<img src=\"themes/" . $theme . "/images/helptip.png\" id='" . $id . "' " . "width='11' height='11' style='cursor:pointer;' " . "onmouseout=\"UnTip();opacity('" . $id . "', 100, 50, 50)\" " . "onmouseover=\"Tip('" . $help . "',DELAY,50,WIDTH,200,SHADOW,true,FADEIN,200,FADEOUT,200," . "BORDERCOLOR,'#FFFF99',SHADOWCOLOR,'#947C52',FONTCOLOR,'#000000',BGCOLOR,'#FFFF99'," . "OPACITY,80,SHADOWWIDTH,3);opacity('" . $id . "', 50, 100, 50)\">" . "<script>opacity('" . $id . "', 100, 50, 1);</script>";
                $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', $tip, $template_file);
            } else {
                $str_new = str_replace('{{' . $e_tpl_new[$el] . '}}', '', $template_file);
            }
            $template_file = $str_new;
        } elseif (substr($e_tpl_new[$el], 0, 5) == 'FILE:') {
            $name = pathinfo(str_replace('FILE:', '', $e_tpl_new[$el]));
            if ($name['dirname'] == '.') {
                $file = SUMO_PATH . "/themes/" . $theme . "/" . $name['dirname'] . "/" . $name['basename'];
            } else {
                $file = SUMO_PATH . $name['dirname'] . "/" . $name['basename'];
            }
            if (file_exists($file)) {
                $template_new = file_get_contents($file);
                $str_new = str_replace("{{" . $e_tpl_new[$el] . "}}", $template_new, $template_file);
                $str_new = sumo_process_template($str_new, $assign, $tpl_file, $theme);
                $template_file = $str_new;
            } else {
                $template_file = "FATAL ERROR: Template &quot;" . $file . "&quot; not found!";
            }
        }
    }
    return $template_file;
}
Esempio n. 4
0
/**
 *  Show module window
 */
function sumo_show_window($name = 'main', $title = '', $tpl_file = '', $tpl_array = array(), $decoration = true, $icon = '', $minwin = '', $maxwin = '')
{
    global $SUMO;
    $m = $_SESSION['module'];
    $name = str_replace('-', '', $name);
    $icon = $icon ? $icon : 'icon.window.png';
    $minwin = $minwin ? 'ShowElement("minwin' . $m . '");' : '';
    $maxwin = $maxwin ? 'ShowElement("maxwin' . $m . '");' : '';
    $tpl1 = SUMO_PATH . '/themes/' . $SUMO['page']['theme'] . '/' . $m . '.' . $tpl_file . '.tpl';
    $tpl2 = SUMO_PATH . '/themes/' . $SUMO['page']['theme'] . '/' . $tpl_file . '.tpl';
    $tpl3 = SUMO_PATH . '/modules/' . $m . '/templates/' . $tpl_file . '.tpl';
    $tplW = SUMO_PATH . '/themes/' . $SUMO['page']['theme'] . '/window.tpl';
    $tpl = $tpl1;
    if (!file_exists($tpl1)) {
        $tpl = $tpl2;
        if (!file_exists($tpl2)) {
            $tpl = $tpl3;
            if (!file_exists($tpl3)) {
                die("FATAL ERROR: Template " . $tpl . " not found!");
            }
        }
    }
    $tpl_module = implode('', file($tpl));
    // decoration
    if ($decoration) {
        if (!file_exists($tplW)) {
            die("FATAL ERROR: Template " . $tplW . " not found!");
        }
        $tpl_window = implode('', file($tplW));
        $tpl_array2 = array('GET:WindowModule' => $tpl_array['GET:WindowModule'] ? $tpl_array['GET:WindowModule'] : $m, 'GET:WindowTitle' => $tpl_array['GET:WindowTitle'] ? $tpl_array['GET:WindowTitle'] : $title, 'GET:WindowContent' => sumo_process_template($tpl_module, $tpl_array), 'GET:WindowElement' => $tpl_array['GET:WindowElement'] ? $tpl_array['GET:WindowElement'] : $m . $name, 'GET:PagePath' => $SUMO['page']['web_path'], 'GET:PageTheme' => $SUMO['page']['theme'], 'GET:WindowMinimize' => "sumo_minimize_window(\"{$m}\");", 'GET:WindowMaximize' => "sumo_maximize_window(\"{$m}\");", 'GET:WindowClose' => $tpl_array['GET:WindowClose'] ? $tpl_array['GET:WindowClose'] : "sumo_remove_window(\"{$m}\");", 'GET:SaveWindowSettings' => $tpl_array['GET:SaveWindowSettings'] ? $tpl_array['GET:SaveWindowSettings'] : "sumo_save_window_settings(\"" . $SUMO['user']['user'] . "\", \"{$m}\", 1);", 'IMG:WindowIcon' => "<img src='themes/" . $SUMO['page']['theme'] . "/images/modules/{$m}/" . $icon . "' " . "alt='&bull;' align='middle' hspace='3'>");
        $win = sumo_process_template($tpl_window, $tpl_array2);
    } else {
        $win = sumo_process_template($tpl_module, $tpl_array);
    }
    echo $win . "<script>" . "setTimeout('windowFocus(\"{$m}\");" . $minwin . $maxwin . "', 100);" . $tpl_array['GET:WindowScripts'] . $tpl_array['MESSAGE'] . "</script>";
}
Esempio n. 5
0
        $sumo_template = 'message';
        $sumo_message = $sumo_access == 'LOGOUT' ? sumo_get_message('I00006C') : sumo_get_message('W00100C');
        $sumo_page_name = sumo_get_accesspoint_name($SUMO['page']['name'], $SUMO['config']['server']['language']);
        header('WWW-Authenticate: Basic realm="' . $sumo_page_name . '"');
        header('HTTP/1.0 401 Unauthorized');
        header('status: 401 unauthorized');
        header('Content/Type: text/html; charset=' . SUMO_CHARSET);
    }
    // Load base Template Library
    $tpl_lib = SUMO_PATH . "/libs/lib.template.login.php";
    $tpl_lib_ext = SUMO_PATH . "/libs/lib.template.login." . $SUMO['page']['theme'] . ".php";
    $tpl_file = SUMO_PATH . "/themes/" . $SUMO['page']['theme'] . "/" . $sumo_template . ".tpl";
    if (sumo_verify_file($tpl_lib)) {
        require $tpl_lib;
    }
    if (file_exists($tpl_lib_ext)) {
        require $tpl_lib_ext;
    }
    if (sumo_verify_file($tpl_file)) {
        $tpl_data = implode('', file($tpl_file));
    }
    // SUMO Authentication
    echo sumo_process_template($tpl_data, $tpl_array, 0, $SUMO['page']['theme']);
    exit;
}
// Return original input data
if (!$SUMO['page']['filtering']) {
    $_GET = $_OLD_GET;
    $_POST = $_OLD_POST;
    $_COOKIE = $_OLD_COOKIE;
}