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

PHP get_site_secret函数代码示例

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

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



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

示例1: gdocs_file_previewer_get_token

function gdocs_file_previewer_get_token($file, $timestamp)
{
    if (!elgg_instanceof($file) || !is_numeric($timestamp)) {
        return false;
    }
    $secret = get_site_secret();
    return sha1($file->guid . $secret . $timestamp);
}
开发者ID:summer11123,项目名称:GDocs-File-Previewer,代码行数:8,代码来源:start.php


示例2: get_token

function get_token($url)
{
    if (elgg_get_config('image_proxy_secret')) {
        $site_secret = elgg_get_config('image_proxy_secret');
    } else {
        $site_secret = get_site_secret();
    }
    return md5($site_secret . $url);
}
开发者ID:ewinslow,项目名称:image_proxy,代码行数:9,代码来源:start.php


示例3: acount_removal_generate_confirm_token

/**
 * Generate a validation token
 *
 * @param string $type      what kind of token
 * @param int    $user_guid the user_guid to generate for
 *
 * @return bool|string
 */
function acount_removal_generate_confirm_token($type, $user_guid)
{
    $result = false;
    if (!empty($user_guid) && ($user = get_user($user_guid)) && in_array($type, array("remove", "disable"))) {
        $site_secret = get_site_secret();
        $user_salt = $user->salt;
        $result = md5($site_secret . $user_guid . $type . $user_salt);
    }
    return $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:18,代码来源:functions.php


示例4: admin_tools_make_switch_admin_secret

/**
 * Create a secret code to toggle admin/normal user
 *
 * @param ElggUser $user the user to create the secret for (default: current user)
 *
 * @return false|string
 */
function admin_tools_make_switch_admin_secret(ElggUser $user = null)
{
    // no param, check current logged in user
    if (empty($user)) {
        $user = elgg_get_logged_in_user_entity();
    }
    // no user to check
    if (!$user instanceof ElggUser) {
        return false;
    }
    return hash_hmac('sha256', $user->time_created, get_site_secret());
}
开发者ID:coldtrick,项目名称:admin_tools,代码行数:19,代码来源:functions.php


示例5: getStrength

 /**
  * Get the strength of the site secret
  *
  * @return string "strong", "moderate", or "weak"
  * @access private
  */
 function getStrength()
 {
     $secret = get_site_secret();
     if ($secret[0] !== 'z') {
         $rand_max = getrandmax();
         if ($rand_max < pow(2, 16)) {
             return 'weak';
         }
         if ($rand_max < pow(2, 32)) {
             return 'moderate';
         }
     }
     return 'strong';
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:20,代码来源:SiteSecret.php


示例6: getThumbUrl

 public function getThumbUrl($url = '', $handle = null)
 {
     $data = $this->resourceCache->get($url, $handle);
     if (!empty($data['thumb_cache'])) {
         $uid = md5($url);
         $path = "scraper_cache/thumbs/{$uid}.{$handle}.jpg";
         $dir = elgg_get_site_entity()->guid;
         $dir_tc = elgg_get_site_entity()->time_created;
         $query = serialize(array('uid' => $uid, 'path' => $path, 'd' => $dir, 'dts' => $dir_tc, 'ts' => $data['thumb_cache'], 'mac' => hash_hmac('sha256', $uid . $path, get_site_secret())));
         $icon_url = elgg_http_add_url_query_elements('/mod/hypeApps/servers/icon.php', array('q' => base64_encode($query)));
     } else {
         if (!empty($data['thumbnail_url'])) {
             $icon_url = $data['thumbnail_url'];
         } else {
             $icon_url = '/mod/hypeScraper/graphics/placeholder.png';
         }
     }
     return elgg_normalize_url($icon_url);
 }
开发者ID:justangel,项目名称:hypeScraper,代码行数:19,代码来源:Resources.php


示例7: group_tools_invite_email

function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
    $result = false;
    if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && ($loggedin_user = elgg_get_logged_in_user_entity())) {
        // get site secret
        $site_secret = get_site_secret();
        // generate invite code
        $invite_code = md5($site_secret . $email . $group->getGUID());
        if (!group_tools_check_group_email_invitation($invite_code, $group->getGUID()) || $resend) {
            // make site email
            $site = elgg_get_site_entity();
            if (!empty($site->email)) {
                if (!empty($site->name)) {
                    $site_from = $site->name . " <" . $site->email . ">";
                } else {
                    $site_from = $site->email;
                }
            } else {
                // no site email, so make one up
                if (!empty($site->name)) {
                    $site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
                } else {
                    $site_from = "noreply@" . get_site_domain($site->getGUID());
                }
            }
            if (!$resend) {
                // register invite with group
                $group->annotate("email_invitation", $invite_code, ACCESS_LOGGED_IN, $group->getGUID());
            }
            // make subject
            $subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
            // make body
            $body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register", elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
            $result = elgg_send_email($site_from, $email, $subject, $body);
        } else {
            $result = null;
        }
    }
    return $result;
}
开发者ID:remy40,项目名称:gvrs,代码行数:40,代码来源:functions.php


