Exemplo n.º 1
0
function getContent()
{
    $index = getIndex();
    if (!$index) {
        $index = 'home';
    }
    if (!isPage($index)) {
        $index = '404';
    } else {
        if (!isAccess($index)) {
            $index = '403';
        }
    }
    $p = Pages::getPages($index)['link'];
    include "/pages/{$p}";
}
Exemplo n.º 2
0
	if ($pagename == "$thispage") echo "current ";
}

?>


<p>
<a href="?page=about" class="<? echo isPage("about") ?>menu">about</a>
<a href="?page=news" class="<? echo isPage("news") ?>menu">news</a>
<a href="?page=downloads" class="<? echo isPage("downloads") ?>menu">downloads</a>
<!-- <a href="?page=tutorials" class="<? echo isPage("tutorials") ?>menu">tutorials</a> -->
<a href="?page=reference" class="<? echo isPage("reference") ?>menu">reference</a>
<a href="?page=applications" class="<? echo isPage("applications") ?>menu">applications</a>
<a href="?page=faq" class="<? echo isPage("faq") ?>menu">faq</a>
<!-- <a href="?page=links" class="<? echo isPage("links") ?>menu">links</a> -->
<a href="?page=credits" class="<? echo isPage("credits") ?>menu">credits</a>
</p>

<div id="main">

<? 

include $thispage .".php";	
	
# the @ suppresses errors
 
include 'footer.php'; 

?>

</div>
Exemplo n.º 3
0
			<ul class="nav nav-pills">
				<?php if ($me): ?>
					<li<?=isPage(false); ?>><a href="user/<?=$_SESSION['user']['id']; ?>">Översikt</a></li>
					<li<?=isPage('settings'); ?>><a href="me/settings">Inställningar</a></li>
				<?php else: ?>
					
				<?php endif; ?>
			</ul>
			<hr />
Exemplo n.º 4
0
}
if (isset($_SESSION["rank"]) && $_SESSION["rank"] >= instancesRank) {
    echo "<li><a class='button img-button instances-button" . isPage($page, 'instances') . "' href='?page=instances'>Instances</a></li>";
}
if (isset($_SESSION["rank"]) && $_SESSION["rank"] >= sessionsRank) {
    echo "<li><a class='button img-button sessions-button" . isPage($page, 'sessions') . "' href='?page=sessions'>Sessions</a></li>";
}
if (isset($_SESSION["rank"]) && $_SESSION["rank"] >= featureaccessRank) {
    echo "<li><a class='button img-button featureaccess-button" . isPage($page, 'featureaccess') . "' href='?page=featureaccess'>Feature Access</a></li>";
}
?>
            </ul>
            <ul class="nav">
                <?php 
if (isset($_SESSION["rank"]) && $_SESSION["rank"] >= helpRank) {
    echo "<li><a class='button img-button help-button" . isPage($page, 'help') . "' href='?page=help'>Help</a></li>";
}
?>
            </ul>
            
            <ul class="nav">
