2011年5月24日火曜日

I wrote lryics.

Title: The Ocean
Word and copyright by Yoshi Sakai ( Licence by GPL Ver.2)

Before, I had a too much pride. But I was so blind.
Now I have a mention. Cause you gave me an attention.
You know you can do nothing and thru. But you gave me a true.
So now, we hands on tight. we come over the hard days and night.

Into deep. Keep our mind.
Let's get together, We can help each other.

Into sea. See your mind.
So we can be free. Like a wave on the ocean.

Hug, each other.
 (Guitar solo)

Into deep. Keep our mind.
Let's get together, We can help each other.

Into sea. See my mind.
So we can be free. Like a wave on the ocean.

2011年5月22日日曜日

民間で「単一サイバー認証」導入を、米政府が新戦略

気になったツイートを後からたどってブログに構成しています。事のはじまりまりはAFPBBの記事のツイートからです。

http://www.afpbb.com/article/environment-science-it/it/2796095/7103232
【4月18日 AFP】米ホワイトハウス(White House)は15日、単一のオンライン認証サービスを民間主導で開発し、インターネットの信頼性向上やネット事業促進を目指す新たな国家戦略を発表した。

バラク・オバマ(Barack Obama)米大統領は声明で、「オンライン決済の信頼性とプライバシー保護をより高めることで、犯罪を防止するとともに、企業や消費者に信頼性を提供し、成長とイノベーションを促進する」と述べた。
新戦略「サイバースペースにおける認証済み身元情報のための国家戦略(National Strategy for Trusted Identities in Cyberspace NSTIC)」は、単一の認証サービスを民間主導で開発し、希望する個人に提供するというもの。
http://www.nist.gov/nstic/identity-ecosystem.html

米国サイトを見てみるとOpenIDは何も触れられていませんが、流れから言ってOpenID/Connect が第一候補だと思っています。逆に他の独自な認証がくればビックリな訳ですが、ともかくどういう流れになるのかはCMSやECサイトの構築や運営に関わる人なら気になる所ではないでしょうか?

という事で米国OpenID財団の理事長であるNatさんにWeeklyCMSでの講演を依頼した訳ですが先約の大学のキャンパスが複数に分かれていて当日の場所移動が物理的に無理という事が急遽判明しました。そこで、私ができる範囲でカバーし OpenID/Connect の概要とこれからを紹介したいと思います。そして、私の後は、OpenID/Twitter/Facebook(ソーシャル認証「これも気になりますが・・・」)のテクニカルに詳しい大和田氏へとバトンを渡す形で5月28日のマイクロソフト本社からのWeeklyCMS放送を行う予定です。

ではでは、皆様どんな講演になるかはこうご期待!

2011年5月20日金曜日

Calender view of each CMS

2011年5月6日金曜日

XOOPS Cube に IE6,7,8 でログインできない場合

FireFox,Safari等ではログインできるのにIEだとどのバージョンでもNGだという報告があり調べてみると、COOKIEの保存の仕方にIE独特のクセがある事がわかりました。

例えば www を抜かしてhttpにアクセスさせるやり方を最近多く見かけますが、サブドメインの有無のどちらにも対応してくれるのがfirefox等で、IEの場合DNSの設定によるかもしれませんがサブドメイン無しが優先的に記録される様です。(現状推測)

という訳で、www.hoge.com / hoge.com と両方からアクセスできてIEだけが「ログインしました」と表示されてログアウト状態になる場合はXOOPS_URL を見直してみましょう。私の場合はサブドメインをカットして正常にログインできる様になりました。

2011年5月2日月曜日

教えて!XOOのカテゴリにグループ権限を追加

今日は @minahito さんの plzXoo モジュールのハッキングについて。

ゲスト用には見えなくてユーザー登録すると見えるQ&Aが欲しいとのオーダーにより作成しました。


まずは、SQL。ユーザーグループを指定できればいいのでシンプルに整数で。
CREATE TABLE plzxoo_category (
    `cid` int(10) auto_increment,
    `pid` int(10) NOT NULL default 0,
    `name` varchar(255) NOT NULL default '',
    `description` text NOT NULL,
    `size` mediumint(5) NOT NULL default 0,
    `weight` mediumint(5) NOT NULL default 0,
    `groupid` tinyint(1) NOT NULL default 0,
    PRIMARY KEY (`cid`) ,
    KEY (`weight`) ,
    KEY (`pid`)
) TYPE=MyISAM;
 済んだら class CategoryEditFormで編集用のインターフェースを準備
<?php

require_once "exForm/Form.php";

class CategoryEditForm extends exActionFormEx
{
    var $cid_;
    var $pid_;
    var $name_;
    var $description_;
    var $groupid_;

