• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP base64url_decode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中base64url_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP base64url_decode函数的具体用法?PHP base64url_decode怎么用?PHP base64url_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: file

 public function file($str = '')
 {
     $this->load->library('EncryptionX', array(), 'encryption');
     $this->encryption->key($this->config->item('encryption_key', 'app'));
     $expiryDate = date('D, d M Y H:i:s e', time() + 3600 * 24 * 30);
     header('Cache-Control: max-age=86400');
     header('Expires: ' . $expiryDate);
     $nstr = explode('||', $this->encryption->decode(base64url_decode($str)));
     if (count($nstr) != 5) {
         return show_404();
     }
     $size = $nstr[1] . 'x' . $nstr[2];
     $type = $nstr[3];
     $global = round($nstr[4]);
     $arrf = explode('/', $nstr[0]);
     if (count($arrf) != 3) {
         return show_404();
     }
     $year = $arrf[0];
     $month = $arrf[1];
     $file = $arrf[2];
     $this->load->config('app', TRUE);
     $folder = $this->config->item('uploads-global', 'app');
     if (!$global || !$folder) {
         $folder = $this->config->item('uploads', 'app');
     }
     $date_y = date('Y/m/d', strtotime("-1 day"));
     $filef = "{$folder}thumbs/{$date_y}/{$size}-{$file}";
     $version = $this->config->item('upload-version', 'app') . '.' . date('H');
     $mime = get_mime($filef);
     if ($mime) {
         header("Content-Type: {$mime}");
         readfile($filef);
         exit;
     }
     $date = date('Y/m/d');
     $filef = "{$folder}thumbs/{$date}/{$size}-{$file}";
     $mime = get_mime($filef);
     if ($mime) {
         header("Content-Type: {$mime}");
         readfile($filef);
         exit;
     }
     $thumbFolder = "{$folder}thumbs/{$date}/";
     if (!is_dir($thumbFolder)) {
         mkdir($thumbFolder, 0777, true);
     }
     $this->load->library('image');
     $fileb = "{$folder}{$year}/{$month}/{$file}";
     if (!file_exists($fileb)) {
         return show_404();
     }
     @unlink("{$folder}thumbs/{$date}/{$size}-{$file}");
     $function = $type == 'thumb' ? 'resize' : 'resize_crop';
     $this->image->load($fileb)->set_jpeg_quality(100)->{$function}($nstr[1], $nstr[2])->save("{$folder}thumbs/{$date}/{$size}-{$file}")->clear();
     $mime = get_mime($filef);
     header("Content-Type: {$mime}");
     readfile($filef);
     exit;
 }
开发者ID:juanazareno,项目名称:piscis,代码行数:60,代码来源:FilesP.php