示例8: registration_randomizer_generate_token

/**
 * Hashes the site secret, UA, and a ts.
 *
 * @return mixed A token if time or req is passed, and array of info if not
 */
function registration_randomizer_generate_token($passed_time = null, $passed_req = null)
{
    if ($passed_time === null) {
        $ts = time();
    } else {
        $ts = $passed_time;
    }
    if ($passed_req === null) {
        $req = $_SERVER;
    } else {
        $req = $passed_req;
    }
    $str = get_site_secret();
    $str .= filter_input(INPUT_SERVER, 'HTTP_USER_AGENT');
    $str .= filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP);
    $str .= $ts;
    $token = md5($str);
    if ($passed_time === null && $passed_req === null) {
        return array('ts' => $ts, 'token' => $token, 'req' => $req);
    } else {
        return $token;
    }
}
开发者ID:brettp,项目名称:elgg-registration-randomizer,代码行数:28,代码来源:start.php


示例9: siteaccess_generate_captcha

function siteaccess_generate_captcha($num)
{
    global $CONFIG;
    $date = date("F j");
    $tmp = hexdec(md5($num . $date . $CONFIG->site->url . get_site_secret()));
    $code = substr($tmp, 4, 6);
    return $code;
}
开发者ID:sh3llc0de,项目名称:elgg-siteaccess,代码行数:8,代码来源:start.php


示例10: generate_action_token

/**
 * Generate an action token.
 *
 * Action tokens are based on timestamps as returned by {@link time()}.
 * They are valid for one hour.
 *
 * Action tokens should be passed to all actions name __elgg_ts and __elgg_token.
 *
 * @warning Action tokens are required for all actions.
 *
 * @param int $timestamp Unix timestamp
 *
 * @see @elgg_view input/securitytoken
 * @see @elgg_view input/form
 * @example actions/manual_tokens.php
 *
 * @return string|false
 * @access private
 */
function generate_action_token($timestamp)
{
    $site_secret = get_site_secret();
    $session_id = session_id();
    // Session token
    $st = $_SESSION['__elgg_session'];
    if ($site_secret && $session_id) {
        return md5($site_secret . $timestamp . $session_id . $st);
    }
    return FALSE;
}
开发者ID:nachopavon,项目名称:Elgg,代码行数:30,代码来源:actions.php


示例11: tidypics_ajax_session_handler

/**
 * Work around for Flash/session issues
 *
 * Catches Elgg attempting to forward the Flash uploader because it doesn't
 * have a session cookie. Instead manually runs the action.
 *
 * @param string $hook   The name of the hook
 * @param string $type   The type of the hook
 * @param string $value  Location being forwarded to
 * @param array  $params Parameters related to the forward() call
 * @return void
 */