    function fetch(&$master) {

        $this->pid_ = intval($_POST['pid']);
        // pid 妥当性検査
        if($this->pid_) {
            $handler=&plzXoo::getHandler('category');
            $obj=&$handler->get($this->pid_);
            if(!is_object($obj))
                $this->addError(_MD_PLZXOO_ERROR_PID_INJURY);
        }

        $this->name_ = trim($_POST['name']);
        if(!$this->name_) {
            $this->addError(_MD_PLZXOO_ERROR_NAME_REQUIRED);
        }
        if(!$this->validateMaxLength($this->name_, 255)) {
            $this->addError(_MD_PLZXOO_ERROR_NAME_SIZEOVER);
        }

        $this->description_ = $_POST['description'];

        $this->weight_ = intval( $_POST['weight'] ) ;
        $this->groupid_ = intval( $_POST['groupid'] ) ;
    }

    function load(&$master) {
        $this->cid_ = $master->getVar ( 'cid', 'e' );
        $this->pid_ = $master->getVar ( 'pid', 'e' );
        $this->name_ = $master->getVar ( 'name', 'e' );
        $this->weight_ = $master->getVar ( 'weight', 'e' );
        $this->groupid_ = $master->getVar ( 'groupid', 'e' );
        $this->description_ = $master->getVar ( 'description', 'e' );
    }

    function update(&$master) {
        $master->setVar ( 'pid', $this->pid_ );
        $master->setVar ( 'name', $this->name_ );
        $master->setVar ( 'weight', $this->weight_ );
        $master->setVar ( 'groupid', $this->groupid_ );
        $master->setVar ( 'description', $this->description_ );
    }
}


?>
language/hoge/admin.phpに変数追加して

define ( '_MD_A_PLZXOO_LANG_GROUPID','groupid' );

管理者画面に項目を追加。
<?php

require_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";

class default_CategoryView_input
{
    function &execute (&$controller, &$request, &$user)
    {
        $editform=&$request->getAttribute('editform');
       
        $form = new XoopsThemeForm(_MD_A_PLZXOO_LANG_EDIT_CATEGORY,'Category','','POST');

        $form->addElement(new XoopsFormHidden('cid',$editform->cid_));

        $form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_NAME,'name',64,255,$editform->name_));

        //-------------------------
        // 親カテゴリ
        //-------------------------
        $select =new XoopsFormSelect(_MD_A_PLZXOO_LANG_PARENT_CATEGORY,'pid',$editform->pid_);
            $select->addOption(0, _MD_A_PLZXOO_LANG_TOP );
            $categories=&$request->getAttribute('categories');
            foreach($categories as $category){
                $select->addOption($category->getVar('cid'),$category->getVar('name'));
            }

        $form->addElement($select);
        unset($select);

        $form->addElement(new XoopsFormDhtmlTextArea(_MD_A_PLZXOO_LANG_DESCRIPTION,'description',$editform->description_,6, 50));

        $form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_WEIGHT,'weight',10,10,intval($editform->weight_)));
        $form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_GROUPID,'groupid',10,10,intval($editform->groupid_)));

        $tray = new XoopsFormElementTray(_MD_A_PLZXOO_LANG_CONTROL);
        $tray->addElement( new XoopsFormButton ( '', 'submit', _MD_A_PLZXOO_LANG_SUBMIT, 'submit' ) );
        $tray->addElement( new XoopsFormButton ( '', 'reset', _MD_A_PLZXOO_LANG_RESET, 'reset' ) );
        $form->addElement($tray);

        $renderer = new mojaLE_Renderer($controller,$request,$user);
        $renderer->setTemplate('category_edit.tpl');

        $renderer->setAttribute('xoopsform',$form);

        return $renderer;
    }
}

?>

後は、表でロードした時にWHERE条件を追加 category.class.php

    /* class function */
    function getChildren( $cid )
    {
        // hack by bluemoon: Added groupid
        global $xoopsUser;
        if (is_object( $xoopsUser )){
            $gids = array_merge( array(0,3) , $xoopsUser->getGroups());
            $usergroups = implode( ",", $gids );
            if ( $usergroups ) $addwhere = " AND groupid in ($usergroups)";
        }else{
            $addwhere = " AND groupid in (0,3)";
        }
        $db =& Database::getInstance() ;
        $sql = "SELECT `cid`,`name`,`groupid` FROM ".$db->prefix('plzxoo_category').
            " WHERE `pid`=".intval($cid).$addwhere." ORDER BY `weight`" ;
        $result = $db->query( $sql ) ;
        $ret = array() ;
        while( list( $cid , $name ) = $db->fetchRow( $result ) ) {
            $ret[] = array( $cid => $name ) ;
        }

        return $ret ;
    }

これでOK。無事会員専用Q&Aの出来上がり。