예제 #1
0
		function init($args = array())
		{	
			if(isset($this->params['num_per_page']))
				$this->num_per_page = $this->params['num_per_page'];
			
			// only load javascript and css for integrated items
			if ( !empty($this->request[ $this->query_string_frag.'_id' ]) )
			{
				$media_work = new entity($this->request[ $this->query_string_frag.'_id' ]);
				if ($media_work->get_values() && $media_work->get_value('type') == id_of('av'))
				{
					$head_items = $this->get_head_items();
					$head_items->add_javascript(JQUERY_URL, true);
					
					$this->displayer_chrome = MediaWorkFactory::displayer_chrome($media_work, 'av');
					if ($this->displayer_chrome)
					{
						$this->displayer_chrome->set_module($this);
						$this->displayer_chrome->set_head_items($head_items);
					}
				}
			}
	
			parent::init($args);
		}
예제 #2
0
	function thor_build_display_values()
	{
		$form = new entity($this->form_id);
		$form->get_values();
		if ($form->get_value('type') != id_of('form'))
		{
			trigger_error('the thor viewer was passed an invalid id ('.$form_id.') - it must be passed the ID of a reason form entity');
		}
		else
		{
			$form_xml_obj = new XMLParser($form->get_value('thor_content'));
			$form_xml_obj->Parse();
			$display_values = array();
			foreach ($form_xml_obj->document->tagChildren as $k=>$v)
			{
				$tagname = is_object($v) ? $v->tagName : '';
				if (method_exists($this, '_build_display_'.$tagname))
				{
					$build_function = '_build_display_'.$tagname;
					$display_values = array_merge($display_values, $this->$build_function($v));
				}
			}
		}
		foreach ($this->extra_fields as $field_name)
		{
			$display_values[$field_name]['label'] = prettify_string($field_name);
			$display_values[$field_name]['type'] = 'text';
		}
		$this->_display_values = (isset($display_values)) ? $display_values : array();
	}
예제 #3
0
 function set_audience_id($aud_id)
 {
     $aud = new entity($aud_id);
     if ($aud->get_values()) {
         $this->audiences[$aud_id] = $aud;
     }
 }
예제 #4
0
 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo '<p>Sorry; use of this module is restricted.</p>' . "\n";
         return;
     }
     if (!empty($this->admin_page->request['entity_id_test'])) {
         $id = $this->admin_page->request['entity_id_test'];
         settype($id, 'integer');
     }
     if (empty($id)) {
         $id = '';
     }
     echo '<form method="get" action="?"><label for="entity_id_test">Entity ID:</label> <input type="text" name="entity_id_test" id="entity_id_test" value="' . $id . '"/><input type="submit" value="submit" /><input type="hidden" name="cur_module" value="EntityInfo" /></form>';
     if (!empty($id)) {
         $entity = new entity($id);
         if ($entity->get_values()) {
             echo '<div class="EntityInfo">' . "\n";
             $this->show_entity_header($entity);
             $this->show_entity_data($entity);
             $this->show_pages($entity);
             $this->show_borrowing_sites($entity);
             $this->show_entity_relationships($entity);
             echo '</div>' . "\n";
         } else {
             echo '<p>The Reason ID ' . $id . ' does not belong to a real entity. It may have been deleted.</p>';
         }
     }
 }
예제 #5
0
 function apply_order_and_limits(&$es)
 {
     $limit_tables = true;
     if (isset($this->viewer_id) && !empty($this->viewer_id)) {
         $viewer = new entity($this->viewer_id);
         if ($viewer->get_values() && $viewer->get_value('type') == id_of('view')) {
             $viewer_default_sort = $viewer->get_value('default_sort');
             if (!empty($viewer_default_sort)) {
                 $limit_tables = false;
             }
         }
     }
     if (!empty($this->admin_page->request['order_by'])) {
         $alias = isset($this->alias[$this->admin_page->request['order_by']]) ? $this->alias[$this->admin_page->request['order_by']] : '';
         if ($alias) {
             $table = $alias['table'] . '.' . $alias['field'];
             $table_name = $alias['table_orig'];
         } else {
             $table = table_of($this->admin_page->request['order_by'], $this->type_id);
             $table_name = substr($table, 0, strpos($table, '.' . $this->admin_page->request['order_by']));
         }
         if ($table) {
             $es->set_order($table . ' ' . $this->admin_page->request['dir']);
             if (!$this->check_filters() && $limit_tables) {
                 $es->limit_tables($table_name);
             }
             // only limit if filters are not being used
         }
     } elseif (!$this->check_filters() && $limit_tables) {
         $es->limit_tables();
     }
     // only limit if filters are not being used
 }
예제 #6
0
 function set_event($event)
 {
     if (!is_object($event)) {
         $event_id = turn_into_int($event);
         $event = new entity($event_id);
     }
     if ($event->get_values() && $event->get_value('type') == id_of('event_type')) {
         $this->event = $event;
     } else {
         trigger_error('Entity passed to reasonEvent object that is not an event');
         $this->event = NULL;
     }
 }
예제 #7
0
 function &get_form()
 {
     if (!isset($this->_form)) {
         $form = new entity($this->admin_page->id);
         if ($form->get_values() && $form->get_value('type') == id_of('form')) {
             $owner = $form->get_owner();
             if ($owner->id() == $this->admin_page->site_id) {
                 $this->_form = $form;
             }
         }
         if (!isset($this->_form)) {
             $this->_form = false;
         }
     }
     return $this->_form;
 }
예제 #8
0
 function init($args = array())
 {
     $es = new entity_selector($this->site_id);
     $es->description = 'Selecting publications for this page';
     $es->add_type(id_of('publication_type'));
     $es->add_right_relationship($this->page_id, relationship_id_of('page_to_publication'));
     $es->set_num(1);
     $publications = $es->run_one();
     if (!empty($publications)) {
         $this->publication = current($publications);
         if ($this->publication->get_value('has_sections') == 'yes') {
             $es = new entity_selector($this->site_id);
             $es->description = 'Selecting news sections for this publication';
             $es->add_type(id_of('news_section_type'));
             $es->add_left_relationship($this->publication->id(), relationship_id_of('news_section_to_publication'));
             $es->set_order('sortable.sort_order ASC');
             $this->sections = $es->run_one();
         }
     }
     if (!empty($this->sections) && !empty($this->publication) && $this->publication->get_value('has_issues')) {
         if (!empty($this->request['issue_id'])) {
             $iss = new entity($this->request['issue_id']);
             if ($iss->get_values() && $iss->get_value('type') == id_of('issue_type')) {
                 $this->issue = $iss;
             }
         } else {
             $es = new entity_selector($this->site_id);
             $es->description = 'Selecting issues for this publication';
             $es->add_type(id_of('issue_type'));
             $es->limit_tables(array('dated', 'show_hide'));
             $es->limit_fields('dated.datetime');
             $es->set_order('dated.datetime DESC');
             $es->add_relation('show_hide.show_hide = "show"');
             $es->add_left_relationship($this->publication->id(), relationship_id_of('issue_to_publication'));
             $es->set_num(1);
             $issues = $es->run_one();
             if (!empty($issues)) {
                 $this->issue = current($issues);
             }
         }
     }
 }
