2 // vim: tabstop=2:shiftwidth=2
5 * NP_AuthSister ($Revision$)
\r
6 * by hsur ( http://blog.cles.jp/np_cles )
\r
12 * Copyright (C) 2008 CLES. All rights reserved.
\r
14 * This program is free software; you can redistribute it and/or
\r
15 * modify it under the terms of the GNU General Public License
\r
16 * as published by the Free Software Foundation; either version 2
\r
17 * of the License, or (at your option) any later version.
\r
19 * This program is distributed in the hope that it will be useful,
\r
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
22 * GNU General Public License for more details.
\r
24 * You should have received a copy of the GNU General Public License
\r
25 * along with this program; if not, write to the Free Software
\r
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
28 * In addition, as a special exception, cles( http://blog.cles.jp/np_cles ) gives
\r
29 * permission to link the code of this program with those files in the PEAR
\r
30 * library that are licensed under the PHP License (or with modified versions
\r
31 * of those files that use the same license as those files), and distribute
\r
32 * linked combinations including the two. You must obey the GNU General Public
\r
33 * License in all respects for all of the code used other than those files in
\r
34 * the PEAR library that are licensed under the PHP License. If you modify
\r
35 * this file, you may extend this exception to your version of the file,
\r
36 * but you are not obligated to do so. If you do not wish to do so, delete
\r
37 * this exception statement from your version.
\r
41 define('_AuthSister_font', dirname(__FILE__).'/sharedlibs/auth_sister/ipagp.ttf');
\r
42 require_once(dirname(__FILE__).'/sharedlibs/sharedlibs.php');
\r
43 require_once('auth_sister/core.php');
45 $authSister = new AuthSister();
46 $authSister->session_start();
\r
48 class NP_AuthSister extends NucleusPlugin {
\r
50 function getName() {
\r
51 return 'AuthSister';
\r
53 function getAuthor() {
\r
57 return 'http://blog.cles.jp/np_cles/category/31/subcatid/23';
\r
59 function getVersion() {
\r
62 function getMinNucleusVersion() {
\r
65 function getMinNucleusPatchLevel() {
\r
68 function getEventList() {
\r
69 return array ('FormExtra', 'ValidateForm', 'InitSkinParse');
\r
71 function getDescription() {
\r
72 return _AuthSister_DESC;
\r
74 function supportsFeature($what) {
\r
76 case 'SqlTablePrefix':
\r
82 function hasAdminArea() {
\r
86 function install() {
\r
87 $this->createOption('load', 'load', 'text', 'reiya');
\r
91 // include language file for this plugin
\r
92 $language = ereg_replace( '[\\|/]', '', getLanguageName());
\r
93 if (file_exists($this->getDirectory().'language/'.$language.'.php'))
\r
94 @include_once($this->getDirectory().'language/'.$language.'.php');
\r
96 global $authSister, $CONF;
\r
98 $authSister->load = $this->getOption('load');
\r
99 $authSister->mes_a = _AuthSister_mes_a;
\r
100 $authSister->mes_b = _AuthSister_mes_b;
\r
101 $authSister->method = _AuthSister_method;
\r
102 $authSister->len_min = _AuthSister_len_min;
\r
103 $authSister->len_max = _AuthSister_len_max;
\r
104 $authSister->outlen = _AuthSister_outlen;
\r
105 $authSister->font = _AuthSister_font;
\r
106 $authSister->basedir = $this->getAdminURL().'../sharedlibs/auth_sister';
\r
107 $authSister->imageurl = $CONF['ActionURL'] . '?action=plugin&name=AuthSister&type=img';
110 function _info($msg) {
\r
111 if ($this->getOption('debug') == 'yes') {
\r
112 ACTIONLOG :: add(INFO, 'AuthSister: '.$msg);
\r
116 function _warn($msg) {
\r
117 ACTIONLOG :: add(WARNING, 'AuthSister: '.$msg);
\r
120 function event_InitSkinParse(&$data){
123 function doSkinVar($skinType, $type = '') {
128 $authSister->header();
131 return 'Unexisting type: ' . $type;
135 function doAction($type){
136 global $CONF,$manager;
138 $aActionsNotToCheck = array(
142 if (!in_array($type, $aActionsNotToCheck)) {
143 if (!$manager->checkTicket()) return _ERROR_BADTICKET;
147 // When no action type is given, assume it's a ping
150 $authSister->show_image('img','png');
156 function event_FormExtra(&$data) {
\r
157 global $manager, $member;
\r
159 if ($member->isLoggedIn())
\r
162 switch ($data['type']) {
\r
163 case 'commentform-notloggedin' :
\r
164 case 'membermailform-notloggedin':
\r
170 $externalauth = array ( 'source' => $this->getName() );
\r
171 $manager->notify('ExternalAuth', array ('externalauth' => &$externalauth));
\r
172 if (isset($externalauth['result']) && $externalauth['result'] == true) return;
\r
174 switch ($data['type']) {
\r
175 case 'membermailform-notloggedin' :
\r
176 case 'commentform-notloggedin' :
177 echo $authSister->load();
\r
178 echo $authSister->insert();
\r
183 function event_ValidateForm(&$data) {
\r
184 global $manager, $member;
\r
186 if ($member->isLoggedIn())
\r
189 $externalauth = array ( 'source' => $this->getName() );
\r
190 $manager->notify('ExternalAuth', array ('externalauth' => &$externalauth));
\r
191 if (isset($externalauth['result']) && $externalauth['result'] == true) return;
\r
193 if ($authSister->auth()) {
\r
194 //echo $authSister->res();
\r
197 $data['error'] = $authSister->res();
\r