コード例 #1
0
ファイル: cb_bbcode.php プロジェクト: yukisky/clipbucket
Description: SAMPLE PLUGIN FOR COMMENT AND DESCRIPTION MODIFICATION
Author: Arslan Hassan
Author Website: http://clip-bucket.com/
ClipBucket Version: 2
Version: 1.0
Website: http://labguru.com/
Plugin Type: global
*/
if (!function_exists('bb_to_html')) {
    function bb_to_html($comment)
    {
        //Replaceing Image Code
        $img_patter = '/\\[img\\](.*)\\[\\/img\\]/';
        $img_replace = '<img src="$1" />';
        $coded_comment = preg_replace($img_patter, $img_replace, $comment);
        $bbcodes = array('/\\[b\\]/', '/\\[i\\]/', '/\\[u\\]/', '/\\[quote\\]/', '/\\[url\\](.*)\\[\\/url\\]/', '/\\[\\/b\\]/', '/\\[\\/i\\]/', '/\\[\\/u\\]/', '/\\[\\/quote\\]/', '/\\[url=(.*)\\](.*)\\[\\/url\\]/');
        $HTMLcodes = array('<strong>', '<em>', '<u>', '<blockquote>', '<a href="$1">$1</a>', '</strong>', '</em>', '</u>', '</blockquote>', '<a href="$1">$2</a>');
        $coded_comment = preg_replace($bbcodes, $HTMLcodes, $coded_comment);
        return $coded_comment;
    }
}
//Registering Action that will be applied while displaying comment and or description
register_action(array('bb_to_html' => array('comment', 'description', 'pm_compose_box', 'before_topic_post_box', 'private_message')));
$hints = "<div style='font-family:tahoma; margin:0px 0x 5px 0px'><strong>*Following bbcodes can be used</strong><br />\n<div style='padding-left:5px'>[b]for bold letters[/b]<br />\n[i]for italic letters[/i]<br />\n[u]for underline[/u]<br />\n[quote]for quotations[/quote]<br />\n[url]for link[/url] or [url=link]title[/url]</div></div>";
//Registerin Anchors , that will be displayed before compose boxes
register_anchor($hints, 'after_compose_box');
register_anchor($hints, 'after_reply_compose_box');
register_anchor($hints, 'after_desc_compose_box');
register_anchor($hints, 'after_pm_compose_box');
register_anchor($hints, 'after_topic_post_box');
コード例 #2
0
             $is_subscribed = is_user_subscribed($sub['userid']);
             $continue = true;
             if ($subscribe and !$is_subscribed) {
                 $heading = sprintf(lang('Subscribe %s'), name($sub));
                 $body = sprintf($body, "Please confirm, you want to subscribe " . name($sub));
             } else {
                 if ($unsubscribe and $is_subscribed) {
                     $heading = sprintf(lang('Unsubscribe %s'), name($sub));
                     $body = sprintf($body, "Please confirm, you want to unsubscribe <a href='" . $userquery->profile_link($sub) . "'>" . name($sub) . '</a>');
                 } else {
                     $continue = false;
                 }
             }
             if ($continue === true) {
                 $javascript = '<script>$( document ).ready( function(){ cb_confirm( "' . $heading . '","' . $body . '",function(){ window.location="' . $url . '" }) } )</script>';
                 register_anchor($javascript, 'cb_head');
             }
         }
     }
 }
 if ($confirm == 2) {
     $subscribe = get('subscribe');
     $unsubscribe = get('unsubscribe');
     if ($subscribe || $unsubscribe) {
         $sub_id = get('owner');
         $sub = get_user_details($sub_id);
         if ($sub) {
             $is_subscribed = is_user_subscribed($sub['userid']);
             if ($subscribe and !$is_subscribed) {
                 subscribe_user($sub_id);
             } else {
コード例 #3
0
ファイル: recaptcha.php プロジェクト: yukisky/clipbucket
Website: http://clip-bucket.com/
Plugin Type: global
*/
include "recaptchalib.php";
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = $Cbucket->configs['reCaptcha_public_key'];
$privatekey = $Cbucket->configs['reCaptcha_private_key'];
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
function cbRecaptcha()
{
    global $publickey, $privatekey, $error;
    return recaptcha_get_html($publickey, $error);
}
function validateCbRecaptcha($val = NULL)
{
    global $privatekey;
    if ($_POST["recaptcha_response_field"]) {
        $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if ($resp->is_valid) {
            return true;
        } else {
            return false;
        }
    }
}
register_cb_captcha('cbRecaptcha', 'validateCbRecaptcha', false);
register_anchor('; Recaptcha.reload ();', 'onClickAddComment');
add_header(PLUG_DIR . '/recaptcha/reCaptcha_header.html');
コード例 #4
0
ファイル: signup_captcha.php プロジェクト: yukisky/clipbucket
<?php

/*
Plugin Name: Signup Captcha
Description: Security Captcha for signup form
Author: Arslan Hassan
Author Website: http://clip-bucket.com/
ClipBucket Version: 2
Version: 1.0
Website: http://clip-bucket.com/
Plugin Type: global
*/
if (!function_exists("signup_captcha")) {
    require "captcha/class.img_validator.php";
    function signup_captcha()
    {
        $rand_id = RandomString(3);
        return '<img src="' . PLUG_URL . '/signup_captcha/captcha.php" border=1 name="captcha" id="captcha_img_' . $rand_id . '"/><br />
               <a href="javascript:void(0)" onclick="javascript:reloadImage(\'' . PLUG_URL . '/signup_captcha/captcha.php\',\'captcha_img_' . $rand_id . '\');"> Refresh</a>';
    }
    $signup_captcha['signup_captcha'] = array('title' => 'Varification Code', 'type' => "textfield", 'name' => "vcode", 'id' => "vcode", 'required' => 'yes', 'validate_function' => 'signup_captcha_check', 'anchor_after' => 'signup_captcha', 'invalid_err' => lang('usr_ccode_err'));
    function signup_captcha_check($val)
    {
        $img = new img_validator();
        return $img->checks_word($val);
    }
    register_anchor(signup_captcha(), "signup_captcha");
    //register_signup_field($signup_captcha);
    register_cb_captcha('signup_captcha', 'signup_captcha_check', TRUE);
}