Esempio n. 1
0
 /**
  * A display name handler for media works
  *
  * Includes a thumbnail of the work's placard image as part of the display name
  *
  * @param mixed $id Reason ID or entity
  * @return string
  */
 function reason_media_work_display_name_handler($id)
 {
     if (!is_object($id)) {
         $e = new entity($id);
     } else {
         $e = $id;
     }
     if ($e->get_value('transcoding_status') == 'converting' || $e->get_value('transcoding_status') == 'finalizing') {
         return '<img src="' . REASON_HTTP_BASE_PATH . 'ui_images/spinner_16.gif" width="16" height="16" alt="Converting" /> ' . $e->get_value('name');
     }
     if ($e->get_value('transcoding_status') == 'error') {
         return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/error.png" width="16" height="16" alt="Error" /> ' . $e->get_value('name');
     }
     if ($e->get_value('transcoding_status') && ($images = $e->get_left_relationship('av_to_primary_image'))) {
         $image = current($images);
         if ($path = reason_get_image_path($image, 'thumbnail')) {
             if (file_exists($path)) {
                 if ($size = getimagesize($path)) {
                     return '<img src="' . htmlspecialchars(reason_get_image_url($image, 'thumbnail'), ENT_QUOTES) . '" width="' . round($size[0] / 2) . '" height="' . round($size[1] / 2) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" /> ' . $e->get_value('name');
                 }
             }
         }
     }
     switch ($e->get_value('av_type')) {
         case 'Audio':
             return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/sound.png" width="16" height="16" alt="Audio" /> ' . $e->get_value('name');
         case 'Video':
             return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/television.png" width="16" height="16" alt="Video" /> ' . $e->get_value('name');
         default:
             return $e->get_value('name');
     }
 }
Esempio n. 2
0
 function init($args = array())
 {
     if (isset($this->params['site_unique_name'])) {
         $this->_search_site = new entity(id_of($this->params['site_unique_name']));
     } else {
         $this->_search_site = $this->parent->site_info;
     }
     $this->default_text = isset($this->params['default_text']) ? $this->params['default_text'] : 'Search ' . reason_htmlspecialchars(strip_tags($this->_search_site->get_value('name')));
     $this->header_text = isset($this->params['header_text']) ? $this->params['header_text'] : '';
 }
 function get_more_link_markup()
 {
     $item = $this->passed_vars['item'];
     $markup_string = '';
     if ($item->get_value('content') && isset($this->passed_vars['link_to_full_item']) && !empty($this->passed_vars['link_to_full_item'])) {
         $markup_string .= '<li class="more">';
         $markup_string .= '<a href="' . $this->passed_vars['link_to_full_item'] . '" title="' . reason_htmlspecialchars($item->get_value('release_title'), ENT_QUOTES, 'UTF-8') . '">';
         $markup_string .= 'Full Story';
         $markup_string .= '</a>';
         $markup_string .= '</li>' . "\n";
     }
     return $markup_string;
 }
Esempio n. 4
0
 /**
  * Add / modify for elements
  */
 function social_account_on_every_time($cm)
 {
     $cm->change_element_type('account_type', 'protected');
     $cm->change_element_type('account_details', 'protected');
     $cm->set_display_name('account_id', 'Instagram username');
     $cm->add_required('account_id');
     // lets add a field showing the current link if one is available.
     $account_id = $cm->get_value('account_id');
     if (!empty($account_id)) {
         $link = 'http://instagram.com/' . $account_id . '/';
         $comment_text = '<a href="' . reason_htmlspecialchars($link) . '">' . reason_htmlspecialchars($link) . '</a>';
         $cm->add_element('account_link', 'commentWithLabel', array('text' => $comment_text));
     }
 }
Esempio n. 5
0
 function init($args = array())
 {
     parent::init($args);
     // REASON_USES_DISTRIBUTED_AUDIENCE_MODEL
     if (REASON_USES_DISTRIBUTED_AUDIENCE_MODEL) {
         $es = new entity_selector($this->site_id);
     } else {
         $es = new entity_selector();
     }
     $es->add_type(id_of('audience_type'));
     $this->all_audiences = $es->run_one();
     $head =& $this->get_head_items();
     $head->add_javascript('/reason_package/reason_4.0/www/js/policy_selector.js');
     if (!$this->_in_show_all_mode()) {
         if (!empty($this->request['policy_id'])) {
             $roots = $this->get_root_nodes();
             if (array_key_exists($this->request['policy_id'], $roots)) {
                 $this->policy = $roots[$this->request['policy_id']];
                 $this->_add_crumb($this->policy->get_value('name'), get_current_url());
                 $head_items = $this->get_head_items();
                 if ($this->policy->get_value('keywords')) {
                     $head_items->add_head_item('meta', array('name' => 'keywords', 'value' => reason_htmlspecialchars($this->policy->get_value('keywords'))));
                 }
                 if ($audience = $this->_get_current_audience()) {
                     $head_items->add_head_item('link', array('rel' => 'canonical', 'href' => $this->get_no_audience_link()));
                 }
                 if ($pages =& $this->get_page_nav()) {
                     $pages->make_current_page_a_link();
                 }
                 $access = $this->_get_access_result($this->policy);
                 if (false === $access) {
                     http_response_code(403);
                 } elseif (null === $access) {
                     http_response_code(401);
                 }
             } else {
                 http_response_code(404);
             }
         }
     }
     // register the module for inline editing
     $inline_edit =& get_reason_inline_editing($this->page_id);
     $inline_edit->register_module($this, $this->user_can_inline_edit($this->policy));
     if ($inline_edit->available_for_module($this)) {
         $head->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/policy/policy_editable.css', '', true);
     }
 }
 /**
  * A display name handler for social accounts
  *
  * Includes the social network's icon
  *
  * @param mixed $id Reason ID or entity
  * @return string
  */
 function reason_social_account_display_name_handler($id)
 {
     if (!is_object($id)) {
         $e = new entity($id);
     } else {
         $e = $id;
     }
     if ($account_type = $e->get_value('account_type')) {
         $helper = new ReasonSocialIntegrationHelper();
         $integrator = $helper->get_integrator($account_type, 'SocialAccountProfileLinks');
         if ($url = $integrator->get_profile_link_icon($e->id())) {
             $integrators = $helper->get_available_integrators();
             $alt = isset($integrators[$account_type]) ? $integrators[$account_type] : $account_type;
             return '<img src="' . reason_htmlspecialchars($url) . '" alt="' . reason_htmlspecialchars($alt) . '" height="24" width="24" /> ' . $e->get_value('name');
         }
     }
     return $e->get_value('name');
 }
Esempio n. 7
0
 function get_markup($events)
 {
     $ret = '<div id="eventsGalleryModule" class="bigList">' . "\n";
     $ret .= '<ul class="events">' . "\n";
     foreach ($events as $event) {
         $ret .= '<li class="event">' . "\n";
         $ret .= '<a href="' . reason_htmlspecialchars($event->get_url()) . '">' . "\n";
         $ret .= '<span class="imageWrap">' . "\n";
         if ($image = $event->get_image()) {
             reason_include_once('classes/sized_image.php');
             $rsi = new reasonSizedImage();
             $rsi->set_id($image->id());
             $rsi->set_width(280);
             $rsi->set_height(200);
             $url = $rsi->get_url();
             $ret .= '<img src="' . htmlspecialchars($url) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" width="295" height="200" class="primaryImage" />' . "\n";
         }
         $ret .= '</span>' . "\n";
         $ret .= '<span class="info">' . "\n";
         $ret .= '<span class="meta">' . "\n";
         $ret .= '<em class="currency">' . htmlspecialchars($event->temporal_phrase()) . '</em> / ';
         $ret .= '<span class="dates">' . htmlspecialchars($event->date_range_phrase()) . '</span>' . "\n";
         $ret .= '</span><br />' . "\n";
         $ret .= '<span class="name">' . "\n";
         $ret .= '<strong class="title">';
         $ret .= $event->get_main_title($event);
         if ($sub = $event->get_subtitle($event)) {
             $ret .= ':';
         }
         $ret .= '</strong>';
         if (!empty($sub)) {
             $ret .= '<span class="subtitle">' . $sub . '</span>' . "\n";
         }
         $ret .= '</span>' . "\n";
         $ret .= '</span>' . "\n";
         $ret .= '</a>' . "\n";
         $ret .= '</li>' . "\n";
     }
     $ret .= '</ul>' . "\n";
     $ret .= '</div>' . "\n";
     return $ret;
 }
