Example #1
0
 /**
  * @todo make me work properly and figure out a scheme for including custom views.
  */
 function get_view()
 {
     if (!isset($this->_view)) {
         $view_class = 'DefaultFeatureView';
         if ($view_class != $this->params['view']) {
             $view = $this->params['view'];
             $file = FEATURE_VIEW_PATH . $view . '.php';
             if (reason_file_exists($file)) {
                 reason_require_once($file);
                 if (isset($GLOBALS['_feature_view_class_names'][$view]) && class_exists($GLOBALS['_feature_view_class_names'][$view])) {
                     $view_class = $GLOBALS['_feature_view_class_names'][$view];
                 } else {
                     trigger_error('Feature view class not registered in $GLOBALS[ \'_feature_view_class_names\' ].');
                 }
             } else {
                 trigger_error('Feature view file not found in ' . FEATURE_VIEW_PATH);
             }
         }
         $this->_view = new $view_class();
     }
     return $this->_view;
 }
Example #2
0
<?php

	reason_include_once( 'minisite_templates/modules/default.php' );
	reason_require_once( 'minisite_templates/modules/events_gallery/item.php');

	$GLOBALS[ '_module_class_names' ][ 'events_gallery' ] = 'EventsGalleryModule';
	
	class EventsGalleryModule extends DefaultMinisiteModule
	{
		protected $events;
		protected $template;
		var $acceptable_params = array(
			'show' => array('current','upcoming'),
			'template' => 'slideshow',
			'order' => '`last_occurence` ASC',
			'no_events_message' => '',
			'model' => 'item',
		);
		function _get_events()
		{
			if(!isset($this->events))
			{
				$es = new entity_selector($this->site_id);
				$es->add_type(id_of('event_type'));
				
				if(!in_array('archived',$this->params['show']))
				{
					$es->add_relation('`last_occurence` >= "'.addslashes(date('Y-m-d')).'"');
				}
				if(!in_array('upcoming',$this->params['show']))
				{
Example #3
0
<?php

/**
 * Enhanced file upload Plasmature types for Reason.
 * 
 * @package reason
 * @subpackage classes
 * @author Eric Naeseth <*****@*****.**>
 */
reason_require_once('classes/entity.php');
reason_require_once('classes/head_items.php');
reason_require_once('function_libraries/asset_functions.php');
reason_require_once('function_libraries/image_tools.php');
reason_require_once('function_libraries/upload.php');
require_once CARL_UTIL_INC . 'basic/cleanup_funcs.php';
include_once DISCO_INC . 'plasmature/plasmature.php';
if (!defined('REASON_FLASH_UPLOAD_URI')) {
    define('REASON_FLASH_UPLOAD_URI', REASON_HTTP_BASE_PATH . 'flash_upload/');
}
$GLOBALS['_disco_upload_session'] = null;
$GLOBALS['_disco_upload_session_sent'] = false;
$GLOBALS['_disco_upload_head_items_shown'] = false;
// There is some unavoidable code repetition here, due to PHP 4/5's lack of
// either traits (mixins) or multiple inheritance. If PHP 6 does implement the
// horizontal reuse RFC and we drop support for PHP 5, this code can be
// reorganized, and you should probably celebrate such a fantastic occurrence
// if you haven't already thoroughly done so.
/**
 * Reason asset uploads.
 */
class ReasonUploadType extends uploadType
<?php

/**
 * This script is run when Zencoder finishes encoding an output file. Using information present
 * in the notification object, we set up a Reason entity for the output file and handle any file 
 * storage that needs to take place. Some info messages are echoed and they can be viewed in 
 * Zencoder's user interface for the corresponding job.
 * 
 * @author Marcus Huderle
 */
// Make sure this points to a copy of Zencoder.php on the same server as this script.
include_once 'reason_header.php';
require_once SETTINGS_INC . 'media_integration/zencoder_settings.php';
require_once INCLUDE_PATH . 'zencoder/Services/Zencoder.php';
include_once CARL_UTIL_INC . 'basic/url_funcs.php';
reason_require_once('classes/entity_selector.php');
reason_include_once('function_libraries/admin_actions.php');
include_once CARL_UTIL_INC . 'dir_service/directory.php';
include_once CARL_UTIL_INC . 'basic/misc.php';
reason_include_once('classes/media/zencoder/shim.php');
reason_include_once('content_managers/image.php3');
set_time_limit(0);
// maps file extensions to mime type
$mime_type_map = array('mp3' => 'audio/mpeg', 'ogg' => 'audio/ogg', 'webm' => 'video/webm', 'mp4' => 'video/mp4');
$zencoder = new Services_Zencoder(ZENCODER_FULL_ACCESS_KEY);
$notification = $zencoder->notifications->parseIncoming();
$output = current($notification->job->outputs);
$media_work = get_media_work($notification->job->id);
if ($media_work) {
    $user = new entity($media_work->get_value('created_by'));
    $netid = $user->get_value('name');
 * Get the media length ( only works with quicktime files, returns null if it can't get the duration ) 
 * $string = get_media_duration($entity_id) // returns the value in seconds (145.02s = 145 seconds, 02 1/100ths of a second)
 *
 * Returns the full remote path to an entity's media
 * $string = media_file_path($entity_id)
 *
 * Returns the remote host storing the media file
 * $string = media_host()
 * 
 * returns the path to the user's source file (their $HOME/streaming_server/ folder) 
 * $string = get_source_path()
 * 
 * @todo this is really Carleton specific and should be generalized or moved to local 
 */
include_once 'reason_header.php';
reason_require_once('ssh/ssh.php');
class streaming_server
{
    var $ssh;
    var $netid = "";
    var $entity = "";
    var $source_media_path;
    var $last_error = "";
    var $local_file = "";
    // initialize streaming_server object
    function streaming_server($source_netid = "", $local_file = "", $streaming_server = REASON_STREAMING_HOST, $streaming_user = REASON_STREAMING_USER)
    {
        if ($source_netid == "") {
            $this->last_error = "streaming_server.php: streaming_server() netid must be specified.";
            error_log($this->last_error);
            return 0;
Example #6
0
 * Common support code for the background upload scripts.
 *
 * @package reason
 * @subpackage scripts
 * @since Reason 4.0 beta 8
 * @author Eric Naeseth <*****@*****.**>
 */
require_once 'reason_header.php';
// Prevent the error handler from dumping HTML error messages.
error_handler_config('script_mode', true);
reason_require_once('function_libraries/util.php');
reason_require_once('classes/entity_selector.php');
connectDB(REASON_DB);
reason_require_once('function_libraries/user_functions.php');
reason_require_once('function_libraries/upload.php');
reason_require_once('function_libraries/reason_session.php');
function response_code($code)
{
    http_response_code($code);
}
function final_response($code, $message)
{
    if (is_array($message) || is_object($message)) {
        header('Content-Type: application/json');
        $message = json_encode($message);
    } else {
        header('Content-Type: text/plain');
    }
    response_code($code);
    echo trim($message) . "\n";
    exit;
<?php

/**
 * A page that allows people who do not have acces to the code to see what modules go 
 * in which page types (and where, kinda)
 *
 * @package reason
 * @subpackage scripts
 */
/**
 * include dependencies
 */
include_once 'reason_header.php';
reason_require_once('minisite_templates/page_types.php');
reason_include_once('classes/page_types.php');
$rpts =& get_reason_page_types();
reason_include_once('classes/entity.php');
connectDB(REASON_DB);
reason_include_once('function_libraries/images.php');
$top_link = '<a href="#top" class="top">Return to top</a>';
reason_include_once('function_libraries/user_functions.php');
force_secure_if_available();
$current_user = check_authentication();
if (!reason_user_has_privs(get_user_id($current_user), 'assign_any_page_type')) {
    die('<h1>Sorry.</h1><p>You do not have permission to view page type info.</p></body></html>');
}
echo '<html><head>';
echo '<title>Reason: Page Type Information</title>';
?>
	<style type="text/css">
		h2 {
Example #8
0
 *
 * For admin modules that handle uploads, {@link get_uploaded_files()} should
 * be used to access the uploaded files instead of the PHP <code>$_FILES</code>
 * facility. The <code>get_uploaded_files</code> function returns objects
 * representing both files that were uploaded in the current POST and that were
 * uploaded in an asynchronous upload session, allowing you to handle both
 * cases transparently.
 *
 * @package reason
 * @subpackage function_libraries
 * @since Reason 4.0 beta 8
 * @author Eric Naeseth <*****@*****.**>
 */
require_once CARL_UTIL_INC . '/basic/filesystem.php';
reason_require_once('function_libraries/reason_session.php');
reason_require_once('classes/uploaded_file.php');
/**
 * Creates a new asynchronous upload session. Files uploaded asynchronously
 * will be recorded in this session, and can be accessed using
 * {@link get_uploaded_files()} after the user (e.g.) submits the form on which
 * the asynchronous uploader appeared. Upload sessions are distinguished from
 * one another by ID's that are unique within the Reason session.
 * 
 * A {@link Session_PHP Reason PHP session} must be started (or must be able to
 * be started) for this function to work; if none can be started, a fatal error
 * will be triggered.
 * 
 * Constraints can be placed on what files will be accepted by the upload
 * handler by using the {@link reason_add_async_upload_constraints} function.
 * 
 * @param array $authenticator specifies a callback that will be used to check
*
* You must tell Kaltura the url of this script in the Kaltura Management Console in the 
* "Settings->Integration Settings" tabs.
*
* @author Marcus Huderle
* @package reason
* @subpackage scripts
*/
/**
 * Include dependencies
 */
include_once 'reason_header.php';
require_once SETTINGS_INC . 'media_integration/kaltura_settings.php';
reason_require_once('classes/entity_selector.php');
reason_include_once('function_libraries/admin_actions.php');
reason_require_once('function_libraries/user_functions.php');
require_once INCLUDE_PATH . 'kaltura/KalturaNotificationClient.php';
require_once INCLUDE_PATH . 'kaltura/KalturaClient.php';
reason_include_once('classes/media/kaltura/shim.php');
reason_include_once('function_libraries/url_utils.php');
reason_include_once('content_managers/image.php3');
include_once CARL_UTIL_INC . 'dir_service/directory.php';
include_once CARL_UTIL_INC . 'basic/url_funcs.php';
include_once CARL_UTIL_INC . 'basic/misc.php';
/**
 * Class that encapsulates kaltura notification receiver logic
 *
 * NOTE: You must change the notification url in the Kaltura Management Console to match this
 * script's url to receive server notifications from Kaltura!
 */
class ReasonKalturaNotificationReceiver