Пример #1
0
function expertLoop2()
{
    $args = array('blog_id' => $GLOBALS['blog_id'], 'role' => 'Scientist', 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'meta_query' => array(), 'include' => array(), 'exclude' => array(), 'orderby' => 'last_name', 'order' => 'ASC', 'offset' => '', 'search' => '', 'number' => '', 'count_total' => false, 'fields' => 'all_with_meta', 'who' => '');
    $blogusers = get_users($args);
    //Open markup
    $output = '';
    foreach ($blogusers as $user) {
        $userdata = get_userdata($user->get('ID'));
        $all_meta_for_user = get_user_meta($user->get('ID'));
        if (!empty($all_meta_for_user['expertise'][0])) {
            $expertise = $all_meta_for_user['expertise'][0];
        }
        if (!empty($userdata->user_url)) {
            $website = $userdata->user_url;
        }
        if (!empty($all_meta_for_user['orchid'][0])) {
            $orchid = $all_meta_for_user['orchid'][0];
        }
        if (!empty($all_meta_for_user['hypothesis'][0])) {
            $hypothesis = $all_meta_for_user['hypothesis'][0];
        }
        if (!empty($all_meta_for_user['title'][0])) {
            $title = $all_meta_for_user['title'][0];
        }
        if (!empty($all_meta_for_user['affiliation'][0])) {
            $affiliation = $all_meta_for_user['affiliation'][0];
        }
        if (!empty($all_meta_for_user['publicationone'][0])) {
            $publicationone = $all_meta_for_user['publicationone'][0];
        }
        if (!empty($all_meta_for_user['first_name'][0])) {
            $first_name = $all_meta_for_user['first_name'][0];
        }
        if (!empty($all_meta_for_user['last_name'][0])) {
            $last_name = $all_meta_for_user['last_name'][0];
        }
        $output .= '<div class="row expert">
          <div class="med-left">
            ' . get_avatar($user->get('ID'), $size = '256', $default = '<path_to_url>') . '
          </div>
          <div class="med-body">
            <h3 class="noborder"> <a href="/reviewers/' . format_uri($first_name) . '-' . format_uri($last_name) . '">' . $first_name . ' ' . $last_name . '</a></h3>
            <p>' . $title . ', ' . $affiliation . '</p>
            <p><small>Expertise:</small> ' . $expertise . '</p>
            <p><small>Hypothesis:</small> <a target="_blank" href="https://hypothes.is/stream?q=user:'******'" class="">' . $hypothesis . '</a></p>
          </div>
        </div>';
    }
    //Close and return markup
    return $output;
}
Пример #2
0
function redirect_rule($gps, $destinationid)
{
    Debuglogs("Destination: {$destinationid}", __FUNCTION__, __LINE__);
    if (!isset($_SESSION["AUTHENTICATOR_AUTH"]["{$destinationid}"])) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT params FROM authenticator_auth WHERE ID={$destinationid}"));
        $_SESSION["AUTHENTICATOR_AUTH"]["{$destinationid}"] = $ligne["params"];
    }
    $params = unserialize(base64_decode($_SESSION["AUTHENTICATOR_AUTH"]["{$destinationid}"]));
    $url = $params["URI"];
    if ($url == null) {
        return false;
    }
    reset($gps);
    $DETECTED = false;
    while (list($gpid, $type) = each($gps)) {
        Debuglogs("Check Group ID {$gpid} for type={$type} (" . $GLOBALS["SOURCE_TYPE"][$type] . ")", __FUNCTION__, __LINE__);
        if (!isset($_SESSION["AUTHENTICATOR_ITEMS"][$gpid])) {
            $q = new mysql_squid_builder();
            $sql = "SELECT pattern FROM authenticator_items WHERE groupid={$gpid}";
            $results = $q->QUERY_SQL($sql);
            while ($ligne = mysql_fetch_assoc($results)) {
                $_SESSION["AUTHENTICATOR_ITEMS"][$gpid][] = $ligne["pattern"];
            }
        }
        reset($_SESSION["AUTHENTICATOR_ITEMS"][$gpid]);
        while (list($none, $KEY_COOKIE) = each($_SESSION["AUTHENTICATOR_ITEMS"][$gpid])) {
            Debuglogs("If there a cookie `{$KEY_COOKIE}` ?", __FUNCTION__, __LINE__);
            if (!isset($_COOKIE[$KEY_COOKIE])) {
                Debuglogs("`{$KEY_COOKIE}` is not present, break and perform action..", __FUNCTION__, __LINE__);
                $DETECTED = true;
                break;
            }
        }
        if ($DETECTED) {
            break;
        }
    }
    if ($DETECTED) {
        $url = format_uri($url);
        $_SESSION["AUTHENTICATOR_RESULTS"][$GLOBALS["ruleid"]] = "redirect:{$url}";
        Debuglogs("Destination: {$url}", __FUNCTION__, __LINE__);
        header('HTTP/1.0 403 Forbidden');
        return true;
    }
}