예제 #9
0
	/**
	 * Move all the fields of one table into another table for a specific type
	 *
	 * This method is for denormalizing Reason tables. For example, a type may use a common table
	 * like meta, datetime, or chunk. For performance reasons, it can be desirable to collapse
	 * these tables into a single table just for that type. This method will do that.
	 * 
	 * @param integer $type The ID of the type whose fields we are moving
	 * @param string $source_table The name of the table we are moving fields FROM
	 * @param string $destination_table The name of the table we are moving fields TO
	 * @param integer $user_id The Reason ID of the user who is doing this move
	 * @return boolean Success
	 *
	 * @todo Add limit to ensure fields are only created that don't already exist
	 */
	function reason_move_table_fields($type, $source_table, $destination_table, $user_id)
	{
		// Sanity checks
		
		if(empty($type))
		{
			trigger_error('No type provided in reason_move_table_fields()');
			return false;
		}
		
		if(empty($source_table))
		{
			trigger_error('No source table provided in reason_move_table_fields()');
			return false;
		}
		
		if(!is_string($source_table))
		{
			trigger_error('Source table provided not a string in reason_move_table_fields()');
			return false;
		}
		
		if(empty($destination_table))
		{
			trigger_error('No destination table provided in reason_move_table_fields()');
			return false;
		}
		
		if(!is_string($destination_table))
		{
			trigger_error('Destination table provided not a string in reason_move_table_fields()');
			return false;
		}
		
		if('entity' == $source_table || 'entity' == $destination_table)
		{
			trigger_error('reason_move_table_fields() cannot move fields into or out of the entity table.');
			return false;
		}
		
		if(is_object($type))
		{
			$type_id = $type->id();
		}
		elseif(is_numeric($type))
		{
			$type_id = (integer) $type;
		}
		else
		{
			$type_id = id_of($type);
		}
		
		if(empty($type_id))
		{
			trigger_error('Invalid type specified in reason_move_table_fields().');
			return false;
		}
		
		if(is_object($type))
			$type_entity = $type;
		else
			$type_entity = new entity($type_id);
		
		$type_vals = $type_entity->get_values();
		if(empty($type_vals))
		{
			trigger_error('Type specified (id '.$type_id.') is not a Reason entity in reason_move_table_fields().');
			return false;
		}
		if($type_entity->get_value('type') != id_of('type'))
		{
			trigger_error('Type specified (id '.$type_id.') is not a Type entity in reason_move_table_fields().');
			return false;
		}
		if($type_entity->get_value('state') != 'Live')
		{
			trigger_error('Type specified (id '.$type_id.') is not a live entity in reason_move_table_fields().');
			return false;
		}
		
		if(empty($user_id))
		{
			trigger_error('No user id specified in reason_move_table_fields().');
			return false;
		}
		$user = new entity($user_id);
		if(!$user->get_values() || $user->get_value('type') != id_of('user'))
		{
			trigger_error('Invalid user ID specified in reason_move_table_fields().');
			return false;
		}
		
		// check for table existence
		$es = new entity_selector();
		$es->add_type(id_of('content_table'));
		$es->add_relation('`name` = "'.addslashes($source_table).'"');
		$source_table_result = $es->run_one();
		if(empty($source_table_result))
		{
			trigger_error('Source table "'.$source_table.'" does not exist in reason_move_table_fields()');
			return false;
		}
		
		$es = new entity_selector();
		$es->add_type(id_of('content_table'));
		$es->add_relation('`name` = "'.addslashes($destination_table).'"');
		$destination_table_result = $es->run_one();
		if(empty($destination_table_result))
		{
			trigger_error('Destination table "'.$destination_table.'" does not exist in reason_move_table_fields()');
			return false;
		}
		
		$source_table_entity = current($source_table_result);
		$destination_table_entity = current($destination_table_result);
		
		// ensure type uses both tables
		
		$type_tables = get_entity_tables_by_type( $type_id );
		
		if(!in_array($source_table, $type_tables))
		{
			trigger_error('Source table "'.$source_table.'" not part of the type in reason_move_table_fields()');
			return false;
		}
		
		if(!in_array($destination_table, $type_tables))
		{
			trigger_error('Destination table "'.$destination_table.'" not part of the type in reason_move_table_fields()');
			return false;
		}
		
		$es = new entity_selector();
		$es->add_type(id_of('type'));
		$es->add_left_relationship($destination_table_entity->id(),relationship_id_of('type_to_table'));
		$es->add_relation('`entity`.`id` != "'.addslashes($type_id).'"');
		$other_types = $es->run_one();
		
		if(!empty($other_types))
		{
			trigger_error(count($other_types).' other type(s) share the destination table with the type specified in reason_move_table_fields(). reason_move_table_fields() can only move fields into single-type tables.');
			return false;
		}
		
		// get the fields in the old table
		$es = new entity_selector();
		$es->add_type(id_of('field'));
		$es->add_left_relationship($source_table_entity->id(), relationship_id_of('field_to_entity_table'));
		$source_table_fields = $es->run_one();
		
		if(empty($source_table_fields))
		{
			trigger_error('Source table '.$source_table.' does not appear to have any fields associated with it in Reason. Unable to move its content in reason_move_table_fields()');
		}
		
		$q = 'DESCRIBE `'.addslashes($destination_table).'`';
		$handle = db_query( $q, 'Unable to describe destination table in reason_move_table_fields()' );
		$raw_dest_cols = array();
		while($row = mysql_fetch_assoc($handle))
		{
			$raw_dest_cols[] = $row['Field'];
		}
		
		
		foreach($source_table_fields as $k=>$field)
		{
			if(in_array($field->get_value('name'),$raw_dest_cols))
			{
				trigger_error($field->get_value('name').' field is already in destination table. Unable to accomplish reason_move_table_fields().');
				return false;
			}
			$tmp_field_name = $field->get_value('name').'_move_tmp';
			if(in_array($tmp_field_name,$raw_dest_cols))
			{
				trigger_error($tmp_field_name.' field already in destination table. There appears to have been an error in a previous attempt to run reason_move_table_fields(). Please drop this column in MySQL and try again.');
				return false;
			}
			$source_table_fields[$k]->set_value('_field_move_temp_name',$field->get_value('name').'_move_tmp');
		}
		
		// Done with sanity checks
		
		
		// map old to temp field names & create new fields
		$query_parts = array();
		foreach($source_table_fields as $k=>$field)
		{
			$source_table_fields[$k]->set_value('_field_move_temp_name',$field->get_value('name').'_move_tmp');
			$q = 'ALTER TABLE `'.addslashes($destination_table).'` ADD '.addslashes( $field->get_value('_field_move_temp_name') ).' '. $field->get_value('db_type');
			db_query( $q, 'Unable to create new field '.$field->get_value('_field_move_temp_name').' in reason_move_table_fields()' );
			$values = array();
			foreach($field->get_values() as $f=>$v)
			{
				if($f != 'name' && $f != 'id' && strpos($f,'_') !== 0)
				{
					$values[$f] = $v;
				}
			}
			$id = reason_create_entity( id_of('master_admin'), id_of('field'), $user_id, $field->get_value('_field_move_temp_name'), $values);
			$source_table_fields[$k]->set_value('_new_field_id',$id);
			$query_parts[] = '`'.addslashes($destination_table).'`.`'.addslashes($field->get_value('_field_move_temp_name')).'` = `'.addslashes($source_table).'`.`'.addslashes($field->get_value('name')).'`';
		}
		
		// copy content of old fields to new fields
		
		
		$q = 'UPDATE `'.addslashes($destination_table).'`, `'.addslashes($source_table).'`, `entity` SET '.implode(' , ',$query_parts).' WHERE `'.addslashes($destination_table).'`.`id` = `'.addslashes($source_table).'`.`id` AND `'.addslashes($destination_table).'`.`id` = `entity`.`id` AND `entity`.`type` = "'.addslashes($type_id).'";';
		
		db_query($q,'Attempt to move data between fields');
		
		
		// zap source table's type-to-table relationship for this type
		
		$conditions = array(
			'entity_a' => $type_id,
			'entity_b' => $source_table_entity->id(),
			'type' => relationship_id_of('type_to_table'),
		);
		
		delete_relationships( $conditions );
		
		// create new field-to-table relationship for new fields and update field names in new table -- remove temp flag
		
		foreach($source_table_fields as $field)
		{
			create_relationship( $field->get_value('_new_field_id'), $destination_table_entity->id(), relationship_id_of(	'field_to_entity_table' ) );
			$q = 'ALTER TABLE `'.addslashes($destination_table).'` CHANGE '.addslashes($field->get_value('_field_move_temp_name')).' '.addslashes( $field->get_value('name') ).' '.$field->get_value('db_type') ;
			db_query( $q, 'Unable to change field name of '.$field->get_value('_field_move_temp_name').' in reason_move_table_fields()' );
			reason_update_entity( $field->get_value('_new_field_id'), $user_id, array('name' => $field->get_value('name') ), false );
		}
		
		// delete the rows from the source table
		
		$q = 'DELETE `'.addslashes($source_table).'` FROM `'.addslashes($source_table).'`, `entity` WHERE `'.addslashes($source_table).'`.`id` = `entity`.`id` AND `entity`.`type` = "'.addslashes($type_id).'"';
		
		db_query($q,'Attempt to delete rows from '.$source_table.' in reason_move_table_fields()');
		
		get_entity_tables_by_id( $type_id, false );
		
		return true;
			
	}
