Esempio n. 1
0
 function onSubmit($vals)
 {
     // 1. prepare vals for insertion
     if ($vals['contact_url'] == 'http://') {
         $vals['contact_url'] = '';
     }
     if ($vals['loc_map'] == 'http://') {
         $vals['loc_map'] = '';
     }
     $vals['details'] = nl2br(wordwrap(htmlentities_compat($vals['details']), 70, "\n", true));
     if (!$vals['public'] || empty($vals['public'])) {
         $vals['public'] = 'no';
     }
     if (!$vals['media'] || empty($vals['media'])) {
         $vals['media'] = 'no';
     }
     if (!empty($vals['loc_addr2'])) {
         $vals['loc_address'] .= "\n" . $vals['loc_addr2'];
     }
     $data = array('title' => $vals['title'], 'date' => $vals['date'], 'until_date' => $vals['end_date'], 'time' => $vals['time'], 'until_time' => $vals['end_time'], 'category' => $vals['category'], 'audience' => $vals['audience'], 'details' => $vals['details'], 'contact' => $vals['contact'], 'contact_email' => $vals['contact_email'], 'contact_phone' => $vals['contact_phone'], 'contact_url' => $vals['contact_url'], 'loc_name' => $vals['loc_name'], 'loc_address' => $vals['loc_address'], 'loc_city' => $vals['loc_city'], 'loc_province' => $vals['loc_province'], 'loc_country' => $vals['loc_country'], 'sponsor' => $vals['sponsor'], 'rsvp' => $vals['rsvp'], 'public' => $vals['public'], 'media' => $vals['media'], 'sitellite_status' => 'draft', 'sitellite_access' => 'public');
     if (session_valid()) {
         $data['sitellite_owner'] = session_username();
         $data['sitellite_team'] = session_team();
     }
     // 2. submit event as 'draft'
     loader_import('cms.Versioning.Rex');
     $rex = new Rex('siteevent_event');
     $res = $rex->create($data, 'Event submission.');
     $vals['id'] = $res;
     // 3. email notification
     @mail(appconf('submissions'), 'Event Submission Notice', template_simple('submission_email.spt', $vals));
     // 4. thank you screen
     page_title(intl_get('Thank You!'));
     echo template_simple('submissions.spt');
 }
Esempio n. 2
0
 function getInfo($name, $data)
 {
     $res = $this->_getIndex($name);
     $struct = array('sitellite_status' => 'approved', 'sitellite_access' => 'public', 'sitellite_owner' => session_username(), 'sitellite_team' => session_team(), 'filesize' => 0, 'last_modified' => '0000-00-00 00:00:00');
     if (is_object($res)) {
         if (!empty($res->sitellite_status)) {
             $struct['sitellite_status'] = $res->sitellite_status;
         }
         if (!empty($res->sitellite_access)) {
             $struct['sitellite_access'] = $res->sitellite_access;
         }
         $struct['filesize'] = $res->filesize;
         $struct['last_modified'] = $res->last_modified;
         $struct['sitellite_owner'] = $res->sitellite_owner;
         $struct['sitellite_team'] = $res->sitellite_team;
         $struct['keywords'] = $res->keywords;
         $struct['description'] = $res->description;
         $struct['display_title'] = $res->display_title;
     }
     if (isset($data['sitellite_status'])) {
         $struct['sitellite_status'] = $data['sitellite_status'];
     }
     if (isset($data['sitellite_access'])) {
         $struct['sitellite_access'] = $data['sitellite_access'];
     }
     if (isset($data['sitellite_owner'])) {
         $struct['sitellite_owner'] = $data['sitellite_owner'];
     }
     if (isset($data['sitellite_team'])) {
         $struct['sitellite_team'] = $data['sitellite_team'];
     }
     if (isset($data['keywords'])) {
         $struct['keywords'] = $data['keywords'];
     }
     if (isset($data['description'])) {
         $struct['description'] = $data['description'];
     }
     if (isset($data['display_title'])) {
         $struct['display_title'] = $data['display_title'];
     }
     if (isset($data['body'])) {
         if (is_object($data['body'])) {
             if (strpos($data['name'], '/') === 0) {
                 $name = $this->path . $data['name'];
             } else {
                 $name = $this->path . '/' . $data['name'];
             }
             $struct['filesize'] = $data['body']->size;
         } else {
             $struct['filesize'] = strlen($data['body']);
         }
         $struct['last_modified'] = date('Y-m-d H:i:s');
     }
     return $struct;
 }
