Location: PHPKode > projects > Knowledge Box > knowledgebox/require/sessions.php
<?php

  /*
   * Free IT Foundation
   * Free Technology Serving Knowledge
   * http://www.free-it-foundation.org
   * 
   * This file is part of Knowledge Box.
   * 
   * Knowledge Box is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   * 
   * Knowledge Box is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   * 
   * You should have received a copy of the GNU General Public License
   * along with Knowledge Box.  If not, see <http://www.gnu.org/licenses/>.
   */


  // session
  session_start ();

  // base id
  if (isset ($_GET ['kbid']))
    $_SESSION [KB_SESSION_BASE] = (int) $_GET ['kbid'];
  if (!isset ($_SESSION [KB_SESSION_BASE]))
    $_SESSION [KB_SESSION_BASE] = KB_BASE_UNDEFINED;
  define ('KB_BASE', (int) $_SESSION [KB_SESSION_BASE]);

  // tab id
  if (isset ($_GET ['tab']))
    $_SESSION [KB_SESSION_TAB] = (int) $_GET ['tab'];
  if (!isset ($_SESSION [KB_SESSION_TAB]))
    $_SESSION [KB_SESSION_TAB] = KB_TAB_SEARCH;
  define ('KB_TAB', (int) $_SESSION [KB_SESSION_TAB]);

  // pane
  if (isset ($_GET ['pane']))
    $_SESSION [KB_SESSION_PANE] = $_GET ['pane'];
  else
    $_SESSION [KB_SESSION_PANE] = KB_PANE_UNDEFINED;
  define ('KB_PANE', $_SESSION [KB_SESSION_PANE]);
  
  // group id
  if (isset ($_GET ['group_id']))
    $_SESSION [KB_SESSION_GROUP] = (int) $_GET ['group_id'];
  if (!isset ($_SESSION [KB_SESSION_GROUP]))
    $_SESSION [KB_SESSION_GROUP] = 0;
  define ('KB_GROUP', (int) $_SESSION [KB_SESSION_GROUP]);

  // label id
  if (isset ($_GET ['label_id']))
    $_SESSION [KB_SESSION_LABEL] = (int) $_GET ['label_id'];
  if (!isset ($_SESSION [KB_SESSION_LABEL]))
    $_SESSION [KB_SESSION_LABEL] = 0;
  define ('KB_LABEL', (int) $_SESSION [KB_SESSION_LABEL]);

  // is in search
  if (!isset ($_SESSION [KB_SESSION_EXECUTE]))
    $_SESSION [KB_SESSION_EXECUTE] = false;
  define ('KB_EXECUTE_SEARCH', (boolean) $_SESSION [KB_SESSION_EXECUTE]);
  
  // search keywords
  if (!isset ($_SESSION [KB_SEARCH_KEYWORDS]))
    $_SESSION [KB_SEARCH_KEYWORDS] = array ();

  // search text
  if (!isset ($_SESSION [KB_SEARCH_TEXT]))
    $_SESSION [KB_SEARCH_TEXT] = '';

  // search field
  if (!isset ($_SESSION [KB_SEARCH_FIELD]))
    $_SESSION [KB_SEARCH_FIELD] = '';

  // search sort field & direction
  if (!isset ($_SESSION [KB_SEARCH_SORT_FIELD]))
    $_SESSION [KB_SEARCH_SORT_FIELD] = '';
  if (isset ($_GET ['sort']))
    $_SESSION [KB_SEARCH_SORT_FIELD] = (int) $_GET ['sort'];
  if (!isset ($_SESSION [KB_SEARCH_SORT_DIR]))
    $_SESSION [KB_SEARCH_SORT_DIR] = '';
  if (isset ($_GET ['dir']))
    $_SESSION [KB_SEARCH_SORT_DIR] = $_GET ['dir'];

  // search index
  if (!isset ($_SESSION [KB_SEARCH_INDEX]))
    $_SESSION [KB_SEARCH_INDEX] = 0;
  if (isset ($_GET ['inx']))
    $_SESSION [KB_SEARCH_INDEX] = (int) $_GET ['inx'];

?>
Return current item: Knowledge Box