Esempio n. 8
0
 /**
  * A display name handler for features
  *
  * Includes a thumbnail of one of the feature's images as part of the display name
  *
  * @param mixed $id Reason ID or entity
  * @return string
  */
 function reason_feature_display_name_handler($id)
 {
     if (!is_object($id)) {
         $e = new entity($id);
     } else {
         $e = $id;
     }
     if ($images = $e->get_left_relationship('feature_to_image')) {
         $image = reset($images);
         if ($path = reason_get_image_path($image, 'thumbnail')) {
             if (file_exists($path)) {
                 if ($size = getimagesize($path)) {
                     return '<img src="' . htmlspecialchars(reason_get_image_url($image, 'thumbnail'), ENT_QUOTES) . '" width="' . round($size[0] / 2) . '" height="' . round($size[1] / 2) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" /> ' . $e->get_value('name');
                 }
             }
         }
     } elseif ($media = $e->get_left_relationship('feature_to_media_work')) {
         $m = reset($media);
         $images = $m->get_left_relationship('av_to_primary_image');
         if (!empty($images)) {
             $image = reset($images);
             if ($path = reason_get_image_path($image, 'thumbnail')) {
                 if (file_exists($path)) {
                     if ($size = getimagesize($path)) {
                         return '<img src="' . htmlspecialchars(reason_get_image_url($image, 'thumbnail'), ENT_QUOTES) . '" width="' . round($size[0] / 2) . '" height="' . round($size[1] / 2) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" /> ' . $e->get_value('name');
                     }
                 }
             }
         }
         switch ($m->get_value('av_type')) {
             case 'Audio':
                 return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/sound.png" width="16" height="16" alt="Audio" /> ' . $e->get_value('name');
             case 'Video':
                 return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/television.png" width="16" height="16" alt="Video" /> ' . $e->get_value('name');
         }
     }
     return $e->get_value('name');
 }
Esempio n. 9
0
		function show_child_page($child,$counter,$even_odd)
		{
			/* If the page has a link name, use that; otherwise, use its name */
			$page_name = $this->get_page_name($child);
			$title_attr = '';
			if( $page_name != $child->get_value('name') )
			{
				$title_attr = ' title="'.reason_htmlspecialchars(strip_tags($child->get_value('name')),ENT_QUOTES).'"';
			}
			$page_name = strip_tags($page_name,'<span><strong><em>');
			$link = $this->get_page_link($child);
			$classes = array('number'.$counter, $even_odd);
			$uname = '';
			if($child->get_value( 'unique_name' ))
			{
				$classes[] = 'uname-'.reason_htmlspecialchars($child->get_value( 'unique_name' ));
			}
			if($child->get_value('url'))
			{
				$classes[] = 'jump';
			}
				
			echo '<li class="'.implode(' ',$classes).'">';
			
			if($this->params['provide_az_links'] && array_key_exists($child->id(),$this->az))
			{
				echo '<a name="child_'.$this->az[$child->id()].'"></a>';
			}
			$image_markup = '';
			if($this->params['provide_images'])
			{
				$image = $this->get_page_image($child->id());
				
				if(!empty($image))
				{
					if($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0)
					{
						$rsi = new reasonSizedImage();
						if(!empty($rsi))
						{
							$rsi->set_id($image->id());
							if($this->params['thumbnail_width'] != 0)
							{
								$rsi->set_width($this->params['thumbnail_width']);
							}
							if($this->params['thumbnail_height'] != 0)
							{
								$rsi->set_height($this->params['thumbnail_height']);
							}
							if($this->params['thumbnail_crop'] != '')
							{
								$rsi->set_crop_style($this->params['thumbnail_crop']);
							}
							if(!$this->params['html5'])
								$image_markup = get_show_image_html($rsi, true, false, false, '' , '', false, $link);
							else
								$image_markup = get_show_image_html($rsi, true, false, false, '' , '', false );
						}
					}
					else
					{
						if(!$this->params['html5'])
							$image_markup = get_show_image_html( $image->id(), true, false, false, '' , '', false, $link );
						else
							$image_markup = get_show_image_html( $image->id(), true, false, false, '' , '', false );
					}
				}
				if(!$this->params['html5'])
					echo $image_markup;
			}
			if($this->params['description_part_of_link'])
			{
				$element = $this->params['html5'] ? 'h4' : 'strong';
				echo '<a href="'.$link.'"'.$title_attr.'>';
				if($this->params['html5'])
					echo $image_markup;
				echo '<'.$element.'>'.$page_name.'</'.$element.'>';
				if(!$this->params['html5'])
					echo '<br />';
				if ( $child->get_value( 'description' ))
				{
					$element = $this->params['html5'] ? 'div' : 'span';
					echo "\n".'<'.$element.' class="childDesc">'.$child->get_value( 'description' ).'</'.$element.'>';
				}
				echo '</a>';
			}
			else
			{
				echo '<h4><a href="'.$link.'"'.$title_attr.'>'.$page_name.'</a></h4>';
				if ( $child->get_value( 'description' ))
				{
					echo "\n".'<div class="childDesc">'.$child->get_value( 'description' ).'</div>';
				}
			}
			echo '</li>'."\n";
		}
 /**
  * @return a string of html markup of a list item
  * basically the markup for one feature
  */
 function get_html_list_item($view_data)
 {
     $has_anchor = true;
     if ($view_data['destination_url'] == null) {
         $has_anchor = false;
     }
     $height = $this->_view_params['height'];
     $anchor_start = '<span class="noLink">';
     $image_anchor_start = '<span class="noLink">';
     $anchor_end = '</span>';
     $image_anchor_end = '</span>';
     if ($has_anchor) {
         $image_anchor_start = "<a href=\"" . $view_data['destination_url'] . "\" class=\"dest\">";
         //style=\"height:".$height."px;\">";
         $image_anchor_end = "</a>";
         $anchor_start = "<a href=\"" . $view_data['destination_url'] . "\" class=\"dest\">";
         $anchor_end = "</a>";
     }
     $media_str = "";
     $type_str = "";
     if ($view_data['current_object_type'] == 'img') {
         $img_url = $view_data['feature_image_url'][$view_data['current_image_index']];
         $img_alt = $view_data['feature_image_alt'][$view_data['current_image_index']];
         if ($img_url != "none") {
             $media_str = "<div class=\"featureImage\" >\n";
             $media_str .= $image_anchor_start . "<img alt=\"" . reason_htmlspecialchars($img_alt) . "\" name=\"big_pic\" src=\"" . $img_url . "\" />" . $image_anchor_end . "\n";
             $media_str .= "</div>";
         }
         $type_str = ' featureTypeImage';
     } elseif ($view_data['current_object_type'] == 'av') {
         $av_html = $view_data['feature_av_html'][$view_data['current_image_index']];
         $img_url = $view_data['feature_av_img_url'][$view_data['current_image_index']];
         $img_alt = $view_data['feature_av_img_alt'][$view_data['current_image_index']];
         $img_id = "featureVideo-" . $view_data['id'];
         $image_anchor_start = "<a href=\"#" . $img_id . "\" style=\"height:" . $height . "px;\" class=\"anchor\">\n";
         $image_anchor_end = "</a>";
         $text_anchor_start = "<a href=\"#" . $img_id . "\" class=\"anchor\">\n";
         $text_anchor_end = '</a>';
         if ($img_url != "none") {
             $link = $has_anchor ? ' (' . $anchor_start . 'more' . $anchor_end . ')' : '';
             $media_str = "<div class=\"featureImage\" >\n";
             $media_str .= $image_anchor_start . "<img alt=\"" . reason_htmlspecialchars($img_alt) . "\"  name=\"big_pic\" src=\"" . $img_url . "\" />" . $image_anchor_end . "\n";
             $media_str .= "</div>";
             $media_str .= "<div class=\"featureVideo nofitvids\" id=\"" . $img_id . "\" style=\"\">";
             $media_str .= $av_html;
             $media_str .= '<h3 class="featureTitle">' . $view_data['title'] . '</h3>' . "\n";
             $media_str .= '<div class="featureText">' . $view_data['text'] . $link . '</div>' . "\n";
             $media_str .= "</div>";
         }
         $type_str = ' featureTypeVideo';
     }
     $title_str = "";
     $text_str = "";
     if ($view_data['show_text']) {
         if ($view_data['current_object_type'] == 'av') {
             $title_str = "<h3 class=\"featureTitle\">" . $text_anchor_start . $view_data['title'] . $text_anchor_end . "</h3>\n";
             $text_str = "<div class=\"featureText\">" . $text_anchor_start . $view_data['text'] . $text_anchor_end . "</div>\n";
         } else {
             $title_str = "<h3 class=\"featureTitle\">" . $anchor_start . $view_data['title'] . $anchor_end . "</h3>\n";
             $text_str = "<div class=\"featureText\">" . $anchor_start . $view_data['text'] . $anchor_end . "</div>\n";
         }
     }
     $str = "<li id=\"feature-" . $view_data['id'] . "\" class=\"feature " . $view_data['active'] . " sizable\"\n\t\t \t\tstyle=\"background-color:#" . $view_data['bg_color'] . ";\" >\n";
     $str .= '<div class="featureContent' . $type_str . '">' . "\n";
     $str .= $media_str;
     $str .= "<div class=\"featureInfo\">";
     $str .= $title_str;
     $str .= $text_str;
     $str .= $view_data['feature_nav_str'];
     $str .= "</div>";
     //end featureInfo div
     $str .= "</div>\n";
     //end featureContent div
     $str .= "</li>\n";
     return $str;
 }
