Example #1
0
/**
 * @return Engine
 */
function get_patron()
{
    static $patron;
    if (!$patron) {
        $patron = new Engine(get_markups(), get_functions());
    }
    return clone $patron;
}
Example #2
0
if (file_exists(CACHEFILE)) {
    verbose("Using cache file " . CACHEFILE . "\n");
    $cache = unserialize(file_get_contents(CACHEFILE));
    $cache_orig = $cache;
} else {
    $cache = array('md5sums' => array());
    $cache_orig = false;
}
// Find functions and includes
verbose("Find functions and includes ");
$functions = array();
$seetags = array();
foreach ($files as $file) {
    verbose(".");
    $source = file_get_contents($file);
    $functions = array_unique(array_merge($functions, get_functions($source)));
    find_includes($seetags, $source, $file);
}
verbose("\n");
$md5sum = md5(serialize($functions) . serialize($seetags));
if (isset($cache['functions_seetags']) and $md5sum == $cache['functions_seetags']) {
    // Use cache only if functions and seetags haven't changed
    $use_cache = true;
} else {
    $use_cache = false;
    $cache['functions_seetags'] = $md5sum;
}
if (!extension_loaded("tokenizer")) {
    echo "Error: The 'Tokenizer' extension for PHP is missing. See http://php.net/manual/en/book.tokenizer.php for more information.\n";
    exit(1);
}
Example #3
0
/**
 * Function used to generate RSS FEED links
 */
function rss_feeds($params)
{
    /**
     * setting up the feeds arrays..
     * if you want to call em in your functions..simply call the global variable $rss_feeds
     */
    $rss_link = cblink(array("name" => "rss"));
    $rss_feeds = array();
    $rss_feeds[] = array("title" => "Recently added videos", "link" => $rss_link . "recent");
    $rss_feeds[] = array("title" => "Most Viewed Videos", "link" => $rss_link . "views");
    $rss_feeds[] = array("title" => "Top Rated Videos", "link" => $rss_link . "rating");
    $rss_feeds[] = array("title" => "Videos Being Watched", "link" => $rss_link . "watching");
    $rss_feeds = apply_filters($rss_feeds, 'rss_feeds');
    $funcs = get_functions('rss_feeds');
    if (is_array($funcs)) {
        foreach ($funcs as $func) {
            return $func($params);
        }
    }
    if ($params['link_tag']) {
        foreach ($rss_feeds as $rss_feed) {
            echo "<link rel=\"alternate\" type=\"application/rss+xml\"\n\t\t\t\ttitle=\"" . $rss_feed['title'] . "\" href=\"" . $rss_feed['link'] . "\" />\n";
        }
    }
}
/**
 * function used to call clipbucket footers
 */
function footer()
{
    $funcs = get_functions('clipbucket_footer');
    if (is_array($funcs) && count($funcs) > 0) {
        foreach ($funcs as $func) {
            if (function_exists($func)) {
                $func();
            }
        }
    }
}
Example #5
0
 /**
  * Function used to validate comments
  */
 function validate_comment_functions($params)
 {
     $type = $params['type'];
     $obj_id = $params['obj_id'];
     $comment = $params['comment'];
     $reply_to = $params['reply_to'];
     if ($type == 'video' || $type == 'v') {
         if (!$this->video_exists($obj_id)) {
             e(lang("class_vdo_del_err"));
         }
         //Checking owner of video
         //if(!USER_COMMENT_OWN)
         //{
         //	if(userid()==$this->get_vid_owner($obj_id));
         ///		e(lang("usr_cmt_err2"));
         //}
     }
     $func_array = get_functions('validate_comment_functions');
     if (is_array($func_array)) {
         foreach ($func_array as $func) {
             if (function_exists($func)) {
                 return $func($params);
             }
         }
     }
 }
Example #6
0
/**
 * Funcion used to call functions
 * when video is going to dwnload
 * ie in download.php
 */
function call_download_video_function($vdo)
{
    global $db;
    $funcs = get_functions('download_video_functions');
    if (is_array($funcs) && count($funcs) > 0) {
        foreach ($funcs as $func) {
            if (function_exists($func)) {
                $func($vdo);
            }
        }
    }
    //Updating Video Downloads
    $db->update(tbl("video"), array("downloads"), array("|f|downloads+1"), "videoid = '" . $vdo['videoid'] . "'");
    //Updating User Download
    if (userid()) {
        $db->update(tbl("users"), array("total_downloads"), array("|f|total_downloads+1"), "userid = '" . userid() . "'");
    }
}
             */
            if (get_functions('after_convert_functions')) {
                foreach (get_functions('after_convert_functions') as $func) {
                    if (@function_exists($func)) {
                        $func($file_details);
                    }
                }
            }
        } elseif ($file_details['conversion_status'] == 'completed' or strpos($file_details['conversion_log'], 'conversion_status : completed') > 0 or $file_details['conversion_status'] == 'Successful' or strpos($file_details['conversion_log'], 'conversion_status : Successful') > 0) {
            update_processed_video($file, 'Successful');
            $db->update(tbl("conversion_queue"), array("cqueue_conversion", "time_completed"), array("yes", time()), " cqueue_id = '" . $file['cqueue_id'] . "'");
            /**
             * Calling Functions after converting Video
             */
            if (get_functions('after_convert_functions')) {
                foreach (get_functions('after_convert_functions') as $func) {
                    if (@function_exists($func)) {
                        $func($file_details);
                    }
                }
            }
            //Sending Subscription Emails
            $videoDetails = $cbvideo->get_video($file['cqueue_name'], true);
            if ($videoDetails) {
                if (($videoDetails['broadcast'] == 'public' || $videoDetails['logged']) && $videoDetails['active'] == 'yes') {
                    $userquery->sendSubscriptionEmail($videoDetails, true);
                }
            }
        }
    }
}
Example #8
0
function check_cbvideo()
{
    /**
     * come, keep it for two more versions only
     * it will be gone in next few updates by default :p
     *
     * but dont ever forget its name
     * its a damn ClipBucket
     */
    if ((!defined("isCBSecured") || count(get_functions('clipbucket_footer')) == 0) && !BACK_END) {
        echo cbSecured(CB_SIGN_C);
    }
}
Example #9
0
/**
 * Funcion used to call functions
 * when user view collection
 * ie in view_collection.php
 */
function call_view_collection_functions($cdetails)
{
    $funcs = get_functions('view_collection_functions');
    if (is_array($funcs) && count($funcs) > 0) {
        foreach ($funcs as $func) {
            if (function_exists($func)) {
                $func($cdetails);
            }
        }
    }
    increment_views($cdetails['collection_id'], "collection");
}