示例2: get

 function get()
 {
     if (!local_channel()) {
         killme();
     }
     if (argc() > 2 && intval(argv(1)) && argv(2)) {
         $r = q("SELECT abook_xchan from abook where abook_xchan = '%s' and abook_channel = %d and abook_self = 0 limit 1", dbesc(base64url_decode(argv(2))), intval(local_channel()));
         if ($r) {
             $change = $r[0]['abook_xchan'];
         }
     }
     if (argc() > 1 && intval(argv(1))) {
         $r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", intval(argv(1)), intval(local_channel()));
         if (!$r) {
             killme();
         }
         $group = $r[0];
         $members = group_get_members($group['id']);
         $preselected = array();
         if (count($members)) {
             foreach ($members as $member) {
                 $preselected[] = $member['xchan_hash'];
             }
         }
         if ($change) {
             if (in_array($change, $preselected)) {
                 group_rmv_member(local_channel(), $group['gname'], $change);
             } else {
                 group_add_member(local_channel(), $group['gname'], $change);
             }
         }
     }
     killme();
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:34,代码来源:Contactgroup.php


示例3: post

 function post()
 {
     $hash = $_POST['hash'];
     $time = $_POST['time'];
     $sig = $_POST['signature'];
     $resource = $_POST['resource'];
     $revision = intval($_POST['revision']);
     if (!$hash) {
         killme();
     }
     $channel = channelx_by_hash($hash);
     if (!$channel || !$time || !$sig) {
         killme();
     }
     $slop = intval(get_pconfig($channel['channel_id'], 'system', 'getfile_time_slop'));
     if ($slop < 1) {
         $slop = 3;
     }
     $d1 = datetime_convert('UTC', 'UTC', "now + {$slop} minutes");
     $d2 = datetime_convert('UTC', 'UTC', "now - {$slop} minutes");
     if ($time > $d1 || $time < $d2) {
         logger('time outside allowable range');
         killme();
     }
     if (!rsa_verify($hash . '.' . $time, base64url_decode($sig), $channel['channel_pubkey'])) {
         logger('verify failed.');
         killme();
     }
     $r = attach_by_hash($resource, $revision);
     if (!$r['success']) {
         notice($r['message'] . EOL);
         return;
     }
     $unsafe_types = array('text/html', 'text/css', 'application/javascript');
     if (in_array($r['data']['filetype'], $unsafe_types)) {
         header('Content-type: text/plain');
     } else {
         header('Content-type: ' . $r['data']['filetype']);
     }
     header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"');
     if (intval($r['data']['os_storage'])) {
         $fname = dbunescbin($r['data']['data']);
         if (strpos($fname, 'store') !== false) {
             $istream = fopen($fname, 'rb');
         } else {
             $istream = fopen('store/' . $channel['channel_address'] . '/' . $fname, 'rb');
         }
         $ostream = fopen('php://output', 'wb');
         if ($istream && $ostream) {
             pipe_streams($istream, $ostream);
             fclose($istream);
             fclose($ostream);
         }
     } else {
         echo dbunescbin($r['data']['data']);
     }
     killme();
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:58,代码来源:Getfile.php


示例4: oembed_content

function oembed_content(&$a)
{
    if ($a->argc == 2) {
        echo "<html><body>";
        $url = base64url_decode($a->argv[1]);
        $j = oembed_fetch_url($url);
        echo $j->html;
        echo "</body></html>";
    }
    killme();
}
开发者ID:nphyx,项目名称:friendica,代码行数:11,代码来源:oembed.php


示例5: import

 public function import($id1_)
 {
     Logger::debug('main', "UserGroupDB::ldap_memberof::import (id = {$id1_})");
     if (is_base64url($id1_)) {
         $id_ = base64url_decode($id1_);
     } else {
         $id_ = $id1_;
     }
     $prefs = Preferences::getInstance();
     if (!$prefs) {
         die_error('get Preferences failed', __FILE__, __LINE__);
     }
     $config_ldap = $prefs->get('UserDB', 'ldap');
     $config_ldap['match'] = array();
     if (array_key_exists('match', $this->preferences)) {
         $config_ldap['match'] = $this->preferences['match'];
     }
     if (str_endswith(strtolower($id_), strtolower($config_ldap['suffix'])) === true) {
         $id2 = substr($id_, 0, -1 * strlen($config_ldap['suffix']) - 1);
     } else {
         $id2 = $id_;
     }
     $expl = explode(',', $id2, 2);
     if (count($expl) == 1) {
         $expl = array($id2, '');
     }
     $config_ldap['userbranch'] = $expl[1];
     $buf = $config_ldap['match'];
     $buf['id'] = $id_;
     $ldap = new LDAP($config_ldap);
     $sr = $ldap->search($expl[0], array_keys($config_ldap['match']));
     if ($sr === false) {
         Logger::error('main', "UserGroupDB::ldap_memberof::import search failed for ({$id_})");
         return NULL;
     }
     $infos = $ldap->get_entries($sr);
     if ($infos === array()) {
         Logger::error('main', "UserGroupDB::ldap_memberof::import get_entries failed for ({$id_})");
         return NULL;
     }
     $keys = array_keys($infos);
     $dn = $keys[0];
     $info = $infos[$dn];
     foreach ($config_ldap['match'] as $attribut => $match_ldap) {
         if (isset($info[$match_ldap][0])) {
             $buf[$attribut] = $info[$match_ldap][0];
         }
     }
     $ug = new UsersGroup($buf['id'], $buf['name'], $buf['description'], true);
     return $ug;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:51,代码来源:ldap_memberof.php


示例6: loadcomment

function loadcomment($id, $number)
{
    include '../page/protection.php';
    include '../page/db.php';
    $id = (int) base64url_decode($id);
    $sql = "SELECT * FROM Comments WHERE ID='{$id}'";
    $data = mysqli_query($conn, $sql);
    $data = mysqli_fetch_assoc($data);
    $userid = $data['UserID'];
    $usersql = "SELECT UserName,ProfilePicture FROM UserAccounts WHERE RowID='{$userid}'";
    $userdata = mysqli_query($conn, $usersql);
    $userdata = mysqli_fetch_assoc($userdata);
    $user = $userdata['UserName'];
    $comment = $data['Comment'];
    $space = "&emsp;";
    $postdate = date_create($data['CreateDate']);
    $postdate = date_format($postdate, 'm/d/Y g:ia');
    $modifieddate = date_create($data['ModifiedDate']);
    $modifieddate = date_format($modifieddate, 'm/d/Y g:ia');
    if ($userid === $_SESSION['id']) {
        $poster = "<span style=\"float:right;padding-right:10px;\" class=\"link2\"><a href=\"/admin/CommentDelete?a=" . base64url_encode($id) . "\">Delete</a></span>";
    }
    if ($data['Edited']) {
        $time = "<span style=\"float:right;\">Edited: " . $modifieddate . "</span>";
    } else {
        $time = "<span style=\"float:right;\">Posted: " . $postdate . "</span>";
    }
    $text .= "\n\t\t\t<div class=\"commentshadow\" id=\"comment-{$id}\">\n\t\t\t<div class=\"commenttitle\">#{$number} " . $time . $poster . "</div>\n\t\t\t<div class=\"fullcomment\">\n\t\t\t<!--<hr class=\"commenthr\">-->\n\t\t\t<div class=\"commentimage\">\n\t\t";
    $text .= "<div class=\"commentimageinner\"><span class=\"profilepichelper\"></span>";
    if (strlen($userdata['ProfilePicture'])) {
        $text .= "<img src=\"/account/ProfilePictureShow?a=" . base64url_encode($userid) . "\" class=\"commentpic\">";
    } else {
        $text .= "<img src=\"/theme/grey-question-mark.png\" class=\"commentpic hideLight\">";
        $text .= "<img src=\"/theme/darkgrey-question-mark.png\" class=\"commentpic hideDark\">";
    }
    $text .= "</div>";
    $text .= "\n\t\t\t</div>\n\t\t\t\t<div class=\"commentusername\"><span class=\"link3\"><a href=\"/account/Profile?a=" . base64url_encode($userid) . "\">{$user}</a></span></div>\n\t\t";
    include '../page/BBCode.php';
    if (isset($comment)) {
        $comment = decrypt($comment);
        $comment = strip_tags($comment);
        $comment = preg_replace('/\\r\\n?/', "\n<br />", $comment);
        $comment = bb_parse($comment);
    } else {
        $comment = '';
    }
    $text .= "<div class=\"comment\">" . $comment . "</div></div></div>";
    mysqli_close($conn);
    return $text;
}
开发者ID:Chris221,项目名称:My-Site,代码行数:50,代码来源:Comment.php


示例7: import

 public function import($id_)
 {
     if (is_base64url($id_)) {
         $id_ = base64url_decode($id_);
     }
     Logger::debug('main', 'UserGroupDB::import(' . $id_ . ')');
     foreach ($this->instance_type as $key => $value) {
         if (str_startswith($id_, $key . '_')) {
             return $value->import(substr($id_, strlen($key) + 1));
         }
     }
     return NULL;
     // not found
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:14,代码来源:UserGroupDB.php


示例8: process

 /**
  * 处理上传
  *
  * @access public
  */
 public function process()
 {
     $param = Request::only('authkey', 'args');
     $config = @unserialize(base64url_decode($param['args']));
     $uploadObject = new UploadManager();
     if (!$uploadObject->setParam($config)->checkUploadToken($param['authkey'])) {
         return abort(500);
     }
     $file = Request::file('file');
     $returnFileUrl = $uploadObject->setFile($file)->upload();
     if (!$returnFileUrl) {
         return abort(500);
     }
     $this->saveFile($returnFileUrl, $file);
     return response()->json(['file' => implode('|', $returnFileUrl)]);
 }
开发者ID:pfdtk,项目名称:bmsys,代码行数:21,代码来源:UploadController.php


示例9: process

 /**
  * 处理上传
  */
 public function process()
 {
     $parpams = Request::only('authkey', 'args');
     $config = @unserialize(base64url_decode($parpams['args']));
     //检测请求是否合法
     $uploadObject = new UploadManager();
     if (!$uploadObject->setParam($config)->checkUploadToken($parpams['authkey'])) {
         return abort(500);
     }
     //开始处理上传
     $file = Request::file('file');
     $returnFileUrl = $uploadObject->setFile($file)->upload();
     if (!$returnFileUrl) {
         return abort(500);
     }
     return response()->json(['file' => $returnFileUrl]);
 }
开发者ID:mikegit2014,项目名称:laravelback,代码行数:20,代码来源:UploadController.php


示例10: oembed_init

function oembed_init(&$a)
{
    // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
    if (argc() > 1) {
        if (argv(1) == 'b2h') {
            $url = array("", trim(hex2bin($_REQUEST['url'])));
            echo oembed_replacecb($url);
            killme();
        } elseif (argv(1) == 'h2b') {
            $text = trim(hex2bin($_REQUEST['text']));
            echo oembed_html2bbcode($text);
            killme();
        } else {
            echo "<html><body>";
            $j = oembed_fetch_url(base64url_decode(argv(1)));
            echo $j->html;
            //		    logger('mod-oembed ' . $j->html, LOGGER_ALL);
            echo "</body></html>";
        }
    }
    killme();
}
开发者ID:Mauru,项目名称:red,代码行数:22,代码来源:oembed.php


示例11: body

 /**
  * Update item by his id
  * @return void
  */
 public function body()
 {
     //product id
     $id = $this->uri->segment(4);
     $email = base64url_decode($this->uri->segment(5));
     $bodymail = $this->Imap_model->get_newsletter_email_by_email($email);
     $this->load->config('imap');
     //echo '<pre>'; print_r($bodymail); die;
     $config['imap_server'] = $this->config->item('mailbox');
     $config['imap_user'] = $bodymail[0]['email'];
     $config['imap_pass'] = decrypt($bodymail[0]['password']);
     $config['imap_folder'] = 'INBOX';
     // Load the IMAP Library
     $this->Imap_model->imap($config);
     $body = $this->Imap_model->imap_read_body($id);
     //echo $body; die;
     $this->Imap_model->close_imap();
     $data['email'] = $bodymail[0]['email'];
     $data['body'] = $body;
     $data['main_content'] = 'kd2a2a0u1g4/email_inbox/body';
     $this->load->view('kd2a2a0u1g4/includes/template', $data);
 }
开发者ID:bhushansonar,项目名称:knewdog.com,代码行数:26,代码来源:cron_email_issues+_12_1_2015.php


示例12: oembed_content

function oembed_content(&$a)
{
    // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
    if ($a->argv[1] == 'b2h') {
        $url = array("", trim(hex2bin($_REQUEST['url'])));
        echo oembed_replacecb($url);
        killme();
    }
    if ($a->argv[1] == 'h2b') {
        $text = trim(hex2bin($_REQUEST['text']));
        echo oembed_html2bbcode($text);
        killme();
    }
    if ($a->argc == 2) {
        echo "<html><body>";
        $url = base64url_decode($a->argv[1]);
        $j = oembed_fetch_url($url);
        echo $j->html;
        //		logger('mod-oembed ' . $j->html, LOGGER_ALL);
        echo "</body></html>";
    }
    killme();
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:23,代码来源:oembed.php


示例13: init

 function init()
 {
     // logger('mod_oembed ' . \App::$query_string, LOGGER_ALL);
     if (argc() > 1) {
         if (argv(1) == 'b2h') {
             $url = array("", trim(hex2bin($_REQUEST['url'])));
             echo oembed_replacecb($url);
             killme();
         } elseif (argv(1) == 'h2b') {
             $text = trim(hex2bin($_REQUEST['text']));
             echo oembed_html2bbcode($text);
             killme();
         } else {
             echo "<html><head><base target=\"_blank\" /></head><body>";
             $src = base64url_decode(argv(1));
             $j = oembed_fetch_url($src);
             echo $j['html'];
             //		    logger('mod-oembed ' . $h, LOGGER_ALL);
             echo "</body></html>";
         }
     }
     killme();
 }
开发者ID:phellmes,项目名称:hubzilla,代码行数:23,代码来源:Oembed.php


示例14: private_messages_fetch_conversation

function private_messages_fetch_conversation($channel_id, $messageitem_id, $updateseen = false)
{
    // find the parent_mid of the message being requested
    $r = q("SELECT parent_mid from mail WHERE channel_id = %d and id = %d limit 1", intval($channel_id), intval($messageitem_id));
    if (!$r) {
        return array();
    }
    $messages = q("select * from mail where parent_mid = '%s' and channel_id = %d order by created asc", dbesc($r[0]['parent_mid']), intval($channel_id));
    if (!$messages) {
        return array();
    }
    $chans = array();
    foreach ($messages as $rr) {
        $s = "'" . dbesc(trim($rr['from_xchan'])) . "'";
        if (!in_array($s, $chans)) {
            $chans[] = $s;
        }
        $s = "'" . dbesc(trim($rr['to_xchan'])) . "'";
        if (!in_array($s, $chans)) {
            $chans[] = $s;
        }
    }
    $c = q("select * from xchan where xchan_hash in (" . implode(',', $chans) . ")");
    foreach ($messages as $k => $message) {
        $messages[$k]['from'] = find_xchan_in_array($message['from_xchan'], $c);
        $messages[$k]['to'] = find_xchan_in_array($message['to_xchan'], $c);
        if (intval($messages[$k]['mail_obscured'])) {
            if ($messages[$k]['title']) {
                $messages[$k]['title'] = base64url_decode(str_rot47($messages[$k]['title']));
            }
            if ($messages[$k]['body']) {
                $messages[$k]['body'] = base64url_decode(str_rot47($messages[$k]['body']));
            }
        }
    }
    if ($updateseen) {
        $r = q("UPDATE `mail` SET mail_seen = 1 where mail_seen = 0 and parent_mid = '%s' AND channel_id = %d", dbesc($r[0]['parent_mid']), intval($channel_id));
    }
    return $messages;
}
开发者ID:23n,项目名称:hubzilla,代码行数:40,代码来源:message.php


示例15: FreshRSS_feed_Controller

$system_conf->auth_type = 'none';
// avoid necessity to be logged in (not saved!)
Minz_Translate::init('en');
Minz_Request::_param('ajax', true);
$feedController = new FreshRSS_feed_Controller();
$simplePie = customSimplePie();
$simplePie->set_raw_data($ORIGINAL_INPUT);
$simplePie->init();
unset($ORIGINAL_INPUT);
$links = $simplePie->get_links('self');
$self = isset($links[0]) ? $links[0] : null;
if ($self !== base64url_decode($canonical64)) {
    //header('HTTP/1.1 422 Unprocessable Entity');
    logMe('Warning: Self URL [' . $self . '] does not match registered canonical URL!: ' . base64url_decode($canonical64));
    //die('Self URL does not match registered canonical URL!');
    $self = base64url_decode($canonical64);
}
Minz_Request::_param('url', $self);
$nb = 0;
foreach ($users as $userFilename) {
    $username = basename($userFilename, '.txt');
    if (!file_exists(USERS_PATH . '/' . $username . '/config.php')) {
        break;
    }
    try {
        Minz_Session::_param('currentUser', $username);
        Minz_Configuration::register('user', join_path(USERS_PATH, $username, 'config.php'), join_path(USERS_PATH, '_', 'config.default.php'));
        FreshRSS_Context::init();
        if ($feedController->actualizeAction($simplePie) > 0) {
            $nb++;
        }
开发者ID:buggithubs,项目名称:FreshRSS,代码行数:31,代码来源:pshb.php


示例16: unobscure_mail

function unobscure_mail(&$item)
{
    if (array_key_exists('mail_obscured', $item) && intval($item['mail_obscured'])) {
        if ($item['title']) {
            $item['title'] = base64url_decode(str_rot47($item['title']));
        }
        if ($item['body']) {
            $item['body'] = base64url_decode(str_rot47($item['body']));
        }
    }
}
开发者ID:23n,项目名称:hubzilla,代码行数:11,代码来源:text.php


示例17: list

        list($junk, $authStr) = explode("result=", $value);
        $kidB64 = strtok($authStr, ".");
        $chalB64 = strtok(".");
        $nonceB64 = strtok(".");
        $sig = base64url_decode(strtok("."));
    }
}
//dump("kidB64:" . $kidB64 . " chalB64:" . $chalB64 . " nonceB64:" . $nonceB64 ." sig:" . $sig);
if (checkChal($chalB64, getPeer())) {
    dump("HOBA: Challenge accepted");
} else {
    dump("HOBA: Challenge failed");
    setFailCookie();
    exit(1);
}
$kid = base64url_decode($kidB64);
$tbsOrigin = "https://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'];
$sigText = genTbsBlob($nonceB64, $GLOBALS['alg'], $tbsOrigin, $kidB64, $chalB64);
dbLogin();
$device = dbGetDeviceByKid($kid);
if (!$device) {
    dump("HOBA: kid not found");
    setFailCookie();
    dbLogout();
    exit(1);
}
$pem = jwkToPem($device['pubKey']);
$verified = openssl_verify($sigText, $sig, $pem, OPENSSL_ALGO_SHA256);
if ($verified) {
    dump("HOBA: Key Verification Successful");
    $user = dbGetDeviceByKid($kid);
开发者ID:smutt,项目名称:HOBA-server,代码行数:31,代码来源:login.php


示例18: zfinger_init

function zfinger_init(&$a)
{
    require_once 'include/zot.php';
    require_once 'include/crypto.php';
    $ret = array('success' => false);
    $zhash = x($_REQUEST, 'guid_hash') ? $_REQUEST['guid_hash'] : '';
    $zguid = x($_REQUEST, 'guid') ? $_REQUEST['guid'] : '';
    $zguid_sig = x($_REQUEST, 'guid_sig') ? $_REQUEST['guid_sig'] : '';
    $zaddr = x($_REQUEST, 'address') ? $_REQUEST['address'] : '';
    $ztarget = x($_REQUEST, 'target') ? $_REQUEST['target'] : '';
    $zsig = x($_REQUEST, 'target_sig') ? $_REQUEST['target_sig'] : '';
    $zkey = x($_REQUEST, 'key') ? $_REQUEST['key'] : '';
    $mindate = x($_REQUEST, 'mindate') ? $_REQUEST['mindate'] : '';
    $feed = x($_REQUEST, 'feed') ? intval($_REQUEST['feed']) : 0;
    if ($ztarget) {
        if (!$zkey || !$zsig || !rsa_verify($ztarget, base64url_decode($zsig), $zkey)) {
            logger('zfinger: invalid target signature');
            $ret['message'] = t("invalid target signature");
            json_return_and_die($ret);
        }
    }
    // allow re-written domains so [email protected] can provide an address of [email protected]
    // The top-level domain also needs to redirect .well-known/zot-info to the sub-domain with a 301 or 308
    // TODO: Make 308 work in include/network.php for zot_fetch_url and zot_post_url
    if ($zaddr && ($s = get_config('system', 'zotinfo_domainrewrite'))) {
        $arr = explode('^', $s);
        if (count($arr) == 2) {
            $zaddr = str_replace($arr[0], $arr[1], $zaddr);
        }
    }
    $r = null;
    if (strlen($zhash)) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash \n\t\t\twhere channel_hash = '%s' limit 1", dbesc($zhash));
    } elseif (strlen($zguid) && strlen($zguid_sig)) {
        $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash \n\t\t\twhere channel_guid = '%s' and channel_guid_sig = '%s' limit 1", dbesc($zguid), dbesc($zguid_sig));
    } elseif (strlen($zaddr)) {
        if (strpos($zaddr, '[system]') === false) {
            /* normal address lookup */
            $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash\n\t\t\t\twhere ( channel_address = '%s' or xchan_addr = '%s' ) limit 1", dbesc($zaddr), dbesc($zaddr));
        } else {
            /**
             * The special address '[system]' will return a system channel if one has been defined,
             * Or the first valid channel we find if there are no system channels. 
             *
             * This is used by magic-auth if we have no prior communications with this site - and
             * returns an identity on this site which we can use to create a valid hub record so that
             * we can exchange signed messages. The precise identity is irrelevant. It's the hub
             * information that we really need at the other end - and this will return it.
             *
             */
            $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash\n\t\t\t\twhere ( channel_pageflags & %d )>0 order by channel_id limit 1", intval(PAGE_SYSTEM));
            if (!$r) {
                $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash\n\t\t\t\t\twhere not ( channel_pageflags & %d )>0 order by channel_id limit 1", intval(PAGE_REMOVED));
            }
        }
    } else {
        $ret['message'] = 'Invalid request';
        json_return_and_die($ret);
    }
    if (!$r) {
        $ret['message'] = 'Item not found.';
        json_return_and_die($ret);
    }
    $e = $r[0];
    $id = $e['channel_id'];
    $sys_channel = $e['channel_pageflags'] & PAGE_SYSTEM ? true : false;
    $special_channel = $e['channel_pageflags'] & PAGE_PREMIUM ? true : false;
    $adult_channel = $e['channel_pageflags'] & PAGE_ADULT ? true : false;
    $censored = $e['channel_pageflags'] & PAGE_CENSORED ? true : false;
    $searchable = $e['channel_pageflags'] & PAGE_HIDDEN ? false : true;
    $deleted = $e['xchan_flags'] & XCHAN_FLAGS_DELETED ? true : false;
    if ($deleted || $censored || $sys_channel) {
        $searchable = false;
    }
    $public_forum = false;
    $role = get_pconfig($e['channel_id'], 'system', 'permissions_role');
    if ($role === 'forum') {
        $public_forum = true;
    } else {
        // check if it has characteristics of a public forum based on custom permissions.
        $t = q("select abook_my_perms from abook where abook_channel = %d and (abook_flags & %d)>0 limit 1", intval($e['channel_id']), intval(ABOOK_FLAG_SELF));
        if ($t && $t[0]['abook_my_perms'] & PERMS_W_TAGWALL) {
            $public_forum = true;
        }
    }
    //  This is for birthdays and keywords, but must check access permissions
    $p = q("select * from profile where uid = %d and is_default = 1", intval($e['channel_id']));
    $profile = array();
    if ($p) {
        if (!intval($p[0]['publish'])) {
            $searchable = false;
        }
        $profile['description'] = $p[0]['pdesc'];
        $profile['birthday'] = $p[0]['dob'];
        if ($profile['birthday'] != '0000-00-00' && ($bd = z_birthday($p[0]['dob'], $e['channel_timezone'])) !== '') {
            $profile['next_birthday'] = $bd;
        }
        if ($age = age($p[0]['dob'], $e['channel_timezone'], '')) {
            $profile['age'] = $age;
        }
//.........这里部分代码省略.........
开发者ID:HaakonME,项目名称:redmatrix,代码行数:101,代码来源:zfinger.php


示例19: decodeJWT

 /**
  * @param $jwt string encoded JWT
  * @param int $section the section we would like to decode
  * @return object
  */
 private function decodeJWT($jwt, $section = 0)
 {
     $parts = explode(".", $jwt);
     return json_decode(base64url_decode($parts[$section]));
 }
开发者ID:mehrna,项目名称:OpenID-Connect-PHP,代码行数:10,代码来源:OpenIDConnectClient.php


示例20: import_account


//.........这里部分代码省略.........
     if (array_key_exists('channel', $data)) {
         if ($completed < 1) {
             $channel = import_channel($data['channel'], $account_id, $seize);
         } else {
             $r = q("select * from channel where channel_account_id = %d and channel_guid = '%s' limit 1", intval($account_id), dbesc($channel['channel_guid']));
             if ($r) {
                 $channel = $r[0];
             }
         }
         if (!$channel) {
             logger('mod_import: channel not found. ', print_r($channel, true));
             notice(t('Cloned channel not found. Import failed.') . EOL);
             return;
         }
     }
     if (!$channel) {
         $channel = \App::get_channel();
     }
     if (!$channel) {
         logger('mod_import: channel not found. ', print_r($channel, true));
         notice(t('No channel. Import failed.') . EOL);
         return;
     }
     if ($completed < 2) {
         if (is_array($data['config'])) {
             import_config($channel, $data['config']);
         }
         logger('import step 2');
         $_SESSION['import_step'] = 2;
     }
     if ($completed < 3) {
         if ($data['photo']) {
             require_once 'include/photo/photo_driver.php';
             import_channel_photo(base64url_decode($data['photo']['data']), $data['photo']['type'], $account_id, $channel['channel_id']);
         }
         if (is_array($data['profile'])) {
             import_profiles($channel, $data['profile']);
         }
         logger('import step 3');
         $_SESSION['import_step'] = 3;
     }
     if ($completed < 4) {
         if (is_array($data['hubloc']) && !$moving) {
             import_hublocs($channel, $data['hubloc'], $seize);
         }
         logger('import step 4');
         $_SESSION['import_step'] = 4;
     }
     if ($completed < 5) {
         // create new hubloc for the new channel at this site
         $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_primary, \n\t\t\t\thubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey )\n\t\t\t\tvalues ( '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )", dbesc($channel['channel_guid']), dbesc($channel['channel_guid_sig']), dbesc($channel['channel_hash']), dbesc(channel_reddress($channel)), dbesc('zot'), intval($seize ? 1 : 0), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(), $channel['channel_prvkey']))), dbesc(\App::get_hostname()), dbesc(z_root() . '/post'), dbesc(get_config('system', 'pubkey')));
         // reset the original primary hubloc if it is being seized
         if ($seize) {
             $r = q("update hubloc set hubloc_primary = 0 where hubloc_primary = 1 and hubloc_hash = '%s' and hubloc_url != '%s' ", dbesc($channel['channel_hash']), dbesc(z_root()));
         }
         logger('import step 5');
         $_SESSION['import_step'] = 5;
     }
     if ($completed < 6) {
         // import xchans and contact photos
         if ($seize) {
             // replace any existing xchan we may have on this site if we're seizing control
             $r = q("delete from xchan where xchan_hash = '%s'", dbesc($channel['channel_hash']));
             $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_follow, xchan_connurl, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_hidden, xchan_orphan, xchan_censored, xchan_selfcensored, xchan_system, xchan_pubforum, xchan_deleted ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d )", dbesc($channel['channel_hash']), dbesc($channel['channel_guid']), dbesc($channel['channel_guid_sig']), dbesc($channel['channel_pubkey']), dbesc(z_root() . "/photo/profile/l/" . $channel['channel_id']), dbesc(z_root() . "/photo/profile/m/" . $channel['channel_id']), dbesc(z_root() . "/photo/profile/s/" . $channel['channel_id']), dbesc(channel_reddress($channel)), dbesc(z_root() . '/channel/' . $channel['channel_address']), dbesc(z_root() . '/follow?f=&url=%s'), dbesc(z_root() . '/poco/' . $channel['channel_address']), dbesc($channel['channel_name']), dbesc('zot'), dbesc(datetime_convert()), dbesc(datetime_convert()), 0, 0, 0, 0, 0, 0, 0);
         }
         logger('import step 6');
开发者ID:phellmes,项目名称:hubzilla,代码行数:67,代码来源:Import.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP base64url_encode函数代码示例发布时间:2022-05-24
下一篇:
PHP base64_url_decode函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap