예제 #1
0
 /**
  * Make shortcuts for kxEnv and kxDB
  *
  * @access	public
  * @param	object	kxEnv reference
  * @return	void
  */
 public function makeRegistryShortcuts(kxEnv $environment)
 {
     $this->environment = $environment;
     $this->db = kxDB::getinstance();
     $this->request = kxEnv::$request;
 }
예제 #2
0
 private static function _buildMenu()
 {
     $app = KX_CURRENT_APP;
     if (KX_CURRENT_APP == 'core' && !isset(kxEnv::$request['module']) && !isset(kxEnv::$request['app'])) {
         $modules = array(array('module_file' => 'index'));
     } else {
         $modules = kxDB::getinstance()->select("modules", "", array('fetch' => PDO::FETCH_ASSOC))->fields("modules", array("module_name", "module_file"))->condition("module_application", $app)->condition("module_manage", 1)->orderBy("module_position")->execute()->fetchAll();
     }
     //print_r($modules);
     foreach ($modules as $module) {
         $_file = kxFunc::getAppDir($app) . "/modules/manage/" . $module['module_file'] . '/menu.yml';
         //echo "<p>Getting menu from {$_file}</p>";
         if (file_exists($_file)) {
             if (function_exists("syck_load")) {
                 $menu[$module['module_file']] = syck_load(file_get_contents($_file));
             } else {
                 $menu[$module['module_file']] = spyc_load_file($_file);
             }
             self::assign('menu', $menu);
             self::assign('module', $module['module_file']);
         }
     }
 }
예제 #3
0
 public static function BanUser($ip, $modname, $globalban, $duration, $boards, $reason, $staffnote, $appealat = 0, $type = 0, $allowread = 1, $proxyban = false)
 {
     if ($duration > 0) {
         $ban_globalban = '0';
     } else {
         $ban_globalban = '1';
     }
     if ($duration > 0) {
         $ban_until = time() + $duration;
     } else {
         $ban_until = '0';
     }
     kxDB::getinstance()->exec("INSERT INTO `" . kxEnv::Get('kx:db:prefix') . "banlist` ( `ip` , `ipmd5` , `type` , `allowread` , `globalban` , `boards` , `by` , `at` , `until` , `reason`, `staffnote`, `appealat` ) VALUES ( " . $kx_db->qstr(md5_encrypt($ip, kxEnv::Get('kx:misc:randomseed'))) . " , " . $kx_db->qstr(md5($ip)) . " , " . intval($type) . " , " . intval($allowread) . " , " . intval($globalban) . " , " . $kx_db->qstr($boards) . " , " . $kx_db->qstr($modname) . " , " . time() . " , " . intval($ban_until) . " , " . $kx_db->qstr($reason) . " , " . $kx_db->qstr($staffnote) . ", " . intval($appealat) . " ) ");
     if (!$proxyban && $type == 1) {
         $this->UpdateHtaccess();
     }
     return true;
 }