Пример #1
0
<?php

// Copyright (c) 2010 Guanoo, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
load_models('YawfIssue');
class Issue_controller extends App_controller
{
    public function before()
    {
        parent::before();
    }
    public function index()
    {
        // TODO
    }
    public function create()
    {
        // TODO
    }
    public function edit()
    {
        // TODO
Пример #2
0
 public function before()
 {
     parent::before();
     load_models('User');
     $this->render->user_email = $this->cookie->user_email;
 }
Пример #3
0
<?php

//入口验证
END_MODULE != 'admin' && die('Access Denied');
//过滤数据,并写入全局变量
filter_array($_GET, 'm,action,intval:item_id,intval:category_id,item_type,status', true);
load_models();
$category = model('category');
$err_msg = '';
$success_msg = '';
if ($action == 'get_tree') {
}
/* 必须传入 category_id*/
if ($category_id || $item_type) {
    if (!$item_type) {
        $this_category = $category->get_one($category_id);
        $item_type = preg_replace('/_list$/i', '', $this_category['status']);
        define('END_ADMIN_CATEGORY_ID', $category_id);
    } else {
        $this_category = $category->get_one(array('status' => $item_type . '_list'));
        $category_id = $this_category['category_id'];
        define('END_ADMIN_CATEGORY_ID', $category_id);
    }
    if ($item_type) {
        define('END_ADMIN_ITEM_TYPE', $item_type);
    } else {
        die('please provide valid category_id or item_type!');
    }
}
//如果不是列表页面
if ($this_category && !preg_match('/_list$/', $this_category['status'])) {
Пример #4
0
 public function data_for($url)
 {
     load_models('Note');
     $url = preg_replace('/\\.\\w+$/', '', $url);
     $note = new Note(array('url' => $url));
     return $note->load() ? $note->to_text() : NULL;
 }
Пример #5
0
/**
 * Load a model
 *
 * @param String $model the model to load
 */
function load_model($model)
{
    load_models($model);
}
Пример #6
0
    return $models;
}
/**
* This function is used to include the models in the application
* 
* @param models_name : array : models names
* @return void
*/
function load_models($models_name)
{
    foreach ($models_name as $items) {
        require_once "models/{$items}";
    }
}
# Including the file models
load_models(finding_models());
/**
* Instantiate the models
* 
* @return Array with the models names
*/
function prepare_models_to_instantiate()
{
    $models = array();
    foreach (finding_models() as $items) {
        $items = explode('.php', $items);
        $models[] = $items[0];
    }
    $models_names = array();
    foreach ($models as $items) {
        $models_names[$items] = new $items(Database::connect());
Пример #7
0
<?php

// Copyright (c) 2010 Guanoo, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
load_models('YawfAdmin', 'YawfIssue');
class Admin_controller extends App_controller
{
    protected function create_database()
    {
        // Create a YAWF database, but only do it once
        $admin = new YawfAdmin();
        if (file_exists($admin->get_database())) {
            return;
        }
        $sql = file_get_contents('app/data/YAWF_' . DB_CONNECTOR . '.sql');
        $admin->query($sql);
    }
    public function before()
    {
        parent::before();
        $this->create_database();
    }