예제 #10
0
 function show_item_last_edited_by($field, $value)
 {
     if ($value) {
         $user = new entity($value);
         if ($user->get_values()) {
             $name = $user->get_value('name');
         } else {
             $name = 'User ID ' . $value;
         }
         $new_value = $name . ' on ' . prettify_mysql_timestamp($this->_entity->get_value('last_modified'), 'M j, Y \\a\\t g:i a');
         $this->show_item_default('Last Edited By', $new_value);
     } else {
         $new_value = prettify_mysql_timestamp($this->_entity->get_value('last_modified'), 'M j, Y \\a\\t g:i a');
         $this->show_item_default('Last Edited On', $new_value);
     }
 }
예제 #11
0
	function show_persistent()
	{
		if(!empty($this->current_item_id) && $this->request['story_id'] == $this->current_item_id)
		{
			$item = new entity($this->current_item_id);
			$item->get_values();
			$persistent_markup_generator = $this->set_up_generator_of_type('persistent', $item);
		}
		else
		{
			$persistent_markup_generator = $this->set_up_generator_of_type('persistent');
		}
		echo $persistent_markup_generator->get_markup();
	}
예제 #12
0
 function init()
 {
     if (!$this->admin_page->id) {
         return false;
     }
     //these next few lines check the entity to make sure it has everything it needs
     $this->load_content_manager();
     $this->check_entity_values();
     $this->get_required_relationships();
     if (!empty($this->req_rels)) {
         $this->check_required_relationships();
     }
     /* the new finish stuff */
     // new_entity stuff
     // figure out if the entity is new and store that so we can change the data in the database but still know what's going on
     $temp = new entity($this->admin_page->id, false);
     if ($temp->get_value('new')) {
         $this->new_entity = true;
     } else {
         $this->new_entity = false;
     }
     // when finishing an entity, we want to ensure that it is live and not new (unless it is a page)
     if ($this->admin_page->type_id != id_of('minisite_page') && $temp->get_value('state') == 'Pending' && reason_user_has_privs($this->admin_page->user_id, 'publish')) {
         $update_values['state'] = 'Live';
         if (!empty($this->disco_item)) {
             $this->disco_item->set_value('state', "Live");
         }
     }
     if ($temp->get_value('new') != '0') {
         $update_values['new'] = 0;
         if (!empty($this->disco_item)) {
             $this->disco_item->set_value('new_entity', 0);
         }
     }
     if (!empty($update_values)) {
         reason_update_entity($this->admin_page->id, $this->admin_page->user_id, $update_values, false);
         // archive, yes?
     }
     $original = new entity($this->admin_page->id, false);
     $original->get_values();
     // get archive relationship id
     $q = 'SELECT id FROM allowable_relationship WHERE name LIKE "%archive%" AND relationship_a = ' . $this->admin_page->type_id . ' AND relationship_b = ' . $this->admin_page->type_id;
     $r = db_query($q, 'Unable to get archive relationship.');
     $row = mysql_fetch_array($r, MYSQL_ASSOC);
     $this->rel_id = $row['id'];
     // get archives
     $es = new entity_selector($this->admin_page->site_id);
     $es->add_type($this->admin_page->type_id);
     $es->add_right_relationship($this->admin_page->id, $this->rel_id);
     $es->add_relation('last_modified = "' . $original->get_value('last_modified') . '"');
     $es->set_num(1);
     $similar_archived = $es->run_one('', 'Archived');
     // if the entity has in fact been changed, actually create the relationship
     if (empty($similar_archived)) {
         $archived_id = duplicate_entity($original, false, true, array('state' => 'Archived'));
         create_relationship($this->admin_page->id, $archived_id, $this->rel_id);
     }
     // DETERMINE WHERE TO GO
     if (!empty($this->admin_page->request[CM_VAR_PREFIX . 'type_id'])) {
         // this code block is intended to associate a new entity with the context entity upon finish - it once created backwards relationships IF we reached an
         // entity with get_value('new') = 1 from the reverse associator. This needs fixin. We do so by running this section of code only in the case where
         // the "old" module was the associator (the only module that allows the creation of new entities than need a relationship back to the a side entity
         // whose context is relevant.
         if ($this->new_entity && $this->admin_page->request[CM_VAR_PREFIX . 'cur_module'] == 'Associator') {
             $rel_info = reason_get_allowable_relationship_info($this->admin_page->request[CM_VAR_PREFIX . 'rel_id']);
             $entity_a = new entity($this->admin_page->request[CM_VAR_PREFIX . 'id']);
             $entity_b = new entity($this->admin_page->request['id']);
             // lets do a bit of additional sanity checking.
             if ($rel_info['relationship_a'] == $entity_a->get_value('type') && $rel_info['relationship_b'] == $entity_b->get_value('type')) {
                 if ($rel_info['connections'] == 'one_to_many') {
                     $this->delete_existing_relationships();
                 }
                 create_relationship($entity_a->id(), $entity_b->id(), $rel_info['id']);
             }
         }
         $old_vars = array();
         foreach ($this->admin_page->request as $key => $val) {
             if (substr($key, 0, strlen(CM_VAR_PREFIX)) == CM_VAR_PREFIX) {
                 $old_vars[substr($key, strlen(CM_VAR_PREFIX))] = $val;
                 $old_vars[$key] = '';
             }
         }
         foreach ($this->admin_page->default_args as $arg) {
             if (!isset($old_vars[$arg])) {
                 $old_vars[$arg] = '';
             }
         }
         $link = $this->admin_page->make_link($old_vars);
     } elseif (!empty($this->admin_page->request['next_entity'])) {
         $link = $this->admin_page->make_link(array('cur_module' => 'Editor', 'id' => $this->admin_page->request['next_entity']));
     } else {
         $link = $this->admin_page->make_link(array('id' => '', 'site_id' => $this->admin_page->site_id, 'type_id' => $this->admin_page->type_id, 'cur_module' => 'Lister'));
     }
     // before redirecting, check to see if there are any custom finish actions associated with this type.
     // the entity_type variable is declared earlier in the check_entity_values method.
     //Run any custom finish actions specified in the content manager
     if (!empty($this->disco_item)) {
         $this->disco_item->run_custom_finish_actions($this->new_entity);
     }
     if ($this->entity_type->get_value('finish_actions')) {
         $finish_actions_filename = $this->entity_type->get_value('finish_actions');
     } else {
         $finish_actions_filename = 'default.php';
     }
     reason_include_once('finish_actions/' . $finish_actions_filename);
     $finish_action_class_name = $GLOBALS['_finish_action_classes'][$finish_actions_filename];
     $fac = new $finish_action_class_name();
     $vars = array('site_id' => $this->admin_page->site_id, 'type_id' => $this->admin_page->type_id, 'id' => $this->admin_page->id, 'user_id' => $this->admin_page->user_id);
     $fac->init($vars);
     $fac->run();
     header('Location: ' . unhtmlentities($link));
     die;
 }
