예제 #1
0
파일: Setup.php 프로젝트: hisaboh/w2t
    /**
     * クラスファイルからgettext文字列を抜き出してpotファイルを作成する
     * @param string $path
     * @param string $lc_messages_path
     */
    public static function po_generate($path, $lc_messages_path)
    {
        $messages = array();
        foreach (File::ls($path, true) as $file) {
            if ($file->isClass()) {
                ob_start();
                include_once $file->fullname();
                Rhaco::import($file->oname());
                ob_get_clean();
                $ref = Info::reflection($file->oname());
                foreach ($ref->methods as $method) {
                    foreach ($method->gettext as $text) {
                        $messages[$text->str]["#: " . str_replace($path, "", $file->fullname()) . ":" . $text->line] = true;
                    }
                }
            }
        }
        ksort($messages, SORT_STRING);
        $output_src = sprintf(Text::plain('
						# SOME DESCRIPTIVE TITLE.
						# Copyright (C) YEAR THE PACKAGE\'S COPYRIGHT HOLDER
						# This file is distributed under the same license as the PACKAGE package.
						# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
						#
						#, fuzzy
						msgid ""
						msgstr ""
						"Project-Id-Version: PACKAGE VERSION\\n"
						"Report-Msgid-Bugs-To: \\n"
						"POT-Creation-Date: %s\\n"
						"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
						"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
						"Language-Team: LANGUAGE <*****@*****.**>\\n"
				'), date("Y-m-d H:iO")) . "\n\n";
        foreach ($messages as $str => $lines) {
            $output_src .= "\n" . implode("\n", array_keys($lines)) . "\n";
            $output_src .= "msgid \"" . $str . "\"\n";
            $output_src .= "msgstr \"\"\n";
        }
        File::write(File::absolute($lc_messages_path, "messages.pot"), $output_src);
        //Rhaco::import("ext.Setup");
        //Setup::po_generate(dirname(__FILE__),Rhaco::selfpath()."/resources/locale/");
        //Setup::mo_generate(Rhaco::selfpath()."/resources/locale/");
        //Test::each_flush();
    }
예제 #2
0
파일: Test.php 프로젝트: hisaboh/w2t
 /**
  * テストを実行する
  * @param string $class クラス名
  * @param strgin $method メソッド名
  */
 public static final function verify($class, $method = null, $block_name = null)
 {
     if (!class_exists($class) && Rhaco::import($class)) {
         $pos = strrpos($class, ".");
         $class = substr($class, $pos !== false ? $pos + 1 : $pos);
     }
     $ref = Info::reflection($class);
     self::$current_file = $ref->path;
     self::$current_class = $ref->name;
     foreach ($ref->methods as $name => $m) {
         self::$current_method = $name;
         if ($method === null || $method == $name) {
             self::execute($m, $block_name);
         }
     }
     self::$current_class = null;
     self::$current_file = null;
     self::$current_method = null;
     return new self();
 }
예제 #3
0
파일: Db.php 프로젝트: hisaboh/w2t
 protected function __new__()
 {
     if (func_num_args() == 1) {
         $this->dict(func_get_arg(0));
     }
     if (!empty($this->con)) {
         $db = self::connection($this->con);
         $this->type = $db->type;
         $this->host = $db->host;
         $this->dbname = $db->dbname;
         $this->user = $db->user;
         $this->password = $db->password;
         $this->port = $db->port;
         $this->sock = $db->sock;
         $this->connection = $db->connection;
         $this->copy_module($db, true);
     } else {
         try {
             $type = ucfirst(strtolower($this->type));
             Rhaco::import("db.controller." . $type);
         } catch (Exception $e) {
             try {
                 Lib::import($this->type);
                 $type = preg_replace("/^.+\\.([^\\.]+)\$/", "\\1", $this->type);
             } catch (Exception $e) {
                 throw new Exception("not support " . $this->type);
             }
         }
         $this->type = $type;
         $this->add_modules(new $type());
         try {
             $this->connection = new PDO($this->call_module("dsn", $this->dbname, $this->host, $this->port, $this->user, $this->password, $this->sock), $this->user, $this->password);
         } catch (Exception $e) {
             throw new Exception("access denied for " . $this->dbname);
         }
         $this->connection->beginTransaction();
     }
 }
예제 #4
0
<?php

require dirname(__FILE__) . '/__init__.php';
Rhaco::import('tag.HtmlParser');
$db = new DbUtil(Event::connection());
$p = new HtmlParser('index.html');
$p->setVariable('event', $db->get(new Event(), new C(Q::depend(), Q::eq(Event::columnId(), Rhaco::constant('CURRENT_EVENT', 1)))));
$p->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description')));
$p->write();
예제 #5
0
파일: Rss.php 프로젝트: hisaboh/w2t
 public function atom()
 {
     Rhaco::import("net.feed.atom.Atom");
     $atom = new Atom();
     $atom->title($this->title());
     $atom->subtitle($this->description());
     $atom->generator($this->webMaster());
     $atom->updated($this->lastBuildDate());
     $link = new AtomLink();
     $link->href($this->link());
     $atom->link($link);
     foreach ($this->arItem() as $item) {
         $entry = new AtomEntry();
         $entry->title($item->title());
         $entry->published($item->pubDate());
         $author = new AtomAuthor();
         $author->name($item->author());
         $entry->author($author);
         $link = new AtomLink();
         $link->href($item->link());
         $entry->link($link);
         $content = new AtomContent();
         $content->value($item->description());
         $entry->content($content);
         $summary = new AtomSummary();
         $summary->value($item->comments());
         $entry->summary($summary);
         $atom->add($entry);
     }
     return $atom;
     /***
     			 $src = text('
     						<rss version="2.0">
     							<channel>
     								<title>rhaco</title>
     								<link>http://rhaco.org</link>
     								<description>php</description>
     								<language>ja</language>
     								<copyright>rhaco.org</copyright>
     								<docs>hogehoge</docs>
     								<lastBuildDate>2007-10-10T10:10:10+09:00</lastBuildDate>
     								<managingEditor>tokushima</managingEditor>
     								<pubDate>2007-10-10T10:10:10+09:00</pubDate>
     								<webMaster>kazutaka</webMaster>
     								<item>
     									<title>rhaco</title>
     									<link>http://rhaco.org</link>
     									<description>rhaco desc</description>
     								</item>
     								<item>
     									<title>everes</title>
     									<link>http://www.everes.net</link>
     									<description>everes desc</description>
     								</item>
     							</channel>
     						</rss>
     					');
     					$xml = Rss::parse($src);
     					eq("2.0",$xml->version());
     					eq("rhaco",$xml->title());
     					eq("http://rhaco.org",$xml->link());
     					eq("php",$xml->description());
     					eq("ja",$xml->language());
     					eq("rhaco.org",$xml->copyright());
     					eq("hogehoge",$xml->docs());
     					eq(1191978610,$xml->lastBuildDate());
     					eq("Wed, 10 Oct 2007 10:10:10 +0900",$xml->fmLastBuildDate());
     					eq("tokushima",$xml->managingEditor());
     					eq(1191978610,$xml->pubDate());
     					eq("Wed, 10 Oct 2007 10:10:10 +0900",$xml->fmPubDate());
     					eq("kazutaka",$xml->webMaster());
     					eq(2,sizeof($xml->item()));
     
     					$atom = $xml->atom();
     					eq(true,$atom instanceof Atom);
     					eq("rhaco",$atom->title());
     					eq("php",$atom->subtitle());
     					eq(1191978610,$atom->updated());
     					eq("kazutaka",$atom->generator());
     					eq(2,sizeof($atom->entry()));
     			*/
 }
예제 #6
0
파일: Au.php 프로젝트: riaf/private-arbo
<?php

/**
 * Au
 *
 * @author  riaf <*****@*****.**>
 * @package arbo
 * @license New BSD License
 * @version $Id$
 */
Rhaco::import('model.MobileCarrierBase');
class Au extends MobileCarrierBase
{
    function isAu()
    {
        return true;
    }
}
예제 #7
0
파일: Opml.php 프로젝트: hisaboh/w2t
 public function atom()
 {
     Rhaco::import("net.feed.atom.Atom");
     $atom = new Atom();
     $atom->title($this->title());
     foreach ($this->outlines() as $outline) {
         $entry = new AtomEntry();
         $entry->title($outline->title());
         $entry->published(time());
         if ($outline->isHtmlUrl()) {
             $entry->link(new AtomLink("type=html,href=" . $outline->htmlUrl()));
         }
         if ($outline->isXmlUrl()) {
             $entry->link(new AtomLink("type=xml,href=" . $outline->xmlUrl()));
         }
         $entry->content(new AtomContent("value=" . $outline->description()));
         $entry->summary(new AtomSummary("value=" . $outline->tags()));
         $atom->add($entry);
     }
     return $atom;
     /***
     			$text = text('
     						<?xml version="1.0" encoding="utf-8"?>
     						<opml version="1.0">
     						<head>
     							<title>Subscriptions</title>
     							<dateCreated>Mon, 19 May 2008 04:51:05 UTC</dateCreated>
     							<ownerName>rhaco</ownerName>
     						</head>
     						<body>
     						<outline title="Subscriptions">
     							  <outline title="スパムとか" htmlUrl="http://www.everes.net/" type="rss" xmlUrl="http://www.everes.net/blog/atom/" />
     							  <outline title="tokushimakazutaka.com" htmlUrl="http://tokushimakazutaka.com" type="rss" xmlUrl="tokushimakazutaka.com/rss" />
     							<outline title="rhaco">
     							</outline>
     							<outline title="php">
     							  <outline title="riaf-ja blog" htmlUrl="http://blog.riaf.jp/" type="rss" xmlUrl="http://blog.riaf.jp/rss" />
     							</outline>
     							<outline title="お知らせ">
     							</outline>
     						</outline>
     						</body></opml>
     					');
     
     			$feed = Opml::parse($text);
     			eq("Subscriptions",$feed->title());
     			eq("1.0",$feed->version());
     			eq(1211172665,$feed->dateCreated());
     			eq("rhaco",$feed->ownerName());
     			eq(null,$feed->ownerEmail());
     			
     			eq(1,sizeof($feed->outline()));
     			$opml = $feed->outline();
     			eq("Subscriptions",$opml[0]->title());
     	
     			eq(3,sizeof($opml[0]->xml()));
     			eq(3,sizeof($opml[0]->html()));
     
     			$atom = $feed->atom();
     			eq(true,$atom instanceof Atom);
     			eq("Subscriptions",$atom->title());
     			eq(null,$atom->subtitle());
     			eq(time(),$atom->updated());
     			eq(null,$atom->generator());
     			eq(5,sizeof($atom->entry()));
     		*/
 }
예제 #8
0
<?php

Rhaco::import("resources.Message");
Rhaco::import("database.model.TableObjectBase");
Rhaco::import("database.model.DbConnection");
Rhaco::import("database.TableObjectUtil");
Rhaco::import("database.model.Table");
Rhaco::import("database.model.Column");
/**
 * #ignore
 * 
 */
class CommentTable extends TableObjectBase
{
    /**  */
    var $id;
    /**  */
    var $stageId;
    /**  */
    var $name;
    /**  */
    var $message;
    /**  */
    var $ctime;
    var $factStageId;
    function CommentTable($id = null)
    {
        $this->__init__($id);
    }
    function __init__($id = null)
    {
예제 #9
0
파일: Command.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.File");
Rhaco::import("core.Log");
/**
 *
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Command extends Object
{
    protected $resource;
    protected $stdout;
    protected $stderr;
    protected $end_code;
    private $proc;
    private $close = true;
    protected function __new__($command = null)
    {
        if (!empty($command)) {
            $this->open($command);
            $this->close();
        }
    }
    public function open($command, $out_file = null, $error_file = null)
    {
        Log::debug($command);
        $this->close();
        if (!empty($out_file)) {
            File::write($out_file);
        }
예제 #10
0
파일: __rhaco__.php 프로젝트: hisaboh/w2t
/**
 * importし、クラス名を返す
 * @param string $path
 * @return string
 */
function import($path)
{
    return Rhaco::import($path);
}
예제 #11
0
파일: Packager.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Request");
Rhaco::import("core.File");
Rhaco::import("core.Http");
Rhaco::import("core.Tag");
/**
 *
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Packager
{
    private static $tgz_dir;
    public static function __import__()
    {
        self::$tgz_dir = Rhaco::def("generic.Packager@path", Rhaco::work("tgz"));
    }
    /**
     * キャッシュされたtgzの削除
     */
    public static function rm()
    {
        if (is_dir(self::$tgz_dir)) {
            foreach (File::ls(self::$tgz_dir, true) as $file) {
                File::rm($file->fullname());
            }
            foreach (File::dirs(self::$tgz_dir, true) as $dir) {
                File::rm($dir);
            }
        }
예제 #12
0
<?php

require './__init__.php';
Rhaco::import('generic.Views');
Rhaco::import('model.Todo');
$views = new Views();
$views->create(new Todo(), Rhaco::url('views.php'))->write();
예제 #13
0
파일: Feed.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Http");
Rhaco::import("core.File");
Rhaco::import("net.feed.atom.Atom");
Rhaco::import("net.feed.rss.Rss");
Rhaco::import("net.feed.opml.Opml");
/**
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Feed extends Http
{
    private static $CACHE;
    private static $CACHE_TIME;
    protected static $__updated__ = "type=timestamp";
    protected $title;
    protected $subtitle;
    protected $id;
    protected $generator;
    protected $updated;
    public static function __import__()
    {
        self::$CACHE = Rhaco::def("net.xml.Feed@cache", false);
        self::$CACHE_TIME = Rhaco::def("net.xml.Feed@time", 86400);
    }
    public static function read($url)
    {
        $feed = new self();
        return $feed->do_read($url);
    }
예제 #14
0
파일: Atom.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Tag");
Rhaco::import("core.Log");
Rhaco::import("core.Date");
Rhaco::import("net.feed.atom.AtomLink");
Rhaco::import("net.feed.atom.AtomEntry");
Rhaco::import("net.feed.atom.AtomAuthor");
Rhaco::import("net.feed.atom.AtomInterface");
/**
 * Atom
 *
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Atom extends Object
{
    private static $XMLNS = "http://www.w3.org/2005/Atom";
    protected static $__updated__ = "type=timestamp";
    protected static $__link__ = "type=AtomLink[]";
    protected static $__entry__ = "type=AtomEntry[]";
    protected static $__author__ = "type=AtomAuthor[]";
    protected static $__entry_modules__ = "type=object[]";
    protected $title;
    protected $subtitle;
    protected $id;
    protected $generator;
    protected $updated;
    protected $link;
    protected $entry;
    protected $author;
<?php

/**
 * OpenID による認証条件
 *
 * @author  riaf <*****@*****.**>
 * @version $Id$
 */
Rhaco::import('network.http.model.RequestLoginCondition');
Rhaco::import('OpenIDAuth');
// arbo
class RequestLoginConditionOpenID extends RequestLoginCondition
{
    var $url;
    var $endPointUrl;
    var $serverVarName = 'openid_server';
    function RequestLoginConditionOpenID($url = null, $endPointUrl = null)
    {
        $this->__init__($url, $endPointUrl);
    }
    function __init__($url, $endPointUrl)
    {
        $this->url = is_null($url) ? Rhaco::url() : $url;
        $this->endPointUrl = is_null($endPointUrl) ? Rhaco::url('login') : $endPointUrl;
    }
    function condition($request)
    {
        $openid = new OpenIDAuth();
        $variables = $request->getVariable();
        if ($openid->validate($variables)) {
            return true;
예제 #16
0
<?php

/**
 * ClippAtomEntry10
 *
 * @author  riaf <*****@*****.**>
 * @package arbo
 * @version $Id$
 */
Rhaco::import('tag.feed.Atom10');
class ClippAtomEntry10 extends AtomEntry10
{
    var $category;
    // for clipp
    var $clipp_imageAddress;
    var $clipp_embedCode;
    var $clipp_quote;
    var $clipp_description;
    var $clipp_rating;
    var $clipp_publicity;
    function get()
    {
        $outTag = new SimpleTag("entry", "", array('xmlns' => 'http://www.w3.org/2005/Atom', 'xmlns:clipp' => 'http://clipp.in/service/ns'));
        $outTag = $this->_get($outTag);
        return $outTag->get();
    }
    function _get($outTag)
    {
        $outTag = parent::_get($outTag);
        foreach (ArrayUtil::arrays($this->category) as $category) {
            if (!empty($category)) {
예제 #17
0
파일: Crud.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Flow");
Rhaco::import("db.Dao");
Rhaco::import("db.ActiveMapper");
Rhaco::module("CrudTools");
/**
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Crud extends Flow
{
    private function get_class($name)
    {
        $this->search_model();
        if (class_exists($name)) {
            return new $name($this->to_dict("primary"));
        }
        return ACTIVE_TABLE($name, null, $this->to_dict("primary"));
    }
    public function do_find($name)
    {
        if ($this->login()) {
            $class = $this->get_class($name);
            $order = $this->inVars("order");
            $paginator = new Paginator(10, $this->inVars("page"));
            $this->vars("object_list", $class->find_page($this->inVars("query"), $paginator, $order, $this->inVars("porder")));
            $this->vars("paginator", $paginator->cp(array("query" => $this->inVars("query"), "porder" => $order)));
            $this->vars("porder", $order);
            $this->vars("model", $class);
            $this->vars("f", new CrudTools($name));
예제 #18
0
파일: Stage.php 프로젝트: riaf/concert
<?php

Rhaco::import("model.table.StageTable");
/**
 * 
 */
class Stage extends StageTable
{
}
예제 #19
0
<?php

Rhaco::import("db.Dao");
/**
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class StatementIterator implements Iterator
{
    private $dao;
    private $statement;
    private $resultset;
    private $key;
    private $resultset_counter;
    public function __construct(Dao $dao, PDOStatement $statement)
    {
        $this->dao = $dao;
        $this->statement = $statement;
    }
    public function rewind()
    {
        $this->resultset = $this->statement->fetch(PDO::FETCH_ASSOC);
        $this->resultset_counter = 0;
    }
    public function current()
    {
        $obj = clone $this->dao;
        $this->key = $obj->parse_resultset($this->resultset);
        return $obj;
    }
    public function key()
예제 #20
0
<?php

require dirname(__FILE__) . '/__init__.php';
Rhaco::import('generic.Flow');
Rhaco::import('network.http.Header');
$flow = new Flow();
if (!$flow->isVariable('id')) {
    Header::redirect(Rhaco::url());
}
$db = new DbUtil(Event::connection());
if ($flow->isPost() && $flow->isVariable('pass')) {
    $participant = $db->get(new Participant($flow->getVariable('id')));
    if (Variable::istype('Participant', $participant) && $participant->hash === $flow->getVariable('pass')) {
        $db->delete($participant);
        Header::redirect(Rhaco::url());
    }
}
$flow->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description')));
$flow->write('cancel.html');
예제 #21
0
파일: Dao.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Paginator");
Rhaco::import("core.Text");
Rhaco::import("core.Model");
Rhaco::import("db.Db");
Rhaco::import("db.Column");
Rhaco::import("db.Q");
Rhaco::module("StatementIterator");
/**
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
abstract class Dao extends Object implements Model
{
    private static $CONNECTION;
    private static $DAO;
    protected $_database_;
    protected $_table_;
    protected $_has_hierarchy_ = 1;
    private $_columns_ = array();
    private $_self_columns_ = array();
    private $_conds_ = array();
    private $_alias_ = array();
    protected $_class_id_;
    protected $_has_many_conds_ = array();
    protected $_hierarchy_;
    protected function __new__()
    {
        if (func_num_args() == 1) {
            $this->dict(func_get_arg(0));
예제 #22
0
파일: Templf.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Tag");
Rhaco::import("core.Http");
Rhaco::import("core.Flow");
/**
 * テンプレートで利用するフォーマットツール
 *
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Templf
{
    /**
     * フォーマットした日付を取得
     * @param int $value
     * @param string $format
     * @return string
     */
    public static final function df($value, $format = "Y/m/d H:i:s")
    {
        return date($format, $value);
    }
    /**
     * HTML表現を返す
     * @param string $value
     * @param int $letgth
     * @param int $lines
     * @return string
     */
    public static final function html($value, $length = 0, $lines = 0)
예제 #23
0
<?php

/**
 * Clipp API
 *
 * @author  riaf <*****@*****.**>
 * @package arbo
 * @version $Id$
 */
Rhaco::import('network.http.ServiceRestAPIBase');
Rhaco::import('model.ClippAtomEntry10');
class ClippAPI extends ServiceRestAPIBase
{
    var $url = 'http://clipp.in/service/';
    var $method;
    function ClippAPI($user, $pass)
    {
        parent::ServiceRestAPIBase($this->url);
        $this->setBasicAuthorization($user, $pass);
    }
    function add($entry)
    {
        $this->method = 'add';
        if (Variable::istype('ClippAtomEntry10', $entry)) {
            $this->browser->setRequestHeader(array('type' => 'application/atom+xml;type=entry;charset=utf-8', 'rawdata' => '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . $entry->get()));
            return $this->post();
        }
        return false;
    }
    function buildUrl($hash = array())
    {
예제 #24
0
<?php

require_once '__init__.php';
Rhaco::import('generic.Urls');
Rhaco::import('model.Todo');
Rhaco::import('model.Category');
$db = new DbUtil(Category::connection());
$patterns = array('^$' => array('class' => 'generic.Views', 'method' => 'read', 'args' => array(new Todo(), new C(Q::eq(Todo::columnClose(), false), Q::fact())), 'template' => 'list.html'), '^detail/(\\d+)$' => array('method' => 'detail', 'args' => array(new Todo(), new C(Q::fact()))), '^create$' => array('method' => 'create', 'args' => array(new Todo(), Rhaco::url())), '^update/(\\d+)$' => array('method' => 'update', 'args' => array(new Todo(), null, Rhaco::url())), '^delete/(\\d+)$' => array('method' => 'delete', 'args' => array(new Todo(), null, Rhaco::url())), '^cat/(\\d+)$' => array('method' => 'detail', 'args' => array(new Category(), new C(Q::depend()))));
$parser = Urls::parser($patterns, $db);
$parser->setVariable('categories', $db->select(new Category()));
$parser->write();
예제 #25
0
파일: Request.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.File");
/**
 * リクエストを処理する
 *
 * @author Kazutaka Tokushima
 * @license New BSD License
 */
class Request extends Object
{
    protected static $__user__ = "type=variable";
    protected static $__vars__ = "type=variable{}";
    protected static $__sessions__ = "type=variable{}";
    protected static $__files__ = "type=File[]";
    protected static $__args__ = "type=string";
    protected $vars = array();
    protected $sessions = array();
    protected $files = array();
    protected $args;
    protected $user;
    private $loginId;
    private $expire = 1209600;
    public static function __import__()
    {
        /** (none/nocache/private/private_no_expire/public) */
        session_cache_limiter(Rhaco::def("core.Request@limiter", "nocache"));
        session_cache_expire(Rhaco::def("core.Request@expire", 2592000));
        session_start();
    }
    protected function setSessions($key, $value)
예제 #26
0
파일: Model.php 프로젝트: hisaboh/w2t
<?php

Rhaco::import("core.Paginator");
interface Model
{
    public function sync();
    public function delete();
    public function save();
    public function commit();
    public function rollback();
    public function find_page($query, Paginator $paginator, $order, $porder = null);
    public function set_model($vars);
    public function values();
}
예제 #27
0
<?php

Rhaco::import("model.table.StageCategoryTable");
/**
 * 
 */
class StageCategory extends StageCategoryTable
{
}
예제 #28
0
<?php

Rhaco::import("model.table.ParticipantTable");
Rhaco::import('network.mail.Mail');
/**
 * 
 */
class Participant extends ParticipantTable
{
    function beforeInsert($db)
    {
        $event = $db->get(new Event($this->event));
        if (Variable::istype('Event', $event) && $event->isActive($db)) {
            $this->hash = crypt($this->name . time() . mt_rand(0, 9999));
            if ($this->mail) {
                $parser = new HtmlParser('thanks.mtpl');
                $parser->setVariable('participant', $this);
                $mail = new Mail('*****@*****.**', 'rhaco kaigi');
                $mail->to($this->mail, $this->name);
                $mail->subject('rhaco kaigi');
                $mail->message($parser->read());
                $mail->send();
            }
            return true;
        }
        return false;
    }
    function beforeDelete($db)
    {
        $event = $db->get(new Event($this->event));
        if (!Variable::istype('Event', $event) || !$event->isActive($db)) {
예제 #29
0
파일: Flow.php 프로젝트: hisaboh/w2t
 /**
  * URLのパターンからTemplateを切り替える
  * @param array $urlconf
  */
 public function handler(array $urlconf = array())
 {
     $params = array();
     foreach ($urlconf as $pattern => $conf) {
         if (is_int($pattern)) {
             $pattern = $conf;
             $conf = null;
         }
         if (preg_match("/" . str_replace(array("\\/", "/", "__SLASH__"), array("__SLASH__", "\\/", "\\/"), $pattern) . "/", $this->args(), $params)) {
             if ($conf !== null) {
                 if (is_array($conf)) {
                     if (isset($conf["class"])) {
                         $this->class = $conf["class"];
                     }
                     if (isset($conf["method"])) {
                         $this->method = $conf["method"];
                     }
                     if (isset($conf["template"])) {
                         $this->template = $conf["template"];
                     }
                     if (isset($conf["name"])) {
                         $this->name = $conf["name"];
                     }
                 } else {
                     $this->dict($conf);
                 }
             }
             self::$match_pattern = empty($this->name) ? $params[0] : $this->name;
             if (!empty($this->class)) {
                 if (false !== strrpos($this->class, ".") || !class_exists($this->class)) {
                     $this->class = Rhaco::import($this->class);
                 }
                 if (empty($this->method) && !empty($pattern)) {
                     $method_patterns = array();
                     $patterns = explode("/", $pattern);
                     if ($patterns[0] == "^") {
                         array_shift($patterns);
                     }
                     foreach ($patterns as $p) {
                         if (!preg_match("/[\\w_]/", $p)) {
                             break;
                         }
                         $method_patterns[] = $p;
                     }
                     if (!empty($method_patterns)) {
                         $this->method = implode("_", $method_patterns);
                     }
                 }
             }
             if (empty($this->method) && !empty($this->template)) {
                 $obj = new self();
                 $obj->copy_module($this, true);
                 $obj->template($this->template);
             } else {
                 $method = empty($this->method) ? "index" : $this->method;
                 if (!method_exists($this->class, $method)) {
                     throw new Exception("Not found " . $this->class . "::" . $method);
                 }
                 array_shift($params);
                 try {
                     $class = $this->class;
                     $action = new $class();
                     $action->copy_module($this, true);
                     if ($action instanceof self) {
                         $action->handled();
                     }
                     $obj = call_user_func_array(array($action, $method), $params);
                 } catch (Exception $e) {
                     Log::debug($e);
                     $on_error = Rhaco::def("core.Flow@on_error");
                     if ($on_error === null) {
                         throw $e;
                     }
                     if (isset($on_error[0])) {
                         Http::status_header((int) $on_error[0]);
                     }
                     if (isset($on_error[2])) {
                         Http::redirect($on_error[2]);
                     }
                     if (isset($on_error[1])) {
                         $template = new Template();
                         $template->output($on_error[1]);
                     }
                     exit;
                 }
             }
             if ($obj instanceof self) {
                 $obj = $obj->templ();
             }
             if (!$obj instanceof Template) {
                 throw new Exception("Forbidden " . $this->args());
             }
             $obj->path($this->path());
             $obj->url($this->url());
             $this->templ = $obj;
             if (!$this->isTemplate()) {
                 $this->template($obj->filename());
             }
             if (!$this->isTemplate()) {
                 $cs = explode(".", $this->class);
                 $class = array_pop($cs);
                 $class = implode("/", $cs) . (!empty($cs) ? "/" : "") . strtolower($class[0]) . substr($class, 1);
                 $this->template($class . "/" . $method . ".html");
             }
             return $this;
         }
     }
     throw new Exception("no match pattern");
 }
예제 #30
0
<?php

/**
 * Tumblr API
 *
 * @author  riaf<*****@*****.**>
 * @package arbo
 * @license New BSD License
 * @version $Id$
 */
Rhaco::import('network.http.ServiceRestAPIBase');
class TumblrAPI extends ServiceRestAPIBase
{
    var $url = 'http://www.tumblr.com/api/';
    var $login;
    var $password;
    var $method;
    function TumblrAPI($login, $password)
    {
        parent::ServiceRestAPIBase();
        $this->login = $login;
        $this->password = $password;
    }
    /**
     * 投稿
     */
    function write($params, $type = 'Regular')
    {
        $this->method = 'write';
        return $this->post(array_merge($params, array('email' => $this->login, 'password' => $this->password, 'type' => $type)));
    }