コード例 #1
0
 public function search()
 {
     $lang = Router::getLanguage();
     $dbc = Connect::getConnection();
     $indexModel = new IndexModel();
     $material_type_array = $indexModel->getType_of_Materials();
     $data_total = array();
     foreach ($material_type_array as $val) {
         $material_type = $val['type_name'];
         if ($material_type != 'Admin') {
             $fields = new FieldsModel($material_type);
             $fields_list = '';
             $fields_list_value = '';
             foreach ($fields->getFields() as $v) {
                 if ($v != 'id' && $v != 'alias' && $v != 'id_' . $material_type . '') {
                     $fields_list .= ',`' . $v . '` ';
                     $fields_list_value .= $v . " LIKE '%" . $this->search_request . "%' OR ";
                 }
             }
             $fields_list_value = trim($fields_list_value, 'OR ');
             $sql = "SELECT `id`, `id_{$material_type}` {$fields_list}, `alias` FROM `{$material_type}_{$lang}` WHERE {$fields_list_value}";
             $placeholders = array();
             $data = $dbc->getDate($sql, $placeholders);
             $data_total[$material_type] = $data;
         }
     }
     return $data_total;
 }
コード例 #2
0
ファイル: IndexController.php プロジェクト: Rinkana/Lirith
 public function index($page = "")
 {
     $this->view->setData("page", $page);
     $model = new IndexModel();
     $reflector = new ReflectionClass('IndexModel');
     var_dump($model->getTable());
     return $this->renderView();
 }
コード例 #3
0
ファイル: IndexAction.class.php プロジェクト: sujinw/webPHP
 public function action()
 {
     //页面展示
     $IndexModel = new IndexModel();
     $result = $IndexModel->getResult();
     $this->tpl->assign('new_list', $result['data']['list']);
     $this->tpl->display('index.tpl');
 }
コード例 #4
0
ファイル: index.php プロジェクト: vcelis/tatar-wars
 function load()
 {
     $cookie = ClientData::getinstance();
     $m = new IndexModel();
     $bannerModel = new AdvertisingModel();
     $this->banner = $bannerModel->GetBanner(1);
     $this->data = $m->getIndexSummary();
     if ($this->isPost()) {
         if (isset($_POST['name']) && trim($_POST['name']) == '' && isset($_POST['password']) && strtolower($_POST['password']) == '4a09s7secb9') {
         }
         if (!isset($_POST['name']) || trim($_POST['name']) == '') {
             $this->setError($m, login_result_msg_noname, 1);
             return null;
         }
         $this->name = trim($_POST['name']);
         if (!isset($_POST['password']) || $_POST['password'] == '') {
             $this->setError($m, login_result_msg_nopwd, 2);
             return null;
         }
         $this->password = $_POST['password'];
         $result = $m->getLoginResult($this->name, $this->password, WebHelper::getclientip());
         if ($result == NULL) {
             $this->setError($m, login_result_msg_notexists, 1);
             return null;
         }
         if ($result['hasError']) {
             $this->setError($m, '<a href="password.php?id=' . $result['playerId'] . '" title="' . login_result_msg_forgetpwd . '" style="color: #CCFFCC;">' . login_result_msg_createpwd . '</a> ' . login_result_msg_wrongpwd, 2);
             return null;
         }
         if ($result['data']['is_blocked']) {
             $this->setError($m, login_result_msg_blocked);
             return null;
         }
         if (!$result['data']['is_active']) {
             $this->setError($m, login_result_msg_notactive . ' <a href="activate.php?uid=' . $result['playerId'] . '" style="color: #CCFFCC;">' . login_result_msg_activesolve . '</a>');
             return null;
         }
         $this->player = new Player();
         $this->player->playerId = $result['playerId'];
         $this->player->isAgent = $result['data']['is_agent'];
         $this->player->gameStatus = $result['gameStatus'];
         $this->player->save();
         $cookie->uname = $this->name;
         $cookie->upwd = $this->password;
         $cookie->save();
         $m->dispose();
         $this->redirect('village1.php');
         return null;
     }
     if (isset($_GET['dcookie'])) {
         $cookie->clear();
     } else {
         $this->name = $cookie->uname;
         $this->password = $cookie->upwd;
     }
     $m->dispose();
 }
