protected function _loadPengin()
 {
     $pengin = Pengin::getInstance();
     $pengin->path(XOOPS_ROOT_PATH . '/modules/social_media');
     $pengin->translator->useTranslation('social_media', $pengin->cms->langcode, 'translation');
     $this->pengin = $pengin;
 }
 public function __construct()
 {
     /*
       下位クラスは__constructを継承する。
       下位クラスはparent::__construct()すること。
       __constructでは、クラス変数などの初期化を行う。
       Actionを含めることはできない。
     */
     $this->root =& Pengin::getInstance();
     $this->Controller = $this->root->context->Controller;
     $this->Action = $this->root->context->Action;
     $this->controller = $this->root->context->controller;
     $this->action = $this->root->context->action;
     $this->dirname = $this->root->context->dirname;
     $this->url = $this->root->context->url;
     $this->path = $this->root->context->path;
     $this->name = $this->root->context->name;
     $this->options = $this->root->context->options;
     $this->output['url'] =& $this->url;
     $this->output['dirname'] =& $this->dirname;
     $this->output['controller'] =& $this->controller;
     $this->output['action'] =& $this->action;
     $this->output['options'] =& $this->options;
     $this->_setUpModelHandlers();
 }
示例#3
0
 protected function _init($module)
 {
     $this->root =& Pengin::getInstance();
     $this->module = $module;
     $this->dirname = $module->getVar('dirname');
     $this->path = $this->root->cms->modulePath . DS . $this->dirname;
 }
