示例#1
0
function get_feed_as_text($params)
{
    if (!empty($params['type_id'])) {
        $type = new entity($params['type_id']);
        if (!empty($params['feed'])) {
            $feed_file = $params['feed'];
        } elseif ($type->get_value('custom_feed')) {
            $feed_file = str_replace('.php', '', $type->get_value('custom_feed'));
        } else {
            $feed_file = 'default';
            // otherwise use default feed script
        }
        reason_include_once('feeds/' . $feed_file . '.php');
        $feed_class = $GLOBALS['_feed_class_names'][$feed_file];
        if (!empty($params['site_id'])) {
            $site = new entity($params['site_id']);
            $feed = new $feed_class($type, $site);
        } else {
            $feed = new $feed_class($type);
        }
        $feed->set_request_vars($params);
        ob_start();
        $feed->run(false);
        $feed_text = ob_get_contents();
        ob_end_clean();
        if (!empty($feed_text)) {
            return $feed_text;
        }
    }
}
 function show_feed_link()
 {
     $type = new entity(id_of('event_type'));
     if ($type->get_value('feed_url_string')) {
         echo '<div class="feedInfo"><a href="/' . REASON_GLOBAL_FEEDS_PATH . '/' . $type->get_value('feed_url_string') . '" title="RSS feed for this site\'s events">xml</a></div>';
     }
 }
示例#3
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();
	}
示例#4
0
 function init($args = array())
 {
     parent::init($args);
     $root_id = $this->parent->pages->root_node();
     $this_page_id = $this->cur_page->id();
     // check to see if this is a home page -- don't even query for siblings
     if ($root_id != $this_page_id) {
         $parent_id = $this->parent->pages->parent($this->cur_page->id());
         if (!empty($parent_id)) {
             $sibling_ids = $this->parent->pages->children($parent_id);
             if (!empty($sibling_ids)) {
                 foreach ($sibling_ids as $sibling_id) {
                     if ($sibling_id != $root_id) {
                         $page = new entity($sibling_id);
                         if ($this->params['show_only_pages_in_nav'] && $page->get_value('nav_display') != 'Yes') {
                             continue;
                         }
                         if (isset($this->params['show_external_links']) && !$this->params['show_external_links'] && $page->get_value('url')) {
                             continue;
                         }
                         $this->siblings[$sibling_id] = $page;
                     }
                 }
             }
             $this->parent_page = new entity($parent_id);
         }
     }
 }