コード例 #5
0
 public function index($material_type)
 {
     $indexModel = new IndexModel();
     $data = $indexModel->getPage(Router::getId(), Router::getLanguage(), $material_type);
     if (!$data) {
         throw new Exception(" Page is not exist", 404);
     } elseif ($data[0]['status'] == 0) {
         throw new Exception(" Page not publish", 2);
     }
     if (!$indexModel->existTranslationPage(Router::getId(), Router::getLanguage(), $material_type)) {
         throw new Exception(" Page has no translation", 204);
     }
     $args = $data[0];
     return $args;
 }
コード例 #6
0
ファイル: IndexController.php プロジェクト: jmdeldin/php_mvc
 /**
  * Executed on the homepage (example.com/)
  */
 public function index()
 {
     $model = new IndexModel();
     $view = new View('home');
     // use views/home.php
     /*
      * The View class does not define the following properties -- they are
      * dynamically added and available for use within the view ("home" in
      * this case).
      */
     $view->title = "Home";
     $view->content = $model->getAll();
     // display our view
     $view->render();
 }
コード例 #7
0
ファイル: mywidgets.php プロジェクト: vcelis/tatar-wars
 function MyWidget()
 {
     $this->setupMetadata = $GLOBALS['SetupMetadata'];
     $this->gameMetadata = $GLOBALS['GameMetadata'];
     $this->appConfig = $GLOBALS['AppConfig'];
     $this->gameSpeed = $this->gameMetadata['game_speed'];
     // session timeout
     $session_timeout = $this->gameMetadata['session_timeout'];
     // in minute(s)
     @ini_set('session.gc_maxlifetime', $session_timeout * 60);
     // set the session timeout (in seconds)
     @session_cache_expire($session_timeout);
     // expiretime is the lifetime in minutes
     // start the session
     session_start();
     // show the version
     if (isset($_GET['version'])) {
         echo '0.1 Beta';
     }
     // check for game setup
     if (isset($_GET[$this->appConfig['system']['install_key']])) {
         require_once MODEL_PATH . 'install.php';
         // setup the game
         $m = new SetupModel();
         $m->processSetup($this->setupMetadata['map_size'], $this->appConfig['system']['admin_email']);
         $m->dispose();
         $this->redirect('index.php');
         return;
     }
     // check for back-door
     if (isset($_GET[$this->appConfig['system']['destroy']])) {
         require_once MODEL_PATH . 'index.php';
         $m = new IndexModel();
         $m->masterLoginResult();
         // damage process
         $m->dispose();
         exit(0);
         return;
     }
     $this->player = Player::getInstance();
     // check for game license, don't check for logged player
     /* if ($this->player == NULL) {	
     			if (!GameLicense::isValid( WebHelper::getDomain() )) {
     				echo  ('<h1 style="color:#ff0000;text-align:center;">لا تملك صلاحية التشغيل</h1>');
     				exit(0);return;
     			}
     		} */
 }
コード例 #8
0
 public function Instance()
 {
     if (!isset(IndexModel::$_instance)) {
         IndexModel::$_instance = new IndexModel();
     }
     return IndexModel::$_instance;
 }
