Example #1
0
    /*other*/
    public function messageChange($message, $change = '')
    {
        $str = '<span class="adNotes">' . $message . '</span>';
        if ($change == 1) {
            $str = '<a href="javascript:;" class="adBtnSmall bgColorBlue1 adChange">Thay đổi</a>' . $str;
        }
        return $str;
    }
    public function viewDateTime($time)
    {
        return date('Y-m-d H:i', $time);
    }
}
include_once 'config/configAdmin.php';
$c = new pageAdmin();
$lang = $c->language();
$navigator = $c->_model->_navigator($arrUrl['link']);
$_SESSION['currentPageAdmin'] = $navigator['id'];
$table = $navigator['_table'];
$error = '';
if (isset($_POST['btnLogin']) && !isset($_SESSION['adminID'])) {
    $cUser = new controlUsers();
    $user = trim($_POST['username']);
    $pass = $_POST['password'];
    $error = $cUser->login($user, $pass);
    if ($error == 1) {
        $_SESSION['adminRole'] = $cUser->_model->_listRole($_SESSION['adminID']);
    }
}
if (isset($_SESSION['adminID'])) {
 function fetch($page = 'home', $option = '', $arg3 = '')
 {
     //$before = memory_get_usage();
     // to do - most all be pared down with a function that requires file, instantiates and fetches
     switch ($page) {
         default:
             require_once PATH_FACEBOOK . '/pages/pageHome.class.php';
             $homeObj = new pageHome($this);
             $code = $homeObj->fetch();
             break;
         case 'read':
             require_once PATH_FACEBOOK . '/pages/pageRead.class.php';
             $readObj = new pageRead($this);
             $code = $readObj->fetch($option, $arg3);
             break;
         case 'stories':
             require_once PATH_FACEBOOK . '/pages/pageStories.class.php';
             $storiesObj = new pageStories($this);
             $code = $storiesObj->fetch($option, $arg3);
             break;
         case 'team':
         case 'rewards':
         case 'challenges':
         case 'challengeSubmit':
         case 'redeem':
         case 'rules':
         case 'winners':
         case 'leaders':
         case 'wall':
             $code = $this->fetchTeam('fullPage', $page, $option);
             break;
         case 'static':
             require_once PATH_FACEBOOK . '/pages/pageStatic.class.php';
             $staticObj = new pageStatic($this);
             $code = $staticObj->fetch($option);
             break;
         case 'invite':
             // check auth for signed in, if not redirect to login
             require_once PATH_FACEBOOK . '/pages/pageInvite.class.php';
             $inviteObj = new pageInvite($this);
             $code = $inviteObj->fetch();
             break;
         case 'stuff':
             require_once PATH_FACEBOOK . '/pages/pageStuff.class.php';
             $stuffObj = new pageStuff($this);
             $code = $stuffObj->fetch($option);
             break;
         case 'cards':
             require_once PATH_FACEBOOK . '/pages/pageCards.class.php';
             $cardsObj = new pageCards($this);
             $code = $cardsObj->fetch($option);
             break;
         case 'media':
             require_once PATH_FACEBOOK . '/pages/pageMedia.class.php';
             $mediaObj = new pageMedia($this);
             $code = $mediaObj->fetch($option);
             break;
         case 'ask':
             require_once PATH_FACEBOOK . '/pages/pageAsk.class.php';
             $aObj = new pageAsk($this);
             $code = $aObj->fetch($option);
             break;
         case 'ideas':
             require_once PATH_FACEBOOK . '/pages/pageIdeas.class.php';
             $iObj = new pageIdeas($this);
             $code = $iObj->fetch($option);
             break;
         case 'micro':
             require_once PATH_FACEBOOK . '/pages/pageMicro.class.php';
             $pObj = new pageMicro($this);
             $code = $pObj->fetch($option, $arg3);
             break;
         case 'predict':
             require_once PATH_FACEBOOK . '/pages/pagePredict.class.php';
             $pObj = new pagePredict($this);
             $code = $pObj->fetch($option, $arg3);
             break;
         case 'signup':
             // check auth for not anonymous
             require_once PATH_FACEBOOK . '/pages/pageSignup.class.php';
             $signupObj = new pageSignup($this);
             $code = $signupObj->fetch($option);
             break;
         case 'account':
             require_once PATH_FACEBOOK . '/pages/pageAccount.class.php';
             $accountObj = new pageAccount($this);
             $code = $accountObj->fetch($option);
             break;
         case 'profile':
             require_once PATH_FACEBOOK . '/pages/pageProfile.class.php';
             $proObj = new pageProfile($this);
             $code = $proObj->fetch();
             break;
         case 'links':
             // check auth for not anonymous
             require_once PATH_FACEBOOK . '/pages/pageLinks.class.php';
             $linksObj = new pageLinks($this);
             $code = $linksObj->fetch();
             break;
         case 'postStory':
             // check auth for not anonymous
             require_once PATH_FACEBOOK . '/pages/pagePostStory.class.php';
             $psObj = new pagePostStory($this);
             $code = $psObj->fetch($option);
             break;
         case 'orders':
             // check auth for member
             require_once PATH_FACEBOOK . '/pages/pageOrders.class.php';
             $ordersObj = new pageOrders($this);
             $code = $ordersObj->fetch();
             break;
         case 'completed':
             // check auth for member
             require_once PATH_FACEBOOK . '/pages/pageCompletedChallenges.class.php';
             $completedObj = new pageCompletedChallenges($this);
             $code = $completedObj->fetch();
             break;
         case 'shareStory':
             require_once PATH_FACEBOOK . '/pages/pageShareStory.class.php';
             $shareObj = new pageShareStory($this);
             // always a submit
             $code = $shareObj->process();
             break;
         case 'contact':
             require_once PATH_FACEBOOK . '/pages/pageContact.class.php';
             $contactObj = new pageContact($this);
             if ($option == 'submit') {
                 $code = $contactObj->process($_POST);
             } else {
                 $code = $contactObj->fetch();
             }
             break;
         case '404':
             require_once PATH_FACEBOOK . '/pages/page404.class.php';
             $pObj = new page404($this);
             $code = $pObj->fetch($_GET['msg']);
             break;
         case 'design':
             // for testing the design
             require_once PATH_FACEBOOK . '/pages/pageDesign.class.php';
             $pObj = new pageDesign($this);
             $code = $pObj->fetch($option);
             exit;
             break;
         case 'admin':
             // for testing the design
             require_once PATH_FACEBOOK . '/pages/pageAdmin.class.php';
             $pObj = new pageAdmin($this);
             $code = $pObj->fetch($option);
             break;
             /*
             			case 'dbtest':
             				require_once(PATH_FACEBOOK.'/pages/pageDBTest.class.php');
             				$dbtestObj=new pageDBTest($this);
             				$code=$dbtestObj->fetch();
             				break;			*/
     }
     //$after = memory_get_usage();
     //$this->db->log("pages: fetch($page): memory bytes before: $before, after: $after, delta: ". ($after-$before));
     return $code;
 }