示例#5
0
 function init()
 {
     if (!empty($this->admin_page->id)) {
         $temp = new entity($this->admin_page->id, false);
         if ($temp->get_value('new') && $temp->get_value('state') == 'Pending' && !$temp->get_value('name') && reason_user_has_privs($this->admin_page->user_id, 'delete_pending')) {
             reason_expunge_entity($this->admin_page->id, $this->admin_page->user_id);
         }
     }
     if (!empty($this->admin_page->request[CM_VAR_PREFIX . 'type_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);
     } 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'));
     }
     header('Location: ' . unhtmlentities($link));
     die;
 }
示例#6
0
 /**
  * Get the appropriate parameters to pass to the plasmature element
  * @param integer $site_id The Reason id of the site in which this editor is being invoked
  * @param integer $user_id The Reason id of the current user (0 if user is anonymous or not in the Reason user store)
  * @return array plasmature parameters 
  */
 function get_plasmature_element_parameters($site_id, $user_id = 0)
 {
     $params = array();
     // site id
     $params['site_id'] = $site_id;
     // paths
     $params['paths'] = $this->_get_paths($site_id);
     // default widgets
     $site = new entity($site_id);
     if ($site->get_value('loki_default')) {
         $map = $this->_get_options_map();
         if (array_key_exists($site->get_value('loki_default'), $map)) {
             $params['widgets'] = $map[$site->get_value('loki_default')]['maps_to'];
         } else {
             $params['widgets'] = $site->get_value('loki_default');
         }
     } else {
         $params['widgets'] = 'default';
     }
     // user is admin
     if (!empty($user_id) && (user_is_a($user_id, id_of('admin_role')) || user_is_a($user_id, id_of('power_user_role')))) {
         $params['widgets'] .= ' +source +debug';
     } else {
         $params['widgets'] .= ' -source -debug';
     }
     if (defined('REASON_DEFAULT_ALLOWED_TAGS')) {
         $params['allowable_tags'] = explode(',', str_replace(array('><', '<', '>'), array(',', '', ''), REASON_DEFAULT_ALLOWED_TAGS));
     }
     if (defined('REASON_LOKI_CRASH_REPORT_URI') && REASON_LOKI_CRASH_REPORT_URI != '') {
         $params['crash_report_uri'] = REASON_LOKI_CRASH_REPORT_URI;
     }
     return $params;
 }
示例#7
0
 function init($args = array())
 {
     parent::init($args);
     $site = new entity($this->site_id);
     if (!empty($this->params['sites'])) {
         $this->child_sites = array();
         foreach ($this->params['sites'] as $unique_name) {
             if ($id = id_of($unique_name)) {
                 $e = new entity($id);
                 if ($e->get_value('type') == id_of('site') && ($site->get_value('site_state') != 'Live' || $e->get_value('site_state') == 'Live')) {
                     $this->child_sites[$id] = $e;
                 }
             }
         }
     } else {
         $es = new entity_selector();
         $es->description = 'Getting child sites of this site';
         $es->add_type(id_of('site'));
         $es->add_left_relationship($this->site_id, relationship_id_of('parent_site'));
         $es->set_order('entity.name');
         if ($site->get_value('site_state') == 'Live') {
             $es->add_relation('site_state="Live"');
         }
         $this->child_sites = $es->run_one();
     }
 }
示例#8
0
function get_blog_content_from_id($id)
{
    $post = new entity($id);
    if ($post->get_value('content')) {
        return $post->get_value('content');
    } else {
        return get_blog_description_from_id($id);
    }
}
示例#9
0
 function pre_show_all_items()
 {
     if ($this->top_link_site_id == $this->site_id) {
         $this->link = $this->top_link_site_id = '';
     } elseif (!empty($this->top_link_site_id) && empty($this->link)) {
         $site = new entity($this->top_link_site_id);
         $this->link = '<a href="' . $site->get_value('base_url') . '">' . $site->get_value('name') . " Home" . '</a>';
     }
 }
示例#10
0
 function delete_entity()
 {
     if ($this->get_value('id')) {
         $e = new entity($this->get_value('id'));
         if ($e->get_value('state') == 'Live' || $e->get_value('state') == 'Deleted') {
             $q = 'UPDATE URL_history SET deleted="yes" WHERE page_id="' . $this->get_value('id') . '"';
             $r = db_query($q, 'Deleting Page');
         }
     }
     parent::delete_entity();
 }
 /**
  * Populates the form with the data based on the mapping defined
  **/
 function on_every_time()
 {
     if (!empty($this->entity)) {
         foreach ($this->mapping as $element => $array) {
             if ($this->entity->get_value($array['field'])) {
                 $this->set_value($element, $this->entity->get_value($array['field']));
             } elseif ($array['default']) {
                 $this->set_value($element, $array['default']);
             }
         }
     }
 }
 function make_link($id)
 {
     $asset = $this->items[$id];
     $owner_id = $asset->get_value('owner_id');
     $owner_site = new entity($owner_id);
     return 'http://' . REASON_HOST . $owner_site->get_value('base_url') . MINISITE_ASSETS_DIRECTORY_NAME . '/' . $asset->get_value('file_name');
 }
示例#13
0
 function show_entity_data($entity)
 {
     //echo '<h4>Entity data:</h4>';
     $entity_type = new entity($entity->get_value('type'));
     echo '<p><strong>Type</strong>: ' . $entity_type->get_value('name') . '</p>';
     $owner = $entity->get_owner();
     if (is_object($owner)) {
         echo '<p><strong>Owner site</strong>: ' . $owner->get_value('name') . ' (ID: ' . $this->get_id_markup($owner->id()) . ')</p>' . "\n";
     } else {
         echo '<p>No owner site (orphan entity)</p>' . "\n";
     }
     echo '<table class="entityInfoDataTable">' . "\n";
     echo '<tr>' . "\n";
     echo '<th>Attribute</th>' . "\n";
     echo '<th>Value</th>' . "\n";
     echo '</tr>' . "\n";
     $id_markup_keys = array('type', 'last_edited_by', 'created_by');
     foreach ($entity->get_values() as $key => $value) {
         echo '<tr>' . "\n";
         echo '<td>' . $key . '</td>' . "\n";
         if (in_array($key, $id_markup_keys)) {
             echo '<td>' . $this->get_id_markup($value) . '</td>' . "\n";
         } else {
             echo '<td>' . $value . '</td>' . "\n";
         }
         echo '</tr>' . "\n";
     }
     echo '</table>' . "\n";
 }
 /**
  * Run the upgrader
  *
  * @return string HTML report
  */
 public function run()
 {
     $ret = '';
     $e = new entity(id_of('css'));
     if (!$e->get_value('custom_content_handler')) {
         reason_update_entity($e->id(), $this->user_id(), array('custom_content_handler' => 'css.php'));
         $ret .= '<p>The CSS type has been assigned a content manager.</p>' . "\n";
     }
     $tables = get_entity_tables_by_type(id_of('css'), false);
     $has_meta = in_array('meta', $tables);
     $has_url = in_array('url', $tables);
     if ($has_meta || $has_url) {
         set_time_limit(3600);
         if ($has_meta) {
             $ret .= $this->_move_table_fields('meta');
         }
         if ($has_url) {
             $ret .= $this->_move_table_fields('url');
         }
     }
     if (empty($ret)) {
         $ret .= '<p>This upgrade has already been run. There is nothing to do.</p>';
     }
     return $ret;
 }
 function get_pages_needing_change()
 {
     if (!isset($this->pages_needing_change)) {
         $es = new entity_selector();
         $es->add_type(id_of('minisite_page'));
         $es->enable_multivalue_results();
         $es->limit_tables('page_node');
         $es->limit_fields('custom_page');
         $es->add_relation('page_node.custom_page = "blurb"');
         $es->add_left_relationship_field('minisite_page_to_text_blurb', 'entity', 'id', 'blurb_id');
         $result = $es->run_one();
         foreach ($result as $k => $page) {
             $blurbs = is_array($page->get_value('blurb_id')) ? $page->get_value('blurb_id') : array($page->get_value('blurb_id'));
             foreach ($blurbs as $blurb_id) {
                 $blurb = new entity($blurb_id);
                 $content = $blurb->get_value('content');
                 $demoted_content = demote_headings($content, 1);
                 if ($content == $demoted_content) {
                     $pages_needing_page_type_change[$k] = $k;
                 }
             }
         }
         $this->pages_needing_change = isset($pages_needing_page_type_change) ? array_keys($pages_needing_page_type_change) : false;
     }
     return $this->pages_needing_change;
 }
 function init()
 {
     parent::init();
     if (!empty($this->admin_page->request['event_id'])) {
         $event = new entity($this->admin_page->request['event_id']);
         $this->admin_page->title = 'Sorting Registration Slots of "' . $event->get_value('name') . '"';
     }
 }
示例#17
0
 function init()
 {
     parent::init();
     if (!empty($this->admin_page->request['parent_id'])) {
         $x = new entity($this->admin_page->request['parent_id']);
         $this->admin_page->title = 'Sorting Children of "' . $x->get_value('name') . '"';
     }
 }
示例#18
0
function reason_iframe_get_media_work()
{
    static $media_work;
    if (isset($media_work)) {
        return $media_work;
    }
    if (!empty($_REQUEST['media_work_id'])) {
        $id = (int) $_REQUEST['media_work_id'];
        if ($id) {
            $media_work = new entity($id);
            if ($media_work->get_value('type') == id_of('av') && ($media_work->get_value('state') == 'Live' || user_can_edit_site(get_user_id(reason_check_authentication()), get_owner_site_id($id)))) {
                return $media_work;
            }
        }
    }
    $media_work = false;
    return $media_work;
}
示例#19
0
 function init()
 {
     parent::init();
     if (!empty($this->admin_page->request['parent_id'])) {
         $x = new entity($this->admin_page->request['parent_id']);
         $this->admin_page->title = 'Sorting Children of "' . $x->get_value('name') . '"';
     } elseif (!$this->is_new()) {
         $this->admin_page->title = 'Sorting Top Level Policies';
     }
 }
示例#20
0
 /**
  * Set up and run the actual form used to import the images
  */
 function run_form()
 {
     $f = new $this->image_import_form_class_name();
     $user = new entity($this->admin_page->user_id);
     $f->username = $user->get_value('name');
     $f->user_id = $this->admin_page->user_id;
     $f->site_id = $this->admin_page->site_id;
     $f->add_element('cancel_text', 'comment', array('text' => '<a href="' . $this->admin_page->make_link(array('cur_module' => 'Lister', 'id' => '')) . '">Cancel batch import</a>'));
     $f->run();
 }
示例#21
0
 /**
  * Attempts to delete a video from Vimeo. If the video wasn't uploaded through Reason, the 
  * deletion call will simply fail.
  * @param $media_work_deleter
  */
 public function delete_media_work($media_work_deleter)
 {
     if (VIMEO_UPLOADING_ENABLED) {
         $media_work = new entity($media_work_deleter->get_value('id'));
         $vimeo = new phpVimeo(VIMEO_CLIENT_ID, VIMEO_CLIENT_SECRET, VIMEO_ACCESS_TOKEN, VIMEO_ACCESS_TOKEN_SECRET);
         try {
             $vimeo->call('vimeo.videos.delete', array('video_id' => $media_work->get_value('entry_id')));
         } catch (VimeoAPIException $e) {
         }
     }
 }
示例#22
0
 /**
  * Assemble the markup for a particular filter selector
  * @return string
  * @access private
  */
 function _build_filter_set($key)
 {
     $ret = '';
     $other_filter_links = $this->default_links;
     unset($other_filter_links[$key]);
     $combined_other_filter_links = implode('&amp;', $other_filter_links);
     $ret .= '<div class="filters">';
     foreach ($this->filter_types as $filter_name => $filter_type) {
         if (!empty($this->filter_entities[$filter_name])) {
             if ($type_id = id_of($filter_type['type'])) {
                 $type = new entity($type_id);
                 $name = $type->get_value('plural_name');
             } else {
                 $name = prettify_string($filter_name);
             }
             $ret .= '<h4>' . $name . '</h4>' . "\n";
             $ret .= '<ul>';
             if (!empty($this->filters[$key])) {
                 $link = '?';
                 if (!empty($this->search_value)) {
                     $link .= 'search=' . urlencode($this->search_value) . '&amp;';
                 }
                 if (!empty($other_filter_links)) {
                     $link .= $combined_other_filter_links;
                 }
                 $ret .= '<li><a href="' . $link . '">All</a></li>' . "\n";
             }
             foreach ($this->filter_entities[$filter_name] as $entity) {
                 $ret .= '<li>';
                 if (!empty($this->filters[$key]) && $this->filters[$key]['type'] == $filter_name && $this->filters[$key]['id'] == $entity->id()) {
                     $ret .= '<strong>' . $entity->get_value('name') . '</strong>' . "\n";
                 } else {
                     $link = '?';
                     if (!empty($other_filter_links)) {
                         $link .= $combined_other_filter_links . '&amp;';
                     }
                     if (!empty($this->search_value)) {
                         $link .= 'search=' . urlencode($this->search_value) . '&amp;';
                     }
                     $link .= 'filter' . $key . '=' . $filter_name . '-' . $entity->id();
                     if (!empty($this->textonly)) {
                         $link .= '&amp;textonly=1';
                     }
                     $ret .= '<a href="' . $link . '">' . $entity->get_value('name') . '</a>' . "\n";
                 }
                 $ret .= '</li>';
             }
             $ret .= '</ul>';
         }
     }
     $ret .= '</div>' . "\n";
     return $ret;
 }
示例#23
0
 function init()
 {
     $this->admin_page->set_show('leftbar', false);
     if (empty($this->admin_page->id)) {
         $this->_not_undeletable_reason = 'no_id_provided';
         return false;
     }
     if (!reason_user_has_privs($this->admin_page->user_id, 'publish')) {
         $this->_not_undeletable_reason = 'insufficient_privileges';
         return false;
     }
     $item = new entity($this->admin_page->id);
     $user = new entity($this->admin_page->user_id);
     if (!$item->user_can_edit_field('state', $user)) {
         $this->_not_undeletable_reason = 'state_field_locked';
         return false;
     }
     if ($item->get_value('state') != 'Deleted') {
         $this->_not_undeletable_reason = 'not_deleted_yet';
         return false;
     }
     reason_update_entity($this->admin_page->id, $this->admin_page->user_id, array('state' => 'Live'), false);
     if ($this->admin_page->type_id == id_of('minisite_page')) {
         // zap nav cache so it reappears.
         reason_include_once('classes/object_cache.php');
         $cache = new ReasonObjectCache($this->admin_page->site_id . '_navigation_cache');
         $cache->clear();
     }
     $manager_site_id = $this->admin_page->site_id;
     if ($item->get_value('type') == id_of('site')) {
         $manager_site_id = $item->id();
     }
     //Updates the rewrites to prevent infinite redirection loop.
     reason_include_once('classes/url_manager.php');
     $urlm = new url_manager($manager_site_id);
     $urlm->update_rewrites();
     $link = unhtmlentities($this->admin_page->make_link(array('cur_module' => 'Lister', 'id' => '', 'state' => 'deleted')));
     header('Location: ' . $link);
     die;
 }
 function get_feed_url($site_id = '')
 {
     $site_id = $site_id ? $site_id : $this->get_site_id();
     $publication_type = new entity(id_of('publication_type'));
     $feed_url_string = $publication_type->get_value('feed_url_string');
     if ($feed_url_string) {
         $site = new entity($site_id);
         $base_url = $site->get_value('base_url');
         $blog_feed_string = $this->get_value('blog_feed_string');
         $feed_url = $base_url . MINISITE_FEED_DIRECTORY_NAME . '/' . $feed_url_string . '/' . $blog_feed_string;
     }
     return isset($feed_url) ? $feed_url : false;
 }
示例#25
0
 function init()
 {
     $this->head_items->add_stylesheet(REASON_ADMIN_CSS_DIRECTORY . 'sharing.css');
     reason_include_once('classes/sharing_filter.php');
     reason_include_once('content_listers/sharing.php');
     $type = new entity($this->admin_page->type_id);
     // save the type entity in an object scope
     $this->rel_type = $type;
     $this->get_views($type->id());
     if (empty($this->views)) {
         //add generic lister if not already present
         $this->views = array();
     } else {
         reset($this->views);
         $c = current($this->views);
         if ($c) {
             $lister = $c->id();
             $this->admin_page->request['lister'] = $lister;
         } else {
             $lister = '';
         }
     }
     $this->admin_page->title = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
     if ($icon_url = reason_get_type_icon_url($type, false)) {
         $this->admin_page->title = '<img src="' . $icon_url . '" alt="" /> ' . $this->admin_page->title;
     }
     if ($this->admin_page->is_second_level()) {
         $this->admin_page->set_show('leftbar', false);
     }
     $this->viewer = new sharing_viewer();
     $this->viewer->set_page($this->admin_page);
     if (!isset($lister)) {
         $lister = '';
     }
     $this->viewer->init($this->admin_page->site_id, $type->id(), $lister);
     $this->filter = new sharing_filter();
     $this->filter->set_page($this->admin_page);
     $this->filter->grab_fields($this->viewer->filters);
 }
示例#26
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;
     }
 }
 /**
  * Returns the path used for storing the given media file and temporary file name.
  *
  * @param $media_file_or_id entity or integer
  * @param $tmp_file_name string leave this out if getting the original file's path
  * @param $media_work entity
  * @param $extra_dir string
  * @return string
  */
 public static function get_path($media_file_or_id, $tmp_file_name = '', $media_work = null, $extra_dir = '')
 {
     if (!$media_file_or_id || is_object($media_file_or_id)) {
         return self::_get_path_from_entities($media_file_or_id, $tmp_file_name, $media_work, $extra_dir);
     } elseif (!is_object($media_file_or_id)) {
         $media_file = new entity($media_file_or_id);
         if ($media_file->get_value('type') == id_of('av_file')) {
             return self::_get_path_from_entities($media_file, $tmp_file_name, $media_work, $extra_dir);
         } else {
             trigger_error('Non-Media File entity with type ' . $media_file_or_id->get_value('type') . ' given.');
         }
     }
 }
