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

PHP base64url_encode函数代码示例

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

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



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

示例1: emailadmins

            function emailadmins($idofuser, $ticketid)
            {
                include '../page/db.php';
                $sql = "SELECT * FROM UserAccounts WHERE RowID='{$idofuser}'";
                $emaildata = mysqli_query($conn, $sql);
                $emaildata = mysqli_fetch_assoc($emaildata);
                $to = $emaildata['Email'];
                $subject = 'New Support Ticket';
                $message = '
								<html>
								<head>
								  <title>New Support Ticket</title>
								</head>
								<body>
								  <p>' . $emaildata['UserName'] . ',</p>
								  <p>A new support ticket was posted. Click here to view it <a href="http:ChrisSiena.com/support/TicketView?a=' . base64url_encode($ticketid) . '">http:ChrisSiena.com/support/TicketView?a=' . base64url_encode($ticketid) . '</a> or copy and paste this into your browser.</p><br />
								  <p>Do not reply to this email. It will not be checked.</p>
								</body>
								</html>
								';
                $headers .= 'MIME-Version: 1.0' . "\r\n";
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                $headers .= 'From: [email protected]' . "\r\n";
                $headers .= 'Return-Path: [email protected]' . "\r\n";
                $headers .= 'X-Mailer: PHP/' . phpversion();
                mail($to, $subject, $message, $headers, '[email protected]');
                mysqli_close($conn);
            }
开发者ID:Chris221,项目名称:My-Site,代码行数:28,代码来源:PostTicket.php


示例2: validate_credentials_front

 function validate_credentials_front()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'User Name', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->form_validation->run()) {
         if (!$this->session->userdata('is_logged_in')) {
             $this->load->model('Admin_model');
             $username = $this->input->post('username');
             $password = $this->__encrip_password($this->input->post('password'));
             $is_valid = $this->Admin_model->validate_front($username, $password);
             if ($is_valid) {
                 $where_username = " AND username='{$username}' OR primary_email='{$username}'";
                 $user_type = $this->common_model->getFieldData('user', 'type_of_membership', $where_username);
                 if ($user_type == "User") {
                     $is_account_confirm = $this->Admin_model->validate_front_account_confirm($username);
                     if ($is_account_confirm) {
                         $stored_user_data = $this->Admin_model->get_user_id($username);
                         $user_id = $stored_user_data[0]->user_id;
                         $primary_email = $stored_user_data[0]->primary_email;
                         $affiliate = $stored_user_data[0]->type;
                         $type_of_membership = $stored_user_data[0]->type_of_membership;
                         if (!empty($affiliate)) {
                             $type = $affiliate;
                         } else {
                             $type = 'user';
                         }
                         $data = array('username' => $username, 'primary_email' => $primary_email, 'user_id' => $user_id, 'type' => $type, 'type_of_membership' => $type_of_membership, 'is_logged_in' => true);
                         $this->session->set_userdata($data);
                         if ($affiliate == 'affiliate') {
                             redirect("signin/signin_user/{$user_id}/affiliate");
                         } else {
                             $email = base64url_encode($primary_email);
                             redirect("home/account/{$user_id}/{$email}");
                         }
                     } else {
                         $this->session->set_flashdata('flash_class', 'alert-danger');
                         $this->session->set_flashdata('flash_message', '<strong>ohh snap!</strong> Please Confirm Your Account By Your Email  </strong>');
                         redirect('signin/signin_user');
                     }
                 } else {
                     $this->session->set_flashdata('flash_class', 'alert-danger');
                     $this->session->set_flashdata('flash_message', '<strong>ohh snap!</strong> Your are Affiliate User Please login with Affilite login </strong>');
                     redirect('signin/signin_user');
                 }
             } else {
                 $url = '<a href="' . base_url() . 'home/set_pass_mail">reset your password</a>';
                 $this->session->set_flashdata('flash_class', 'alert-danger');
                 $this->session->set_flashdata('flash_message', '<strong>ohh snap!</strong> Wrong Username And Password  </strong>');
                 $this->session->set_flashdata('flash_reset_url', 'Please try again or <strong>' . $url . '</strong>');
                 redirect('signin/signin_user');
             }
         } else {
             redirect('home');
         }
     }
     $data['main_content'] = 'signin_view';
     $this->load->view('includes/template', $data);
 }