Esempio n. 11
0
 function process()
 {
     $site_id = $this->site_id;
     $counts = array();
     for ($i = 1; $i <= $this->max_upload_number; $i++) {
         $element = $this->get_element('upload_' . $i);
         if (!empty($element->tmp_full_path) and file_exists($element->tmp_full_path)) {
             $filename = $this->get_value('upload_' . $i . '_filename');
             if ($this->verify_image($element->tmp_full_path)) {
                 if (empty($counts[$filename])) {
                     $this->files[$filename] = $element->tmp_full_path;
                     $counts[$filename] = 1;
                 } else {
                     $counts[$filename]++;
                     $this->files[$filename . '.' . $counts[$filename]] = $element->tmp_full_path;
                 }
             } else {
                 $this->invalid_files[$filename] = $element->tmp_full_path;
             }
         }
     }
     if (count($this->files)) {
         $page_id = (int) $this->get_value('attach_to_page');
         $max_sort_order_value = 0;
         if ($page_id) {
             $max_sort_order_value = $this->_get_max_sort_order_value($page_id);
         }
         $sort_order_value = $max_sort_order_value;
         $tables = get_entity_tables_by_type(id_of('image'));
         $valid_file_html = '<ul>' . "\n";
         foreach ($this->files as $entry => $cur_name) {
             $sort_order_value++;
             $valid_file_html .= '<li><strong>' . $entry . ':</strong> processing ';
             $date = '';
             // get suffix
             $type = strtolower(substr($cur_name, strrpos($cur_name, '.') + 1));
             $ok_types = array('jpg');
             // get exif data
             if ($this->get_value('exif_override') && in_array($type, $ok_types) && function_exists('read_exif_data')) {
                 // read_exif_data() does not obey error supression
                 $exif_data = @read_exif_data($cur_name);
                 if ($exif_data) {
                     // some photos may have different fields filled in for dates - look through these until one is found
                     $valid_dt_fields = array('DateTimeOriginal', 'DateTime', 'DateTimeDigitized');
                     foreach ($valid_dt_fields as $field) {
                         // once we've found a valid date field, store that and break out of the loop
                         if (!empty($exif_data[$field])) {
                             $date = $exif_data[$field];
                             break;
                         }
                     }
                 }
             } else {
                 $date = $this->get_value('datetime');
             }
             $keywords = $entry;
             if ($this->get_value('keywords')) {
                 $keywords .= ', ' . $this->get_value('keywords');
             }
             // insert entry into DB with proper info
             $values = array('datetime' => $date, 'image_type' => $type, 'author' => $this->get_value('author'), 'state' => 'Pending', 'keywords' => $keywords, 'description' => $this->get_value('description'), 'name' => $this->get_value('name') ? $this->get_value('name') : $entry, 'content' => $this->get_value('content'), 'original_image_format' => $this->get_value('original_image_format'), 'new' => 0, 'no_share' => $this->get_value('no_share'));
             //tidy values
             $no_tidy = array('state', 'new');
             foreach ($values as $key => $val) {
                 if (!in_array($key, $no_tidy) && !empty($val)) {
                     $values[$key] = trim(get_safer_html(tidy($val)));
                 }
             }
             $id = reason_create_entity($site_id, id_of('image'), $this->user_id, $entry, $values);
             if ($id) {
                 //assign to categories
                 $categories = $this->get_value('assign_to_categories');
                 if (!empty($categories)) {
                     foreach ($categories as $category_id) {
                         create_relationship($id, $category_id, relationship_id_of('image_to_category'));
                     }
                 }
                 //assign to	gallery page
                 if ($page_id) {
                     create_relationship($page_id, $id, relationship_id_of('minisite_page_to_image'), array('rel_sort_order' => $sort_order_value));
                 }
                 // resize and move photos
                 $new_name = PHOTOSTOCK . $id . '.' . $type;
                 $orig_name = PHOTOSTOCK . $id . '_orig.' . $type;
                 $tn_name = PHOTOSTOCK . $id . '_tn.' . $type;
                 // Support for new fields; they should be set null by default, but will be
                 // changed below if a thumbnail/original image is created. This is very messy...
                 $thumbnail_image_type = null;
                 $original_image_type = null;
                 // atomic move the file if possible, copy if necessary
                 if (is_writable($cur_name)) {
                     rename($cur_name, $new_name);
                 } else {
                     copy($cur_name, $new_name);
                 }
                 // create a thumbnail if need be
                 list($width, $height, $type, $attr) = getimagesize($new_name);
                 if ($width > REASON_STANDARD_MAX_IMAGE_WIDTH || $height > REASON_STANDARD_MAX_IMAGE_HEIGHT) {
                     copy($new_name, $orig_name);
                     resize_image($new_name, REASON_STANDARD_MAX_IMAGE_WIDTH, REASON_STANDARD_MAX_IMAGE_HEIGHT);
                     $original_image_type = $this->image_types[$type];
                 }
                 $thumb_dimensions = get_reason_thumbnail_dimensions($site_id);
                 if ($width > $thumb_dimensions['width'] || $height > $thumb_dimensions['height']) {
                     copy($new_name, $tn_name);
                     resize_image($tn_name, $thumb_dimensions['width'], $thumb_dimensions['height']);
                     $thumbnail_image_type = $this->image_types[$type];
                 }
                 // real original
                 $my_orig_name = $this->add_name_suffix($cur_name, '-unscaled');
                 if (file_exists($my_orig_name)) {
                     // move the original image into the photostock directory
                     if (is_writable($my_orig_name)) {
                         rename($my_orig_name, $orig_name);
                     } else {
                         copy($my_orig_name, $orig_name);
                     }
                     $original_image_type = $this->image_types[$type];
                 }
                 $info = getimagesize($new_name);
                 $size = round(filesize($new_name) / 1024);
                 // now we have the size of the resized image.
                 $values = array('width' => $info[0], 'height' => $info[1], 'size' => $size, 'thumbnail_image_type' => $thumbnail_image_type, 'original_image_type' => $original_image_type);
                 // update with new info - don't archive since this is really just an extension of the creation of the item
                 // we needed that ID to do something
                 reason_update_entity($id, $this->user_id, $values, false);
                 $valid_file_html .= 'completed</li>';
             } else {
                 trigger_error('Unable to create image entity');
                 $valid_file_html .= '<li>Unable to import ' . $entry . '</li>';
             }
             sleep(1);
         }
         $valid_file_html .= '</ul>' . "\n";
         $num_image_string = count($this->files) == 1 ? '1 image has ' : count($this->files) . ' images have ';
         $valid_file_html .= '<p>' . $num_image_string . 'been successfully imported into Reason.</p>';
         $valid_file_html .= '<p>They are now pending.</p>';
         $next_steps[] = '<a href="?site_id=' . $site_id . '&amp;type_id=' . id_of('image') . '&amp;user_id=' . $this->user_id . '&amp;cur_module=Lister&amp;state=pending">review & approve imported images</a>';
     }
     if (isset($this->invalid_files)) {
         $invalid_files = array_keys($this->invalid_files);
         $invalid_file_html = '<p>The following could not be validated as image files and were not successfully imported.</p>';
         $invalid_file_html .= '<ul>';
         foreach ($invalid_files as $file) {
             $invalid_file_html .= '<li><strong>' . reason_htmlspecialchars($file) . '</strong></li>';
         }
         $invalid_file_html .= '</ul>';
     }
     $next_steps[] = '<a href="' . get_current_url() . '">Import another set of images</a>';
     if (!isset($this->invalid_files) && !isset($this->files)) {
         echo '<p>You did not select any files for upload</p>';
     }
     if (isset($valid_file_html)) {
         echo $valid_file_html;
     }
     if (isset($invalid_file_html)) {
         echo $invalid_file_html;
     }
     echo '<p>Next Steps:</p><ul><li>' . implode('</li><li>', $next_steps) . '</li></ul>';
     $this->show_form = false;
 }
 public function render()
 {
     return reason_htmlspecialchars(strip_tags(array_reduce($this->tags, array('TitleTagParser', 'sub'), $this->pattern)));
 }
Esempio n. 13
0
    function run()
    {
        $form = $this->get_form();
        // thor_core needs the XML from the form entities thor_content field, and the table name the data is stored in
        $xml = $form->get_value('thor_content');
        $table_name = 'form_' . $form->id();
        $thor_core = new ThorCore($xml, $table_name);
        $thor_values = $thor_core->get_rows();
        // Loop through the database information to gather the poll results
        $pretty_values = array();
        if ($thor_values != "") {
            foreach ($thor_values as $t_v) {
                foreach ($t_v as $key => $value) {
                    if ($key != "id" && $key != "submitted_by" && $key != "submitter_ip" && $key != "date_created" && $key != "date_modified") {
                        $pretty_values[] = $value;
                    }
                }
            }
        }
        // Get the total number of results and then find the total results for each option
        $responses = array_count_values($pretty_values);
        $accumulator = array();
        foreach ($responses as $response) {
            $accumulator[] = $response;
        }
        // Get the label for each option
        $name = array();
        foreach ($responses as $key => $value) {
            $name[] = $key;
        }
        // Calculate the total and get the percentage for each option
        $total = 0;
        $per = array();
        foreach ($accumulator as $key => $value) {
            $total += $value;
        }
        if ($total > 0) {
            for ($i = 0; $i <= count($accumulator) - 1; $i++) {
                $per[$i] = round($accumulator[$i] / $total * 100) . "%";
            }
        }
        if (!$this->show_results()) {
            echo '<p><a href="' . carl_make_link(array('show_results' => 1, 'submission_key' => '')) . '">Show Results</a></p>';
        } else {
            echo '<p><a href="' . carl_make_link(array('show_results' => 0, 'submission_key' => '')) . '">Hide Results</a></p>';
        }
        if ($this->show_results()) {
            if ($this->sidebar) {
                echo '<div id="interactive" class="graph">';
            } else {
                echo '<div id="graph1" class="graph">';
            }
            for ($i = 0; $i <= count($accumulator) - 1; $i++) {
                echo '<table width="300px" border="solid" cellpadding="5px">
				<tr>
				<td width="50px">' . reason_htmlspecialchars($per[$i]) . ' </td><td> ' . reason_htmlspecialchars($name[$i]) . '</td>
				</tr>
				</table>';
            }
            echo '</div>';
            if ($this->sidebar) {
                echo '<div id="hover"></div>';
            }
            echo '<div id="responses"><p><strong>Total responses: ' . $total . '</strong></p></div>';
        }
        $datas = array();
        $lbls = array();
        for ($i = 0; $i <= count($accumulator) - 1; $i++) {
            $datas[$i] = $accumulator[$i];
            $lbls[$i] = $name[$i];
        }
        // Transfer the labels and totals for each option to polls.js
        echo '<script type="text/javascript">' . "\n";
        echo 'var data = new Array();' . "\n";
        echo 'var lbl = new Array();' . "\n";
        echo 'var color = new Array();' . "\n";
        for ($i = 0; $i <= count($datas) - 1; $i++) {
            $color = isset($this->params['custom_colors'][$i]) ? $this->params['custom_colors'][$i] : "#" . dechex(rand(0, 10000000));
            echo 'color[' . $i . '] = "' . addslashes(htmlspecialchars($color)) . '" ;' . "\n";
            echo 'data[' . $i . '] =' . addslashes(htmlspecialchars($datas[$i])) . ';' . "\n";
            echo 'lbl[' . $i . '] = "' . addslashes(htmlspecialchars($lbls[$i])) . '" ;' . "\n";
        }
        echo '</script>' . "\n";
    }
Esempio n. 14
0
		function get_sanitized_search_string()
		{
			if(!empty($this->request['search']))
			{
				return reason_htmlspecialchars($this->request['search']);
			}
			else
				return '';
		}