예제 #13
0
 function sitebar()
 {
     echo '<div class="sites">';
     if (!$this->id) {
         $sites = $this->get_sites();
         echo '<form action="?" name="siteSwitchSelect" class="jumpNavigation" method="get">' . "\n";
         echo 'Site: <select name="site_id" class="jumpDestination siteMenu">' . "\n";
         echo '<option value="">--</option>' . "\n";
         foreach (array_keys($sites) as $site_id) {
             echo '<option value="' . $site_id . '"';
             if ($site_id == $this->site_id) {
                 echo ' selected="selected"';
             }
             echo '>' . strip_tags($sites[$site_id]->get_value('name')) . '</option>' . "\n";
         }
         $this->show['sites'] = false;
         echo '</select>';
         if (isset($_GET['user_id']) && !empty($_GET['user_id'])) {
             $user_id = turn_into_int($_GET['user_id']);
             if (!empty($user_id)) {
                 echo '<input type="hidden" name="user_id" value="' . $user_id . '" />';
             }
         }
         echo '<input type="submit" class="jumpNavigationGo" value="go" />';
         $cur_site = $sites[$this->site_id];
         $cur_site_base_url = $cur_site->get_value('base_url');
         $cur_site_unique_name = $cur_site->get_value('unique_name');
         $user = new entity($this->user_id);
         $target = $user->get_value('site_window_pref') == 'Popup Window' ? 'target="_blank" ' : '';
         if (!empty($cur_site_base_url) && $cur_site_unique_name != 'master_admin') {
             echo '<a href="http://' . REASON_HOST . $cur_site_base_url . '" ' . $target . 'class="publicSiteLink">Go to public site</a>';
         }
         echo '</form>';
     } else {
         $site = new entity($this->site_id);
         if ($site->get_values()) {
             echo 'Site: <strong>' . $site->get_value('name') . '</strong>' . "\n";
             if ($this->type_id) {
                 $e = new entity($this->type_id);
                 echo '<strong> :: </strong>' . prettify_string($e->get_value('name'));
                 if ($this->id) {
                     $e = new entity($this->id);
                     echo '<strong> :: </strong>' . $e->get_value('name');
                 }
             }
         }
     }
     echo '</div>';
 }