开发者ID:hardikamutech,项目名称:stacksclassifieds,代码行数:60,代码来源:signin.php


示例3: random_string

 function random_string($size = 64, $type = RANDOM_STRING_HEX)
 {
     // generate a bit of entropy and run it through the whirlpool
     $s = hash('whirlpool', (string) rand() . uniqid(rand(), true) . (string) rand(), $type == RANDOM_STRING_TEXT ? true : false);
     $s = $type == RANDOM_STRING_TEXT ? str_replace("\n", "", base64url_encode($s, true)) : $s;
     return substr($s, 0, $size);
 }
开发者ID:nextgensh,项目名称:friendica,代码行数:7,代码来源:text.php


示例4: slapper

function slapper($owner, $url, $slap)
{
    // does contact have a salmon endpoint?
    if (!strlen($url)) {
        return;
    }
    if (!$owner['channel_prvkey']) {
        logger(sprintf("channel '%s' (%d) does not have a salmon private key. Send failed.", $owner['channel_address'], $owner['channel_id']));
        return;
    }
    logger('slapper called for ' . $url . '. Data: ' . $slap, LOGGER_DATA, LOG_DEBUG);
    // create a magic envelope
    $data = base64url_encode($slap);
    $data_type = 'application/atom+xml';
    $encoding = 'base64url';
    $algorithm = 'RSA-SHA256';
    $keyhash = base64url_encode(hash('sha256', salmon_key($owner['channel_pubkey'])), true);
    // precomputed base64url encoding of data_type, encoding, algorithm concatenated with periods
    $precomputed = '.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng==';
    $signature = base64url_encode(rsa_sign(str_replace('=', '', $data . $precomputed), $owner['channel_prvkey']));
    $signature2 = base64url_encode(rsa_sign($data . $precomputed, $owner['channel_prvkey']));
    $signature3 = base64url_encode(rsa_sign($data, $owner['channel_prvkey']));
    $salmon_tpl = get_markup_template('magicsig.tpl');
    $salmon = replace_macros($salmon_tpl, array('$data' => $data, '$encoding' => $encoding, '$algorithm' => $algorithm, '$keyhash' => $keyhash, '$signature' => $signature));
    // slap them
    $redirects = 0;
    $ret = z_post_url($url, $salmon, $redirects, array('headers' => array('Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon))));
    $return_code = $ret['return_code'];
    // check for success, e.g. 2xx
    if ($return_code > 299) {
        logger('compliant salmon failed. Falling back to status.net hack2');
        // Entirely likely that their salmon implementation is
        // non-compliant. Let's try once more, this time only signing
        // the data, without stripping '=' chars
        $salmon = replace_macros($salmon_tpl, array('$data' => $data, '$encoding' => $encoding, '$algorithm' => $algorithm, '$keyhash' => $keyhash, '$signature' => $signature2));
        $redirects = 0;
        $ret = z_post_url($url, $salmon, $redirects, array('headers' => array('Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon))));
        $return_code = $ret['return_code'];
        if ($return_code > 299) {
            logger('compliant salmon failed. Falling back to status.net hack3');
            // Entirely likely that their salmon implementation is
            // non-compliant. Let's try once more, this time only signing
            // the data, without the precomputed blob
            $salmon = replace_macros($salmon_tpl, array('$data' => $data, '$encoding' => $encoding, '$algorithm' => $algorithm, '$keyhash' => $keyhash, '$signature' => $signature3));
            $redirects = 0;
            $ret = z_post_url($url, $salmon, $redirects, array('headers' => array('Content-type: application/magic-envelope+xml', 'Content-length: ' . strlen($salmon))));
            $return_code = $ret['return_code'];
        }
    }
    logger('slapper for ' . $url . ' returned ' . $return_code);
    if (!$return_code) {
        return -1;
    }
    if ($return_code == 503 && stristr($ret['header'], 'retry-after')) {
        return -1;
    }
    return $return_code >= 200 && $return_code < 300 ? 0 : 1;
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:58,代码来源:salmon.php


示例5: generate_state_parameter

function generate_state_parameter()
{
    if (isset($_SESSION['state'])) {
        return $_SESSION['state'];
    } else {
        $state = base64url_encode(openssl_random_pseudo_bytes(32));
        $_SESSION['state'] = $state;
        return $state;
    }
}
开发者ID:dg711,项目名称:geekportal,代码行数:10,代码来源:generate_state.php


示例6: login_nonce

 function login_nonce(&$args)
 {
     /* generate a nonce (state) for this oauth request */
     function base64url_encode($data)
     {
         return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
     }
     $_SESSION['nonce'] = base64url_encode(openssl_random_pseudo_bytes(32));
     $args->retval = $_SESSION['nonce'];
 }
开发者ID:mountainstorm,项目名称:TeapotCMS,代码行数:10,代码来源:module.php


示例7: get

 function get()
 {
     $uid = local_channel();
     if (\App::$is_sys && is_site_admin()) {
         $sys = get_sys_channel();
         $uid = intval($sys['channel_id']);
     }
     if (!$uid) {
         notice(t('Permission denied.') . EOL);
         return '';
     }
     if (argc() == 1) {
         $channel = $sys ? $sys : \App::get_channel();
         // list menus
         $x = menu_list($uid);
         if ($x) {
             for ($y = 0; $y < count($x); $y++) {
                 $m = menu_fetch($x[$y]['menu_name'], $uid, get_observer_hash());
                 if ($m) {
                     $x[$y]['element'] = '[element]' . base64url_encode(json_encode(menu_element($channel, $m))) . '[/element]';
                 }
                 $x[$y]['bookmark'] = $x[$y]['menu_flags'] & MENU_BOOKMARK ? true : false;
             }
         }
         $create = replace_macros(get_markup_template('menuedit.tpl'), array('$menu_name' => array('menu_name', t('Menu Name'), '', t('Unique name (not visible on webpage) - required'), '*'), '$menu_desc' => array('menu_desc', t('Menu Title'), '', t('Visible on webpage - leave empty for no title'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow Bookmarks'), 0, t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), '$submit' => t('Submit and proceed'), '$sys' => \App::$is_sys, '$display' => 'none'));
         $o = replace_macros(get_markup_template('menulist.tpl'), array('$title' => t('Menus'), '$create' => $create, '$menus' => $x, '$nametitle' => t('Menu Name'), '$desctitle' => t('Menu Title'), '$edit' => t('Edit'), '$drop' => t('Drop'), '$created' => t('Created'), '$edited' => t('Edited'), '$new' => t('New'), '$bmark' => t('Bookmarks allowed'), '$hintnew' => t('Create'), '$hintdrop' => t('Delete this menu'), '$hintcontent' => t('Edit menu contents'), '$hintedit' => t('Edit this menu'), '$sys' => \App::$is_sys));
         return $o;
     }
     if (argc() > 1) {
         if (intval(argv(1))) {
             if (argc() == 3 && argv(2) == 'drop') {
                 menu_sync_packet($uid, get_observer_hash(), intval(argv(1)), true);
                 $r = menu_delete_id(intval(argv(1)), $uid);
                 if (!$r) {
                     notice(t('Menu could not be deleted.') . EOL);
                 }
                 goaway(z_root() . '/menu' . (\App::$is_sys ? '?f=&sys=1' : ''));
             }
             $m = menu_fetch_id(intval(argv(1)), $uid);
             if (!$m) {
                 notice(t('Menu not found.') . EOL);
                 return '';
             }
             $o = replace_macros(get_markup_template('menuedit.tpl'), array('$header' => t('Edit Menu'), '$sys' => \App::$is_sys, '$menu_id' => intval(argv(1)), '$menu_edit_link' => 'mitem/' . intval(argv(1)) . (\App::$is_sys ? '?f=&sys=1' : ''), '$hintedit' => t('Add or remove entries to this menu'), '$editcontents' => t('Edit menu contents'), '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), '$menu_desc' => array('menu_desc', t('Menu title'), $m['menu_desc'], t('Menu title as seen by others'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow bookmarks'), $m['menu_flags'] & MENU_BOOKMARK ? 1 : 0, t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), '$menu_system' => $m['menu_flags'] & MENU_SYSTEM ? 1 : 0, '$submit' => t('Submit and proceed')));
             return $o;
         } else {
             notice(t('Not found.') . EOL);
             return;
         }
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:51,代码来源:Menu.php


示例8: 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


示例9: uploadButton

 /**
  * 输出上传图片按钮,调用上传窗口
  */
 public function uploadButton()
 {
     $config = $this->config;
     if (!isset($config['alowexts']) or empty($config['alowexts'])) {
         $config['alowexts'] = 'jpg,jpeg,gif,bmp,png,doc,docx';
     }
     $uploadObject = new UploadManager();
     if (!isset($config['uploadPath']) or empty($config['uploadPath'])) {
         $config['uploadPath'] = Config::get('sys.sys_upload_path') . '/';
     }
     $config['uploadPath'] = base64url_encode($config['uploadPath']);
     $config['uploadUrl'] = route('foundation.upload.index');
     //生成密钥,附止表单被修改。
     $authkey = $uploadObject->setParam($config)->uploadKey();
     return view('admin.widget.uploadbutton', compact('config', 'authkey'));
 }
开发者ID:pfdtk,项目名称:bmsys,代码行数:19,代码来源:Upload.php


示例10: make_rsa_jwk_key

function make_rsa_jwk_key($n, $e, $kid = NULL, $use = '')
{
    if (!$n || !$e) {
        return false;
    }
    $key_info = array('e' => base64url_encode($e), 'kty' => 'RSA', 'n' => base64url_encode($n));
    if ($kid) {
        $key_info['kid'] = $kid;
    } else {
        printf("jwk = %s\n", json_encode($key_info));
        $key_info['kid'] = base64url_encode(hash('sha256', json_encode($key_info), true));
    }
    if ($use) {
        $key_info['use'] = $use;
    }
    return $key_info;
}
开发者ID:reTHINK-project,项目名称:dev-IdPServer-phpOIDC,代码行数:17,代码来源:makejwk.php


示例11: get

 function get()
 {
     if (!is_site_admin()) {
         return;
     }
     $o = '';
     $r = q("select * from channel where channel_removed = 0");
     $sitekey = get_config('system', 'pubkey');
     if ($r) {
         foreach ($r as $rr) {
             $found = false;
             $primary_address = '';
             $x = zot_get_hublocs($rr['channel_hash']);
             if ($x) {
                 foreach ($x as $xx) {
                     if ($xx['hubloc_url'] === z_root() && $xx['hubloc_sitekey'] === $sitekey) {
                         $found = true;
                         break;
                     }
                 }
                 if ($found) {
                     $o .= 'Hubloc exists for ' . $rr['channel_name'] . EOL;
                     continue;
                 }
             }
             $y = q("select xchan_addr from xchan where xchan_hash = '%s' limit 1", dbesc($rr['channel_hash']));
             if ($y) {
                 $primary_address = $y[0]['xchan_addr'];
             }
             $hub_address = $rr['channel']['channel_address'] . '@' . \App::get_hostname();
             $primary = $hub_address === $primary_address ? 1 : 0;
             if (!$y) {
                 $primary = 1;
             }
             $m = q("delete from hubloc where hubloc_hash = '%s' and hubloc_url = '%s' ", dbesc($rr['channel_hash']), dbesc(z_root()));
             // Create a verified hub location pointing to this site.
             $h = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_primary, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_network )\n\t\t\t\t\tvalues ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s' )", dbesc($rr['channel_guid']), dbesc($rr['channel_guid_sig']), dbesc($rr['channel_hash']), dbesc($rr['channel_address'] . '@' . \App::get_hostname()), intval($primary), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(), $rr['channel_prvkey']))), dbesc(\App::get_hostname()), dbesc(z_root() . '/post'), dbesc($sitekey), dbesc('zot'));
             if ($h) {
                 $o . 'local hubloc created for ' . $rr['channel_name'] . EOL;
             } else {
                 $o .= 'DB update failed for ' . $rr['channel_name'] . EOL;
             }
         }
         return $o;
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:46,代码来源:Fhublocs.php


示例12: validate_credentials_front

 function validate_credentials_front()
 {
     if (!$this->session->userdata('is_logged_in')) {
         $this->load->model('Admin_model');
         $username = $this->input->post('username');
         $password = $this->__encrip_password($this->input->post('password'));
         $is_account_confirm = $this->Admin_model->validate_front_account_confirm($username, $password);
         if ($is_account_confirm) {
             $is_valid = $this->Admin_model->validate_front($username, $password);
             if ($is_valid) {
                 $stored_user_data = $this->Admin_model->get_user_id($username);
                 $user_id = $stored_user_data[0]->user_id;
                 $primary_email = $stored_user_data[0]->primary_email;
                 $affiliate = $stored_user_data[0]->type;
                 $type_of_membership = $stored_user_data[0]->type_of_membership;
                 if (!empty($affiliate)) {
                     $type = $affiliate;
                 } else {
                     $type = 'user';
                 }
                 $data = array('username' => $username, 'primary_email' => $primary_email, 'user_id' => $user_id, 'type' => $type, 'type_of_membership' => $type_of_membership, 'is_logged_in' => true);
                 $this->session->set_userdata($data);
                 if ($affiliate == 'affiliate') {
                     redirect("signin/signin_user/{$user_id}/affiliate");
                 } else {
                     $email = base64url_encode($primary_email);
                     redirect("home/account/{$user_id}/{$email}");
                 }
             } else {
                 $url = '<a href="' . base_url() . 'home/set_pass_mail">reset your password</a>';
                 $this->session->set_flashdata('flash_class', 'alert-danger');
                 $this->session->set_flashdata('flash_message', '<strong>ohh snap!</strong> Wrong Username And Password  </strong>');
                 $this->session->set_flashdata('flash_reset_url', 'Please try again or <strong>' . $url . '</strong>');
                 redirect('signin/signin_user');
             }
         } else {
             $this->session->set_flashdata('flash_class', 'alert-danger');
             $this->session->set_flashdata('flash_message', '<strong>ohh snap!</strong> Please Confirm Your Account By Your Email  </strong>');
             redirect('signin/signin_user');
         }
     } else {
         redirect('home');
     }
 }
开发者ID:hardikamutech,项目名称:stacksclassifieds,代码行数:44,代码来源:signin(1-4-2015).php


示例13: index

 function index($param = NULL)
 {
     if (!isset($this->ci->session) || !$this->ci->session->userdata('uid')) {
         if ($this->ci->uri->segment(1) != 'login') {
             redirect('login/' . base64url_encode($this->ci->uri->uri_string()), 'location');
         }
     } else {
         $userInfo = $this->ci->User_Model->get($this->ci->session->userdata('uid'), 'username,fullname');
         $this->ci->username = $this->ci->User_Model->get($this->ci->session->userdata('uid'), 'username');
         // 			$this->ci->usertype = $this->ci->User_Model->usertype();
         // 			if( $this->ci->usertype =='partner' ){
         // 				$partnerID = $this->ci->Common_Model->getVal(array('owner'=>$this->ci->session->userdata('uid')),'id',$this->ci->Account_Model->partnerTable);
         // 				$this->ci->parterID = ( is_numeric($partnerID) ) ? $partnerID : NULL;
         // 			} else if ($this->ci->usertype =='customer') {
         // 				$partnerID = $this->ci->Common_Model->getVal(array('owner'=>$this->ci->session->userdata('uid')),'partner',$this->ci->Account_Model->companyTable);
         // 				$companyName = $this->ci->Common_Model->getVal(array('owner'=>$this->ci->session->userdata('uid')),'name',$this->ci->Account_Model->companyTable);
         // 				$this->ci->parterID = ( is_numeric($partnerID) ) ? $partnerID : NULL;
         // 				$this->ci->smartyci->assign('companyname',$companyName);
         // 			}
         $this->ci->smarty->assign('username', $userInfo->username);
         $this->ci->smarty->assign('fullname', $userInfo->fullname);
         // 			if( !class_exists('adminDesigns') ){
         // 			$this->ci->smartyci->assign('usertype',$this->ci->usertype);
     }
     $this->ci->suffix = $this->ci->config->item('url_suffix');
     if (isset($_SERVER['ORIG_PATH_INFO'])) {
         $pathInfo = pathinfo($_SERVER['ORIG_PATH_INFO']);
     } else {
         if (isset($_SERVER['PATH_INFO'])) {
             $pathInfo = pathinfo($_SERVER['PATH_INFO']);
         }
     }
     if (isset($pathInfo['extension']) && $pathInfo['extension']) {
         $this->ci->suffix = $pathInfo['extension'];
     }
     if ($this->ci->suffix == 'json') {
         header('Content-type: application/json');
     }
     $this->ci->lang->load('common', 'english');
     $this->ci->lang->load('common', 'vietnam');
 }
开发者ID:quanict,项目名称:annu,代码行数:41,代码来源:annu_hook.php


示例14: prate_post

function prate_post(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = App::get_channel();
    $target = trim($_REQUEST['target']);
    if (!$target) {
        return;
    }
    if ($target === $channel['channel_hash']) {
        return;
    }
    $rating = intval($_POST['rating']);
    if ($rating < -10) {
        $rating = -10;
    }
    if ($rating > 10) {
        $rating = 10;
    }
    $rating_text = trim(escape_tags($_REQUEST['rating_text']));
    $signed = $target . '.' . $rating . '.' . $rating_text;
    $sig = base64url_encode(rsa_sign($signed, $channel['channel_prvkey']));
    $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc($target));
    if ($z) {
        $record = $z[0]['xlink_id'];
        $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s'\n\t\t\twhere xlink_id = %d", intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()), intval($record));
    } else {
        $w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_sig, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', '%s', 1 ) ", dbesc($channel['channel_hash']), dbesc($target), intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()));
        $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc($orig_record[0]['abook_xchan']));
        if ($z) {
            $record = $z[0]['xlink_id'];
        }
    }
    if ($record) {
        proc_run('php', 'include/ratenotif.php', 'rating', $record);
    }
    json_return_and_die(array('result' => true));
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:39,代码来源:prate.php


示例15: firstConnection

function firstConnection($id, $mdp, $IV)
{
    if (file_exists("C:\\wamp64\\www\\Web\\" . $id) != true) {
        $chemin = "C:\\wamp64\\www\\Web\\";
        //On creer un dossier.
        mkdir($chemin . $id);
    }
    //On creer un fichier ou on stocke le mdp.
    $chemin = "C:\\wamp64\\www\\Web\\" . $id . "\\Confg.txt";
    $handle = fopen($chemin, "w+");
    $mdp = chiffrement($mdp, $IV);
    $mdp = base64url_encode($mdp);
    fwrite($handle, "mdp:" . $mdp . "\r\n");
    $min = rand(0, 1000);
    $max = rand(100000, 1000000);
    $code = rand($min, $max);
    $code = chiffrement($code, $IV);
    $code = base64url_encode($code);
    fwrite($handle, "Code:" . $code);
    fclose($handle);
    return $code;
}
开发者ID:jeoff09,项目名称:Project-Optimisation,代码行数:22,代码来源:connection.php


示例16: post

 function post()
 {
     if (!local_channel()) {
         return;
     }
     if (!\App::$data['target']) {
         return;
     }
     if (!$_REQUEST['execute']) {
         return;
     }
     $channel = \App::get_channel();
     $rating = intval($_POST['rating']);
     if ($rating < -10) {
         $rating = -10;
     }
     if ($rating > 10) {
         $rating = 10;
     }
     $rating_text = trim(escape_tags($_REQUEST['rating_text']));
     $signed = \App::$data['target'] . '.' . $rating . '.' . $rating_text;
     $sig = base64url_encode(rsa_sign($signed, $channel['channel_prvkey']));
     $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc(\App::$data['target']));
     if ($z) {
         $record = $z[0]['xlink_id'];
         $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s'\n\t\t\t\twhere xlink_id = %d", intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()), intval($record));
     } else {
         $w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_sig, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', '%s', 1 ) ", dbesc($channel['channel_hash']), dbesc(\App::$data['target']), intval($rating), dbesc($rating_text), dbesc($sig), dbesc(datetime_convert()));
         $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), dbesc(\App::$data['target']));
         if ($z) {
             $record = $z[0]['xlink_id'];
         }
     }
     if ($record) {
         \Zotlabs\Daemon\Master::Summon(array('Ratenotif', 'rating', $record));
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:37,代码来源:Rate.php


示例17: check_zotinfo

function check_zotinfo($channel, $locations, &$ret)
{
    //	logger('locations: ' . print_r($locations,true),LOGGER_DATA);
    // This function will likely expand as we find more things to detect and fix.
    // 1. Because magic-auth is reliant on it, ensure that the system channel has a valid hubloc
    //    Force this to be the case if anything is found to be wrong with it.
    // @FIXME ensure that the system channel exists in the first place and has an xchan
    if ($channel['channel_system']) {
        // the sys channel must have a location (hubloc)
        $valid_location = false;
        if (count($locations) === 1 && $locations[0]['primary'] && !$locations[0]['deleted']) {
            if (rsa_verify($locations[0]['url'], base64url_decode($locations[0]['url_sig']), $channel['channel_pubkey']) && $locations[0]['sitekey'] === get_config('system', 'pubkey') && $locations[0]['url'] === z_root()) {
                $valid_location = true;
            } else {
                logger('sys channel: invalid url signature');
            }
        }
        if (!$locations || !$valid_location) {
            logger('System channel locations are not valid. Attempting repair.');
            // Don't trust any existing records. Just get rid of them, but only do this
            // for the sys channel as normal channels will be trickier.
            q("delete from hubloc where hubloc_hash = '%s'", dbesc($channel['channel_hash']));
            $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_primary,\n\t\t\t\thubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_network )\n\t\t\t\tvalues ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s' )", dbesc($channel['channel_guid']), dbesc($channel['channel_guid_sig']), dbesc($channel['channel_hash']), dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()), intval(1), dbesc(z_root()), dbesc(base64url_encode(rsa_sign(z_root(), $channel['channel_prvkey']))), dbesc(get_app()->get_hostname()), dbesc(z_root() . '/post'), dbesc(get_config('system', 'pubkey')), dbesc('zot'));
            if ($r) {
                $x = zot_encode_locations($channel);
                if ($x) {
                    $ret['locations'] = $x;
                }
            } else {
                logger('Unable to store sys hub location');
            }
        }
    }
}
开发者ID:23n,项目名称:hubzilla,代码行数:34,代码来源:zot.php


示例18: get

 function get()
 {
     $change = false;
     logger('mod_group: ' . \App::$cmd, LOGGER_DEBUG);
     if (!local_channel()) {
         notice(t('Permission denied') . EOL);
         return;
     }
     // Switch to text mode interface if we have more than 'n' contacts or group members
     $switchtotext = get_pconfig(local_channel(), 'system', 'groupedit_image_limit');
     if ($switchtotext === false) {
         $switchtotext = get_config('system', 'groupedit_image_limit');
     }
     if ($switchtotext === false) {
         $switchtotext = 400;
     }
     $tpl = get_markup_template('group_edit.tpl');
     $context = array('$submit' => t('Submit'));
     if (argc() == 2 && argv(1) === 'new') {
         return replace_macros($tpl, $context + array('$title' => t('Create a group of channels.'), '$gname' => array('groupname', t('Privacy group name: '), '', ''), '$gid' => 'new', '$public' => array('public', t('Members are visible to other channels'), false, ''), '$form_security_token' => get_form_security_token("group_edit")));
     }
     if (argc() == 3 && argv(1) === 'drop') {
         check_form_security_token_redirectOnErr('/group', 'group_drop', 't');
         if (intval(argv(2))) {
             $r = q("SELECT `name` FROM `groups` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval(argv(2)), intval(local_channel()));
             if ($r) {
                 $result = group_rmv(local_channel(), $r[0]['gname']);
             }
             if ($result) {
                 info(t('Privacy group removed.') . EOL);
             } else {
                 notice(t('Unable to remove privacy group.') . EOL);
             }
         }
         goaway(z_root() . '/group');
         // NOTREACHED
     }
     if (argc() > 2 && intval(argv(1)) && argv(2)) {
         check_form_security_token_ForbiddenOnErr('group_member_change', 't');
         $r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 limit 1", dbesc(base64url_decode(argv(2))), intval(local_channel()));
         if (count($r)) {
             $change = base64url_decode(argv(2));
         }
     }
     if (argc() > 1 && intval(argv(1))) {
         require_once 'include/acl_selectors.php';
         $r = q("SELECT * FROM `groups` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1", intval(argv(1)), intval(local_channel()));
         if (!$r) {
             notice(t('Privacy group not found.') . EOL);
             goaway(z_root() . '/connections');
         }
         $group = $r[0];
         $members = group_get_members($group['id']);
         $preselected = array();
         if (count($members)) {
             foreach ($members as $member) {
                 if (!in_array($member['xchan_hash'], $preselected)) {
                     $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);
             }
             $members = group_get_members($group['id']);
             $preselected = array();
             if (count($members)) {
                 foreach ($members as $member) {
                     $preselected[] = $member['xchan_hash'];
                 }
             }
         }
         $drop_tpl = get_markup_template('group_drop.tpl');
         $drop_txt = replace_macros($drop_tpl, array('$id' => $group['id'], '$delete' => t('Delete'), '$form_security_token' => get_form_security_token("group_drop")));
         $context = $context + array('$title' => t('Privacy group editor'), '$gname' => array('groupname', t('Privacy group name: '), $group['gname'], ''), '$gid' => $group['id'], '$drop' => $drop_txt, '$public' => array('public', t('Members are visible to other channels'), $group['visible'], ''), '$form_security_token' => get_form_security_token('group_edit'));
     }
     if (!isset($group)) {
         return;
     }
     $groupeditor = array('label_members' => t('Members'), 'members' => array(), 'label_contacts' => t('All Connected Channels'), 'contacts' => array());
     $sec_token = addslashes(get_form_security_token('group_member_change'));
     $textmode = $switchtotext && count($members) > $switchtotext ? true : false;
     foreach ($members as $member) {
         if ($member['xchan_url']) {
             $member['archived'] = intval($member['abook_archived']) ? true : false;
             $member['click'] = 'groupChangeMember(' . $group['id'] . ',\'' . base64url_encode($member['xchan_hash']) . '\',\'' . $sec_token . '\'); return false;';
             $groupeditor['members'][] = micropro($member, true, 'mpgroup', $textmode);
         } else {
             group_rmv_member(local_channel(), $group['gname'], $member['xchan_hash']);
         }
     }
     $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_self = 0 and abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc", intval(local_channel()));
     if (count($r)) {
         $textmode = $switchtotext && count($r) > $switchtotext ? true : false;
         foreach ($r as $member) {
             if (!in_array($member['xchan_hash'], $preselected)) {
                 $member['archived'] = intval($member['abook_archived']) ? true : false;
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:101,代码来源:Group.php


示例19: consume_feed

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP baseName函数代码示例发布时间:2022-05-24
下一篇:
PHP base64url_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