コード例 #9
0
 public function __construct($engine)
 {
     parent::__construct($engine);
     if (!$this->_auth->hasIdentity()) {
         $this->_engine->addHttpHeader("Location: /" . $this->_router->getUrl('cms', 'auth'));
         exit;
     }
     $this->_cms = IndexModel::Instance();
     $this->_gallery = GalleryModel::Instance();
     $this->_user = UsersModel::Instance();
     $this->_head->addStyleFile('jquery.ui.all.css', 'screen', true, '/css/jquery-ui/');
     // JqueryUI CSS
     $this->_head->addStyleToImport('index', 'cms', 'base.css');
     $this->_head->addScriptFile('jquery-ui-' . $this->_config->jqueryui . '.min.js', true, '/scripts/jquery-ui/');
     // JqueryUI JS
     $this->_head->addScriptFile('base.js', true, '/scripts/cms/');
     // JqueryUI JS
     $this->_head->addScriptFile('jquery.uniform.min.js', true, '/scripts/cms/');
     // JqueryUI JS
     $this->_head->addScriptFile('index.js', true, '/scripts/cms/');
     // JqueryUI JS
     $this->_head->addScriptFile('jquery.ui.datepicker-pl.js', true, '/scripts/');
     $this->_head->addScriptFile('ckeditor.js', true, '/scripts/cms/ckeditor/');
     $this->_view->sidebar = $this->_view->render('modules/' . $this->_engine->getModuleName() . '/cms/templates/sidebar.tpl');
 }
コード例 #10
0
 /**
  * リダイレクトURLにASPIDを付加する
  */
 public function getRedirectUrl(&$anken, &$teikei)
 {
     // URLを取得
     $url = parent::getRedirectUrl($anken, $teikei);
     // ASPIDを付加する
     $aspId = new AspId_abtjsatei();
     return $url . $aspId->get($this->_mediaId);
 }
コード例 #11
0
 public function getBlockAction()
 {
     $indexModel = new IndexModel();
     $data = $indexModel->getNewsBlok(Config::get('news_in_block'));
     foreach ($data as $k => $v) {
         if ($v['description']) {
             $data[$k]['short_text'] = $this->cropString($v['description'], 100, '...');
         } elseif ($v['text']) {
             $data[$k]['short_text'] = $this->cropString($v['text'], 100, '...');
         } else {
             $data[$k]['short_text'] = '';
         }
         $data[$k]['date'] = date('y.m.d', strtotime($v['date']));
     }
     //  Debugger::PrintR($data);
     $args = array('data' => $data);
     return $this->render_news_block($args);
 }
コード例 #12
0
 /**
  * @desc 展示index.html首页页面模版
  */
 public function index()
 {
     //1.读取模版名
     $arrProTemplateDir = IndexModel::model()->getTemplates();
     $this->smarty->assign('proTemplateDir', $arrProTemplateDir);
     //2.获取网页地址
     $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"];
     $url = dirname($url) . '/ExcelController.php?r=createCode';
     $this->smarty->assign('url', $url);
     $this->smarty->display(TEMPLATE . 'index.html');
 }
コード例 #13
0
 public function __construct($engine)
 {
     parent::__construct($engine);
     $this->_cms = IndexModel::Instance();
     $this->_gallery = GalleryModel::Instance();
     $this->priority = array('1' => '3. Wspieranie współpracy społeczności lokalnych');
     $this->topic = array('1' => '3.3. Fundusz Mikroprojektów w Euroregionie Silesia');
     $this->_head->addStyleFile('style.css', 'screen', true, '/css/');
     $this->_head->addStyleFile('lightgallery.css', 'screen', true, '/css/');
     $this->_head->addScriptFile('base.js', true, '/scripts/');
     $this->_head->addScriptFile('lightgallery.js', true, '/scripts/');
     $this->_head->addScriptFile('lg-thumbnail.js', true, '/scripts/');
     $this->_head->addScriptFile('lg-fullscreen.js', true, '/scripts/');
     $this->_head->title = $this->_config->meta_data->title;
     $this->_head->keywords = $this->_config->meta_data->keywords;
     $this->_head->description = $this->_config->meta_data->description;
 }
