private final function setContent($temp)
 {
     $content = "";
     $oVar = new stdClass();
     try {
         $name = "tpl_" . $temp['name'];
         if (requireFile('pages/tpl/php/' . $name . '.php')) {
             $oTemp = new $name();
         } else {
             throw new cException("Php template file " . $name . " not found!");
         }
         /// set content ///
         $content = "";
         $fileTpl = ROOT_PATH . "pages/tpl/" . $temp['name'] . ".tpl.php";
         if (@is_file($fileTpl) && filesize($fileTpl) > 0) {
             $handle = fopen($fileTpl, "r");
             $content = fread($handle, filesize($fileTpl));
             fclose($handle);
         }
         /// set vars ///
         $oVar = new stdClass();
         foreach ($oTemp->getFinalVars() as $name => $var) {
             eval("\$oVar->{$name} = \$var;");
         }
         //$this->logs->addLog($temp,"temp");
     } catch (cException $e) {
         $this->logs->addLog($e->getMessage());
     }
     $this->aContent[$temp['name']] = array("oVars" => $oVar, "content" => $content);
 }
 /**
  * 获取页面
  */
 public function fetch($path = '')
 {
     if (empty($path)) {
         $path = $this->_rootPath . '/' . strtolower(__MODULE__) . '/' . strtolower(__CONTROL__) . '/' . strtolower(__ACTION__) . config('TMPL_TEMPLATE_SUFFIX');
     } else {
         $path = $this->_rootPath . '/' . $path . config('TMPL_TEMPLATE_SUFFIX');
     }
     requireFile($path);
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
 /**
  * 通过模块获取菜单
  * @param $module
  */
 public function getMenus($module)
 {
     $module = strtolower($module);
     if (isset($this->_menus[$module])) {
         return $this->_menus[$module];
     }
     $path = APP_CLASS_PATH . "/control/{$module}/menu.conf.php";
     if (!file_exists($path)) {
         return array();
     }
     return requireFile($path);
 }
 public function buildPage()
 {
     try {
         if (requireFile('pages/actions/' . $this->aPageTree[0]['name'] . '.php')) {
             $this->oPage = new $this->aPageTree[0]['name']();
         } else {
             throw new cException("Action " . $this->aPageTree[0]['name'] . " not found!");
         }
     } catch (cException $e) {
         $this->logs->addLog($e->getMessage());
     }
     self::$aActPage = $this->oPage->getData();
     self::$sTitle .= " - " . $this->oPage->aPageData['title'];
     $this->oPage->end();
     self::buildHead();
     self::buildBody();
 }
Example #5
0
 /**
  * Try load class
  * @param sting $type Full classname
  */
 protected function tryLoad($type)
 {
     /* Robot load */
     if (($path = $this->findClass($type)) !== false) {
         requireFile($path);
         if ($this->cache) {
             $this->cache->cache($this->classes);
         }
     }
 }
function loadExtnedsFun()
{
    requireFile(CORE_PATH . '/common/extends.fun.php');
}
Example #7
0
<?php

require_once "function.php";
if (isset($_POST) && !empty($_POST)) {
    if (requireFile("config.php")) {
        foreach ($_POST as $key => $value) {
            ${$key} = $value;
        }
        $sql = "SELECT * FROM users WHERE email = '{$email}' AND password = MD5('{$password}') LIMIT 1";
        $query = mysql_query($sql) or die(mysql_error());
        $row = mysql_fetch_assoc($query);
        if (!empty($row)) {
            singin($email, $password);
        } else {
            echo "<script>alert('Erro no Login.')</script>";
            echo "<script>window.location='index.html'</script>";
        }
    }
} else {
    header("location:index.html");
}
 /**
  * 获取角色act列表
  * @param request key
  * @param request module
  */
 public function getRoleAct()
 {
     $role = $this->getR('key');
     $module = $this->getR('module');
     if (empty($role)) {
         return array('status' => -1, 'info' => '角色名不能为空', 'data' => null, 'url' => 1);
     }
     if (empty($module)) {
         return array('status' => -1, 'info' => '模块名不能为空', 'data' => null, 'url' => 1);
     }
     $act = params("act/{$module}");
     $menuPath = APP_CLASS_PATH . "/control/{$module}/menu.conf.php";
     $menu = requireFile($menuPath);
     $rbacEveryOne = config('RBAC_EVERYONE');
     //所有用户
     $rbacOnly = config('RBAC_ONLY');
     //登陆用户
     foreach ($menu as $key => &$val) {
         if ($val['child']) {
             foreach ($val['child'] as $childKey => &$childVal) {
                 if (empty($act[$childKey])) {
                     //如果为空,就没有权限
                     $childVal['checked'] = false;
                     continue;
                 }
                 if ($act[$childKey] == $rbacEveryOne || $act[$childKey] == $rbacOnly) {
                     $childVal['checked'] = true;
                     continue;
                 }
                 $act[$childKey] = explode(',', $act[$childKey]);
                 if (in_array($role, $act[$childKey])) {
                     $childVal['checked'] = true;
                 } else {
                     $childVal['checked'] = false;
                 }
             }
         }
         if (empty($act[$key])) {
             //如果为空,就没有权限
             $val['checked'] = false;
             continue;
         }
         if ($act[$key] == $rbacEveryOne || $act[$key] == $rbacOnly) {
             $val['checked'] = true;
             continue;
         }
         $act[$key] = explode(',', $act[$key]);
         if (in_array($role, $act[$key])) {
             $val['checked'] = true;
         } else {
             $val['checked'] = false;
         }
     }
     return $menu;
 }
Example #9
0
_showActions('addrole', 'Add new role');
_showActions('adduser', 'Add new user');
_showActions('addcapability', 'Add new capability');
_showActions('updatelng', 'Update languages');
print "</ul>";
foreach ($_aErrors as $error) {
    print "<div class='error'>{$error}</div>";
}
foreach ($_aAlerts as $alert) {
    print "<div class='alert'>{$alert}</div>";
}
if (isset($_GET['action'])) {
    print "<ul class='sub_links other'>";
    print "<li><a href='" . getUrl() . "admin' title='Back'>Back to admin homepage</a></li>";
    print "</ul>";
    requireFile("admin/" . trim($_GET['action']) . ".php");
} else {
    ?>
		<div id="show_pagetree" class="switcher">pages</div>
		<div id="show_temptree" class="switcher">templates</div>
		<div id="show_roletree" class="switcher">roles</div>
		<div id="show_usertree" class="switcher">users</div>
		<div id="show_capatree" class="switcher">capabilities</div>
		<div class="clear"></div>
	<?php 
    print "<div id='page_tree'>";
    _showPageTree();
    print "</div>";
    print "<div id='template_tree'>";
    _showTemplateTree();
    print "</div>";
Example #10
0
    }
}
if (isset($_SESSION['authenticated']) and $_SESSION['authenticated'] == true) {
    $PAGE = requireFile('./honeycombs/home.php');
} else {
    $PAGE = requireFile('./honeycombs/login.php', array('MESSAGE' => $MESSAGE));
}
if (isset($_GET['p']) and $_GET['p'] == 'create-account') {
    $MESSAGE = "Join our Bee club and have some honey!";
    $PAGE = requireFile('./honeycombs/register.php', array('MESSAGE' => $MESSAGE));
} elseif (isset($_GET['p']) and $_GET['p'] == 'login') {
    $MESSAGE = "Please log in.";
    $PAGE = requireFile('./honeycombs/login.php', array('MESSAGE' => $MESSAGE));
} elseif (isset($_POST['logout'])) {
    $MESSAGE = "See you soon!";
    $PAGE = requireFile('./honeycombs/login.php', array('MESSAGE' => $MESSAGE));
}
?>


<html>
<head>
	<link rel="stylesheet" type="text/css" href="./css/furtive.css">
	 <meta name="viewport" content="width=device-width, initial-scale=1">
	<style type="text/css">

		.wrap {
			box-sizing: border-box;
			padding: 20px;
			min-width: 320px;
			max-width: 960px;