コード例 #1
0
<?php

# Movable Type (r) (C) 2001-2015 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
 * Class for mt_asset
 */
class Asset extends BaseObject
{
    public $_table = 'mt_asset';
    protected $_prefix = "asset_";
    protected $_has_meta = true;
}
// Relations
ADODB_Active_Record::ClassHasMany('Asset', 'mt_asset_meta', 'asset_meta_asset_id');
コード例 #2
0
# Movable Type (r) (C) 2001-2015 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
 * Class for mt_tbping
 */
class TBPing extends BaseObject
{
    public $_table = 'mt_tbping';
    protected $_prefix = "tbping_";
    protected $_has_meta = true;
    public function trackback()
    {
        $col_name = "tbping_tb_id";
        ${$tb} = null;
        if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
            $tb_id = $this->{$col_name};
            require_once 'class.mt_trackback.php';
            $tb = new Trackback();
            $tb->Load("trackback_id = {$tb_id}");
        }
        return $tb;
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('TBPing', 'mt_tbping_meta', 'tbping_meta_tbping_id');
コード例 #3
0
 * Class for mt_blog (website)
 */
class Website extends Blog
{
    function Save()
    {
        if (empty($this->blog_class)) {
            $this->blog_class = 'website';
        }
        return parent::Save();
    }
    function blogs()
    {
        $where = "blog_parent_id = " . $this->id;
        require_once 'class.mt_blog.php';
        $blog = new Blog();
        $blogs = $blog->Find($where);
        return $blogs;
    }
    function site_path()
    {
        return $this->blog_site_path;
    }
    function site_url()
    {
        return $this->blog_site_url;
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('Website', 'mt_blog_meta', 'blog_meta_blog_id');
コード例 #4
0
        }
        require_once 'class.mt_trackback.php';
        $trackback = new Trackback();
        $loaded = $trackback->Load("trackback_entry_id = " . $this->entry_id);
        if (!$loaded) {
            $trackback = null;
        }
        return $trackback;
    }
    public function pings()
    {
        $pings = array();
        $tb = $this->trackback();
        if (!empty($tb)) {
            require_once 'class.mt_tbping.php';
            $tbping = new TBPing();
            $pings = $tbping->Find("tbping_tb_id = " . $tb->id);
        }
        return $pings;
    }
    function Save()
    {
        if (empty($this->entry_class)) {
            $this->class = 'entry';
        }
        return parent::Save();
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('Entry', 'mt_entry_meta', 'entry_meta_entry_id');
コード例 #5
0
        if (!empty($tb)) {
            require_once 'class.mt_tbping.php';
            $tbping = new TBPing();
            $pings = $tbping->Find("tbping_tb_id = " . $tb->id);
        }
        return $pings;
    }
    public function Save()
    {
        if (empty($this->category_class)) {
            $this->class = 'category';
        }
        parent::Save();
    }
    public function entry_count()
    {
        $child_class = $this->class === 'category' ? 'entry' : 'page';
        $blog_id = $this->blog_id;
        $cat_id = $this->id;
        $where = "entry_status = 2\n                  and entry_class = '{$child_class}'\n                  and entry_blog_id = {$blog_id}";
        $join = array();
        $join['mt_placement'] = array('condition' => "placement_entry_id = entry_id and placement_category_id = {$cat_id}");
        require_once 'class.mt_entry.php';
        $entry = new Entry();
        $cnt = $entry->count(array('where' => $where, 'join' => $join));
        return $cnt;
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('Category', 'mt_category_meta', 'category_meta_category_id');
コード例 #6
0
<?php

class Template extends ADOdb_Active_Record
{
}
ADODB_Active_Record::ClassHasMany('template', 'templates', 'user_id');
コード例 #7
0
ファイル: class.mt_comment.php プロジェクト: OCMO/movabletype
# Movable Type (r) (C) 2001-2014 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
 * Class for mt_comment
 */
class Comment extends BaseObject
{
    public $_table = 'mt_comment';
    protected $_prefix = "comment_";
    protected $_has_meta = true;
    public function commenter()
    {
        $commenter_id = $this->comment_commenter_id;
        if (empty($commenter_id) || !is_numeric($commenter_id)) {
            return;
        }
        require_once 'class.mt_author.php';
        $author = new Author();
        if ($author->Load("author_id = {$commenter_id}")) {
            return $author;
        }
        return null;
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('Comment', 'mt_comment_meta', 'comment_meta_comment_id');
コード例 #8
0
/**
 * 
 * show all network
 * @param unknown_type $username
 */
function isShowAllNetwork($username)
{
    ADODB_Active_Record::ClassHasMany('Users', 'user_privileges', 'user');
    $obone_user = new Users();
    $obone_user->Load("user='******'");
    $res = $obone_user->LoadRelations('user_privileges', "id=12 ");
    foreach ($res as $item) {
        $item->value == "1" ? $result = true : ($result = false);
    }
    return $result;
}
コード例 #9
0
<?php

# Movable Type (r) (C) 2001-2014 Six Apart, Ltd. All Rights Reserved.
# This code cannot be redistributed without permission from www.sixapart.com.
# For more information, consult your Movable Type license.
#
# $Id$
require_once "class.baseobject.php";
/***
 * Class for mt_template
 */
class Template extends BaseObject
{
    public $_table = 'mt_template';
    protected $_prefix = "template_";
    protected $_has_meta = true;
    public function blog()
    {
        if ($this->template_blog_id === 0) {
            return null;
        }
        return parent::blog();
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('Template', 'mt_template_meta', 'template_meta_template_id');
コード例 #10
0
    public function permissions($blog_id = null)
    {
        require_once 'class.mt_permission.php';
        $whereOrder = "permission_author_id = " . $this->id;
        if (!is_null($blog_id)) {
            if (is_array($blog_id)) {
                $ids = join(',', $blog_id);
                $whereOrder = $whereOrder . " and permission_blog_id in ( {$ids} )";
            } else {
                $whereOrder = $whereOrder . " and permission_blog_id = {$blog_id}";
            }
        }
        $whereOrder = $whereOrder . " order by permission_blog_id";
        $permission = new Permission();
        return $permission->Find($whereOrder);
    }
    public function userpic()
    {
        $userpic_id = $this->author_userpic_asset_id;
        if (empty($userpic_id) || !is_numeric($userpic_id)) {
            return;
        }
        require_once 'class.mt_asset.php';
        $asset = new Asset();
        $asset->Load("asset_id = {$userpic_id}");
        return $asset;
    }
}
// Relations
ADODB_Active_Record::ClassHasMany('Author', 'mt_author_meta', 'author_meta_author_id');
コード例 #11
0
<?php

class User extends ADOdb_Active_Record
{
}
ADODB_Active_Record::ClassHasMany('document', 'documents', 'user_id');
コード例 #12
0
ファイル: index.php プロジェクト: henriquegogo/juridix
<?php

// Connect into database and create active record
include 'libraries/adodb5/adodb.inc.php';
include 'libraries/adodb5/adodb-active-record.inc.php';
$DB = NewADOConnection("mysql://*****:*****@localhost/juridix");
// if ($_SERVER['HTTP_HOST'] == 'localhost') { $DB = NewADOConnection("mysql://*****:*****@localhost/juridix");
// } else { $DB = NewADOConnection("mysql://*****:*****@localhost/gogs_juridix"); }
$DB->SetFetchMode(ADODB_FETCH_ASSOC);
ADOdb_Active_Record::SetDatabaseAdapter($DB);
// Create class for tables
class user extends ADOdb_Active_Record
{
}
// Table relations
ADODB_Active_Record::ClassHasMany('user', 'profile', 'user_id');
// User...
$user = new user();
// Set logged
@session_start();
// Verify permissions and users options
if ($_SESSION[email]) {
    $env['name'] = "Jorge Pinheiro Advogados Associados";
    $env['modules'] = array('db', 'login', 'user', 'panel', 'agenda', 'money', 'todo', 'news', 'mobile');
    $env['start_module'] = "panel";
    $env['menu'] = array('panel' => 'Inicial', 'agenda' => 'Agenda', 'money' => 'Financeiro');
    $env['blocks'] = array('agenda', 'todo', 'news');
} else {
    $env['name'] = "Jorge Pinheiro Advogados Associados";
    $env['modules'] = array('login', 'user', 'news', 'mobile');
    $env['start_module'] = "login";