예제 #14
0
	/**
	 * Make sure the input from userland is sanitized
	 * @return void
	 */
	function validate_inputs()
	{
		if (!isset($this->calendar)) $this->calendar = new reasonCalendar;
		$views = $this->calendar->get_views();
		
		if(!empty($this->request['start_date']))
			$this->request['start_date'] = prettify_mysql_datetime($this->request['start_date'], 'Y-m-d');
			
		if(!empty($this->request['end_date']))
			$this->request['end_date'] = prettify_mysql_datetime($this->request['end_date'], 'Y-m-d');
			
		if(!empty($this->request['date']))
			$this->request['date'] = prettify_mysql_datetime($this->request['date'], 'Y-m-d');
			
		if(!empty($this->request['category']))
		{
			$e = new entity($this->request['category']);
			if(!($e->get_values() && $e->get_value('type') == id_of('category_type')))
			{
				unset($this->request['category']);
			}
		}
		if(!empty($this->request['audience']))
		{
			$e = new entity($this->request['audience']);
			if(!($e->get_values() && $e->get_value('type') == id_of('audience_type')))
			{
				unset($this->request['audience']);
			}
		}
	}
예제 #15
0
 /**
  * Modify the head items of a Reason page
  *
  * This is the primary (and simplest) way for a theme customizer to affect the look of a site.
  *
  * @param object $head_items
  * @return void
  */
 public function modify_head_items($head_items)
 {
     $data = $this->get_customizaton_data();
     if (!empty($data)) {
         $css = '';
         if (!empty($data->background_color)) {
             $css .= 'body{background-color:#' . $data->background_color . ';}';
         }
         if (!empty($data->text_color)) {
             $css .= 'body{color:#' . $data->text_color . ';}';
         }
         if (!empty($data->banner_font)) {
             $css .= '#banner,.banner{font-family:"' . $data->banner_font . '";}';
         }
         if (!empty($data->banner_image_id)) {
             $image = new entity($data->banner_image_id);
             if ($image->get_values() && $image->get_value('type') == id_of('image')) {
                 $rsi = new reasonSizedImage();
                 $rsi->set_id($data->banner_image_id);
                 $rsi->set_width(1680);
                 $rsi->set_height(205);
                 $css .= '#banner,.banner{background-image:url("' . $rsi->get_url() . '");}';
             } else {
                 trigger_error('Banner image ID in theme customizer not valid');
             }
         }
         $head_items->add_head_item('style', array('type' => 'text/css'), $css);
     }
 }
예제 #16
0
 function show_manager()
 {
     $orphans = $this->orphans;
     if (empty($orphans)) {
         echo '<p>No orphans; nothing to do</p>';
     } else {
         $maxed_type = $this->omi->get_maxed_type();
         echo '<form method="post">';
         foreach ($orphans as $type_id => $orphans) {
             $type = new entity($type_id);
             $plural_name = strip_tags($type->get_value('plural_name'));
             $name = strip_tags($type->get_value('name'));
             $count_statement = isset($maxed_type) & $type_id == $maxed_type['type'] ? ' of ' . $maxed_type['total'] : '';
             $sites = $this->omi->get_types_to_sites($type_id);
             $header_row = '<tr><th class="option">Do Nothing</th><th class="option">Delete</th><th class="option">Move</th><th>Name</th><th>Entity ID</th><th></th></tr>' . "\n";
             echo '<div class="orphan_group">';
             echo '<h3>' . $plural_name . ' (id# ' . $type_id . '; ' . count($orphans) . $count_statement . ' orphans total) </h3>';
             echo '<table summary="Orphans of type ' . $name . '" class="orphans" cellpadding="0" cellspacing="0" border="0">';
             echo '<thead>' . $header_row . '</thead>';
             echo '<tbody>';
             $i = 0;
             $amputee_count = 0;
             foreach ($orphans as $oid => $orphan) {
                 $orphan = new entity($oid);
                 if ($orphan->get_values()) {
                     if ($i && !($i % 16)) {
                         echo $header_row . "\n";
                     }
                     $display_name = $orphan->get_value('name') ? $orphan->get_value('name') : '&nbsp;';
                     echo '<tr><td><input type="radio" name="orphan[' . $type_id . '][' . $oid . ']" value="" checked="checked" class="nothing"/></td>';
                     echo '<td><input type="radio" name="orphan[' . $type_id . '][' . $oid . ']" value="delete" class="delete" /></td>';
                     echo '<td><input type="radio" name="orphan[' . $type_id . '][' . $oid . ']" value="move" class="move"/></td>';
                     echo '<td>' . $display_name . '</td>' . "\n";
                     echo '<td>' . $oid . '</td>';
                     echo '<td> <a href="index.php?cur_module=EntityInfo&entity_id_test=' . $oid . '">Details...</a></td></tr>' . "\n";
                     $i++;
                 } else {
                     $amputee_count = $amputee_count + 1;
                 }
             }
             echo '</tbody></table>' . "\n";
             if ($amputee_count > 1) {
                 echo '<p>There are ' . $amputee_count . ' orphaned entities that are amputees. To manage these orphans, first run the <a href="/reason_package/reason_4.0/www/scripts/db_maintenance/amputees.php">Fix Amputees</a> script.</p>';
             } else {
                 if ($amputee_count == 1) {
                     echo '<p>There is 1 orphaned entity that is an amputee. To manage this orphan, first run the <a href="/reason_package/reason_4.0/www/scripts/db_maintenance/amputees.php">Fix Amputees</a> script.</p>';
                 }
             }
             if (!empty($sites)) {
                 echo '<p class="mover">Move ' . $type->get_value('plural_name') . ' to: ';
                 echo '<select name="type_site_' . $type_id . '">';
                 foreach ($sites as $site_id => $site) {
                     echo '<option value="' . $site_id . '">' . $site->get_value('name') . '</option>';
                 }
                 echo '</select></class>' . "\n";
             }
             echo '</div>';
         }
         echo '<p><input type="hidden" name="mode" value="process" />';
         echo '<br /><input type="submit" name="" value="Submit" /> </p>';
         echo '</form>';
     }
 }