Esempio n. 15
0
    /**
     * Returns the html markup to display the media with share/download info.
     * @return string
     */
    public function get_html_markup()
    {
        $markup = '';
        if ($this->media_work->get_value('transcoding_status') == 'ready') {
            if (!empty($this->request['displayer_height'])) {
                $height = $this->request['displayer_height'];
            } else {
                $height = $this->av_module->params['default_video_height'];
            }
            $this->displayer->set_height($height);
            $embed_markup = $this->displayer->get_display_markup();
            $markup .= $embed_markup;
            $mwh = new media_work_helper($this->media_work);
            if ($mwh->user_has_access_to_media()) {
                if ($this->media_work->get_value('av_type') == 'Video') {
                    $markup .= $this->size_selector->get_size_selector_html($this->media_work, $height);
                }
                $markup .= '<div class="share_download_info">' . "\n";
                $markup .= '<div class="share">' . "\n";
                $markup .= '<h5 class="share_label">Share:</h5>' . "\n";
                $markup .= '<ul class="share_list">' . "\n";
                $facebook_url = 'http://www.facebook.com/sharer.php?u=' . urlencode(get_current_url()) . '&t=' . urlencode($this->media_work->get_value('name'));
                $markup .= '<li><a href="' . $facebook_url . '">Facebook</a></li>' . "\n";
                $twitter_url = 'https://twitter.com/share?url=' . urlencode(get_current_url()) . '&text=' . urlencode($this->media_work->get_value('name'));
                $markup .= '<li><a href="' . $twitter_url . '">Twitter</a></li>' . "\n";
                $markup .= '</ul>' . "\n";
                $markup .= '</div>' . "\n";
                if ($this->media_work->get_value('show_embed')) {
                    $markup .= '<div class="embed">' . "\n";
                    $markup .= '<h5 class="embed_label">Embed:</h5>' . "\n";
                    $markup .= '<textarea class="embed_code" rows="7" cols="75" readonly="readonly">' . "\n";
                    $markup .= htmlspecialchars($embed_markup, ENT_QUOTES);
                    $markup .= '</textarea>' . "\n";
                    $markup .= '</div>' . "\n";
                }
                if ($this->media_work->get_value('show_download')) {
                    $markup .= '<div class="download">' . "\n";
                    $markup .= '<h5 class="download_label">Download:</h5>' . "\n";
                    $markup .= '<ul class="media_file_list">' . "\n";
                    // Offer an original file download link if this parameter is set
                    if ($this->av_module->params['offer_original_download_link'] && !empty($this->shim)) {
                        $file_ext = $this->shim->get_source_file_extension($this->media_work);
                        if ($orig_url = $this->shim->get_original_data_url($this->media_work->get_value('entry_id'))) {
                            $markup .= '<li class="orig_li"><a href="' . $orig_url . '"">original (.' . $file_ext . ')</a></li>' . "\n";
                        }
                    }
                    if ($this->media_work->get_value('av_type') == 'Video') {
                        // We must provide the url for each size here so that the javascript has a hook for the download links.
                        $mp4_vals = array();
                        $webm_vals = array();
                        $small_av_files = $this->displayer->_get_suitable_flavors(MEDIA_WORK_SMALL_HEIGHT, MEDIA_WORK_SMALL_HEIGHT);
                        $small_mp4 = $small_av_files[0];
                        $mp4_vals['small'] = $small_mp4->get_value('download_url');
                        $small_webm = $small_av_files[1];
                        $webm_vals['small'] = $small_webm->get_value('download_url');
                        $medium_av_files = $this->displayer->_get_suitable_flavors(MEDIA_WORK_MEDIUM_HEIGHT, MEDIA_WORK_MEDIUM_HEIGHT);
                        $med_mp4 = $medium_av_files[0];
                        $mp4_vals['medium'] = $med_mp4->get_value('download_url');
                        $med_webm = $medium_av_files[1];
                        $webm_vals['medium'] = $med_webm->get_value('download_url');
                        $large_av_files = $this->displayer->_get_suitable_flavors(MEDIA_WORK_LARGE_HEIGHT, MEDIA_WORK_LARGE_HEIGHT);
                        $large_mp4 = $large_av_files[0];
                        $mp4_vals['large'] = $large_mp4->get_value('download_url');
                        $large_webm = $large_av_files[1];
                        $webm_vals['large'] = $large_webm->get_value('download_url');
                        $av_files = $this->displayer->get_media_files();
                        $markup .= '<li class="mp4_li"><a href="' . $av_files[0]->get_value('download_url') . '" 
											data-small-url="' . $mp4_vals['small'] . '"
											data-medium-url="' . $mp4_vals['medium'] . '"
											data-large-url="' . $mp4_vals['large'] . '">.mp4</a></li>' . "\n";
                        $markup .= '<li class="webm_li"><a href="' . $av_files[1]->get_value('download_url') . '" 
											data-small-url="' . $webm_vals['small'] . '"
											data-medium-url="' . $webm_vals['medium'] . '"
											data-large-url="' . $webm_vals['large'] . '">.webm</a></li>' . "\n";
                    } elseif ($this->media_work->get_value('av_type') == 'Audio') {
                        $av_files = $this->displayer->get_media_files();
                        foreach ($av_files as $file) {
                            $extension = $file->get_value('mime_type');
                            // people know what mp3 is, not mpeg, so we display mpegs as mp3s
                            if ($extension == 'audio/mpeg') {
                                $extension = 'audio/mp3';
                            }
                            $parts = explode('/', $extension);
                            $markup .= '<li class="' . reason_htmlspecialchars(str_replace(' ', '-', end($parts))) . '_li"><a href="' . $file->get_value('download_url') . '">.' . end($parts) . '</a></li>' . "\n";
                        }
                    }
                    $markup .= '</ul>' . "\n";
                    $markup .= '</div>' . "\n";
                }
                $markup .= '</div>' . "\n";
            }
        } else {
            if ($this->media_work->get_value('av_type') == 'Video') {
                $markup .= '<p>This video is currently processing. Try again later.</p>' . "\n";
            } elseif ($this->media_work->get_value('av_type') == 'Audio') {
                $markup .= '<p>This audio file is currently processing. Try again later.</p>' . "\n";
            } else {
                $markup .= '<p>This item is currently processing. Try again later.</p>' . "\n";
            }
        }
        return $markup;
    }
Esempio n. 16
0
 /**
  * Get a map for a given event
  * @param object $event
  * @return string markup
  */
 protected function get_map_markup($event)
 {
     $ret = '';
     $lat = $event->has_value('latitude') ? $event->get_value('latitude') : false;
     $lon = $event->has_value('longitude') ? $event->get_value('longitude') : false;
     $address = $event->has_value('address') ? $event->get_value('address') : false;
     if (!empty($lat) && !empty($lon)) {
         $ret .= '<div class="eventMap">';
         $static_map_base_url = 'https://maps.googleapis.com/maps/api/staticmap';
         $params['size'] = '100x100';
         $params['markers'] = 'color:0xFF6357|' . $lat . ',' . $lon;
         $params['sensor'] = 'false';
         // lets add zoom level if it is set
         if ($zoom = $this->bundle->map_zoom_level($event)) {
             $params['zoom'] = $zoom;
         }
         $qs = carl_make_query_string($params);
         $static_map_url = $static_map_base_url . $qs;
         $google_maps_base_url = 'https://maps.google.com/maps/';
         if ($address) {
             $google_maps_params['saddr'] = $event->get_value('address');
         } else {
             $google_maps_params['q'] = $lat . ',' . $lon;
         }
         $google_maps_qs = carl_construct_query_string($google_maps_params);
         $google_maps_link = $google_maps_base_url . $google_maps_qs;
         $ret .= '<a href="' . $google_maps_link . '"><img src="' . $static_map_url . '" alt="map of ' . reason_htmlspecialchars($event->get_value('name')) . '" /></a>';
         $ret .= '</div>';
     }
     return $ret;
 }