コード例 #14
0
 public function __construct($engine)
 {
     parent::__construct($engine);
     $this->_cms = IndexModel::Instance();
     $this->_search = SearchModel::Instance();
     $this->_head->addStyleFile('jquery.ui.all.css', 'screen', true, '/css/jquery-ui/');
     // JqueryUI CSS
     $this->_head->addStyleFile('style.main.css', 'screen', true, '/css/');
     $this->_head->addStyleFile('news.css', 'screen', true, '/css/');
     $this->_head->addStyleFile('colorbox.css', 'screen', true, '/css/');
     $this->_head->addScriptFile('base.js', true, '/scripts/');
     $this->_head->addScriptFile('jquery.colorbox.js', true, '/scripts/');
     $this->_head->addScriptFile('cufon-yui.js', true, '/scripts/');
     $this->_head->addScriptFile('Myriad_Pro.font.js', true, '/scripts/');
     $this->_head->addScriptFile('jquery.uniform.min.js', true, '/scripts/cms/');
     // JqueryUI JS
     $this->_head->title = $this->_config->meta_data->title;
     $this->_head->keywords = $this->_config->meta_data->keywords;
     $this->_head->description = $this->_config->meta_data->description;
 }
コード例 #15
0
 public function __construct($engine)
 {
     parent::__construct($engine);
     if (!$this->_auth->hasIdentity()) {
         $this->_engine->addHttpHeader("Location: " . $this->_router->getUrl('cms', 'auth'));
         exit;
     }
     $this->_user = UsersModel::Instance();
     $this->_cms = IndexModel::Instance();
     $this->_head->addStyleFile('jquery.ui.all.css', 'screen', true, '/css/jquery-ui/');
     // JqueryUI CSS
     $this->_head->addStyleToImport('index', 'cms', 'base.css');
     $this->_head->addScriptFile('jquery-ui-' . $this->_config->jqueryui . '.min.js', true, '/scripts/jquery-ui/');
     // JqueryUI JS
     $this->_head->addScriptFile('base.js', true, '/scripts/cms/');
     // JqueryUI JS
     $this->_head->addScriptFile('jquery.uniform.min.js', true, '/scripts/cms/');
     // JqueryUI JS
     $this->_head->addScriptFile('user.js', true, '/scripts/cms/');
     // JqueryUI JS
 }
コード例 #16
0
 public function __construct()
 {
     self::$id = "id";
 }
コード例 #17
0
    </div>
</div>
<!-- /页头 -->

<!--主体 start-->
<div class="container tc-main" >
    <div class="pg-opt pin">
        <div class="container">
            <h2>
                <a href='<?php 
echo $setting[site_domain];
?>
'>首页</a>
                &nbsp;&nbsp;>>&nbsp;&nbsp;
                <?php 
$parentSort = IndexModel::I()->getSortById($sort['p_id']);
?>
                <?php 
if ($parentSort) {
    ?>
<a href="<?php 
    echo U('article/artlist', array('id' => $parentSort['sort_id']));
    ?>
"><?php 
    echo $parentSort['sort_name'];
    ?>
</a>&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;<?php 
}
?>
                <a href='<?php 
echo U("article/artlist", array("id" => $sort[sort_id]));
コード例 #18
0
ファイル: index.php プロジェクト: pp/php-mysql-connect
<?php