예제 #17
0
 /**
  * Get the image this module will be sizing
  *
  * Returns either a Reason image object or false if permissions, types, etc. not correct
  *
  * @return mixed
  */
 function _get_image()
 {
     if (isset($this->_image)) {
         return $this->_image;
     }
     if (!empty($this->admin_page->id)) {
         $image = new entity($this->admin_page->id);
         if ($image->get_values() && $image->get_value('type') == id_of('image')) {
             $this->_image = $image;
         } else {
             $this->_image = false;
         }
     } else {
         $this->_image = false;
     }
     return $this->_image;
 }
예제 #18
0
/**
 * Ensures validity of site_id and page_id requested.
 *
 * Because of the expense of this call we skip it for cached pages.
 */
function get_validated_site($site_id, $page_id)
{
    static $validated;
    if (isset($validated[$site_id][$page_id])) {
        return $validated[$site_id][$page_id];
    }
    if ($site_id != $_REQUEST['site_id']) {
        trigger_error('the site id in $_REQUEST[\'site_id\'] - ' . $_REQUEST['site_id'] . ' - does not match the site id in the .htaccess file - ' . $site_id . ' - possible hack attempt.', FATAL);
        die;
    }
    if ($page_id != $_REQUEST['page_id']) {
        trigger_error('the page id in $_REQUEST[\'page_id\'] - ' . $_REQUEST['page_id'] . ' - does not match the page id in the .htaccess file - ' . $page_id . ' - possible hack attempt.', FATAL);
        die;
    }
    $page = new entity($page_id);
    if (!$page->get_values()) {
        trigger_error('generate_page could not generate page id ' . $page_id . ' - the page entity was empty', FATAL);
        die;
    }
    if ($page->get_value('type') != id_of('minisite_page')) {
        trigger_error('generate_page passed page_id ' . $page_id . ' which is not an entity of type page', FATAL);
        die;
    }
    if ($page->get_value('state') != 'Live' && $page->get_value('state') != 'Pending') {
        trigger_error('generate_page called with page_id ' . $page_id . ' which is not a live or pending page', FATAL);
        die;
    }
    $actual_site_id = get_owner_site_id($page_id);
    if (empty($actual_site_id)) {
        trigger_error('page must have an owner site to be displayed', FATAL);
        die;
    }
    if ($actual_site_id != $site_id) {
        trigger_error('generate page called with site_id ' . $site_id . ', but the actual owner of page_id ' . $page_id . ' is ' . $actual_site_id . '. Rewrites may need to be run.', FATAL);
        die;
    }
    $site = new entity($actual_site_id);
    if (!$site->get_values()) {
        trigger_error('generate_page could not generate a page for site id ' . $actual_site_id . ' - the site entity was empty', FATAL);
        die;
    }
    if ($site->get_value('type') != id_of('site')) {
        trigger_error('generate_page called with a page whose owner with id ' . $actual_site_id . ' is not an entity of type site', FATAL);
        die;
    }
    if ($site->get_value('state') != 'Live') {
        trigger_error('generate_page called with site_id ' . $site_id . ', which has the state "' . $site->get_value('state') . '".', FATAL);
        die;
    }
    $validated[$site_id][$page_id] = $site;
    return $site;
}
예제 #19
0
 function get_archive_name($id)
 {
     $edited_by_id = $this->history[$id]->get_value('last_edited_by');
     if (!empty($edited_by_id)) {
         $user = new entity($edited_by_id);
         if ($user->get_values()) {
             $name = $user->get_value('name');
         } else {
             $name = 'user id ' . $user->id();
         }
     } else {
         $name = '[unknown]';
     }
     if ($id == $this->current->id()) {
         return 'Current Version - ' . $name;
     } else {
         return prettify_mysql_timestamp($this->history[$id]->get_value('last_modified'), 'n/j/y, g:i a') . ' Version - ' . $name;
     }
 }
	public function process( $disco )
	{
		$s = get_microtime();
		$q = 'SELECT * from entity where state = "Live" AND entity.id > ' . (int) $disco->get_value('starting_id') . ' LIMIT ' . (int) $disco->get_value('num_to_process');
		$result = db_query($q);
		$num_rows = mysql_num_rows($result);
		$updated_count = 0;
		if ($num_rows > 0)
		{
			while ($row = mysql_fetch_assoc($result))
			{
				$eid = $row['id'];
				$e = new entity($eid);
				$values = $e->get_values();
				$hash = md5(serialize($values));
				$updated = reason_update_entity($e->id(), $this->user_id(), $values, false);
				if ($updated) $updated_count++;
			}
			$disco->set_value('starting_id', $eid);
		}
		$e = get_microtime();
		
		$complete = ($num_rows < $disco->get_value('num_to_process'));
		
		// Lets show our results
		echo '<div id="results">';
		echo '<h3>Results</h3>';
		echo '<ul>';
		echo '<li><strong>Checked - </strong> <span class="num_checked">' . $num_rows . '</span></li>';
		echo '<li><strong>Updated - </strong> <span class="num_updated">' . $updated_count . '</span></li>';
		echo '<li><strong>Processing Time (ms) - </strong> ' . round( (($e - $s) * 1000) ) . '</li>';
		echo '</ul>';
		if (!$complete)
		{
			echo '<p>The starting ID has been updated to <span class="starting_id">' . $eid . '</span></p>';
			$disco->actions = array('Continue Entity Sanitization');
		}
		else
		{
			$status = '<p><strong>Processing is complete.</strong></p>';
			$disco->add_element('status', 'comment', array('text' => $status));
			$disco->actions = array();
		}
		echo '</div>';
		echo '<hr/>';
	}
예제 #21
0
 /**
  * Set a "current user" if other than the one who is logged in
  * or if running via shell script/cron
  * (e.g. no current user can be identified)
  *
  * @param object $user Reason user entity
  * @return boolean success
  */
 public function set_current_user($user)
 {
     if (is_numeric($user)) {
         $user = new entity($user);
         if (!$user->get_values() || $user->get_value('type') != id_of('user')) {
             trigger_error('Invalid user id passed to set_current_user()');
             return false;
         }
     } elseif (!is_object($user)) {
         trigger_error('Invalid user passed to set_current_user()');
         return false;
     }
     $this->_current_user = $user;
     return true;
 }
