コード例 #1
0
ファイル: webpage.php プロジェクト: henkmahendra/emms-devel
 function WEBPAGE()
 {
     require_once 'DB.php';
     require_once 'class/TTFButton.php';
     self::$dbh = DB::connect(self::$auth_options['dsn']);
     self::$dbh->setFetchMode(DB_FETCHMODE_ASSOC);
     //  self::$lang = self::_DEFAULT_LANG;
     //  if ($lang = $_POST['lang']) self::$lang = $lang;
     //  if ($lang = $_GET['lang'])  self::$lang = $lang;
     self::$lang = isset($_POST['lang']) ? $_POST['lang'] : self::_DEFAULT_LANG;
     self::$lang = isset($_GET['lang']) ? $_GET['lang'] : self::$lang;
     //  self::$scr_name = self::_DEFAULT_FRONTPAGE;
     //  if ($scr_name = $_POST['scr_name']) self::$scr_name = $scr_name;
     //  if ($scr_name = $_GET['scr_name'])  self::$scr_name = $scr_name;
     self::$scr_name = isset($_POST['scr_name']) ? $_POST['scr_name'] : self::_DEFAULT_FRONTPAGE;
     self::$scr_name = isset($_GET['scr_name']) ? $_GET['scr_name'] : self::$scr_name;
     //  if (!(self::$referrer = $_REQUEST['ref']))	self::$referrer = $_CONF[ref][self::$scr_name];
     self::$referrer = isset($_REQUEST['ref']) ? $_REQUEST['ref'] : '';
     if (isset($_POST['screenWidth'])) {
         self::$screenWidth = 0.95 * $_POST['screenWidth'];
     }
     self::$theme = self::_DEFAULT_THEME;
     self::$themePath = sprintf("%s%s/", self::_THEMES_PATH, self::$theme);
     self::$btn = new TTFButton(self::$theme);
     self::checkcachefiles();
     //  self::$runMode = array_pop(WEBPAGE::$dbh->getAssoc(sprintf("select id,mode from tblDataLog where date = '%s' order by id",date('Y-m-d'))));
     $data = current(self::$dbh->getAssoc("select id,mode,date from tblDataLog order by id desc limit 1"));
     self::$runDate = $data['date'];
     self::$runMode = $data['mode'];
     if (self::$runDate != date('Y-m-d')) {
         if (self::$runMode != self::_RUN_MODE_NORMAL) {
             self::$runMode = self::_RUN_MODE_CRASHED;
         }
         if (self::$runMode != self::_RUN_MODE_CRASHED) {
             self::$runMode = self::_RUN_MODE_OUTDATED;
         }
     }
     self::$url = current(WEBPAGE::$dbh->getAssoc(sprintf("select var,%s from tblConfiguration where var='url'", self::$lang)));
 }