Esempio n. 17
0
 function get_meta_information()
 {
     // add the charset information
     $this->head_items->add_head_item('meta', array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'));
     if ($favicon_path = $this->_get_favicon_path()) {
         $this->head_items->add_head_item('link', array('rel' => 'shortcut icon', 'href' => $favicon_path));
     }
     // array of meta tags to search for in the page entity
     // key: entity field
     // value: meta tag to use
     $meta_tags = array('description' => 'description', 'author' => 'author');
     if (REASON_SHOW_META_KEYWORDS) {
         $meta_tags['keywords'] = 'keywords';
     }
     // load meta elements from current page
     $tags_added = array();
     foreach ($meta_tags as $entity_field => $meta_name) {
         if ($this->cur_page->get_value($entity_field)) {
             $content = reason_htmlspecialchars($this->cur_page->get_value($entity_field));
             $this->head_items->add_head_item('meta', array('name' => $meta_name, 'content' => $content));
             $tags_added[] = $meta_name;
         }
     }
     if (!in_array('keywords', $tags_added) && $this->pages->root_node() == $this->page_id && REASON_SHOW_META_KEYWORDS) {
         $content = reason_htmlspecialchars($this->site_info->get_value('keywords'));
         $this->head_items->add_head_item('meta', array('name' => 'keywords', 'content' => $content));
     }
     if (!empty($_REQUEST['no_search']) || $this->site_info->get_value('site_state') != 'Live' || defined('THIS_IS_A_DEVELOPMENT_REASON_INSTANCE') && THIS_IS_A_DEVELOPMENT_REASON_INSTANCE || !$this->cur_page->get_value('indexable')) {
         $this->head_items->add_head_item('meta', array('name' => 'robots', 'content' => 'none'));
     }
 }
Esempio n. 18
0
 function run()
 {
     if ($this->params['previous_next']) {
         $siblings = $this->_get_previous_next($this->siblings);
     } else {
         $siblings = $this->siblings;
     }
     $classes = array('siblingList');
     if ($this->params['provide_images']) {
         $classes[] = 'siblingListWithImages';
     }
     if ($this->params['previous_next']) {
         $classes[] = 'prevNext';
     }
     echo '<div class="siblingsModule">' . "\n";
     if ($this->params['use_parent_title_as_header']) {
         echo '<h3>' . $this->parent_page->get_value('name') . '</h3>' . "\n";
     }
     echo '<ul class="' . implode(' ', $classes) . '">' . "\n";
     $counter = 1;
     $even_odd = 'odd';
     foreach ($siblings as $key => $sibling) {
         $classes = array('number' . $counter, $even_odd);
         $uname = '';
         if ($sibling->get_value('unique_name')) {
             $classes[] = 'uname-' . reason_htmlspecialchars($sibling->get_value('unique_name'));
         }
         /* If the page has a link name, use that; otherwise, use its name */
         $page_name = $sibling->get_value('link_name') ? $sibling->get_value('link_name') : $sibling->get_value('name');
         $image_html = '';
         $is_current_page = false;
         if ($this->parent->cur_page->id() == $sibling->id()) {
             $classes[] = 'currentPage';
             $is_current_page = true;
         }
         $link = '';
         if (!$is_current_page) {
             /* Check for a url (that is, the page is an external link); otherwise, use its relative address */
             if ($sibling->get_value('url')) {
                 $link = $sibling->get_value('url');
                 $classes[] = 'jump';
             } else {
                 $link = '../' . $sibling->get_value('url_fragment') . '/';
                 if (!empty($this->parent->textonly)) {
                     $link .= '?textonly=1';
                 }
                 //pray($this->parent->site_info);
                 //$base_url = $this->parent->site_info[ 'base_url' ];
                 //$link = '/'.$base_url.$this->get_nice_url( $child->id() ).'/';
             }
         }
         if ($this->params['provide_images']) {
             $image = $this->get_page_image($sibling->id());
             if (!empty($image)) {
                 if ($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0) {
                     $rsi = new reasonSizedImage();
                     if (!empty($rsi)) {
                         $rsi->set_id($image->id());
                         if ($this->params['thumbnail_width'] != 0) {
                             $rsi->set_width($this->params['thumbnail_width']);
                         }
                         if ($this->params['thumbnail_height'] != 0) {
                             $rsi->set_height($this->params['thumbnail_height']);
                         }
                         if ($this->params['thumbnail_crop'] != '') {
                             $rsi->set_crop_style($this->params['thumbnail_crop']);
                         }
                         $image_html = get_show_image_html($rsi, true, false, false, '', '', false, $link);
                     }
                 } else {
                     $image_html = get_show_image_html($image->id(), true, false, false, '', '', false, $link);
                 }
             }
         }
         if (!$is_current_page) {
             if ('previous' == $key || 'next' == $key) {
                 $classes[] = $key;
             }
             echo '<li class="' . implode(' ', $classes) . '">';
             if (!empty($prevnext)) {
                 echo '<strong>' . ucfirst($key) . ':</strong> ';
             }
             echo $image_html;
             echo '<a href="' . $link . '">' . $page_name . '</a>';
             /* if ( $sibling->get_value( 'description' ))
             			echo "\n".'<div class="smallText">'.$sibling->get_value( 'description' ).'</div>'; */
             echo "</li>\n";
         } else {
             echo '<li class="' . implode(' ', $classes) . '">';
             echo $image_html;
             echo '<strong>' . $page_name . '</strong>';
             echo '</li>' . "\n";
         }
         $counter++;
         if ($even_odd == 'even') {
             $even_odd = 'odd';
         } else {
             $even_odd = 'even';
         }
     }
     echo '</ul>' . "\n";
     echo '</div>' . "\n";
 }
Esempio n. 19
0
 function process_form($d)
 {
     $user = new entity($this->admin_page->user_id);
     $fail_count = 0;
     $success_count = 0;
     echo '<ul>' . "\n";
     foreach ($this->metadata as $info) {
         $prepped_info = $this->prep_item_info($info);
         $id = $this->reason_import($prepped_info, $user);
         $entry = $this->media_import($id, $prepped_info, $user);
         if ($entry) {
             reason_update_entity($id, $this->admin_page->site_id, array('entry_id' => $this->shim->get_entry_id($entry)), false);
             // attach access group if applicable
             if (!empty($info['access_group'])) {
                 if (is_numeric($info['access_group'])) {
                     $group_id = $info['access_group'];
                 } else {
                     $group_id = id_of($info['access_group']);
                 }
                 create_relationship($id, $group_id, relationship_id_of('av_restricted_to_group'));
             } elseif ($group = $this->get_default_access_group()) {
                 create_relationship($id, $group->id(), relationship_id_of('av_restricted_to_group'));
             }
             echo '<li>Started processing: ' . reason_htmlspecialchars($info['name']) . '</li>' . "\n";
             $success_count++;
         } else {
             echo '<li><strong>Failed</strong> to start processing (likely due to a communication problem with ' . $this->integration_library . '): ' . reason_htmlspecialchars($info['name']) . '</li>' . "\n";
             $fail_count++;
         }
     }
     echo '</ul>' . "\n";
     if ($success_count) {
         echo '<h4>Successfully started processing ' . $success_count . ' item(s).</h4>' . "\n";
     }
     if ($fail_count) {
         echo '<h4>Failed to import ' . $fail_count . ' item(s).</h4>' . "\n";
         echo '<p>Please contact your Reason administrator for assistance.</p>' . "\n";
     }
     $this->delete_dir($this->temp_location);
     echo '<hr />' . "\n";
 }
Esempio n. 20
0
 /**
  * Show an image thumbnail
  *
  * Note that this function does not return XHTML; instead it directly outputs it
  * via echo statements. If you want returned XHTML, use get_show_image_html().
  *
  * @param mixed $image An image object, image ID, or array of image values
  * @param boolean $die_without_thumbnail Echo nothing if no thumb available? (default behavior 
  *                                       is to make link to full-sized image if no thumb available)
  * @param boolean $show_popup_link Wrap image in link that pops up image popup?
  * @param boolean $show_description Place the image description (i.e. short caption) below the image?
  * @param string $other_text Text to use instead of image description
  * @param boolean $textonly True sets function into textonly mode, which instead of outputting
  *                          image markup outputs a text description linking to image
  * @param boolean $show_author Output the value of the author field below the description?
  * @param string $link_with_url Wrap the image in a link to this URL instead of to image popup
  * @return void
  *
  * @todo Make a better image markup library!
  */
 function show_image($image, $die_without_thumbnail = false, $show_popup_link = true, $show_description = true, $other_text = '', $textonly = false, $show_author = false, $link_with_url = '')
 {
     if (is_array($image)) {
         $id = $image['id'];
     } elseif (is_object($image)) {
         if ('reasonSizedImage' == get_class($image)) {
             $sizedImageObject = $image;
             $image_entity = $sizedImageObject->get_entity();
             $values = $image_entity->get_values();
             $id = $image_entity->id();
             $image = $values;
         } else {
             $values = $image->get_values();
             $id = $image->id();
             $image = $values;
         }
     } else {
         $id = $image;
         $image = get_entity_by_id($id);
     }
     if (isset($sizedImageObject)) {
         $tn = true;
         $width = $sizedImageObject->get_image_width();
         $height = $sizedImageObject->get_image_height();
         $image_path = $sizedImageObject->get_file_system_path_and_file_of_dest();
         $mod_time = filemtime($image_path);
         $image_url = $sizedImageObject->get_URL() . '?cb=' . $mod_time;
     } else {
         $tn_name = reason_get_image_filename($id, 'tn');
         $fs_name = reason_get_image_filename($id);
         if (file_exists(PHOTOSTOCK . $tn_name)) {
             $tn = true;
             $image_name = $tn_name;
         } elseif (file_exists(PHOTOSTOCK . $fs_name)) {
             if ($die_without_thumbnail) {
                 return;
             }
             $tn = false;
             $image_name = $fs_name;
         } else {
             trigger_error('No thumbail or full sized image found for image id ' . $id);
             return;
         }
         $image_path = PHOTOSTOCK . $image_name;
         list($width, $height) = getimagesize($image_path);
         $mod_time = filemtime($image_path);
         $image_url = WEB_PHOTOSTOCK . $image_name . '?cb=' . $mod_time;
     }
     if (file_exists($image_path)) {
         $full_image_exists = file_exists(PHOTOSTOCK . reason_get_image_filename($id));
         if (!$image['description']) {
             if ($image['keywords']) {
                 $image['description'] = $image['keywords'];
             } else {
                 $image['description'] = $image['name'];
             }
         }
         $window_width = $image['width'] < 340 ? 340 : 40 + $image['width'];
         $window_height = 170 + $image['height'];
         // formerly 130 // 96 works on Mac IE 5
         if (empty($link_with_url)) {
             if (empty($textonly)) {
                 $pre_link = "<a onmouseover=\"window.status = 'view larger image'; return true;\" onmouseout=\"window.status = ''; return true;\" onclick=\"this.href='javascript:void(window.open(\\'" . REASON_IMAGE_VIEWER . "?id=" . $image['id'] . "\\', \\'PopupImage\\', \\'menubar,scrollbars,resizable,width=" . $window_width . ",height=" . $window_height . "\\'))'\" href=\"" . WEB_PHOTOSTOCK . reason_get_image_filename($id) . "?cb=" . filemtime($image_path) . "\">";
             } else {
                 $pre_link = '<a href="' . WEB_PHOTOSTOCK . reason_get_image_filename($id) . '?cb=' . filemtime(PHOTOSTOCK . $image_name) . '">';
             }
         } else {
             $pre_link = '<a href="' . $link_with_url . '">';
         }
         if (empty($textonly)) {
             echo '<div class="tnImage">';
             if (($tn and $show_popup_link and $full_image_exists) || $tn && !empty($link_with_url)) {
                 echo $pre_link;
             }
             // show photo
             echo '<img src="' . $image_url . '" width="' . $width . '" height="' . $height . '" alt="' . reason_htmlspecialchars($image['description']) . '" class="thumbnail" border="0"/>';
             if (($tn and $show_popup_link and $full_image_exists) || $tn && !empty($link_with_url)) {
                 echo '</a>';
             }
             echo '</div>';
         }
         if ($show_description) {
             $desc =& $image['description'];
             if (empty($textonly)) {
                 echo '<div class="tnDesc smallText">';
             } else {
                 echo '<div class="tnDesc">';
             }
             if ($tn and $show_popup_link and $full_image_exists) {
                 echo $pre_link . $desc . '</a>';
             } else {
                 echo $desc;
             }
             echo '</div>';
         }
         if ($other_text) {
             if (empty($textonly)) {
                 echo '<div class="tnDesc smallText">';
             } else {
                 echo '<div class="tnDesc">';
             }
             if ($tn and $show_popup_link and $full_image_exists) {
                 echo $pre_link . $other_text . '</a>';
             } else {
                 echo $other_text;
             }
             echo '</div>';
         }
         if ($show_author and !empty($image['author'])) {
             echo '<div class="tnAuthor smallText">Photo: ' . $image['author'] . '</div>';
         }
     }
 }
Esempio n. 21
0
 function process_form($d)
 {
     $user = new entity($this->admin_page->user_id);
     $fail_count = 0;
     $success_count = 0;
     echo '<ul>' . "\n";
     foreach ($this->metadata as $info) {
         $prepped_info = $this->prep_item_info($info);
         $shim = new KalturaShim();
         $entry = $this->kaltura_import($prepped_info, $user, $shim);
         if (!empty($entry) && $entry->id) {
             $id = $this->reason_import($prepped_info, $entry, $user);
             // attach access group if applicable
             if (!empty($info['access_group'])) {
                 if (is_numeric($info['access_group'])) {
                     $group_id = $info['access_group'];
                 } else {
                     $group_id = id_of($info['access_group']);
                 }
                 create_relationship($id, $group_id, relationship_id_of('av_restricted_to_group'));
             } elseif ($group = $this->get_default_access_group()) {
                 create_relationship($id, $group->id(), relationship_id_of('av_restricted_to_group'));
             }
             echo '<li>Started processing: ' . reason_htmlspecialchars($info['name']) . '</li>' . "\n";
             $success_count++;
         } else {
             echo '<li><strong>Failed</strong to start processing (likely due to a communication problem with Kaltura): ' . reason_htmlspecialchars($info['name']) . '</li>' . "\n";
             $fail_count++;
         }
     }
     echo '</ul>' . "\n";
     if ($success_count) {
         echo '<h4>Successfully started processing ' . $success_count . ' item(s).</h4>' . "\n";
     }
     if ($fail_count) {
         echo '<h4>Failed to import ' . $fail_count . ' item(s).</h4>' . "\n";
         echo '<p>Please contact your Reason or Kaltura administrator for assistance.</p>' . "\n";
     }
     echo '<hr />' . "\n";
 }
Esempio n. 22
0
            if ($detail_mode) {
                $check = $region_info['module_name'] == $detail_limiter ? true : false;
            } else {
                $check = empty($module_limiter) ? true : stripos($region_info['module_name'], $module_limiter) !== false;
            }
            if (isset($reason_page_types[$page_type_name]) && $check) {
                if (empty($core_local_limiter) || module_location_is_acceptable($region_info['module_name'], $core_local_limiter)) {
                    $modules_by_page_type[$region_info['module_name']][$page_type_name] = $reason_page_types[$page_type_name];
                }
            }
        }
    }
}
$module_limiter = reason_htmlspecialchars($module_limiter);
// in case of weird chars - parse the limiter since we are going to display it
$detail_limiter = reason_htmlspecialchars($detail_limiter);
// in case of weird chars - parse the limiter since we are going to display it
if ($detail_mode) {
    $pages = array();
    $items = $count = '';
    foreach ($modules_by_page_type as $module => $my_page_types) {
        foreach ($my_page_types as $page_type => $module_pages) {
            $pages = array_merge(array_keys($module_pages), $pages);
        }
        shuffle($pages);
        // randomize array
        foreach ($pages as $page_id) {
            $page =& $result[$page_id];
            $builder->set_id($page_id);
            $url = $builder->get_url();
            if ($url) {
Esempio n. 23
0
	function get_title()
	{
		$ret = '';
		if($this->use_default_org_name_in_page_title)
		{
			$ret .= FULL_ORGANIZATION_NAME.': ';
		}
		$ret .= $this->site_info->get_value('name');
		
		if(carl_strtolower($this->site_info->get_value('name')) != carl_strtolower($this->title))
		{
			$ret .= ": " . $this->title;
		}
		$crumbs = &$this->_get_crumbs_object();
		// Take the last-added crumb and add it to the page title
		if($last_crumb = $crumbs->get_last_crumb() )
		{
			if(empty($last_crumb['id']) || $last_crumb['id'] != $this->page_id)
			{
				$ret .= ': '.$last_crumb['page_name'];
			}
		}
		$ret = reason_htmlspecialchars(strip_tags($ret));
		$this->head_items->add_head_item('title',array(),$ret, true);
		//return $ret;
	}
Esempio n. 24
0
 function show_user()
 {
     // if behind HTTP authentication the session lasts until the browser is closed and logout will not do anything
     $show_logout = !isset($_SERVER['REMOTE_USER']);
     $user = new entity($this->authenticated_user_id);
     if (reason_user_has_privs($this->authenticated_user_id, 'pose_as_other_user')) {
         $es = new entity_selector();
         $es->add_type(id_of('user'));
         $es->set_order('name ASC');
         $es->limit_tables();
         $es->limit_fields('name');
         $users = $es->run_one();
         echo '<form action="?" class="jumpNavigation" name="userSwitchSelect" method="get">' . "\n";
         echo '<label for="user_switch_select">User</label>: ';
         echo '<select name="user_id" class="jumpDestination siteMenu" id="user_switch_select">' . "\n";
         echo '<option value="">--</option>' . "\n";
         foreach (array_keys($users) as $user_id) {
             echo '<option value="' . $user_id . '"';
             if ($user_id == $this->user_id) {
                 echo ' selected="selected"';
             }
             echo '>' . $users[$user_id]->get_value('name') . '</option>' . "\n";
         }
         echo '</select>';
         $this->echo_hidden_fields('user_id');
         echo '<input type="submit" class="jumpNavigationGo" value="go" />' . "\n";
         if ($this->user_id != $this->authenticated_user_id) {
             if (isset($users[$this->authenticated_user_id])) {
                 $username = $users[$this->authenticated_user_id]->get_value('name');
             } else {
                 $username = '******';
             }
             echo '<a class="stopPosing" href="' . carl_make_link(array('user_id' => $this->authenticated_user_id)) . '" title="Stop posing as another user">' . htmlspecialchars($username) . '</a>' . "\n";
         }
         if ($show_logout) {
             echo ' <strong><a href="' . REASON_LOGIN_URL . '?logout=true" class="bannerLink">Logout</a></strong>';
         }
         echo '</form>';
     } else {
         echo 'You are <strong>' . reason_htmlspecialchars($user->get_value('name')) . '</strong>';
         if ($show_logout) {
             echo ': <strong><a href="' . REASON_LOGIN_URL . '?logout=true" class="bannerLink">Logout</a></strong>';
         }
     }
 }
Esempio n. 25
0
/**
 * Get the url of an icon for a given type
 *
 * Note that this only supports .png icons at the moment.
 * If someone wants to use other file types, feel free to add support and contribute back. :)
 *
 * @param mixed $type id, unique name, or entity (entity will offer best performance in tight loops)
 * @param boolean $use_default Provide the url of a default icon if none available
 * @return string URL of the icon (html encoded), or an empty string if none found and $use_default set to false
 * @todo add support for image types other than .png (will need some sort of hierarchy of formats)
 */
function reason_get_type_icon_url($type, $use_default = true)
{
    if (!is_object($type)) {
        if (is_numeric($type)) {
            $type = new entity($type);
        } elseif (is_string($type)) {
            $type = new entity(id_of($type));
        } else {
            trigger_error('$type not an object, integer, or string');
            $type = NULL;
        }
    }
    if (isset($type) && $type->get_values() && $type->get_value('unique_name') && (file_exists(REASON_INC . 'www/ui_images/types/' . $type->get_value('unique_name') . '.png') || file_exists(REASON_INC . 'www/local/ui_images/types/' . $type->get_value('unique_name') . '.png'))) {
        return REASON_HTTP_BASE_PATH . 'ui_images/types/' . reason_htmlspecialchars($type->get_value('unique_name')) . '.png';
    } elseif ($use_default) {
        return REASON_HTTP_BASE_PATH . 'ui_images/types/default.png';
    } else {
        return '';
    }
}
Esempio n. 26
0
	/**
	 * Get the markup for the categories section of the options bar
	 * 
	 * @return string
	 * @todo move into markup class
	 */
	function get_all_categories()
	{
		$ret = '';
		$cs = new entity_selector($this->parent->site_id);
		$cs->description = 'Selecting all categories on the site';
		$cs->add_type(id_of('category_type'));
		$cs->set_order('entity.name ASC');
		$cs->set_cache_lifespan($this->get_cache_lifespan_meta());
		$cats = $cs->run_one();
		$cats = $this->check_categories($cats);
		if(empty($cats))
			return '';
		
		$cat_names = array();
		foreach($cats as $cat)
			$cat_names[$cat->id()] = $cat->get_value('name');
		
		if($this->params['natural_sort_categories'])
			natcasesort($cat_names);
		
		$ret .= '<div class="categories';
		if ($this->calendar->get_view() == "all")
			$ret .= ' divider';
		$ret .= '">'."\n";
		$ret .= '<h4>Event Categories</h4>'."\n";
		$ret .= '<ul>'."\n";
		$ret .= '<li class="all">';
		$used_cats = $this->calendar->get_categories();
			if (empty( $used_cats ))
				$ret .= '<strong>All Categories</strong>';
			else
				$ret .= '<a href="'.$this->construct_link(array('category'=>'','view'=>'')).'" title="Events in all categories">All Categories</a>';
		$ret .= '</li>';
		foreach($cat_names as $cat_id=>$cat_name)
		{
			$cat = $cats[$cat_id];
			$ret .= '<li>';
			if (array_key_exists($cat->id(), $this->calendar->get_categories()))
				$ret .= '<strong>'.$cat->get_value('name').'</strong>';
			else
				$ret .= '<a href="'.$this->construct_link(array('category'=>$cat->id(),'view'=>'','no_search'=>'1')).'" title="'.reason_htmlspecialchars(strip_tags($cat->get_value('name'))).' events">'.$cat->get_value('name').'</a>';
			$ret .= '</li>';
		}
		$ret .= '</ul>'."\n";
		$ret .= '</div>'."\n";
		return $ret;
	}
 function show_item_value_default($display_name, $display_value)
 {
     echo '<li><strong>' . reason_htmlspecialchars($display_name) . '</strong>: ' . reason_htmlspecialchars($display_value) . '</li>';
 }
	/**
	 * Get a the markup for an individual category
	 *
	 * @param entity $category
	 * @param string $event_page_url
	 * @return string $markup
	 */
	function _get_event_output($category, $event_page_url)
	{
		$ret = '';
		if($this->params['show_individual_occurrences'])
			$days = $this->_get_event_ocurrences_for_category($category);
		else
			$days = $this->_get_events_for_category($category);
		if($this->params['show_empty_categories'] || !empty($days))
		{
			$name = $category->get_value('name');
			$url = $event_page_url.'?category='.$category->id();
			if($this->params['link_to_related_pages'] || $this->params['use_related_page_name'])
			{
				$page = $this->_get_page_for_category($category);
				if(!empty($page))
				{
					if($this->params['link_to_related_pages'])
						$url = $this->_pages->get_full_url($page->id());
					if($this->params['use_related_page_name'])
						$name = $page->get_value('link_name') ? $page->get_value('link_name') : $page->get_value('name');
				}
			}
			$ret .= '<h3>';
			if($url)
				$ret .= '<a href="'.$url.'"><span class="categoryName">'.$name.'</span></a>';
			else
				$ret .= '<span class="categoryName">'.$name.'</span>';
			$ret .= '</h3>'."\n";
			$items = array();
			foreach($days as $day=>$events)
			{
				foreach($events as $event)
				{
					if($this->params['link_to_more_info_url'] && $event->get_value('url'))
						$event_url = reason_htmlspecialchars($event->get_value('url'));
					else
						$event_url = $event_page_url.'?event_id='.$event->id();
					$items[] = '<a href="'.$event_url.'">'.$event->get_value('name').'</a>'."\n";
					$this->_last_mod_reg($event);
				}
			}
			if($this->params['show_archive_links'])
			{
				$items[] = '<a href="'.$event_page_url.'?view=all&amp;start_date=1970-01-01&amp;category='.$category->id().'" class="archive">Archive</a>'."\n";
			}
			$ret .= '<div class="items">'.implode($this->params['item_separator'],$items).'</div>'."\n";
		}
		return $ret;
	}
Esempio n. 29
0
		function get_title($word, $name)
		{
			if(false !== stripos($name, $word))
				return '';
			else
				return reason_htmlspecialchars($word) . ' &#8211; ' . reason_htmlspecialchars($name);
		}
Esempio n. 30
0
 function show_item_url($field, $value)
 {
     $value = '<a href="' . reason_htmlspecialchars($value) . '">' . $value . '</a>';
     $this->show_item_default($field, $value);
 }