当前位置: 首页>>代码示例>>PHP>>正文


PHP auth::check_auth方法代码示例

本文整理汇总了PHP中auth::check_auth方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::check_auth方法的具体用法?PHP auth::check_auth怎么用?PHP auth::check_auth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth的用法示例。


在下文中一共展示了auth::check_auth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plugin_xbel_convert

function plugin_xbel_convert()
{
    global $script, $vars;
    global $_xbel_msg;
    // ユーザ認証されていない
    $id = auth::check_auth();
    if (empty($id)) {
        return '';
    }
    $argv = func_get_args();
    $argc = func_num_args();
    $field = array('pref');
    for ($i = 0; $i < $argc; $i++) {
        ${$field}[$i] = $argv[$i];
    }
    if (empty($pref)) {
        $pref = XBEL_PREF_PAGE;
    }
    $page_pref = xbel::get_data_prefix($pref);
    $rc = <<<EOD
<form action="{$script}" method="post">
<input type="hidden" name="plugin" value="xbel" />
<input type="hidden" name="adm" value="list" />
<div>
{$_xbel_msg['msg_text']}
</div>
<table>
EOD;
    $i = 0;
    foreach ($page_pref as $_page) {
        $i++;
        $url = get_page_uri($_page);
        $rc .= <<<EOD
<tr>
 <td><input type="checkbox" name="{$i}_c" /></td>
 <td><input type="hidden" name="{$i}_n" value="{$_page}" /><a href="{$url}">{$_page}</a></td>
</tr>

EOD;
    }
    if ($i == 0) {
        return $_xbel_msg['msg_zero'];
    }
    $rc .= <<<EOD
</table>
<div>
<input type="submit" value="{$_xbel_msg['btn_exec']}" />
</div>
</form>

EOD;
    return $rc;
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:53,代码来源:xbel.inc.php

示例2: plugin_brokenlink_action

function plugin_brokenlink_action()
{
    global $vars, $_brokenlink_msg;
    $retval = array('msg' => $_brokenlink_msg['msg_title'], 'body' => '');
    if (empty($vars['page'])) {
        $retval['body'] = $_brokenlink_msg['msg_param_error'];
        return $retval;
    }
    // ユーザ認証されていない
    $id = auth::check_auth();
    if (empty($id)) {
        $retval['body'] = $_brokenlink_msg['msg_not_access'];
        return $retval;
    }
    if (!exist_plugin('xbel')) {
        $retval['body'] = $_brokenlink_msg['msg_not_found_xbel'];
        return $retval;
    }
    $links = xbel::get_link_list($vars['page']);
    $data = '';
    foreach ($links as $href => $aname) {
        $rc = http_request($href, 'HEAD');
        switch ($rc['rc']) {
            case 200:
                // Ok
            // Ok
            case 301:
                // Moved Permanently
            // Moved Permanently
            case 401:
                // Unauthorized
                continue;
            default:
                $data .= '-[[' . $aname . '>' . $href . ']] (' . $rc['rc'] . ")\n";
        }
    }
    if ($data == '') {
        $data = $_brokenlink_msg['msg_all_ok'];
    }
    $retval['body'] = convert_html($data);
    return $retval;
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:42,代码来源:brokenlink.inc.php

示例3: passwd_menu

function passwd_menu($msg = '&nbsp;')
{
    global $script, $head_tags, $_passwd_msg, $auth_type, $realm, $vars;
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/md5.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/sha1.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/des.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/base64.js"></script>';
    $func = 'save';
    $role_level = auth::get_role_level();
    $old_algorithm = '';
    $r_realm = rawurlencode($realm);
    $checked_md5 = 'checked="checked"';
    $checked_sha1 = '';
    // adminpass を求める処理の場合か?
    $is_adminpass = isset($vars['adminpass']);
    if ($is_adminpass) {
        $use_pkwk_write_func = false;
        $auth_type = 1;
    } else {
        $use_pkwk_write_func = USE_PKWK_WRITE_FUNC;
    }
    // 役割に応じた設定
    if ($role_level == 2) {
        // 管理者
        $disabled_user = $user = '';
        $msg_pass = $_passwd_msg['msg_pass_admin'];
        $a1_des = "a1 = objForm.key.value;\n";
        $msg_role = <<<EOD
    <tr>
      <th>{$_passwd_msg['role']}</th>
      <td>
        <select name="role">
          <option value="">{$_passwd_msg['role_4']}</option>
          <option value="3">{$_passwd_msg['role_3']}</option>
          <option value="2">{$_passwd_msg['role_2']}</option>
        </select>
      </td>
    </tr>

EOD;
    } else {
        // 一般ユーザ
        $disabled_user = 'disabled="disabled"';
        // ゲスト時は、admin として一律生成できるようにしておく
        // $user = ($role_level == 0) ? 'admin' :  auth::check_auth();
        if ($role_level == 0) {
            $user = 'admin';
            $msg_pass = $_passwd_msg['msg_pass_none'];
            $a1_des = "a1 = objForm.key.value;\n";
        } else {
            $user = auth::check_auth();
            $msg_pass = $_passwd_msg['msg_pass_old'];
            $old_algorithm = passwd_get_scheme($user);
            switch ($old_algorithm) {
                case 'md5':
                    $checked_md5 = 'checked="checked"';
                    $checked_sha1 = '';
                    break;
                case 'sha1':
                    $checked_md5 = '';
                    $checked_sha1 = 'checked="checked"';
                    break;
            }
            // $a1_des = 'a1 = objForm.username.value+\':' . $realm . ":'+objForm.key.value;\n";
            $a1_des = 'a1 = objForm.username.value+\':\'+decodeURIComponent(objForm.realm.value)+\':\'+objForm.key.value;' . "\n";
        }
        $func = 'update';
        $msg_role = <<<EOD
    <tr>
      <th>{$_passwd_msg['role']}</th>
      <td>

EOD;
        $msg_role .= passwd_get_role_name($role_level) . ' (' . $role_level . ')';
        $msg_role .= <<<EOD
      </td>
    </tr>

EOD;
    }
    $msg_username = <<<EOD
    <tr>
      <th>{$_passwd_msg['UserName']}</th>
      <td><input type="text" name="username" size="10" value="{$user}" {$disabled_user} /></td>
    </tr>

EOD;
    switch ($auth_type) {
        case 1:
            // basic
            $pref = 'php';
            $submit_sha1 = "objForm.submit.disabled = false;\n";
            $a1 = "a1 = objForm.passwd.value;\n";
            // basic の場合は上書きする
            $a1_des = "a1 = objForm.key.value;\n";
            $disabled_sha1 = '';
            // 書き込み禁止 または ゲスト時は、ユーザ名不要
            if (!$use_pkwk_write_func || $role_level == 0) {
                $msg_username = '';
            }
//.........这里部分代码省略.........
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:101,代码来源:passwd.inc.php

示例4: get_existpages

 function get_existpages($dir = DATA_DIR, $ext = '.txt')
 {
     $rc = array();
     // ページ名の取得
     $pages = get_existpages($dir, $ext);
     // ユーザ名取得
     $uname = auth::check_auth();
     // コンテンツ管理者以上は、: のページも閲覧可能
     $is_colon = auth::check_role('role_adm_contents');
     // 役割の取得
     // $now_role = auth::get_role_level();
     foreach ($pages as $file => $page) {
         if (!auth::is_page_readable($uname, $page)) {
             continue;
         }
         if (substr($page, 0, 1) != ':') {
             $rc[$file] = $page;
             continue;
         }
         // colon page
         if ($is_colon) {
             continue;
         }
         $rc[$file] = $page;
     }
     return $rc;
 }
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:27,代码来源:auth.cls.php

示例5: htdigest_menu

function htdigest_menu($msg = '&nbsp;')
{
    global $script, $realm, $head_tags, $_htdigest_msg;
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/md4.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/md5.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/sha1.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/des.js"></script>';
    $head_tags[] = ' <script type="text/javascript" src="' . SKIN_URI . 'crypt/base64.js"></script>';
    // 使用する場合は、変更させることもコピーさせることも不要なので、抑止する
    $disabled = USE_APACHE_WRITE_FUNC ? 'disabled="disabled"' : '';
    $func = 'save';
    $role_level = auth::get_role_level();
    if ($role_level > 2) {
        $user_disabled = 'disabled="disabled"';
        $user = auth::check_auth();
        $func = 'update';
        $msg_pass = $_htdigest_msg['msg_pass_old'];
    } else {
        $user_disabled = $user = '';
        $msg_pass = $role_level == 2 ? $_htdigest_msg['msg_pass_admin'] : '';
    }
    $x = <<<EOD
<script type="text/javascript">
<!-- <![CDATA[

function set_hash()
{
 var a1,ctr,pref,hash,des_key;
 var fn = function(){
   switch(objForm.algorithm.value) {
   case 'MD4':
     hash = hex_md4(a1);
     break;
   case 'SHA-1':
     hash = hex_sha1(a1);
     break;
   default:
     objForm.submit.disabled = false;
     hash = hex_md5(a1);
   }
 };

 var objForm = eval("document.htdigest");
 objForm.submit.disabled = true;

 if (objForm.passwd.value == "" || objForm.key.value == "") {
   objForm.hash.value = "";
   objForm.algorithm.value = "";
 } else {

   ctr = objForm.scheme.length;
   for (i=0; i<ctr; i++) {
     if (objForm.scheme[i].checked) {
       objForm.algorithm.value = objForm.scheme[i].value;
       break;
     }
   }
EOD;
    if ($role_level > 2) {
        // a1
        $x .= "a1 = objForm.username.value+':'+objForm.realm.value+':'+objForm.key.value;\n";
    } else {
        // adminpass
        $x .= "a1 = objForm.key.value;\n";
    }
    $x .= <<<EOD
   fn();
   des_key = hash;

   a1 = objForm.username.value+':'+objForm.realm.value+':'+objForm.passwd.value;
   fn();

   objForm.hash.value = base64encode( des(des_key, hash, 1, 0) );
   objForm.passwd.value = "";
 }

 if (objForm.hash.value == "") {
   objForm.hash_view.value = "";
 } else {
   objForm.hash_view.value = objForm.username.value+':'+objForm.realm.value+':'+hash;
 }
}

//]]>-->
</script>

<h2>htdigest</h2>

<div>{$msg}</div>

<form name="htdigest" action="{$script}" method="post">
  <input type="hidden" name="plugin" value="htdigest" />
  <input type="hidden" name="func" value="{$func}" />
  <input type="hidden" name="algorithm" />
  <input type="hidden" name="hash" />
  <table class="indented">
    <tr>
      <th>{$_htdigest_msg['realm']}</th>
      <td><input type="text" name="realm" size="30" value="{$realm}" /></td>
    </tr>
//.........这里部分代码省略.........
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:101,代码来源:htdigest.inc.php

示例6: get_view_field

 /**
  * ログの表示指示項目の設定
  * @static
  */
 function get_view_field($kind)
 {
     global $log;
     $rc = log::set_fieldname($kind);
     // 認証済の判定
     $user = auth::check_auth();
     $kind_view = empty($user) ? 'guest' : 'view';
     if ($log[$kind][$kind_view] == 'all') {
         return $rc;
     }
     $tmp = explode(':', $log[$kind][$kind_view]);
     // 妥当性チェック
     $chk = array();
     foreach ($tmp as $_tmp) {
         $sw = 0;
         foreach ($rc as $_name) {
             if ($_name == $_tmp) {
                 $sw = 1;
                 break;
             }
         }
         if (!$sw) {
             continue;
         }
         $chk[] = $_tmp;
     }
     unset($tmp, $sw);
     return $chk;
 }
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:33,代码来源:log.php

示例7: check_role

 function check_role($func = '')
 {
     global $adminpass;
     switch ($func) {
         case 'readonly':
             $chk_role = defined('PKWK_READONLY') ? PKWK_READONLY : ROLE_GUEST;
             break;
         case 'safemode':
             $chk_role = defined('PKWK_SAFE_MODE') ? PKWK_SAFE_MODE : ROLE_GUEST;
             break;
         case 'su':
             $now_role = auth::get_role_level();
             if ($now_role == 2 || (int) $now_role == ROLE_ADM_CONTENTS) {
                 return FALSE;
             }
             // 既に権限有
             $chk_role = ROLE_ADM_CONTENTS;
             switch ($now_role) {
                 case ROLE_AUTH_TEMP:
                     // FIXME:
                     return TRUE;
                 case ROLE_GUEST:
                     // 未認証者は、単に管理者パスワードを要求
                     $user = UNAME_ADM_CONTENTS_TEMP;
                     break;
                 case ROLE_ENROLLEE:
                 case ROLE_AUTH:
                     // 認証済ユーザは、ユーザ名を維持しつつ管理者パスワードを要求
                     $user = auth::check_auth();
                     break;
             }
             $auth_temp = array($user => array($adminpass));
             while (1) {
                 if (!auth::auth_pw($auth_temp)) {
                     unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
                     header('WWW-Authenticate: Basic realm="USER NAME is ' . $user . '"');
                     header('HTTP/1.0 401 Unauthorized');
                     break;
                 }
                 // ESC : 認証失敗
                 return TRUE;
             }
             break;
         case 'role_adm':
             $chk_role = ROLE_ADM;
             break;
         case 'role_adm_contents':
             $chk_role = ROLE_ADM_CONTENTS;
             break;
         case 'role_enrollee':
             $chk_role = ROLE_ENROLLEE;
             break;
         case 'role_auth':
             $chk_role = ROLE_AUTH;
             break;
         default:
             $chk_role = ROLE_GUEST;
     }
     return auth::is_check_role($chk_role);
 }
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:60,代码来源:auth.cls.php

示例8: plugin_logview_action

/**
 * アクションプラグイン処理
 */
function plugin_logview_action()
{
    global $vars, $_logview_msg;
    global $log, $sortable_tracker;
    static $count = 0;
    $kind = isset($vars['kind']) ? $vars['kind'] : 'update';
    $title = sprintf($_logview_msg['msg_title'], $kind);
    // タイトルを設定
    $page = isset($vars['page']) ? $vars['page'] : '';
    // ゲスト表示ができない場合は、認証を要求する
    if ($log[$kind]['guest'] == '') {
        $obj = new auth();
        $user = $obj->check_auth();
        if (empty($user)) {
            if (exist_plugin('login')) {
                do_plugin_action('login');
            }
            unset($obj);
            return array('msg' => $title, 'body' => $_logview_msg['msg_not_auth']);
        }
    }
    unset($obj);
    check_readable($page, false);
    // 保存データの項目名を取得
    $name = log::get_log_field($kind);
    $view = log::get_view_field($kind);
    // 表示したい項目設定
    if ($sortable_tracker && $count == 0) {
        global $head_tags;
        $head_tags[] = ' <script type="text/javascript" charset="utf-8" src="' . SKIN_URI . 'sortabletable.js"></script>';
    }
    $count++;
    $body = <<<EOD
<table id="logview{$count}" class="style_table" cellspacing="1" border="0">
<thead>
<tr>

EOD;
    $cols = 0;
    $is_role_adm = auth::check_role('role_adm');
    // タイトルの処理
    foreach ($view as $_view) {
        if ($_view === 'local_id' && $is_role_adm) {
            continue;
        }
        $body .= '<td class="style_td">' . $_logview_msg[$_view] . '</td>' . "\n";
        $cols++;
    }
    $body .= <<<EOD
</tr>
</thead>
<tbody>

EOD;
    // データを取得
    $fld = logview_get_data(log::set_filename($kind, $page), $name);
    if (empty($fld)) {
        return array('msg' => $title, 'body' => 'no data');
    }
    // USER-AGENT クラス
    $obj_ua = new user_agent(USE_UA_OPTION);
    $path_flag = IMAGE_URI . 'icon/flags/';
    $path_browser = IMAGE_URI . 'icon/browser/';
    $path_os = IMAGE_URI . 'icon/os/';
    $path_domain = IMAGE_URI . 'icon/option/domain/';
    $guess = $log['guess_user']['use'] ? log::read_guess() : log::summary_signature();
    $ctr = 0;
    // データの編集
    foreach ($fld as $data) {
        if (!VIEW_ROBOTS && $obj_ua->is_robots($data['ua'])) {
            continue;
        }
        // ロボットは対象外
        $body .= "<tr>\n";
        foreach ($view as $field) {
            switch ($field) {
                case 'ts':
                    // タイムスタンプ (UTIME)
                    $body .= ' <td class="style_td">' . get_date('Y-m-d H:i:s', $data['ts']) . ' ' . get_passage($data['ts']) . "</td>\n";
                    break;
                case '@guess_diff':
                case '@diff':
                    // 差分内容
                    $update = $field == '@diff' ? true : false;
                    // FIXME: バックアップ/差分 なしの新規の場合
                    // バックアップデータの確定
                    $body .= ' <td class="style_td">';
                    $age = log::get_backup_age($page, $data['ts'], $update);
                    switch ($age) {
                        case -1:
                            // データなし
                            $body .= '<a class="ext" href="' . get_page_uri($page) . '" rel="nofollow">none</a>';
                            break;
                        case 0:
                            // diff
                            $body .= '<a class="ext" href="';
                            $body .= log::diff_exist($page) ? get_cmd_uri('diff', $page) : get_page_uri($page);
//.........这里部分代码省略.........
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:101,代码来源:logview.inc.php


注:本文中的auth::check_auth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。