function logged()
 {
     global $config, $db, $phpdoc, $gpc;
     // Alte Sessions (nach bestimmter Zeit, die geprüft wird) löschen
     if ($this->SessionDel() == true) {
         $sessionsave = $config['sessionsave'] * 60;
         $old = time() - $sessionsave;
         $db->query("DELETE FROM {$db->pre}session WHERE active <= '" . $old . "'", __LINE__, __FILE__);
     }
     $sessionid = $gpc->get('s', str);
     if (empty($sessionid) || strlen($sessionid) != $config['sid_length']) {
         $sessionid = FALSE;
         $this->querysid = FALSE;
     }
     $vdata = $gpc->save_str(getcookie('vdata'));
     $vlastvisit = $gpc->save_int(getcookie('vlastvisit'));
     $vhash = $gpc->save_str(getcookie('vhash'));
     // Read additional data
     if (!empty($vdata)) {
         $this->cookies = TRUE;
         $this->cookiedata = explode("|", $vdata);
     } else {
         $this->cookiedata = array(0, '');
     }
     if (!empty($vlastvisit)) {
         $this->cookies = TRUE;
         $this->cookielastvisit = $vlastvisit;
     } else {
         $this->cookielastvisit = 0;
     }
     if (isset($vhash)) {
         $this->cookies = TRUE;
         if (strlen($vhash) != $config['sid_length']) {
             $this->sid = '';
         } else {
             $this->sid = $vhash;
         }
     } elseif ($sessionid) {
         $this->sid = $sessionid;
     } else {
         $this->sid = '';
     }
     if (empty($this->sid)) {
         $result = $db->query('SELECT sid FROM ' . $db->pre . 'session WHERE ip = "' . $this->ip . '" AND mid = "0" LIMIT 1', __LINE__, __FILE__);
         if ($db->num_rows() == 1) {
             $sidrow = $db->fetch_assoc($result);
             $this->sid = $sidrow['sid'];
             $this->querysid = TRUE;
         }
     }
     // Checke nun die Session
     if (empty($this->sid)) {
         if (SCRIPTNAME != 'external') {
             $my = $this->sid_new();
         } else {
             $my->vlogin = FALSE;
         }
     } else {
         $my = $this->sid_load();
     }
     $expire = $config['sessionsave'] + 1 * 60;
     makecookie($config['cookie_prefix'] . '_vhash', $this->sid, $expire);
     if ($gpc->get('action') == "markasread" || !isset($my->mark)) {
         $my->mark = array();
     } else {
         $my->mark = unserialize(html_entity_decode($my->mark, ENT_QUOTES));
     }
     if (!is_array($my->mark)) {
         $my->mark = array();
     }
     if ($my->vlogin) {
         makecookie($config['cookie_prefix'] . '_vdata', $my->id . "|" . $my->pw);
     } else {
         $my->id = 0;
     }
     if (!isset($my->pwfaccess)) {
         $my->pwfaccess = array();
     } else {
         $my->pwfaccess = unserialize(html_entity_decode($my->pwfaccess, ENT_QUOTES));
     }
     if (!is_array($my->pwfaccess)) {
         $my->pwfaccess = array();
     }
     if (!isset($my->settings)) {
         $my->settings = array();
     } else {
         $my->settings = unserialize(html_entity_decode($my->settings, ENT_QUOTES));
     }
     if (!is_array($my->settings)) {
         $my->settings = array();
     }
     if (!isset($my->timezone) || $my->timezone == NULL) {
         $my->timezone = $config['timezone'];
     }
     $my->timezonestr = '';
     if ($my->timezone != 0) {
         if ($my->timezone[0] != '+' && $my->timezone > 0) {
             $my->timezonestr = '+' . $my->timezone;
         } else {
             $my->timezonestr = $my->timezone;
         }
     }
     $cache = cache_loaddesign();
     $q_tpl = $gpc->get('design', int);
     if (isset($my->template) == false || isset($cache[$my->template]) == false) {
         $my->template = $config['templatedir'];
     }
     if (isset($my->settings['q_tpl']) && isset($cache[$my->settings['q_tpl']])) {
         $my->template = $my->settings['q_tpl'];
     }
     if (isset($cache[$q_tpl])) {
         //if ($gpc->get('admin', int) != 1) {
         $my->settings['q_tpl'] = $q_tpl;
         //}
         $my->template = $q_tpl;
     }
     $my->templateid = $cache[$my->template]['template'];
     $my->imagesid = $cache[$my->template]['images'];
     $my->cssid = $cache[$my->template]['stylesheet'];
     $my->smileyfolder = $cache[$my->template]['smileyfolder'];
     $cache2 = cache_loadlanguage();
     $q_lng = $gpc->get('lang', int);
     if (isset($my->language) == false || isset($cache2[$my->language]) == false) {
         $my->language = $config['langdir'];
     }
     if (isset($my->settings['q_lng']) && isset($cache2[$my->settings['q_lng']]) != false) {
         $my->language = $my->settings['q_lng'];
     }
     if (isset($cache2[$q_lng]) != false) {
         $my->settings['q_lng'] = $q_lng;
         $my->language = $q_lng;
     }
     if (isset($my->lastvisit) && !$my->clv) {
         $my->clv = $my->lastvisit;
     }
     if (!isset($my->opt_hidebad)) {
         $my->opt_hidebad = 0;
     }
     if (!isset($my->opt_showsig)) {
         $my->opt_showsig = 1;
     }
     if ($this->bi[1] == 'e') {
         $slog = new slog();
         $my = $slog->logged();
         global $lang;
         $lang->init($my->language);
         $tpl = new tpl();
         ob_start();
         include 'data/banned.php';
         $banned = ob_get_contents();
         ob_end_clean();
         echo $tpl->parse("banned");
         $phpdoc->Out();
         $db->close();
         exit;
     }
     $this->sid2url();
     return $my;
 }
Example #2
0
	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 this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
error_reporting(E_ALL);
DEFINE('SCRIPTNAME', 'images');
define('VISCACHA_CORE', '1');
include "data/config.inc.php";
include "classes/function.viscacha_frontend.php";
$zeitmessung1 = t1();
$slog = new slog();
$my = $slog->logged();
$my->p = $slog->Permissions();
$lang->init($my->language);
function ImageHexColorAllocate(&$image, $string)
{
    sscanf($string, "%2x%2x%2x", $red, $green, $blue);
    return ImageColorAllocate($image, $red, $green, $blue);
}
($code = $plugins->load('images_start')) ? eval($code) : null;
if ($_GET['action'] == 'vote') {
    $result = $db->query('
	SELECT id, topic, posts, sticky, status, last, board, vquestion, prefix
	FROM ' . $db->pre . 'topics
	WHERE id = ' . $_GET['id'] . '
	LIMIT 1
	', __LINE__, __FILE__);
 /**
  * Bans a user. 
  * 
  * After calling the function exit() is called and script ends. 
  * Connection to database is closed. Template 'banned' will be shown.
  * Error Message is loaded from 'data/banned.php'-file.
  */
 function banish()
 {
     global $config, $db, $phpdoc, $gpc, $lang, $plugins;
     $slog = new slog();
     $my = $slog->logged();
     $lang->init($my->language);
     $tpl = new tpl();
     ob_start();
     include 'data/banned.php';
     $banned = ob_get_contents();
     ob_end_clean();
     ($code = $plugins->load('permissions_banish')) ? eval($code) : null;
     echo $tpl->parse("banned");
     $phpdoc->Out();
     $db->close();
     exit;
 }