//-- zig's directory structure
$GLOBALS['zig']['dir'] = array('gui', 'lib', 'sql');
//-- zig's default settings
$GLOBALS['zig']['default']['template'] = $template ? $template : "default";
// template
$GLOBALS['zig']['default']['theme'] = $theme ? $theme : "default";
// theme
$GLOBALS['zig']['default']['value'] = 1;
// 0 = no return value, 2 = return 'return value'
$GLOBALS['zig']['default']['cookie'] = time() + 1800;
// default cookie lifetime
//-- zig's current settings
$ripped_url = explode("/", $_SERVER['PHP_SELF']);
$url_size = sizeof($ripped_url);
$zig_hash = isset($_GET['zig_hash']) ? $_GET['zig_hash'] : (isset($_POST['zig_hash']) ? $_POST['zig_hash'] : NULL);
$zig_hash_result = $zig_hash ? $zig_hash_obj->hash_vars_decode($zig_hash) : $default_action;
if (is_array($zig_hash_result)) {
    $action = array_key_exists("action", $zig_hash_result) ? $zig_hash_result['action'] : NULL;
    $id = array_key_exists("id", $zig_hash_result) ? $zig_hash_result['id'] : NULL;
} else {
    $action = $default_action;
    $id = NULL;
}
$zig_action = isset($_GET['zig_action']) ? $_GET['zig_action'] : (isset($_POST['zig_action']) ? $_POST['zig_action'] : NULL);
$action = $zig_action ? $zig_hash_obj->hash_decrypt($zig_action) : $action;
$GLOBALS['zig']['current']['id'] = $id;
$GLOBALS['zig']['current']['action'] = $action;
$GLOBALS['zig']['current']['script'] = $ripped_url[$url_size - 1];
$GLOBALS['zig']['current']['module'] = isset($ripped_url[$url_size - 2]) ? $ripped_url[$url_size - 2] : NULL;
$GLOBALS['zig']['current']['directory'] = $GLOBALS['zig']['current']['module'];
$GLOBALS['zig']['current']['template'] = isset($GLOBALS['zig']['current']['template']) ? $GLOBALS['zig']['current']['template'] : $GLOBALS['zig']['default']['template'];
 function group_id()
 {
     if (isset($_SESSION['zig_hash'])) {
         require_once "../zig-api/lib/hash.lib.php";
         $zig_hash_obj = new zig_hash();
         $zig_hash = $zig_hash_obj->hash_vars_decode($_SESSION['zig_hash']);
         $zig_group = $zig_hash['username'];
         if ($zig_user) {
             $sql = "SELECT `id` FROM `zig_groups` WHERE `groupname`='{$zig_group}' LIMIT 1";
             $result = zig("query", $sql);
             $fetch = $result->fetchRow();
             $zig_return = $fetch['id'];
         }
         return $zig_return;
     }
 }