예제 #22
0
 /**
  * Get the markup for a given date range, type (optional) and site (optional)
  *
  * @param string $start_date
  * @param string $end_date
  * @param integer $type_id
  * @param integer $site_id
  * @return string markup
  */
 function _get_changes_markup($start_date, $end_date, $type_id = '', $site_id = '', $mod_user = '', $sort = '')
 {
     if ($start_date == $end_date) {
         echo '<p>Items added or edited on ' . prettify_mysql_datetime($start_date) . '</p>' . "\n";
     } else {
         echo '<p>Items added or edited between ' . prettify_mysql_datetime($start_date) . ' and ' . prettify_mysql_datetime($end_date) . '</p>' . "\n";
     }
     $types = $this->_get_types();
     $sites = $this->_get_sites();
     if ($site_id) {
         $site_param = $site_id;
     } else {
         $site_param = array_keys($sites);
     }
     foreach ($types as $type) {
         if ($type_id && $type_id != $type->id()) {
             continue;
         }
         $es = new entity_selector($site_param);
         $es->add_type($type->id());
         $es->add_relation('entity.last_modified >= "' . $start_date . '"');
         $es->add_relation('entity.last_modified <= "' . $end_date . ' 23:59:59"');
         if ($mod_user) {
             $es->add_relation('entity.last_edited_by = "' . addslashes($mod_user) . '"');
         }
         if ($sort && ('ASC' == $sort || 'DESC' == $sort)) {
             $es->set_order('entity.last_modified ' . $sort);
         }
         $es->set_sharing('owns');
         $changes = $es->run_one();
         $deletions = $es->run_one('', 'Deleted');
         if (!empty($changes) || !empty($deletions)) {
             $plural_word = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
             echo '<div class="' . htmlspecialchars($type->get_value('unique_name')) . '_report">' . "\n";
             echo '<h3>' . $plural_word . '</h3>' . "\n";
             if (!empty($changes)) {
                 echo '<h4>Changes: ' . count($changes) . '</h4>' . "\n";
                 echo '<ul class="changes">' . "\n";
                 foreach ($changes as $item) {
                     $change_type = 'change';
                     if ($item->get_value('creation_date') > $start_date && $item->get_value('creation_date') <= $end_date . ' 23:59:59') {
                         $change_type = 'addition';
                     }
                     echo '<li class="' . $change_type . '">';
                     if ($change_type == 'change') {
                         echo '<a href="' . $this->_get_archive_link($item, $start_date, $end_date) . '">' . $item->get_display_name() . '</a>';
                     } else {
                         echo '<a href="' . $this->_get_preview_link($item) . '">' . $item->get_display_name() . '</a> (new)';
                     }
                     if (empty($site_id) && ($owner = $item->get_owner())) {
                         echo '<div class="owner">' . $owner->get_value('name') . '</div>' . "\n";
                     }
                     $lastmod = $item->get_value('last_edited_by');
                     if ($lastmod) {
                         $user = new entity($lastmod);
                         if ($user->get_values()) {
                             echo '<div class="lastmod">Last modified by: ' . $user->get_value('name') . ' on ' . date("F j, Y - g:i a", strtotime($item->get_value('last_modified'))) . '</div>';
                         }
                     }
                     echo '</li>' . "\n";
                 }
                 echo '</ul>' . "\n";
             }
             if (!empty($deletions)) {
                 echo '<h4>Deletions: ' . count($deletions) . '</h4>' . "\n";
                 echo '<ul class="deletions">' . "\n";
                 foreach ($deletions as $item) {
                     echo '<li class="deletion">';
                     echo '<a href="' . $this->_get_preview_link($item) . '">' . $item->get_display_name() . '</a>';
                     if (empty($site_id) && ($owner = $item->get_owner())) {
                         echo '<div class="owner">' . $owner->get_value('name') . '</div>' . "\n";
                     }
                     $lastmod = $item->get_value('last_edited_by');
                     if ($lastmod) {
                         $user = new entity($lastmod);
                         if ($user->get_values()) {
                             echo '<div class="lastmod">Deleted by: ' . $user->get_value('name') . '</div>';
                         }
                     }
                     echo '</li>' . "\n";
                 }
                 echo '</ul>' . "\n";
             }
             echo '</div>' . "\n";
             //die('foo');
         }
     }
 }
예제 #23
0
		/**
		 * Check a given id to see if it is OK to show
		 *
		 * Called upon by _show_item()
		 * Calls on further_checks_on_entity()
		 *
		 * @todo check to see if the order of the checking is appropriate... it seems a little wonky
		 * @param integer $id Reason Entity ID
		 * @return mixed false if not OK, the entity object if OK
		 */
		function check_id( $id )
		{
			// assume that if it's in the list it's OK
			if(!empty($this->items[$id]))
				return $this->items[$id];
			
			$e = new entity ( $id );
			if(in_array($id,$this->ok_ids))
			{
				return $e;
			}
			elseif(in_array($id, $this->not_ok_ids))
			{
				return false;
			}
			elseif( $e->get_values()
				&& $e->get_value('type')
				&& $e->get_value('type') == $this->type
				&& $e->get_value('state') == 'Live'
				&& ( !$this->params['limit_to_current_site'] || $e->owned_or_borrowed_by( $this->parent->site_id ) )
				&& $this->further_checks_on_entity( $e )
			 )
			 {
			 	$this->ok_ids[] = $id;
				return $e;
			}
			elseif(array_key_exists($id,$this->ids))
			{
				$this->ok_ids[] = $id;
				return $e;
			}
			else
			{
				$this->not_ok_ids[] = $id;
				http_response_code(404);
				// 404s, even internal ones, don't need to go into the error log ... commenting this out to reduce error log spam.
				//if(!empty($_SERVER['HTTP_REFERER']))
				//{
				//	$parts = parse_url($_SERVER['HTTP_REFERER']);
				//	if($parts['host'] == HTTP_HOST_NAME) // probably can't do anything about it if the link is offsite...
				//		trigger_error('ID given does not correspond to an appropriate entity. Referer: '.$_SERVER['HTTP_REFERER']);
				//}
				return false;
			}
		}
예제 #24
0
 /**
  * Utility for -i and -e.
  * Parses string and returns array of valid unique names for site types.
  */
 function _set_site_types($string)
 {
     //Parse string:
     $given_types = explode(",", $string);
     $valid_types = array();
     //Check valid site_type.
     foreach ($given_types as $type) {
         //If a valid id, keep and get entity:
         if ($id = id_of($type, true, false)) {
             $entity = new entity($id);
             $entity->get_values();
             //If the entity's type is Site Type
             if ($entity->get_value('type') === id_of('site_type_type')) {
                 $valid_types[] = $type;
             } else {
                 $this->log_notice('Given site type unique name (' . $type . ') is not the "site type" type.');
             }
         } else {
             $this->log_notice('Given site type unique name (' . $type . ') does not exist.');
         }
     }
     //If no valid site types were found, avoid emailing for all sites by giving error.
     if (empty($valid_types)) {
         $this->stop_error('All given site type unique names are invalid. No emails sent.');
     } else {
         return $valid_types;
     }
 }