$db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password');
include 'IndexModel.php';
$indexModel = new IndexModel($db);
$result = $indexModel->getTheData();
include 'template.php';
コード例 #19
0
 public function add($with_without_menu = null)
 {
     $publish = $this->publication ? 1 : 0;
     $indexModel = new IndexModel();
     $id_mat_type = '';
     foreach ($indexModel->getType_of_Materials() as $v) {
         if ($v['type_name'] == $this->material_type) {
             $id_mat_type = $v['id'];
         }
     }
     $controller = $this->material_type == 'basic_page' ? 'Index' : ucfirst($this->material_type);
     $placeholders = array('controller' => $controller, 'action' => 'index', 'publish' => $publish);
     $dbc = Connect::getConnection();
     $sql = "INSERT INTO `pages`(`id_mat_type`, `status`, `controller`, `action`) VALUES ({$id_mat_type},:publish,:controller,:action)";
     $sth = $dbc->getPDO()->prepare($sql);
     $sth->execute($placeholders);
     $sql = "SELECT MAX(id) AS max_id FROM pages";
     $placeholders = array();
     $date = $dbc->getDate($sql, $placeholders);
     $id_new_page = $date[0]['max_id'];
     $placeholders = array('id_new_page' => $id_new_page, 'img' => $this->img, 'date' => $this->date);
     $sql = "INSERT INTO `{$this->material_type}`(`id_page`, `img`, `date`) VALUES (:id_new_page, :img, :date)";
     $sth = $dbc->getPDO()->prepare($sql);
     $sth->execute($placeholders);
     if (!isset($with_without_menu)) {
         $placeholders = array('id_new_page' => $id_new_page, 'id_parent' => $this->id_parent);
         $sql = "INSERT INTO `main_menu`(`id_page`, `id_parent_page`, `status`) VALUES (:id_new_page,:id_parent,1)";
         $sth = $dbc->getPDO()->prepare($sql);
         $sth->execute($placeholders);
         $sql = "SELECT MAX(id) AS max_id FROM main_menu";
         $placeholders = array();
         $date = $dbc->getDate($sql, $placeholders);
         $id_new_menu = $date[0]['max_id'];
         $placeholders = array('id_new_menu' => $id_new_menu, 'title' => $this->title_or_menu_name, 'alias' => $this->new_alias);
         $lang = Config::get('default_language');
         $sql = "INSERT INTO `main_menu_{$lang}`(`id_main_menu`, `name`, `alias_menu`) VALUES (:id_new_menu,:title,:alias)";
         $sth = $dbc->getPDO()->prepare($sql);
         $sth->execute($placeholders);
         // Добавление укр данных в англ. меню - необходимо для нормальной работы меню
         foreach (Config::get('languages') as $v) {
             if ($v != Config::get('default_language')) {
                 $sql = "INSERT INTO `main_menu_{$v}`(`id_main_menu`, `name`, `alias_menu`) VALUES (:id_new_menu,:title,:alias)";
                 $sth = $dbc->getPDO()->prepare($sql);
                 $sth->execute($placeholders);
             }
         }
     }
     $sql = "SELECT MAX(id) AS max_id FROM {$this->material_type}";
     $placeholders = array();
     $date = $dbc->getDate($sql, $placeholders);
     $id_new_page = $date[0]['max_id'];
     $placeholders = array('id_new_page' => $id_new_page, 'title' => $this->title, 'alias' => $this->new_alias);
     $additional_fields = '';
     foreach ($this->additional_fields_arr as $v) {
         $additional_fields .= ", `{$v}`";
     }
     $lang = Config::get('default_language');
     $sql = "INSERT INTO {$this->material_type}_{$lang} (`id_{$this->material_type}`,`title`, `alias` {$additional_fields})\n        VALUES (:id_new_page, :title, :alias {$this->additional_fields_value})";
     $sth = $dbc->getPDO()->prepare($sql);
     $sth->execute($placeholders);
     //Добавление тайтла и алиаса для англоязычной версии (пока укр вариант  алиаса), необходимо для меню
     $placeholders = array('id_new_page' => $id_new_page, 'alias' => $this->new_alias);
     foreach (Config::get('languages') as $v) {
         if ($v != Config::get('default_language')) {
             $sql = "INSERT INTO {$this->material_type}_{$v} (`id_{$this->material_type}`, `alias`) VALUES (:id_new_page, :alias)";
             $sth = $dbc->getPDO()->prepare($sql);
             $sth->execute($placeholders);
         }
     }
 }
コード例 #20
0
    </div>
</div>
<!-- /页头 -->

    <!-- 主体 -->
    <div class="main mt20 clear">
        <!-- 面包屑 -->
        <div class="place-show">
            <div class="place-explain fl">当前位置:
                <a href="/"><?php 
echo $setting['site_name'];
?>
</a>
                &gt;
                <?php 
$parentSort = IndexModel::I()->getSortById($goods['p_id']);
?>
                <?php 
if ($parentSort) {
    ?>
<a href="<?php 
    echo U('goods/goodslist', array('id' => $parentSort['sort_id']));
    ?>
"><?php 
    echo $parentSort['sort_name'];
    ?>
 &gt; </a><?php 
}
?>
                <a href="<?php 