function tidypics_ajax_session_handler($hook, $type, $value, $params)
{
    $www_root = elgg_get_config('wwwroot');
    $url = $params['current_url'];
    if ($url !== "{$www_root}action/photos/image/ajax_upload") {
        return;
    }
    if (elgg_get_logged_in_user_guid() != 0) {
        return;
    }
    // action_gatekeeper rejected ajax call from Flash due to session issue
    // Validate token
    $token = get_input('__elgg_token');
    $ts = get_input('__elgg_ts');
    $session_id = get_input('Elgg');
    $session_token = get_input('session_token');
    $tidypics_token = get_input('tidypics_token');
    $user_guid = get_input('user_guid');
    $user = get_user($user_guid);
    $timeout = elgg_get_config('action_token_timeout');
    if (!$timeout) {
        $timeout = 2;
    }
    if (!$user) {
        trigger_error('Tidypics warning: failed to get user in flash uploader', E_USER_WARNING);
        return;
    }
    if (!$token || !$ts || !$session_id || !$tidypics_token) {
        trigger_error('Tidypics warning: token information missing in flash uploader', E_USER_WARNING);
        return;
    }
    $hour = 60 * 60;
    $now = time();
    if ($ts < $now - $hour || $ts > $now + $hour) {
        trigger_error('Tidypics warning: failed time check in flash uploader', E_USER_WARNING);
        return;
    }
    $generated_token = md5($session_id . get_site_secret() . $ts . $user->salt);
    if ($tidypics_token !== $generated_token) {
        trigger_error('Tidypics warning: token check failed in flash uploader', E_USER_WARNING);
        return;
    }
    // passed token test, so login and process action
    login($user);
    $actions = elgg_get_config('actions');
    include $actions['photos/image/ajax_upload']['file'];
    exit;
}
开发者ID:pleio,项目名称:tidypics,代码行数:60,代码来源:start.php


