Exemple #1
0
function _moduleContent(&$smarty, $module_name)
{
    //include elastix framework
    include_once "libs/paloSantoForm.class.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoBuildModule.class.php";
    global $arrConf;
    global $arrConfig;
    //include lang local module
    global $arrLangModule;
    load_language_module($module_name);
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConfig['templates_dir']) ? $arrConfig['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    require_once 'libs/paloSantoDB.class.php';
    $pDB_acl = new paloDB($arrConf['elastix_dsn']['acl']);
    if (!empty($pDB_acl->errMsg)) {
        echo "ERROR DE DB: {$pDB_acl->errMsg} <br>";
    }
    $accion = getAction();
    switch ($accion) {
        case "mostrar_menu":
            $content = mostrar_menu();
            break;
        case "save_module":
            $content = save_module($smarty, $module_name, $local_templates_dir, $arrLangModule, $pDB_acl, $arrConf);
            break;
        case "check_errors":
            $content = check_errors();
            break;
        default:
            $content = new_module($smarty, $module_name, $local_templates_dir, $arrLangModule, $pDB_acl);
            break;
    }
    return $content;
}
Exemple #2
0
<?php

require_once 'src/header.html';
$title = "Login to KittenCoin Wallet";
$css = "";
$subtitle = "Please sign in!";
require_once 'src/title.php';
require_once 'src/functions.php';
check_errors();
?>
<form action="/login_user.php" method="POST">
    <div class="row">
        <div class="small-4 columns"><p></p></div>
        <div class="small-4 columns">
            <input type="text" placeholder="Username" name="username">
        </div>
        <div class="small-4 columns"><p></p></div>
    </div>
    <div class="row">
        <div class="small-4 columns"><p></p></div>
        <div class="small-4 columns">
            <input type="password" placeholder="Password" name="pass">
        </div>
        <div class="small-4 columns"><p></p></div>
    </div>
    <div class="row">
        <div class="small-6 columns">
            <input type="submit" class="button right" value="Login">
        </div>
        <div class="small-6 columns">
            <a href="/welcome.php" class="button alert left">Cancel</a>
						$submit = htmlentities($_POST["submit"]);

						function check_errors($password, $checkpassword) {
							if (
							(strlen($password) < 8 || strlen($password) > 16) ||
							(strlen($checkpassword) < 8 || strlen($checkpassword) > 16) ||
							($password !== $checkpassword)
							) {
								// Errors
								return TRUE;
							} else {
								// No errors
								return FALSE;
							}
						}
						if (empty($submit) || check_errors($password1, $password2)) {
						?>
							<form name = "resetpassword" method = "post">
								<label>Password: <input type = "password" name = "password1"/></label><br/>
								<?
								// Check if password is valid
								if (!empty($submit) && (strlen($password1) < 8 || strlen($password1) > 16)) {
									echo '<div id = "error">Password is invalid<br/></div>';
								}
								?>

								<label>Type Password Again: <input type = "password" name = "password2" /></label><br/>
								<?
								// Check if second password matches first
								if (!empty($submit) && $password1 !== $password2) {
									echo '<div id = "error">Passwords do not match<br/></div>';
Exemple #4
0
        exit;
    }
    ?>
    <div class="info">
    <h2>Scripting interface</h2>
    <p>This interface permits to script your uploads and downloads.</p>
    <p>See <a href="https://gitlab.com/mojo42/Pingouin/blob/master/script.php">source code</a> of this interface to get available calls :)</p>
    </div>
    <br />
    <?php 
    require Pingouin_ROOT . 'lib/template/footer.php';
    exit;
}
/* Lets use interface now. */
header('Content-Type: text; charset=utf-8');
check_errors($cfg);
if (has_error()) {
    echo 'Error';
    exit;
}
/* Upload file */
if (isset($_FILES['file']) && is_writable(VAR_FILES) && is_writable(VAR_LINKS)) {
    if (!Pingouin_challenge_upload_ip($cfg, get_ip_address($cfg))) {
        echo 'Error';
        exit;
    }
    if (Pingouin_has_upload_password($cfg) && (!isset($_POST['upload_password']) || !Pingouin_challenge_upload_password($cfg, $_POST['upload_password']))) {
        echo 'Error';
        exit;
    }
    $key = '';
function chunk_ul($scheme, $host, $port, $url, $onlyOpen = false)
{
    global $nn, $pauth, $fp, $errno, $errstr, $fsize, $pbChunkSize, $data, $zapros;
    if ($scheme == 'https://') {
        $scheme = 'tls://';
        $port = 443;
    }
    if (!empty($_GET['proxy'])) {
        $proxy = true;
        list($proxyHost, $proxyPort) = explode(':', $_GET['proxy'], 2);
        $host = $host . ($port != 80 && ($scheme != 'tls://' || $port != 443) ? ':' . $port : '');
        $url = $scheme . $host . $url;
    } else {
        $proxy = false;
    }
    if ($scheme != 'tls://') {
        $scheme = '';
    }
    $request = array();
    $request[] = 'POST ' . str_replace(' ', '%20', $url) . ' HTTP/1.0';
    $request[] = "Host: {$host}";
    $request[] = 'User-Agent: ' . (defined('rl_UserAgent') ? rl_UserAgent : 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.17');
    $request[] = 'Accept: */*';
    $request[] = 'Accept-Language: en-US;q=0.7,en;q=0.3';
    $request[] = 'Accept-Charset: utf-8,windows-1251;q=0.7,*;q=0.7';
    $request[] = 'Content-Type: application/octet-stream';
    $request[] = "Content-Length: " . ($onlyOpen ? $fsize : strlen($data));
    if ($proxy && !empty($pauth)) {
        $request[] = "Proxy-Authorization: Basic {$pauth}\r\n";
    }
    $request[] = 'Connection: Close';
    $zapros = implode("\r\n", $request) . "\r\n\r\n";
    $errno = 0;
    $errstr = '';
    $posturl = (!empty($proxyHost) ? $scheme . $proxyHost : $scheme . $host) . ':' . (!empty($proxyPort) ? $proxyPort : $port);
    $fp = @stream_socket_client($posturl, $errno, $errstr, 120, STREAM_CLIENT_CONNECT);
    if (!$fp) {
        $dis_host = $proxy ? $proxyHost : $host;
        $dis_port = $proxy ? $proxyPort : $port;
        html_error(sprintf(lang(88), $dis_host, $dis_port));
    } elseif ($errno || $errstr) {
        html_error($errstr);
    }
    if (!@fputs($fp, $zapros)) {
        html_error('Cannot send request headers.');
    }
    fflush($fp);
    $id = 'upload_div';
    require_once TEMPLATE_DIR . '/uploadui.php';
    echo "\n<script type='text/javascript'>document.getElementById('ul_con').innerHTML ='" . ($proxy ? sprintf(lang(89), $proxyHost, $proxyPort) . "<br />'UPLOAD: <b>{$url}</b>...<br />" : sprintf(lang(90), $host, $port)) . "';document.getElementById('ul_fname').style.display = 'block';</script>";
    flush();
    if ($onlyOpen) {
        return;
    }
    global $timeStart, $totalsend, $time, $lastChunkTime;
    $dlen = strlen($data);
    $sended = 0;
    for ($s = 0; $s < $dlen - 1; $s += $pbChunkSize) {
        $chunk = $pbChunkSize >= $dlen - $s ? substr($data, $s) : substr($data, $s, $pbChunkSize);
        $sendbyte = @fputs($fp, $chunk);
        fflush($fp);
        if ($sendbyte === false || strlen($chunk) > $sendbyte) {
            if (isset($GLOBALS['T8DEBUG'])) {
                textarea("UPLOAD Chunk\nRAW Request:\n" . $zapros . "[Incomplete Chunk Content]", 200, 15);
            }
            //Debug 4/4 XD
            fclose($fp);
            html_error(lang(113));
        }
        $totalsend += $sendbyte;
        $sended += $sendbyte;
        $time = getmicrotime() - $timeStart;
        $chunkTime = $time - $lastChunkTime;
        if ($s + $sendbyte <= $dlen - 1 && $chunkTime < 1) {
            continue;
        }
        $chunkTime = !($chunkTime < 0) && $chunkTime > 0 ? $chunkTime : 1;
        $lastChunkTime = $time;
        $speed = round($sended / 1024 / $chunkTime, 2);
        $percent = round($totalsend / $fsize * 100, 2);
        echo "<script type='text/javascript'>pr('{$percent}', '" . bytesToKbOrMbOrGb($totalsend) . "', '{$speed}');</script>\n";
        flush();
        $sended = 0;
    }
    if ($errno || $errstr) {
        html_error($errstr);
    }
    fflush($fp);
    $page = '';
    while (!feof($fp)) {
        $data = fgets($fp, 16384);
        if ($data === false) {
            break;
        }
        $page .= $data;
    }
    fclose($fp);
    if (isset($GLOBALS['T8DEBUG'])) {
        textarea("UPLOAD Chunk\nResponse:\n{$page}\nRAW Request:\n" . $zapros . "[Uploaded Chunk Content]", 200, 15);
    }
    $body = substr($page, strpos($page, "\r\n\r\n") + 4);
    if (is_numeric($body) && $body < 0) {
        check_errors($body, 'Error while uploading chunk');
    }
    return $page;
}