示例#28
0
 function run()
 {
     //pray ($this->admin_page->request);
     $user = new entity($this->admin_page->user_id);
     $netid = $user->get_value('name');
     echo '<br />You are logged in as <strong>' . $netid . '</strong><br /><br />';
     $q = 'SELECT count(*) as c FROM entity WHERE last_edited_by = ' . $this->admin_page->user_id;
     $r = db_query($q, 'Unable to grab number of edited items.');
     $row = mysql_fetch_array($r, MYSQL_ASSOC);
     mysql_free_result($r);
     $c = $row['c'];
     echo 'You have last edited ' . $c . ' item' . ($c != 1 ? 's' : '') . '<br /><br />';
 }
 function remove_minisite_page_rewrite_finish_action()
 {
     $minisite_page_type_entity = new entity(id_of('minisite_page'));
     $finish_action = $minisite_page_type_entity->get_value('finish_actions');
     if ($finish_action != 'update_rewrites.php') {
         echo '<p>The minisite_page finish action is not update_rewrites.php - this script has probably been run</p>';
     } elseif ($this->mode == 'test') {
         echo '<p>Would remove the update_rewrites.php finish action from the minisite_page type</p>';
     } elseif ($this->mode == 'run') {
         $updates = array('finish_actions' => '');
         reason_update_entity(id_of('minisite_page'), $this->reason_user_id, $updates);
         echo '<p>Removed the update_rewrites.php finish action from the minisite_page type</p>';
     }
 }