示例12: generateCode

 private function generateCode($userGuid, $email, $date)
 {
     return md5($userGuid . $email . $date . elgg_get_site_url() . get_site_secret());
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:4,代码来源:UserManagement.php


示例13: uservalidationbyemail_generate_code

/**
 * Generate an email activation code.
 *
 * @param int $user_guid The guid of the user
 * @param string $email_address Email address
 * @return string
 */
function uservalidationbyemail_generate_code($user_guid, $email_address)
{
    global $CONFIG;
    // Note I bind to site URL, this is important on multisite!
    return md5($user_guid . $email_address . $CONFIG->site->url . get_site_secret());
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:13,代码来源:start.php


示例14: group_tools_generate_email_invite_code

/**
 * Generate a unique code to be used in email invitations
 *
 * @param int    $group_guid the group GUID
 * @param string $email      the email address
 *
 * @return boolean|string the invite code, or false on failure
 */
function group_tools_generate_email_invite_code($group_guid, $email)
{
    $result = false;
    if (!empty($group_guid) && !empty($email)) {
        // get site secret
        $site_secret = get_site_secret();
        // generate code
        $result = md5($site_secret . strtolower($email) . $group_guid);
    }
    return $result;
}
开发者ID:pleio,项目名称:group_tools,代码行数:19,代码来源:functions.php


示例15: notifyOnRsvp

 /**
  * Notifies an user of the RSVP
  *
  * @param string $type type of the RSVP
  * @param string $to   guid of the user
  *
  * @return void
  */
 public function notifyOnRsvp($type, $to = null)
 {
     $ia = elgg_set_ignore_access(true);
     if ($to === null) {
         $to = elgg_get_logged_in_user_guid();
     }
     $to_entity = get_entity($to);
     if (empty($to_entity)) {
         elgg_set_ignore_access($ia);
         return;
     }
     // can we make nice links in the emails
     $html_email_handler_enabled = elgg_is_active_plugin("html_email_handler");
     // do we have a registration link
     $registrationLink = "";
     $unsubscribeLink = "";
     if ($type == EVENT_MANAGER_RELATION_ATTENDING) {
         if ($this->registration_needed) {
             $link = elgg_get_site_url() . 'events/registration/view/?guid=' . $this->getGUID() . '&u_g=' . $to . '&k=' . md5($this->time_created . get_site_secret() . $to);
             $registrationLink = PHP_EOL . PHP_EOL;
             $registrationLink .= elgg_echo('event_manager:event:registration:notification:program:linktext');
             $registrationLink .= PHP_EOL . PHP_EOL;
             if ($html_email_handler_enabled) {
                 $registrationLink .= elgg_view("output/url", array("text" => $link, "href" => $link));
             } else {
                 $registrationLink .= $link;
             }
         }
         if ($this->register_nologin) {
             $link = elgg_get_site_url() . "events/unsubscribe/" . $this->getGUID() . "/" . elgg_get_friendly_title($this->title) . "?e=" . $to_entity->email;
             $unsubscribeLink = PHP_EOL . PHP_EOL;
             $unsubscribeLink .= elgg_echo('event_manager:event:registration:notification:unsubscribe:linktext');
             $unsubscribeLink .= PHP_EOL . PHP_EOL;
             if ($html_email_handler_enabled) {
                 $unsubscribeLink .= elgg_view("output/url", array("text" => $link, "href" => $link));
             } else {
                 $unsubscribeLink .= $link;
             }
         }
     }
     // make the event title for in the e-mail
     if ($html_email_handler_enabled) {
         $event_title_link = elgg_view("output/url", array("text" => $this->title, "href" => $this->getURL()));
     } else {
         $event_title_link = $this->title;
     }
     // notify the owner of the event
     $this->notifyOwnerOnRSVP($type, $to_entity, $event_title_link, $registrationLink);
     // notify the attending user
     $user_subject = elgg_echo('event_manager:event:registration:notification:user:subject');
     $user_message = elgg_echo('event_manager:event:registration:notification:user:text:' . $type, array($to_entity->name, $event_title_link));
     $user_message .= $registrationLink;
     $user_message .= $unsubscribeLink;
     if ($to_entity instanceof ElggUser) {
         // use notification system for real users
         notify_user($to, $this->getOwnerGUID(), $user_subject, $user_message);
     } else {
         // send e-mail for non users
         $to_email = $to_entity->name . "<" . $to_entity->email . ">";
         $site = elgg_get_site_entity($this->site_guid);
         if ($site->email) {
             if ($site->name) {
                 $site_from = $site->name . " <" . $site->email . ">";
             } else {
                 $site_from = $site->email;
             }
         } else {
             // no site email, so make one up
             if ($site->name) {
                 $site_from = $site->name . " <noreply@" . $site->getDomain() . ">";
             } else {
                 $site_from = "noreply@" . $site->getDomain();
             }
         }
         elgg_send_email($site_from, $to_email, $user_subject, $user_message);
     }
     elgg_set_ignore_access($ia);
 }
开发者ID:pleio,项目名称:event_manager,代码行数:86,代码来源:Event.php


示例16: time

<?php

/**
 * Tidypics ajax upload form body
 *
 * @uses $vars['entity']
 */
$album = $vars['entity'];
$ts = time();
$batch = time();
$tidypics_token = md5(session_id() . get_site_secret() . $ts . elgg_get_logged_in_user_entity()->salt);
$basic_uploader_url = current_page_url() . '/basic';
$maxfilesize = (double) elgg_get_plugin_setting('maxfilesize', 'tidypics');
if (!$maxfilesize) {
    $maxfilesize = 5;
}
$quota = elgg_get_plugin_setting('quota', 'tidypics');
if ($quota) {
    $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
    $image_repo_size = (int) $image_repo_size_md->value;
    $image_repo_size = $image_repo_size / 1024 / 1024;
    $quote_percentage = round(100 * ($image_repo_size / $quota));
    // for small quotas, so one decimal place
    if ($quota < 10) {
        $image_repo_size = sprintf('%.1f', $image_repo_size);
    } else {
        $image_repo_size = round($image_repo_size);
    }
    if ($image_repo_size > $quota) {
        $image_repo_size = $quota;
    }
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:31,代码来源:ajax_upload.php


示例17: ws_pack_generate_sso_secret

/**
 * Generates a Single Sign On secret for a give user
 *  
 * @param ElggUser $user      user to generate the secret for
 * @param int      $timestamp timestamp to limit the durability of the secret
 * 
 * @return boolean|string
 */
function ws_pack_generate_sso_secret(ElggUser $user, $timestamp)
{
    static $running_cache;
    $result = false;
    if (!empty($user) && elgg_instanceof($user, "user", null, "ElggUser")) {
        if (!isset($running_cache)) {
            $running_cache = array();
        }
        if (!isset($running_cache[$user->getGUID()])) {
            $running_cache[$user->getGUID()] = md5($user->getGUID() . get_site_secret() . $user->salt . $timestamp);
        }
        $result = $running_cache[$user->getGUID()];
    }
    return $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:23,代码来源:functions.php


示例18: zhaohuEmailUnsubEnd

function zhaohuEmailUnsubEnd($group, $user_guid, $is_notificiation, $from_group)
{
    $end = '<div style="clear:both;background:#ececec;text-align:center;margin-top:20px;border-top:solid 10px #ececec;border-bottom:solid 10px #ececec">' . '<div style="width:94%;margin:0 auto;border-left:solid 10px #ececec;border-right:solid 10px #ececec;min-width:220px;max-width:600px;text-align:left;font-family:arial;color:#333;font-size:12px;line-height:14px">';
    if ($is_notificiation) {
        if ($from_group) {
            $unsub = elgg_get_site_url() . "zhgroups/emUnsub?guid=" . $group->guid . "&user=" . $user_guid . "&k=" . md5($group->time_created . get_site_secret() . $user_guid);
            $end .= '<p style="margin:0 0 .25em;color:#333"><a href="' . $unsub . '" style="color:#ccc;text-decoration:underline" target="_blank">' . elgg_echo('zhgroups:mail:unsub1') . '</a> ' . elgg_echo('zhgroups:mail:unsub2') . '</p>';
        }
        $end .= '<p style="margin:0 0 .25em;color:#333">' . elgg_echo('zhgroups:unsub:site') . '</p>';
    }
    $end .= '<p style="margin:0 0 .25em;color:#333">' . elgg_echo('51zhaohu') . ': http://51zhaohu.com</p></div></div>';
    return zhaohuEmailSupport() . zhaohuEmailSocialButtons() . $end;
}
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:13,代码来源:notify.php


示例19: newsletter_generate_unsubscribe_code

/**
 * Generate a unsubscribe code to be used in validation
 *
 * @param ElggEntity $container Which newsletter container (ElggSite or ElggGroup)
 * @param string|int $recipient The user_guid or email address of the recipient
 *
 * @return bool|string The unsubscribe code or false on failure
 */
function newsletter_generate_unsubscribe_code(ElggEntity $container, $recipient)
{
    $result = false;
    if (!empty($container) && (elgg_instanceof($container, "site") || elgg_instanceof($container, "group")) && !empty($recipient)) {
        // make sure we have a user_guid or email address
        if (is_numeric($recipient) || newsletter_is_email_address($recipient)) {
            $plugin = elgg_get_plugin_from_id("newsletter");
            $result = hash_hmac("sha256", $container->getGUID() . "|" . $recipient . "|" . $plugin->time_created, get_site_secret());
        }
    }
    return $result;
}
开发者ID:pleio,项目名称:newsletter,代码行数:20,代码来源:functions.php


示例20: generate_key

function generate_key()
{
    $secret = get_site_secret();
    return sha1(microtime(true) . $secret);
}
开发者ID:beck24,项目名称:elgg_copy,代码行数:5,代码来源:start.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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