<?php require_once('includes/requirecompere.inc.php'); $op=TGET('op'); $filter=TGET('filter'); $trying=TGET('trying'); $mb_id=current_mb_id(); if (!$trying && preg_match('/thm-([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9])\//',$_SERVER['REQUEST_URI'])) { redirect(preg_replace('/thm-([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9])\//','',$_SERVER['REQUEST_URI'],1)); return; } $themelist=array(); if (!$filter || $filter=='system') { $files=glob($Config->Paths['theme.system'].'/*-*'); foreach ($files as $file) { if (is_dir($file)) array_push($themelist, array( 'name'=>basename($file), 'nickname'=>basename($file) ) ); } $dataset['SYSTEM']=array(0); } else if ($filter=='shared') { $files=glob($Config->Paths['theme.system'].'/*'); list($offset,$pagesize,$pageno)=decide_page_range(TGET('p'),TGET('ps')); $themesloaded=load_theme_info($offset,$pagesize+1,true); $dataset+=prepare_paging_dataset($pageno,$pagesize,$themesloaded); foreach ($themesloaded as &$tl) { array_push($themelist, array( 'name'=>$tl[0], 'nickname'=>$tl[1], ) ); } $dataset['SHARED']=array(0); } else { redirect("qx-cmd-theme.manage.html"); return; } $dataset['THEMELIST']=$themelist; $nothemeurl=preg_replace('/thm-([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9])\//','',$_SERVER['REQUEST_URI'],1); $nothemeurl=str_replace('?trying=1','',$nothemeurl); $dataset['nothemeurl']=$nothemeurl; $nothemeurl_prefix=dirname_ending_with_slash($nothemeurl); $nothemeurl_suffix=basename($nothemeurl); $currenttheme=retrieve_user_theme_setting($mb_id); $themereq=TGET('THEME'); foreach ($dataset['THEMELIST'] as &$theme) { $theme['themed-url']=$nothemeurl_prefix.'thm-'.$theme['name'].'/'.$nothemeurl_suffix.'?trying=1'; if ($theme['name']==$currenttheme['name']) $theme['IS-CURRENT']=array(0); else $theme['NOT-CURRENT']=array(0); if ($trying && $theme['name']==$themereq) $theme['TRYING']=array(0); else $theme['NOT-TRYING']=array(0); } $dataset['TRYING']=$trying?array(0):array(); $dataset['UPLOADED']=$op=='uploaded'?array(0):array(); ?>