示例#30
0
    function run()
    {
        $type = new entity($this->admin_page->type_id);
        $entity = new entity($this->admin_page->id);
        $user = new entity($this->admin_page->user_id);
        $text = array('root_node' => 'This is a root ' . $type->get_value('name') . ', so you may not delete it.  If you wish to delete this item, please contact the <a href="' . $this->admin_page->make_link(array("cur_module" => "about_reason")) . '">web team</a>.', 'default' => 'You cannot currently delete this item because following items, which 
										are associated with it, must be associated with a ' . $type->get_value('name') . '. If 
										you wish to delete this item, you must first select a different ' . $type->get_value('name') . ' for each of the following items.<br /><br />', id_of('minisite_page') => 'This page has children.  In order to delete it, you must first either:
										<ul>
										<li>delete its children</li>
										<li>Select a different parent page for its children</li>
										</ul>If you wish to delete this item, please select a different parent for the pages listed below.<br /><br />', 'borrowed' => '<p>This item is currently borrowed by one or more sites.  Deleting it might break their sites.  If you still want to delete it, contact the sites\' maintainers to ask if they can stop borrowing the item.</p>', 'locks' => 'This ' . $type->get_value('name') . ' has had a lock applied to it that keeps it from being deleted. A reason administrator may have applied this lock in order to ensure that a site was not inadventently broken. Please contact a Reason administrator if you have any questions about the rationale for placing this lock on this ' . $type->get_value('name') . '.');
        if (!empty($this->borrowed_by)) {
            echo $text['borrowed'];
            echo '<h4>Sites borrowing this item</h4>' . "\n";
            echo '<ul>' . "\n";
            foreach ($this->borrowed_by as $site) {
                echo '<li><a href="' . $site->get_value('base_url') . '">' . $site->get_value('name') . '</a>' . "\n";
                echo '<div>Primary maintainer: ' . $site->get_value('name_cache') . ', <a href="mailto:' . $site->get_value('email_cache') . '" title="send email">' . $site->get_value('email_cache') . '</a></div></li>' . "\n";
            }
            echo '</ul>' . "\n";
        } elseif ($this->is_root_node()) {
            echo $text['root_node'];
        } elseif (!$entity->user_can_edit_field('state', $user)) {
            echo $text['locks'];
        } else {
            if (!empty($text[$this->admin_page->type_id])) {
                echo $text[$this->admin_page->type_id];
            } else {
                echo $text['default'];
            }
            foreach ($this->values as $v) {
                $link = $this->admin_page->make_link(array('cur_module' => 'Preview', 'id' => $v['e_id'], 'type_id' => $v['relationship_a']));
                echo '<a href="' . $link . '" target="' . $v['e_id'] . '">' . $v['e_name'] . '</a><span class="smallText"> (' . prettify_string($v['name']) . ')</span><br />';
            }
        }
    }