コード例 #1
0
 public static function getAuthItemListByUid($uid)
 {
     $userinfo = kekezu::get_user_info($uid);
     if (!$userinfo) {
         return false;
     }
     if ($userinfo['user_type']) {
         $userinfo['user_type'] == '2' and $remove_item = 'realname' or $remove_item = 'enterprise';
     } else {
         $remove_item = '';
     }
     $items = db_factory::get_table_data("*", "witkey_auth_item", " auth_open = '1' AND auth_code NOT IN('{$remove_item}') ", " CASE WHEN listorder >0 THEN 1 ELSE 0 END DESC ", "", "", "auth_code", 3600);
     if (!$items) {
         return false;
     }
     $records = db_factory::get_table_data("*", "witkey_auth_record", " uid = '{$uid}' AND auth_status = '1' AND auth_code NOT IN('{$remove_item}') ", "", "", "", "auth_code", 3600);
     foreach ($items as $authcode => $iteminfo) {
         $auth_record_status = $records[$authcode]['auth_status'] ? 1 : 0;
         $auth_item_status = 0;
         if ($auth_record_status) {
             $tablename = TABLEPRE . 'witkey_auth_' . $authcode;
             $isExists = db_factory::checkTableIsExists($tablename);
             if ($isExists) {
                 $info = db_factory::get_one("SELECT * FROM `{$tablename}` WHERE uid = '{$uid}' AND auth_status = '1'");
                 if ($info) {
                     $auth_item_status = 1;
                 }
             }
         }
         if ($auth_record_status && $auth_item_status) {
             $items[$authcode]['auth_pass'] = 1;
         } else {
             $items[$authcode]['auth_pass'] = 0;
         }
         $items[$authcode]['auth_url'] = "index.php?do=user&view=account&op=auth&code={$authcode}";
     }
     return $items;
 }