예제 #25
0
function update_theme_content_manager($test_mode = true)
{
    echo '<h3>Theme Content Manager Update</h3>';
    $theme_type = new entity(id_of('theme_type'));
    if ($theme_type->get_values()) {
        if (!$theme_type->get_value('custom_content_handler')) {
            if ($test_mode) {
                echo '<p>Would have updated the theme type to use the new content manager</p>';
            } else {
                if (reason_update_entity(id_of('theme_type'), $GLOBALS['__cur_user_id_hack__'], array('custom_content_handler' => 'theme.php'))) {
                    echo '<p>Updated the theme type to use the new content manager</p>';
                } else {
                    echo '<p>Some sort of problem has occurred with updating the theme type to use the new content manager</p>';
                }
            }
        } else {
            echo '<p>Theme type appears to be using the file ' . $theme_type->get_value('custom_content_handler') . ' as a content manager. No database changes are needed.</p>';
        }
    } else {
        echo '<p>Theme type not found; unable to update</p>';
    }
}
예제 #26
0
		protected function _get_current_audience()
		{
			if(!isset($this->current_audience))
			{
				if(!empty($this->request[ 'a' ]) && !empty($this->params['audience_aliases']) && isset($this->params['audience_aliases'][ $this->request[ 'a' ] ]) )
				{
					if($id = id_of($this->params['audience_aliases'][ $this->request[ 'a' ] ]))
					{
						$a = new entity($id);
						if($a->get_values() && $a->get_value('type') == id_of('audience_type'))
							$this->current_audience = $a;
					}
				}
				
				if(!isset($this->current_audience) && !empty($this->request[ 'audience_id' ]))
				{
					$a = new entity($this->request[ 'audience_id' ]);
					if($a->get_values() && $a->get_value('type') == id_of('audience_type'))
						$this->current_audience = $a;
				}
			}
			if(!isset($this->current_audience))
				$this->current_audience = false;
			return $this->current_audience;
		}
 *
 */
include_once 'reason_header.php';
reason_include_once('classes/entity_selector.php');
reason_include_once('classes/media_work_helper.php');
reason_include_once('function_libraries/user_functions.php');
reason_include_once('classes/media/factory.php');
$media_file_id = !empty($_REQUEST['media_file_id']) ? (int) $_REQUEST['media_file_id'] : 0;
$media_work_id = !empty($_REQUEST['media_work_id']) ? (int) $_REQUEST['media_work_id'] : 0;
$hash = !empty($_REQUEST['hash']) ? (string) $_REQUEST['hash'] : '';
if (!$media_file_id || !$media_work_id || !$hash) {
    http_response_code(404);
    die;
}
$media_file = new entity($media_file_id);
if (!$media_file->get_values() || $media_file->get_value('type') != id_of('av_file')) {
    http_response_code(404);
    die;
}
# First, grab the media_work associated with the provided media file
$es = new entity_selector();
$es->add_type(id_of('av'));
$es->add_left_relationship($media_file->id(), relationship_id_of('av_to_av_file'));
$es->add_relation('`entity`.`id` = "' . addslashes($media_work_id) . '"');
$es->add_relation('`media_work`.`integration_library` != ""');
$es->set_num(1);
$works = $es->run_one();
if (empty($works)) {
    http_response_code(404);
    die;
}
예제 #28
0
    } else {
        die('Please provide a days argument' . "\n");
    }
    if (!empty($_GET['emails'])) {
        $args['emails'] = $_GET['emails'];
    }
}
if (is_numeric($args['pub'])) {
    $id = (int) $args['pub'];
} elseif (reason_unique_name_exists($args['pub'])) {
    $id = id_of($args['pub']);
} else {
    die('The publication unique name provided (' . $args['pub'] . ') does not exist' . "\n");
}
$pub = new entity($id);
if (!$pub->get_values()) {
    die('The publication provided does not exist' . "\n");
}
if ($pub->get_value('type') != id_of('publication_type')) {
    die('The publication provided is not, in fact, a publication' . "\n");
}
$days = (int) $args['days'];
if (empty($days)) {
    die('Please provide days as an integer (e.g. 1, 2, 3, or 73)' . "\n");
}
$time = strtotime('-' . $days . ' days');
if (empty($time)) {
    die('Something appears to be amiss -- no time value was able to be resolved from the number of days provided' . "\n");
}
$datetime = date('Y-m-d H:i:s', $time);
$es = new entity_selector();
예제 #29
0
 * @subpackage popup_templates
 */
$reason_session = false;
include_once 'reason_header.php';
reason_include_once('function_libraries/images.php');
reason_include_once('function_libraries/image_tools.php');
reason_include_once('function_libraries/file_finders.php');
reason_include_once('classes/entity.php');
$GLOBALS['_reason_image_popup_data'] = array();
$id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : '';
settype($id, 'integer');
$db = connectDB(REASON_DB);
if (!empty($id)) {
    $image = new entity($id);
}
if (empty($id) or !$image->get_values() or $image->get_value('type') != id_of('image') or $image->get_value('state') != 'Live') {
    http_response_code(404);
    $title = 'No image found';
    if (!empty($_SERVER['HTTP_REFERER']) && !empty($id)) {
        if (!$image->get_values()) {
            $xtra = 'id passed to script is not the id of a Reason entity';
        } elseif ($image->get_value('type') != id_of('image')) {
            $xtra = 'id passed to script is not the id of an image';
        } elseif ($image->get_value('state') != 'Live') {
            $xtra = 'image requested is ' . strtolower($image->get_value('state'));
        }
        $xtra .= ' ( Referrer: ' . $_SERVER['HTTP_REFERER'] . ' )';
        trigger_error('Bad image request on image popup script - ' . $xtra);
    }
    $image = null;
}
예제 #30
0
 function show_item_owner_site_info(&$item)
 {
     $owner_site_id = get_owner_site_id($item->id());
     if ($owner_site_id != $this->site_id) {
         $owner_site = new entity($owner_site_id);
         if ($owner_site->get_values()) {
             echo '<div class="owner">From site: <a href="' . $owner_site->get_value('base_url') . '">' . $owner_site->get_value('name') . '</a></div>' . "\n";
         }
     }
 }