Esempio n. 3
0
    function CmsAddSitellite_filesystemForm()
    {
        parent::MailForm();
        global $page, $cgi;
        $this->parseSettings('inc/app/cms/forms/add/sitellite_filesystem/settings.php');
        page_title(intl_get('Adding File'));
        loader_import('ext.phpsniff');
        $sniffer = new phpSniff();
        $this->_browser = $sniffer->property('browser');
        // include formhelp, edit panel init, and cancel handler
        page_add_script(site_prefix() . '/js/formhelp-compressed.js');
        page_add_script(CMS_JS_FORMHELP_INIT);
        page_add_script('
			function cms_cancel (f) {
				onbeforeunload_form_submitted = true;
				if (arguments.length == 0) {
					window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem";
				} else {
					if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
						window.location.href = f.elements["_return"].value;
					} else {
						window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem";
					}
				}
				return false;
			}

			function cms_preview_action (f) {
				cms_copy_values (f);
				return cms_preview (f);
			}
			
			function cms_cancel_action (f) {
				cms_copy_values (f);
				if (confirm (\'Are you sure you want to cancel?\')) {
					return cms_cancel (f);
				}
				return false;
			}
		');
        if (session_pref('form_help') == 'off') {
            page_add_script('
				formhelp_disable = true;
			');
        }
        $this->widgets['sitellite_owner']->setValue(session_username());
        $this->widgets['sitellite_team']->setValue(session_team());
        // add cancel handler
        $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
    }
Esempio n. 4
0
<?php

$types = array('users' => 'user', 'roles' => 'role', 'teams' => 'team', 'resources' => 'resource', 'statuses' => 'status', 'accesslevels' => 'access', 'prefs' => 'pref');
$names = array('users' => 'user', 'roles' => 'role', 'teams' => 'team', 'resources' => 'resource', 'statuses' => 'status', 'accesslevels' => 'access level', 'prefs' => 'preference');
global $cgi;
if (!in_array($cgi->_list, array_keys($types))) {
    header('Location: ' . site_prefix() . '/index/usradm-browse-action');
    exit;
}
if ($cgi->_list == 'roles' && $cgi->_key == session_role()) {
    header('Location: ' . site_prefix() . '/index/usradm-browse-action?list=' . $cgi->_list . '&_msg=' . urlencode('Cannot delete the specified role, because it is the role of the current user.'));
    exit;
}
if ($cgi->_list == 'teams' && $cgi->_key == session_team()) {
    header('Location: ' . site_prefix() . '/index/usradm-browse-action?list=' . $cgi->_list . '&_msg=' . urlencode('Cannot delete the specified team, because it is the team of the current user.'));
    exit;
}
$snm =& session_get_manager();
$snm->{$types[$cgi->_list]}->delete($cgi->_key);
header('Location: ' . site_prefix() . '/index/usradm-browse-action?list=' . $cgi->_list);
exit;
Esempio n. 5
0
    function CmsAddSitellite_sidebarForm()
    {
        parent::MailForm();
        page_title(intl_get('Adding Sidebar'));
        global $page, $cgi;
        loader_import('ext.phpsniff');
        $sniffer = new phpSniff();
        $this->_browser = $sniffer->property('browser');
        $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"';
        // include formhelp
        page_add_script(site_prefix() . '/js/formhelp-compressed.js');
        page_add_script('
			formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\';
			formhelp_append = \'</td></tr></table>\';

			function cms_preview_action (f) {
				cms_copy_values (f);
				return cms_preview (f);
			}
			
			function cms_cancel_action (f) {
				cms_copy_values (f);
				if (confirm (\'Are you sure you want to cancel?\')) {
					return cms_cancel (f);
				}
				return false;
			}
		');
        if (session_pref('form_help') == 'off') {
            page_add_script('
				formhelp_disable = true;
			');
        }
        $w =& $this->addWidget('tab', 'tab1');
        $w->title = intl_get('Edit');
        // edit widgets go here
        $w =& $this->addWidget('text', 'id');
        $w->alt = intl_get('Sidebar ID');
        $w->addRule('not empty', 'You must enter an ID for your sidebar.');
        $w->addRule('not regex "[^a-zA-Z0-9_-]"', 'Your ID contains invalid characters.');
        $w->addRule('unique "sitellite_sidebar/id"', 'A sidebar with this ID already exists.');
        $help = addslashes(intl_get('Must contain only letters, numbers, underscores, and dashes (ie. product_info).'));
        $w->extra = 'onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w->length = 32;
        $w =& $this->addWidget('hidden', 'collection');
        $w =& $this->addWidget('hidden', '_return');
        $w =& $this->addWidget('text', 'title');
        $w->alt = intl_get('Sidebar Title');
        //$w->addRule ('not empty', 'You must enter a title for your sidebar.');
        $w->extra = 'size="40"';
        $w->length = 72;
        $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
        if (appconf('tidy_path')) {
            $w->tidy_path = appconf('tidy_path');
        }
        //$w->addRule ('not empty', 'You must enter content into your sidebar body.');
        $w->length = 65535;
        $w =& $this->addWidget('tab', 'tab2');
        $w->title = intl_get('Properties');
        // property widgets go here
        //$t =& $this->addWidget ('section', 'section1');
        //$t->title = intl_get ('Display Settings');
        $res = db_fetch('select * from sitellite_sidebar_position order by id asc');
        if (!$res) {
            $res = array('left' => intl_get('Left'));
        } elseif (is_object($res)) {
            $res = array($res->id => ucwords($res->id));
        } else {
            $n = array();
            foreach ($res as $row) {
                $n[$row->id] = ucwords($row->id);
            }
            $res = $n;
        }
        $t =& $this->addWidget('cms.Widget.Position', 'position');
        $t->alt = intl_get('Position');
        $t->setValues($res);
        $help = addslashes(intl_get('Choose the position where you want this sidebar to appear.'));
        $t->extra = 'id="position" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('text', 'sorting_weight');
        $t->alt = intl_get('Sorting Order');
        global $cgi;
        if ($cgi->position) {
            $t->setDefault((string) db_shift('select sorting_weight + 1 from sitellite_sidebar where position = ? order by sorting_weight desc limit 1', $cgi->position));
        } else {
            $t->setDefault((string) db_shift('select sorting_weight + 1 from sitellite_sidebar order by sorting_weight desc limit 1'));
        }
        $help = addslashes(intl_get('The larger the number, the further down the list of sidebars in the same position the current sidebar will appear.'));
        $t->extra = 'id="sorting_weight" style="width: 50px" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        loader_box('sitellite/nav/init');
        $t =& $this->addWidget('multiple', 'show_on_pages');
        $t->alt = intl_get('Show in Sections');
        $t->setValues(array_merge(array('all' => intl_get('All')), menu_get_sections()));
        $help = addslashes(intl_get('Choose the web site sections where you want this sidebar to appear. Ctrl-click to select more than one section.'));
        $t->extra = 'id="show_on_pages" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->size = 5;
        $t =& $this->addWidget('boxchooser.Widget.Boxchooser', 'alias');
        $t->alt = intl_get('Alias of (a box name)');
        $help = addslashes(intl_get('This allows you to specify the name of a box that will provide the contents of this sidebar.'));
        $t->extra = 'id="alias" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->length = 255;
        $t->advanced = true;
        $w =& $this->addWidget('tab', 'tab3');
        $w->title = intl_get('State');
        // state widgets go here
        $t =& $this->addWidget('status', 'sitellite_status');
        $t->alt = intl_get('Status');
        $t->setValue('draft');
        $help = addslashes(intl_get('The status determines what stage of its lifecycle that your document is in.  Only Approved items can be viewed on the live site.  Queued items are set to be approved on the specified Publish On date (below) by the scheduler.'));
        $t->extra = 'id="sitellite_status" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('access', 'sitellite_access');
        $t->alt = intl_get('Access Level');
        $t->setValue('public');
        $help = addslashes(intl_get('The access level of a document determines who is allowed to view it.  This allows you to make portions of your site completely private, or only available to specific user roles (ie. members-only).'));
        $t->extra = 'id="sitellite_access" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('calendar', 'sitellite_startdate');
        $t->alt = intl_get('Publish On (If Status is "Queued")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->advanced = true;
        $t =& $this->addWidget('calendar', 'sitellite_expirydate');
        $t->alt = intl_get('Archive On (If Status is "Approved")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->advanced = true;
        $t =& $this->addWidget('owner', 'sitellite_owner');
        $t->alt = intl_get('Created By');
        $t->setValue(session_username());
        $t->advanced = true;
        $t =& $this->addWidget('team', 'sitellite_team');
        $t->alt = intl_get('Owned by Team');
        $t->setValue(session_team());
        $t->extra = 'id="sitellite_team"';
        $t->advanced = true;
        $t =& $this->addWidget('textarea', 'changelog');
        $t->alt = intl_get('Change Summary');
        $t->rows = 3;
        $t->labelPosition = 'left';
        $help = addslashes(intl_get('The change summary helps give other site editors, including yourself, a more complete history of the changes that have been made to this item.'));
        $t->extra = 'id="changelog" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->setValue('Sidebar added.');
        $w =& $this->addWidget('tab', 'tab-end');
        // submit buttons
        $w =& $this->addWidget('msubmit', 'submit_button');
        $b =& $w->getButton();
        $b->setValues(intl_get('Create'));
        $b->extra = 'onclick="onbeforeunload_form_submitted = true"';
        //$b =& $w->addButton ('submit_button', intl_get ('Preview'));
        //$b->extra = 'onclick="return cms_preview (this.form)"';
        $b =& $w->addButton('submit_button', intl_get('Cancel'));
        $b->extra = 'onclick="return cms_cancel (this.form)"';
        $this->error_mode = 'all';
    }
Esempio n. 6
0
    function CmsAddSitellite_pageForm()
    {
        parent::MailForm();
        page_title(intl_get('Adding Page'));
        global $page, $cgi;
        loader_import('ext.phpsniff');
        $sniffer = new phpSniff();
        $this->_browser = $sniffer->property('browser');
        $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"';
        // include formhelp
        page_add_script(site_prefix() . '/js/formhelp-compressed.js');
        page_add_script('
			formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\';
			formhelp_append = \'</td></tr></table>\';

			function cms_preview_action (f) {
				cms_copy_values (f);
				return cms_preview (f);
			}
			
			function cms_cancel_action (f) {
				cms_copy_values (f);
				if (confirm (\'Are you sure you want to cancel?\')) {
					return cms_cancel (f);
				}
				return false;
			}

			function page_id () {
				f = document.forms[0];
				if (f.elements[\'id\'].value.length == 0) {
					sugg_id = f.elements[\'title\'].value.toLowerCase ();
					sugg_id = sugg_id.replace (/[àáâäå]/g, \'a\');
					sugg_id = sugg_id.replace (/[çč]/g, \'c\');
					sugg_id = sugg_id.replace (/[éèêëě]/g, \'e\');
					sugg_id = sugg_id.replace (/[íìîï]/g, \'i\');
					sugg_id = sugg_id.replace (/[ñ]/g, \'n\');
					sugg_id = sugg_id.replace (/[óòôöø]/g, \'o\');
					sugg_id = sugg_id.replace (/[úùûüů]/g, \'u\');
					sugg_id = sugg_id.replace (/[ÿ]/g, \'y\');
					sugg_id = sugg_id.replace (/[š]/g, \'s\');
					sugg_id = sugg_id.replace (/[ř]/g, \'r\');
					sugg_id = sugg_id.replace (/[ž]/g, \'z\');
					sugg_id = sugg_id.replace (/[ý]/g, \'y\');
					sugg_id = sugg_id.replace (/[á]/g, \'a\');
					sugg_id = sugg_id.replace (/[ť]/g, \'t\');
					sugg_id = sugg_id.replace (/[í]/g, \'i\');
					sugg_id = sugg_id.replace (/[ď]/g, \'d\');
					sugg_id = sugg_id.replace (/[ň]/g, \'n\');
					sugg_id = sugg_id.replace (/^[^a-z0-9_-]+/g, \'\');
					sugg_id = sugg_id.replace (/[^a-z0-9_-]+$/g, \'\');
					sugg_id = sugg_id.replace (/[^a-z0-9_-]+/g, \'-\');
					sugg_id = sugg_id.replace (/-+/g, \'-\');
					f.elements[\'id\'].value = sugg_id;
				}
			}

			function page_id_to_lower () {
				f = document.forms[0];
				f.elements[\'id\'].value = f.elements[\'id\'].value.toLowerCase ();
			}
		');
        if (session_pref('form_help') == 'off') {
            page_add_script('
				formhelp_disable = true;
			');
        }
        $w =& $this->addWidget('tab', 'tab1');
        $w->title = intl_get('Edit');
        // edit widgets go here
        $w =& $this->addWidget('hidden', 'collection');
        $w =& $this->addWidget('hidden', '_return');
        $w =& $this->addWidget('text', 'title');
        $w->alt = intl_get('Page Title');
        //$w->addRule ('not empty', 'You must enter a title for your page.');
        $help = addslashes(intl_get('The standard title of the web page, usually used in the content body as a top-level heading.'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide (); page_id ()"';
        $w->length = 128;
        $w =& $this->addWidget('text', 'id');
        $w->alt = intl_get('Page ID');
        $w->addRule('not empty', 'You must enter an ID for your page.');
        $w->addRule('not regex "[^a-zA-Z0-9_-]"', 'Your ID contains invalid characters.');
        $w->addRule('unique "sitellite_page/id"', 'A page with this ID already exists.');
        $w->addRule('func "cms_rule_no_actions"', 'Your page ID cannot end in -action, -app, or -form.');
        $help = addslashes(intl_get('The unique page identifier, used in the URL to request this page (ie. /index/page_id).  Must contain only letters, numbers, dashes, and underscores (ie. product_info).'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide (); page_id_to_lower ()"';
        $w->length = 72;
        $w =& $this->addWidget('text', 'nav_title');
        $w->alt = intl_get('Title in Navigation');
        $help = addslashes(intl_get('This allows you to specify an alternate title to use when linking to this page.'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w->length = 128;
        $w->advanced = true;
        $w =& $this->addWidget('text', 'head_title');
        $w->alt = intl_get('Window Title');
        $help = addslashes(intl_get('This allows you to specify an alternate title to use in the header of the document, which will appear in the top bar of the browser window.'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w->length = 128;
        $w->advanced = true;
        $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
        if (appconf('tidy_path')) {
            $w->tidy_path = appconf('tidy_path');
        }
        $w->addRule('not empty', 'You must enter content into your page body.');
        //$w->length = 65535;
        $w =& $this->addWidget('tab', 'tab2');
        $w->title = intl_get('Properties');
        // property widgets go here
        $t =& $this->addWidget('section', 'section1');
        $t->title = intl_get('Display Settings');
        $t =& $this->addWidget('pagebrowser.Widget.Pagebrowser', 'below_page');
        //$t->table = 'sitellite_page';
        //$t->primary_key = 'id';
        //$t->display_column = 'if(nav_title != "", nav_title, if(title != "", title, id))';
        //$t->ref_column = 'below_page';
        //$t->self_ref = true;
        //$t->addblank = true;
        $t->alt = intl_get('Location in Web Site');
        $help = addslashes(intl_get('Choose the page that this page should appear under in the hierarchy of the web site.'));
        $t->extra = 'id="below_page" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('cms.Widget.Templates', 'template');
        $t->alt = intl_get('Display with Template');
        $help = addslashes(intl_get('Choose which template you want this page to be displayed with.  This changes the look and feel of the page.'));
        $t->extra = 'id="template" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('select', 'include');
        $t->alt = intl_get('Include in Site Navigation?');
        $t->setValues(array('yes' => 'Yes', 'no' => 'No'));
        $t->setValue('yes');
        $help = addslashes(intl_get('This determines whether or not you want the page to appear in the web site menus and site maps.'));
        $t->extra = 'id="include" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('select', 'include_in_search');
        $t->alt = intl_get('Include in Search?');
        $t->setValues(array('yes' => 'Yes', 'no' => 'No'));
        $t->setValue('yes');
        $help = addslashes(intl_get('This determines whether or not you want the page to be indexed to appear in search results.'));
        $t->extra = 'id="include_in_search" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('text', 'sort_weight');
        $t->alt = intl_get('Sorting Weight');
        $help = addslashes(intl_get('This determines the position of the page within the web site menus and site maps.  Pages with a higher value appear closer to the top.  Pages with the same value are sorted alphabetically.'));
        $t->extra = 'id="sort_weight" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('select', 'is_section');
        $t->alt = intl_get('Is This a Section Index?');
        $t->setValues(array('yes' => 'Yes', 'no' => 'No'));
        $t->setValue('no');
        $help = addslashes(intl_get('If you make this page a section index, then pages below it will adopt its template settings if theirs is not specified explicitly.  This allows you to give a consistent look and feel to entire sections of your web site.'));
        $t->extra = 'id="is_section" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('xed.Widget.Linker', 'external');
        $t->alt = intl_get('Forward to (URL)');
        $help = addslashes(intl_get('If you provide a link to an external web page or file (ie. a PDF or Word document), then this page can act as an alias for that resource within your web site navigation.'));
        $t->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->length = 128;
        $t->advanced = true;
        $t->files = false;
        $t->anchors = false;
        $t->email = false;
        $t =& $this->addWidget('section', 'section3');
        $t->title = intl_get('Page Attributes');
        $t =& $this->addWidget('cms.Widget.Keywords', 'keywords');
        $t->alt = intl_get('Keywords');
        $help = addslashes(intl_get('Type in or select the keywords from the global list that describe the current page.  Keywords help target your page to its intended audience in search engines and site searches.'));
        $t->extra = 'id="keywords" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('textarea', 'description');
        $t->alt = intl_get('Description');
        $t->rows = 3;
        $t->labelPosition = 'left';
        $help = addslashes(intl_get('A description helps target your page to its intended audience in search engines and site searches performed by visitors.'));
        $t->extra = 'id="description" style="overflow: hidden" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w =& $this->addWidget('tab', 'tab3');
        $w->title = intl_get('State');
        // state widgets go here
        $t =& $this->addWidget('status', 'sitellite_status');
        $t->collection = 'sitellite_page';
        $t->alt = intl_get('Status');
        $t->setValue('draft');
        $help = addslashes(intl_get('The status determines what stage of its lifecycle that your document is in.  Only Approved pages can be viewed on the live site.  Queued pages are set to be approved on the specified Publish On date (below) by the scheduler.'));
        $t->extra = 'id="sitellite_status" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('access', 'sitellite_access');
        $t->alt = intl_get('Access Level');
        $t->setValue('public');
        $help = addslashes(intl_get('The access level of a document determines who is allowed to view it.  This allows you to make portions of your site completely private, or only available to specific user roles (ie. members-only).'));
        $t->extra = 'id="sitellite_access" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('calendar', 'sitellite_startdate');
        $t->alt = intl_get('Publish On (If Status is "Queued")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->advanced = true;
        $t =& $this->addWidget('calendar', 'sitellite_expirydate');
        $t->alt = intl_get('Archive On (If Status is "Approved")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->advanced = true;
        $t =& $this->addWidget('owner', 'sitellite_owner');
        $t->alt = intl_get('Created By');
        $t->setValue(session_username());
        $t->advanced = true;
        $t =& $this->addWidget('team', 'sitellite_team');
        $t->alt = intl_get('Owned by Team');
        $t->setValue(session_team());
        $t->extra = 'id="sitellite_team"';
        $t->advanced = true;
        $t =& $this->addWidget('textarea', 'changelog');
        $t->alt = intl_get('Change Summary');
        $t->rows = 3;
        $t->labelPosition = 'left';
        $help = addslashes(intl_get('The change summary helps give other site editors, including yourself, a more complete history of the changes that have been made to this page.'));
        $t->extra = 'id="changelog" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->setValue('Page added.');
        $w =& $this->addWidget('tab', 'tab-end');
        // submit buttons
        $w =& $this->addWidget('msubmit', 'submit_button');
        $b =& $w->getButton();
        $b->setValues(intl_get('Create'));
        $b->extra = 'onclick="onbeforeunload_form_submitted = true"';
        $b =& $w->addButton('submit_button', intl_get('Preview'));
        $b->extra = 'onclick="return cms_preview (this.form)"';
        $b =& $w->addButton('submit_button', intl_get('Cancel'));
        $b->extra = 'onclick="return cms_cancel (this.form)"';
        $this->error_mode = 'all';
        if (!empty($cgi->_dupe)) {
            loader_import('cms.Versioning.Rex');
            $rex = new Rex($cgi->collection);
            // default: database, database
            $_document = $rex->getCurrent($cgi->_dupe);
            unset($cgi->_dupe);
            foreach ((array) $_document as $k => $v) {
                if (in_array($k, array('id', 'below_page', 'is_section', 'sitellite_status', 'sitellite_access', 'sitellite_startdate', 'sitellite_expirydate', 'sitellite_owner', 'sitellite_team', 'sort_weight'))) {
                    continue;
                }
                if (isset($this->widgets[$k])) {
                    $this->widgets[$k]->setValue($v);
                }
            }
        }
    }
Esempio n. 7
0
 /**
  * Returns the display HTML for this widget.  The optional
  * parameter determines whether or not to automatically display the widget
  * nicely, or whether to simply return the widget (for use in a template).
  * 
  * @access	public
  * @param	boolean	$generate_html
  * @return	string
  * 
  */
 function display($generate_html = 0)
 {
     global $intl, $simple;
     if (!isset($this->data_value)) {
         $this->data_value = $this->default_value;
     }
     $attrstr = $this->getAttrs();
     if (empty($this->data_value)) {
         $this->data_value = session_team();
     }
     if (empty($this->owner)) {
         $this->owner = $this->getOwner($this->owner);
     }
     if (session_role() == 'master') {
         // allow all
         $this->value = assocify(session_get_teams());
     } elseif (session_username() == $this->owner) {
         // allow specific ones
         $this->value = assocify(session_allowed_teams_list(true));
     } else {
         // show info instead
         loader_import('saf.MailForm.Widget.Info');
         $info = new MF_Widget_info($this->name);
         $info->extra = $this->extra;
         $info->setValue($this->data_value);
         return $info->display($generate_html);
     }
     asort($this->value);
     $adv = $this->advanced ? ' class="advanced"' : '';
     if ($generate_html) {
         $data = "\t" . '<tr' . $adv . '>' . "\n\t\t" . '<td class="label"><label for="' . $this->name . '" id="' . $this->name . '-label"' . $this->invalid() . '>' . $simple->fill($this->label_template, $this, '', true) . '</label></td>' . "\n\t\t" . '<td class="field"><select ' . $attrstr . ' ' . $this->extra . ' >' . "\n";
         foreach ($this->value as $value => $display) {
             $display = str_replace('_', ' ', ucwords($display));
             if ($value == $this->data_value) {
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             $data .= "\t" . '<option value="' . $value . '"' . $selected . '>' . $display . '</option>' . "\n";
         }
         return $data . '</select></td>' . "\n\t" . '</tr>' . "\n";
     } else {
         $data = '<select ' . $attrstr . ' ' . $this->extra . ' >' . "\n";
         foreach ($this->value as $value => $display) {
             $display = str_replace('_', ' ', ucwords($display));
             if ($value == $this->data_value) {
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             $data .= "\t" . '<option value="' . htmlentities_compat($value, ENT_COMPAT, $intl->charset) . '"' . $selected . '>' . $display . '</option>' . "\n";
         }
         return $data . '</select>';
     }
 }
Esempio n. 8
0
 /**
  * PUT method handler
  *
  * @param  array  parameter passing array
  * @return bool   true on success
  */
 function PUT(&$options)
 {
     // options[path] is mixed-case
     $options['path'] = $this->_path();
     $this->_debug(__LINE__, 0, 'PUT: ' . $options['path']);
     // orig is mixed-case
     $orig = basename($options['path']);
     // fspath is mixed-case
     $fspath = $this->base . $options["path"];
     // checkLock() will adjust to lowercase
     if ($this->checkLock($options['path'], true)) {
         $this->_debug(__LINE__, 409, 'Locked: ' . $options['path']);
         return '409 Conflict';
     }
     // make sure the dir exists
     // we convert to lowercase here
     if (!@is_dir(dirname(strtolower($fspath)))) {
         $this->_debug(__LINE__, 409, 'Not a dir: ' . $fspath);
         return "409 Conflict";
     }
     // check if the file exists
     // we convert to lowercase here
     $options["new"] = !file_exists(strtolower($fspath));
     // ranges not supported
     if (!empty($options['ranges'])) {
         $this->_debug(__LINE__, 501, 'Ranges not implemented');
         return '501 Not implemented';
     }
     // store dot-files directly (used by mac os x for example)
     if (strpos($options['path'], '/.') !== false && strpos($options['path'], '.htaccess') === false) {
         $this->_debug(__LINE__, 0, 'Storing dot-file: ' . $options['path']);
         //return '403 Forbidden';
         $body = '';
         while (!feof($options['stream'])) {
             $body .= fread($options['stream'], 4096);
         }
         fclose($options['stream']);
         // conver to lowercase for storing
         if (file_exists(strtolower($fspath))) {
             file_put_contents(strtolower($fspath), $body);
             return '200 OK';
         }
         // convert to lowercase for storing
         file_put_contents(strtolower($fspath), $body);
         umask(00);
         chmod(strtolower($fspath), 0777);
         return '201 Created';
     }
     if ($options['new']) {
         if (session_is_resource('add') && !session_allowed('add', 'rw', 'resource')) {
             $this->_debug(__LINE__, 403, 'Permissions failed: add');
             return '403 Forbidden';
         }
         $body = '';
         while (!feof($options['stream'])) {
             $body .= fread($options['stream'], 4096);
         }
         fclose($options['stream']);
         // convert to lowercase for storing
         $vals = array('name' => ltrim(strtolower($options['path']), '/'), 'display_title' => $orig, 'keywords' => '', 'description' => '', 'body' => $body, 'sitellite_status' => 'draft', 'sitellite_access' => 'private', 'sitellite_owner' => session_username(), 'sitellite_team' => session_team());
         $res = $this->rex->create($vals, 'Uploaded via WebDAV.');
         if (!$res) {
             $this->_debug(__LINE__, 500, 'Create failed: ' . $vals['name']);
             return '500 Internal server error';
         }
         return '201 Created';
     } else {
         $vals = (array) $this->rex->getCurrent(ltrim(strtolower($options['path']), '/'));
         if (!session_allowed($vals, 'rw')) {
             $this->_debug(__LINE__, 403, 'Permissions failed: ' . $vals['name']);
             return '403 Forbidden';
         }
         $vals['body'] = '';
         while (!feof($options['stream'])) {
             $vals['body'] .= fread($options['stream'], 4096);
         }
         fclose($options['stream']);
         unset($vals['name']);
         unset($vals['path']);
         unset($vals['extension']);
         unset($vals['filesize']);
         unset($vals['last_modified']);
         unset($vals['date_created']);
         $method = $this->rex->determineAction(ltrim(strtolower($options['path']), '/'), $vals['sitellite_status']);
         if (!$method) {
             $this->_debug(__LINE__, 500, 'No method: ' . $options['path']);
             return '500 Internal server error';
         }
         $res = $this->rex->{$method}(ltrim(strtolower($options['path']), '/'), $vals, 'Updated via WebDAV.');
         if (!$res) {
             $this->_debug(__LINE__, 500, 'Rex error: ' . $this->rex->error . ' (' . $options['path'] . ')');
             return '500 Internal server error';
         }
         return '200 OK';
     }
     //$fp = fopen ($fspath, "w");
     //return $fp;
 }
Esempio n. 9
0
         // overwrite
         $info2 = clone $info;
         unset($info2->body);
         unset($info2->name);
         if (!session_allowed($info2, 'rw')) {
             webfiles_error(403, 'Forbidden');
         }
         $method = $rex->determineAction(ltrim($path, '/'), $info->sitellite_status);
         $res = $rex->{$method}(ltrim($path, '/'), array('body' => $body));
         if (!$res) {
             webfiles_error(500, $rex->error);
         }
         $info = $rex->getCurrent(ltrim($path, '/'));
         webfiles_response((object) array('type' => mime($path), 'name' => $path, 'size' => $info->filesize, 'created' => $info->date_created, 'modified' => $info->last_modified, 'keywords' => $info->keywords, 'description' => $info->description, 'access' => $info->sitellite_access, 'status' => $info->sitellite_status, 'team' => $info->sitellite_team, 'owner' => $info->sitellite_owner, 'lock' => webfiles_lock($path)));
     }
     $res = $rex->create(array('name' => ltrim($path, '/'), 'display_title' => basename($path), 'keywords' => '', 'description' => '', 'sitellite_status' => 'draft', 'sitellite_access' => 'private', 'sitellite_owner' => session_username(), 'sitellite_team' => session_team(), 'body' => $body));
     if (!$res) {
         webfiles_error(500, $rex->error);
     }
     $info = $rex->getCurrent(ltrim($path, '/'));
     webfiles_workflow('add', ltrim($path, '/'), $info, 'Uploaded via the Sitellite Desktop');
     webfiles_response((object) array('type' => mime($path), 'name' => $path, 'size' => $info->filesize, 'created' => $info->date_created, 'modified' => $info->last_modified, 'keywords' => $info->keywords, 'description' => $info->description, 'access' => $info->sitellite_access, 'status' => $info->sitellite_status, 'team' => $info->sitellite_team, 'owner' => $info->sitellite_owner, 'lock' => webfiles_lock($path)));
     break;
 case 'search':
     $path = webfiles_request();
     // assign query to cgi object and rex will see it
     // automatically, that's how awesome rex is
     // (actually, keywords is the predefined text
     // search facet which searches the name, display_title,
     // keywords and description, but not the body)
     // future: use sitesearch for body searching?