示例#4
0
 protected function _loginAction()
 {
     $option = $this->_getProviderOption();
     // セッションにアクセストークンがなかったらloginページに飛ぶ
     // サインインしていてもログイン状態でなければSESSIONを消す
     $pengin =& Pengin::getInstance();
     if ($pengin->cms->isUser() == false) {
         unset($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
     }
     if (isset($_SESSION['oauth_token']) == true and isset($_SESSION['oauth_token_secret']) == true) {
         if ($_SESSION['oauth_token'] === NULL && $_SESSION['oauth_token_secret'] === NULL) {
             $tokenExist = false;
         } else {
             $tokenExist = true;
         }
     } else {
         $tokenExist = false;
     }
     if ($tokenExist == false) {
         // OAuthオブジェクト生成
         $to = new TwitterOAuth($option['key'], $option['secret']);
         // callbackURLを指定してRequest tokenを取得
         $tok = $to->getRequestToken($this->connect);
         // セッションに保存
         $_SESSION['request_token'] = $token = $tok['oauth_token'];
         $_SESSION['request_token_secret'] = $tok['oauth_token_secret'];
         // サインインするためのURLを取得
         $url = $to->getAuthorizeURL($token);
         header("location:" . $url);
         die;
     } else {
         //サインインしていればヘッダーを出力
         //include("user_header.php");
     }
 }
示例#5
0
 public function __construct()
 {
     /*
       下位クラスは__constructを継承する。
       下位クラスはparent::__construct()すること。
       __constructでは、クラス変数などの初期化を行う。
       Actionを含めることはできない。
     */
     $this->root =& Pengin::getInstance();
     $this->Controller = $this->root->context->Controller;
     $this->Action = $this->root->context->Action;
     $this->controller = $this->root->context->controller;
     $this->action = $this->root->context->action;
     $this->dirname = $this->root->context->dirname;
     $this->url = $this->root->context->url;
     $this->path = $this->root->context->path;
     $this->name = $this->root->context->name;
     $this->output['url'] =& $this->url;
     $this->output['dirname'] =& $this->dirname;
     $this->output['controller'] =& $this->controller;
     $this->output['action'] =& $this->action;
     $this->output['breadcrumbs'] =& $this->breadcrumbs;
     $this->output['page_title'] =& $this->pageTitle;
     $this->pageTitle = $this->root->cms->getThisModuleName();
     $this->_addBreadCrumb($this->pageTitle, $this->url);
     $this->_setUpModelHandlers();
 }
示例#6
0
 function pengin_block_get_content(array $options)
 {
     ob_start();
     $pengin =& Pengin::getInstance();
     $pengin->main('block', $options);
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
示例#7
0
 public static function check($stub)
 {
     $root =& Pengin::getInstance();
     $tokens = $root->session('tokens');
     if (!isset($tokens[$stub])) {
         return false;
     }
     if (time() >= $tokens[$stub]) {
         unset($tokens[$stub]);
         $root->session('tokens', $tokens);
         return false;
     }
     unset($tokens[$stub]);
     $root->session('tokens', $tokens);
     return true;
 }
示例#8
0
function pengin_call_preload_dispatcher($controller, $action, $dirname)
{
    $options = array('controller' => $controller, 'action' => $action, 'dirname' => $dirname);
    try {
        ob_start();
        $pengin =& Pengin::getInstance();
        $pengin->main('preload', $options);
        $content = ob_get_contents();
        ob_end_clean();
    } catch (RuntimeException $e) {
        ob_flush();
        trigger_error($e->getMessage(), E_USER_WARNING);
        return false;
    } catch (Exception $e) {
        ob_flush();
        return false;
    }
    return $content;
}
示例#9
0
 public function getSocialLoginLinks()
 {
     $links = array();
     // テーブルを参照する
     $pengin =& Pengin::getInstance();
     $pengin->path(TP_MODULE_PATH . '/social_media');
     $providerHandler = $pengin->getModelHandler('Provider', 'social_media');
     $criteria = new Pengin_Criteria();
     $providerModel = $providerHandler->find($criteria, 'weight');
     foreach ($providerModel as $provider) {
         if ($provider->get('option') != '') {
             $link['name'] = $provider->get('name');
             $link['title'] = t('Login by {1}', $provider->get('name'));
             $link['url'] = sprintf(XOOPS_URL . '/modules/social_media/index.php?controller=%s&action=login', $provider->get('name'));
             $link['image'] = sprintf(XOOPS_URL . '/modules/social_media/public/images/%s_login.png', $provider->get('name'));
             $links[] = $link;
         }
     }
     return $links;
 }
示例#10
0
 protected function _fetchTransactionKey()
 {
     $this->transactionKey = Pengin::getInstance()->post($this->transactionKeyName);
 }
示例#11
0
function pen_dump()
{
    $root = Pengin::getInstance();
    $args = func_get_args();
    call_user_func_array(array($root, 'dump'), $args);
}
示例#12
0
<?php

/**
 * A simple description for this script
 *
 * PHP Version 5.2.0 or Upper version
 *
 * @package    SocialMedia
 * @author     Hidehito NOZAWA aka Suin <http://ryus.co.jp>
 * @copyright  2010 Hidehito NOZAWA
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
 *
 */
require '../../mainfile.php';
require_once PENGIN_PATH . '/Pengin.php';
require_once XOOPS_ROOT_PATH . '/header.php';
if (isset($_GET['controller']) === false) {
    $_GET['controller'] = 'default';
}
$pengin =& Pengin::getInstance();
$pengin->main();
require_once XOOPS_ROOT_PATH . '/footer.php';
 protected function _addModified(&$obj)
 {
     if ($obj->isKeyExists('modified')) {
         $obj->setVar('modified', time());
     }
     if ($obj->isKeyExists('modifier_id')) {
         $obj->setVar('modifier_id', Pengin::getInstance()->cms->getUserId());
     }
 }
示例#14
0
 public static function run(array $params, &$smarty)
 {
     $root =& Pengin::getInstance();
     return $root->url(null, null, $params);
 }
示例#15
0
 public function __construct()
 {
     $pengin =& Pengin::getInstance();
     $this->connect = $pengin->cms->moduleUrl . '/' . $pengin->cms->getThisModuleDirname() . '/index.php?controller=facebook&action=after_login';
     parent::__construct();
 }
 protected function __construct()
 {
     $root =& Pengin::getInstance();
     $this->db =& $root->cms->database();
 }