<?php 
if (isset($_SESSION["rank"]) && $_SESSION["rank"] >= characterselectionRank) {
    if (!$mysql->connect_errno) {
        $sql = "SELECT `characters`.`name` as `charname`, `characters`.`objectID` FROM `characters`, `accounts` WHERE `accounts`.`id` = `characters`.`accountID` AND `accounts`.`name` = '" . $_SESSION['user_name'] . "'";
        $result = $mysql->query($sql);
        $chars = [];
        if ($result->num_rows > 0) {
            for ($i = 0; $i < $result->num_rows; $i++) {
                $resobj = $result->fetch_object();
                $chars[] = array('name' => $resobj->charname, 'id' => $resobj->objectID);
Exemplo n.º 5
0
			<?php endif; ?>
			<?php if (empty($member) && $group_info[0]['open'] == 2): ?>
				<div>Du är inte med i den här gruppen.</div>
				<span class="btn btn-success" onclick="joinGroup();">Gå med</span>
			<?php endif; ?>
			<?php if (empty($member) && $group_info[0]['open'] == 3): ?>
				<div>Medlemskap endast via rekrytering.</div>
			<?php endif; ?>
			<?php if ($group_info[0]['secret'] == 0): ?>
			<hr />
			<ul class="nav nav-pills">
				<?php if (!empty($member)): ?>
					<li<?=isPage('stories'); ?>><a href="groups/<?=$groupId; ?>/stories">Stories</a></li>
					<li<?=isPage('chat'); ?>><a href="groups/<?=$groupId; ?>/chat">Chatt</a></li>
					<li<?=isPage('news'); ?>><a href="groups/<?=$groupId; ?>/news">Händelser</a></li>
					<li<?=isPage('members'); ?>><a href="groups/<?=$groupId; ?>/members">Medlemmar</a></li>
					<?php if ($member[0]['admin'] == 1): ?>
						<li<?=isPage('invite'); ?>><a href="groups/<?=$groupId; ?>/invite">Bjud in</a></li>
					<?php endif; ?>
					<li<?=isPage('description'); ?>><a href="groups/<?=$groupId; ?>/description">Beskrivning</a></li>
					<li<?=isPage('new_story'); ?>><a href="groups/<?=$groupId; ?>/new_story">Skapa story</a></li>
				<?php else: ?>
					<li<?=isPage('stories'); ?>><a href="groups/<?=$groupId; ?>/stories">Stories</a></li>
					<li<?=isPage('chat'); ?>><a href="groups/<?=$groupId; ?>/chat">Chatt</a></li>
					<li<?=isPage('news'); ?>><a href="groups/<?=$groupId; ?>/news">Händelser</a></li>
					<li<?=isPage('members'); ?>><a href="groups/<?=$groupId; ?>/members">Medlemmar</a></li>
					<li<?=isPage('join'); ?>><a href="groups/<?=$groupId; ?>/join">Gå med</a></li>
					<li<?=isPage('description'); ?>><a href="groups/<?=$groupId; ?>/description">Beskrivning</a></li>
				<?php endif; ?>
			</ul>
			<?php endif; ?>
Exemplo n.º 6
0
function getData($code, $connection)
{
    if (!isTokenUser()) {
        $code = 4;
    }
    switch ($code) {
        //////////////////////CASE -1/////////////////////////////////////
        //Si entra aqui es porque ningun dato de S_POST coincide con una acción valida. Ya que el $dataCode por defecto es -1
        case -1:
            $response = array("error" => 1030, "description" => "Error no se ejecuto ninguna acción, verifica los parametros de entrada.");
            break;
            //////////////////////CASE 0/////////////////////////////////////
            //Obtenemos las opciones a mostrar de un pregunta y las devolvemos en un array en formato json
        //////////////////////CASE 0/////////////////////////////////////
        //Obtenemos las opciones a mostrar de un pregunta y las devolvemos en un array en formato json
        case 0:
            if ($connection) {
                $id_pregunta = $_POST["id_pregunta"];
                $dataOptions = $connection->query("SELECT * FROM " . TABLE_PREFIX . TABLE_OPCIONES . " where id_pregunta = " . $id_pregunta);
                $data;
                /*
                 * obtenemos los datos de la base de datos en un array asociativo.
                 */
                while ($fila = $dataOptions->fetch_assoc()) {
                    $data[] = $fila;
                }
                //dado que los valores de la base de datos vienen en codificacion utf-8, hay que transformar aquellas columnas con campos de texto.
                $dataResponse = codificationArray($data, "m_option");
                //para la variable m_option de la tabla n_opciones se codifica en utf-8
                $response = $dataResponse;
            } else {
                $response = array("error" => 1020, "description" => "Error conexión no establecida");
            }
            break;
            //////////////////////CASE 1/////////////////////////////////////
            //Devolvemos la pregunta dado una paginacion ( con un LIMIT en la select filtramos la paginación)			.
        //////////////////////CASE 1/////////////////////////////////////
        //Devolvemos la pregunta dado una paginacion ( con un LIMIT en la select filtramos la paginación)			.
        case 1:
            if (!isTokenTest()) {
                createTokenTest(getTokenUser());
            } else {
                if (isTokenTest() && isset($_POST["isFirstSelectedTest"]) && $_POST["isFirstSelectedTest"] == "true") {
                    //$response = array("error" => 1200, "Error token desincronizado");
                    $response = array("error" => 1200, "desError" => "Test desincronizado", "page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
                    break;
                }
            }
            //sincronizamos el avanze de paginas
            if (!isPage()) {
                createPage(intval($_POST["pagination"]));
            } else {
                if (isset($_SESSION["is_page_refresh"]) && $_SESSION["is_page_refresh"] && getPage() < intval($_POST["pagination"])) {
                    createPage(intval(getPage()) + 1);
                } else {
                    if (isset($_SESSION["is_page_refresh"]) && $_SESSION["is_page_refresh"]) {
                        createPage(intval(getPage()));
                    } else {
                        createPage(intval(getPage()) + 1);
                    }
                }
            }
            if (!isCategory()) {
                //si no esta sincroniada la categoria se sincroniza
                createCategory(intval($_POST["id"]));
            }
            if ($connection) {
                $pagination = getPage();
                //numero de pagina.
                $id = $_POST["id"];
                //id categoria: 1- ingles, 2- aleman...
                $result = $connection->query("SELECT * FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id . " LIMIT " . $pagination . ",1");
                $countLengthData = $connection->query("SELECT count(id) as count FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id);
                $data = array();
                while ($fila = $result->fetch_assoc()) {
                    $data[] = $fila;
                }
                $dataResponse = codificationArray($data, "question");
                //para la variable question de la tabla n_preguntas se codifica en utf-8
                $dataLength = $countLengthData->fetch_assoc();
                $dataResponse[1] = $dataLength;
                //numero de preguntas para la categoria actual
                if (!isCountQuestion()) {
                    createCountQuestion($dataLength);
                }
                $dataResponse[2] = getTokenTest();
                $dataResponse[3] = getTokenUser();
                $response = $dataResponse;
            } else {
                $response = array("error" => 1020, "description" => "Error conexión no establecida");
            }
            break;
            //////////////////////CASE 2/////////////////////////////////////
            // Actualizamos el progresso del cliente.
        //////////////////////CASE 2/////////////////////////////////////
        // Actualizamos el progresso del cliente.
        case 2:
            if (isPage()) {
                $canContinue = false;
                if (isset($_POST["pageUpdate"]) && $_POST["pageUpdate"]) {
                    if (intval(getPage()) == intval($_POST["pageUpdate"])) {
                        $canContinue = true;
                    } else {
                        $canContinue = false;
                    }
                } else {
                    $canContinue = true;
                }
                if ($canContinue === true) {
                    if (isset($_SESSION["u_email"])) {
                        $emailClient = $_SESSION["u_email"];
                        $id_question = $_POST["id_question"];
                        $id_option = $_POST["id_option"];
                        if ($connection) {
                            if (!isset($_SESSION["id_cliente"])) {
                                $resultQueryClientes = $connection->query("select id from " . TABLE_PREFIX . TABLE_CLIENTES . " WHERE email = '{$emailClient}'");
                                $responseQueryClientes = $resultQueryClientes->fetch_assoc();
                                $_SESSION["id_cliente"] = $responseQueryClientes["id"];
                            }
                            $query = "SELECT count(o.id) as count\n\t\t\t\t\t\t\t\t\t\t  FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " p inner join " . TABLE_PREFIX . TABLE_OPCIONES . " o\n\t\t\t\t\t\t\t\t\t\t  on o.id_pregunta = p.id\n\t\t\t\t\t\t\t\t\t\t  where {$id_option}. = (select id_opcion from " . TABLE_PREFIX . TABLE_RESPUESTA . " where id_pregunta = {$id_question})";
                            $resultCountCorrect = $connection->query($query);
                            $countCorrectOption = $resultCountCorrect->fetch_assoc();
                            $codeTemp = getTokenTest();
                            $id_client = $_SESSION["id_cliente"];
                            $id_category = getCategory();
                            $date_update = date("Y-m-d H:i:s");
                            $insert = $connection->query("INSERT INTO " . TABLE_PREFIX . TABLE_HISTORY_TEST . " (id_client,id_option,id_question,id_title,code_validation,m_date) VALUES({$id_client},{$id_option},{$id_question},{$id_category},'{$codeTemp}','{$date_update}')");
                            //obtenemos el numero de preguntas de esta categoria.
                            $countQuestionResult = $connection->query("SELECT count(id) as count FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id_category);
                            $countQuestionTemp = $countQuestionResult->fetch_assoc();
                            $countQuestion = $countQuestionTemp["count"];
                            if (intval($countCorrectOption["count"] > 0)) {
                                //si es mayor que cero significa que es la que tenemos marcada como buena en la base de datos.
                                if (!isset($_SESSION["correctCount"])) {
                                    //si el correctCount no está creado aún lo creamos con valor a 1 porque yá tenemos una respuesta correcta.
                                    $_SESSION["correctCount"] = 1;
                                } else {
                                    //si ya estaba activo, solo incrementamos su valor en 1.
                                    $_SESSION["correctCount"] = intval($_SESSION["correctCount"]) + 1;
                                }
                                $dataUpdate = array("check" => $_SESSION['correctCount']);
                            } else {
                                $dataUpdate = array("check" => -1);
                                //editamos el mensaje de respuesta.
                            }
                        } else {
                            $dataUpdate = array("error" => 1020, "description" => "Error conexión no establecida");
                        }
                    } else {
                        $dataUpdate = array("error" => 1050, "description" => "Error de session, la sessión ha expirado.");
                    }
                } else {
                    $dataUpdate = array("error" => 1200, "desError" => "Test desincronizado", "page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
                }
                $response = $dataUpdate;
                break;
            } else {
                $response = array("error" => 1050, "description" => "Error de session, la sessión ha expirado.");
                break;
            }
        case 3:
            //aqui el cliente a finalizado el test y mostramos el detalle de los resultados.
            $id_client = $_SESSION["id_cliente"];
            $date_update = date("Y-m-d H:i:s");
            $id_category = getCategory();
            $puntuacion = $_SESSION["correctCount"];
            $token_test = getTokenTest();
            $result = $connection->query("INSERT INTO " . TABLE_PREFIX . TABLE_HISTORY . " (id_client,id_title,code_validation,m_date,points) VALUES ({$id_client},{$id_category},'{$token_test}','{$date_update}',{$puntuacion})");
            if ($result) {
                $response = array("check" => "register inserted.", "data" => array("num_question" => getCountQuestion(), "correctCount" => getCorrectCount()));
            } else {
                $response = array("error" => $connection->error);
            }
            $dataEndTest = isEndTest($id_category, $token_test, $connection);
            if ($dataEndTest) {
                $_SESSION["end_test"] = true;
                sendResult($_SESSION["u_email"], "Resultado del Test en GRUPOIOE", showResume($dataEndTest, $connection));
            }
            break;
        case 4:
            //aqui no existe el token de usuario, la sesion posiblemente haya expirado.
            $response = array("error" => 1100, "description" => "Error token expirado");
            break;
        case 5:
            //aqui devolvemos si hay un test activo o no.
            $response = array("isTestActive" => isTokenTest());
            break;
        case 6:
            //aqui estamos devolviendo los datos desde la cache de la sesion.
            if (isTestFinished()) {
                $response = array("cache" => "get data from cache.", "data" => array("num_question" => getCountQuestion(), "correctCount" => getCorrectCount()));
            } else {
                $response = array("page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
            }
            break;
            //////////////////////DEFAULT/////////////////////////////////////
            //cualquier accion no contemplada entrara aqui.
        //////////////////////DEFAULT/////////////////////////////////////
        //cualquier accion no contemplada entrara aqui.
        default:
            $response = array("error" => 1040, "description" => "Error de PHP, error inesperado");
            break;
    }
    $connection->close();
    echo json_encode($response);
}
" href="?page=characters">Characters</a></li>
				<li><a class="button img-button instances-button<?php 
    echo isPage($page, 'instances');
    ?>
" href="?page=instances">Instances</a></li>
				<li><a class="button img-button sessions-button<?php 
    echo isPage($page, 'sessions');
    ?>
" href="?page=sessions">Sessions</a></li>
			</ul>
			<?php 
}
?>
<ul class="nav">
				<li><a class="button img-button help-button<?php 
echo isPage($page, 'help');
?>
" href="?page=help">Help</a></li>
			</ul>
			<ul class="nav">
<?php 
if (!$mysql->connect_errno) {
    $sql = "SELECT `characters`.`name` as `charname`, `characters`.`objectID` FROM `characters`, `accounts` WHERE `accounts`.`id` = `characters`.`accountID` AND `accounts`.`name` = '" . $_SESSION['user_name'] . "'";
    $result = $mysql->query($sql);
    $chars = [];
    if ($result->num_rows > 0) {
        for ($i = 0; $i < $result->num_rows; $i++) {
            $resobj = $result->fetch_object();
            $chars[] = array('name' => $resobj->charname, 'id' => $resobj->objectID);
            if (isset($_GET['char_id'])) {
                if ($_GET['char_id'] == $resobj->objectID) {
Exemplo n.º 8
0
<?php

session_start();
if (!(isLogin() || isPage('login'))) {
    gtRedirect('login');
}
$ref = '{imap.gmail.com:993}';
function zp_handle_comment()
{
    global $_zp_current_image, $_zp_current_album, $_zp_comment_stored, $_zp_current_zenpage_news, $_zp_current_zenpage_page;
    $activeImage = false;
    $comment_error = 0;
    $cookie = zp_getCookie('zenphoto');
    if (isset($_POST['comment'])) {
        // ZENPAGE:  if else constructs added
        if (getOption('zp_plugin_zenpage')) {
            //zenpage_news = new ZenpageNews();
            //$zenpage_pages = new ZenpagePage();
            $zenpage_news_context = isPage(ZENPAGE_NEWS);
            $zenpage_pages_context = isPage(ZENPAGE_PAGES);
        } else {
            $zenpage_news_context = FALSE;
            $zenpage_pages_context = FALSE;
        }
        if ($zenpage_news_context) {
            $redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_NEWS . '&title=' . $_zp_current_zenpage_news->getTitlelink();
        } else {
            if ($zenpage_pages_context) {
                $redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_NEWS . '&title=' . $_zp_current_zenpage_page->getTitlelink();
            } else {
                $redirectTo = FULLWEBPATH . '/' . zpurl();
            }
        }
        if (in_context(ZP_ALBUM) || $zenpage_news_context || $zenpage_pages_context) {
            $p_name = sanitize($_POST['name'], 3);
            if (isset($_POST['email'])) {
                $p_email = sanitize($_POST['email'], 3);
            } else {
                $p_email = "";
            }
            if (isset($_POST['website'])) {
                $p_website = sanitize($_POST['website'], 3);
            } else {
                $p_website = "";
            }
            $p_comment = sanitize($_POST['comment'], 1);
            $p_server = sanitize($_SERVER['REMOTE_ADDR'], 3);
            if (isset($_POST['code'])) {
                $code1 = sanitize($_POST['code'], 3);
                $code2 = sanitize($_POST['code_h'], 3);
            } else {
                $code1 = '';
                $code2 = '';
            }
            $p_private = isset($_POST['private']);
            $p_anon = isset($_POST['anon']);
            if (isset($_POST['imageid'])) {
                //used (only?) by the tricasa hack to know which image the client is working with.
                $activeImage = zp_load_image_from_id(strip_tags($_POST['imageid']));
                if ($activeImage !== false) {
                    $commentadded = $activeImage->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon);
                    $redirectTo = $activeImage->getImageLink();
                }
            } else {
                // ZENPAGE: if else change
                if (in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) {
                    $commentobject = $_zp_current_image;
                    $redirectTo = $_zp_current_image->getImageLink();
                } else {
                    if (!in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) {
                        $commentobject = $_zp_current_album;
                        $redirectTo = $_zp_current_album->getAlbumLink();
                    } else {
                        if ($zenpage_news_context) {
                            $commentobject = $_zp_current_zenpage_news;
                            $redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_NEWS . '&title=' . $_zp_current_zenpage_news->getTitlelink();
                        } else {
                            if ($zenpage_pages_context) {
                                $commentobject = $_zp_current_zenpage_page;
                                $redirectTo = FULLWEBPATH . '/index.php?p=' . ZENPAGE_NEWS . '&title=' . $_zp_current_zenpage_page->getTitlelink();
                            }
                        }
                    }
                }
                $commentadded = $commentobject->addComment($p_name, $p_email, $p_website, $p_comment, $code1, $code2, $p_server, $p_private, $p_anon);
            }
            if ($commentadded == 2) {
                $comment_error = 0;
                if (isset($_POST['remember'])) {
                    // Should always re-cookie to update info in case it's changed...
                    $info = array($p_name, $p_email, $p_website, '', false, $p_private, $p_anon);
                    zp_setcookie('zenphoto', implode('|~*~|', $info), time() + COOKIE_PESISTENCE, '/');
                } else {
                    zp_setcookie('zenphoto', '', time() - 368000, '/');
                }
                //use $redirectTo to send users back to where they came from instead of booting them back to the gallery index. (default behaviour)
                //TODO: this does not work for IIS. How to detect IIS server and just fall through?
                // if you are running IIS, delete the next two lines
                header('Location: ' . $redirectTo);
                exit;
            } else {
                $_zp_comment_stored = array($p_name, $p_email, $p_website, $p_comment, false, $p_private, $p_anon);
                if (isset($_POST['remember'])) {
                    $_zp_comment_stored[4] = true;
                }
                $comment_error = 1 + $commentadded;
                // ZENPAGE: if statements added
                if ($activeImage !== false and !$zenpage_news_context and !$zenpage_pages_context) {
                    // tricasa hack? Set the context to the image on which the comment was posted
                    $_zp_current_image = $activeImage;
                    $_zp_current_album = $activeImage->getAlbum();
                    set_context(ZP_IMAGE | ZP_ALBUM | ZP_INDEX);
                }
            }
        }
    } else {
        if (!empty($cookie)) {
            // Comment form was not submitted; get the saved info from the cookie.
            $_zp_comment_stored = explode('|~*~|', stripslashes($cookie));
            $_zp_comment_stored[4] = true;
            if (!isset($_zp_comment_stored[5])) {
                $_zp_comment_stored[5] = false;
            }
            if (!isset($_zp_comment_stored[6])) {
                $_zp_comment_stored[6] = false;
            }
        } else {
            $_zp_comment_stored = array('', '', '', '', false, false, false);
        }
    }
    return $comment_error;
}