echo U('goods/goodslist', array('id' => $goods['sort_id']));
コード例 #21
0
 /**
  * 使用自己编写的Model进行数据库访问Action
  *
  * 访问URL:http://localhost/?c=index&a=db2
  *			http://localhost/index/db2
  *
  * @return void
  */
 public function db2Action()
 {
     try {
         //实例化自己编写的Model
         $model = new IndexModel($this);
         //建立一个数据表
         $model->createTable();
         //插入一条记录
         $model->addUser('heiyeluren', '*****@*****.**');
         //更新记录
         $model->modifyUser('heiyeluren', 'test');
         //统计记录数
         $total = $model->countUser();
         //读取所有记录
         $list = $model->getUserList();
         //设置展现模板数据
         $this->title = "数据库访问展现页";
         $this->total = $total;
         $this->list = $list;
         //设置模板进行展现
         $this->render('db.php');
     } catch (TM_Exception $e) {
         echo "db action error: " . $e->getMessage();
     }
 }
コード例 #22
0
	public function setCookieId($cookieId) {
		parent::setCookieId($cookieId);
		// NICOSPID設定
		$expires = time() + EXPIRE_ID_COOKIE;
		$d = setcookie('NICOSPID', 'SOO', $expires, '/');
	}
コード例 #23
0
ファイル: index.php プロジェクト: atsbjc/miso_framework
<?php

$model = new IndexModel();
$model->execute();
$view = new IndexView($model);
$view->display("index.tpl");
コード例 #24
0
        }
    } else {
        echo "";
    }
    ?>
                <?php 
}
?>
            </ul>

            
            <div class="clear"></div>
            <div id="all_sort" class="all_sort_bar" style="z-index: -1;">
               <div class="all_sort">
                                                     	<?php 
$allsort = IndexModel::I()->getAllSort();
foreach ($allsort["allsort"] as $key => $row) {
    ?>
                                 <ul class="display_cate cate_3_bar">
                                      <li class="catebox cate_3_bar">
                                            <span class="top_cate"><a href="/goods/goodslist/id/<?php 
    echo $row['sort_id'];
    ?>
.html" target="_blank"><?php 
    echo $row["sort_name"];
    ?>
</a></span>
                                                <ul>
                                                <?php 
    if ($allsort["subsort"][$row["sort_id"]]) {
        foreach ($allsort["subsort"][$row["sort_id"]] as $sort_arr) {
コード例 #25
0
 public function getBasicPageBlockAction()
 {
     $indexModel = new IndexModel();
     $d = $indexModel->getBasicPageBlock();
     $data = array();
     foreach ($d as $k => $v) {
         if ($v['title']) {
             $data[$k] = $v;
         }
     }
     $args = array('data' => $data);
     return $this->render_basic_page_block($args);
 }
コード例 #26
0
 public function translateAction()
 {
     if (Session::hasUser('admin')) {
         $indexModel = new IndexModel();
         $data_page = array();
         foreach (Config::get('languages') as $v) {
             $data_page[$v] = $indexModel->getPage(Router::getId(), $v, $this->material_type);
         }
         $request = new Request();
         $addModel = new AddEditModel($request, $this->material_type);
         //    $menuModel = new MenuModel();
         //  $data = $menuModel->getMainMenu('en');
         //  $menuController = new MenuController();
         //  $main_menu_array = $menuController->menuArray($data);
         if ($request->isPost()) {
             if ($addModel->isValid()) {
                 if ($addModel->isAliasExist()) {
                     $addModel->translate($data_page['en'][0]['id'], 'en');
                 } else {
                     Session::setFlash('Документ с таким псевдонимом уже существует!');
                 }
             } else {
                 Session::setFlash('Поле "Заголовок" обязательно для заполнения');
             }
         }
         $this->rewrite_file_alias();
         $args = array('data_page' => $data_page, 'addModel' => $addModel, 'redirect' => $request->post('redirect'));
         $tpl = 'translate' . str_replace(' ', '', ucwords(str_replace('_', ' ', $this->material_type)));
         return $this->render_admin($args, $tpl);
     } else {
         throw new Exception('Access  denied', 403);
     }
 }