Пример #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');
 }
Пример #2
0
function sitesearch_filter_uptime($duration)
{
    $days = floor($duration / 86400);
    $hours = floor(($duration - $days * 86400) / 3600);
    $mins = ceil(($duration - $days * 86400 - $hours * 3600) / 60);
    return $days . ' ' . intl_get('days') . ', ' . $hours . ' ' . intl_get('hours') . ', ' . $mins . ' ' . intl_get('minutes');
}
Пример #3
0
function sitepoll_virtual_enable_comments(&$obj)
{
    if ($obj->enable_comments == 'no') {
        return intl_get('Disabled');
    }
    return db_shift('select count(*) from sitepoll_comment where poll = ?', $obj->id);
}
Пример #4
0
    function SitepresenterEditSlideForm()
    {
        parent::MailForm();
        $this->parseSettings('inc/app/sitepresenter/forms/edit/slide/settings.php');
        page_add_script('
			function cms_cancel (f) {
				if (arguments.length == 0) {
					window.location.href = "/index/cms-app";
				} else {
					if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
						window.location.href = f.elements["_return"].value;
					} else {
						window.location.href = "/index/sitepresenter-app";
					}
				}
				return false;
			}
		');
        $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
        global $cgi;
        page_title(intl_get('Adding Slide to Presentation') . ': ' . db_shift('select title from sitepresenter_presentation where id = ?', $cgi->presentation));
        $res = db_single('select * from sitepresenter_slide where id = ?', $cgi->id);
        foreach (get_object_vars($res) as $k => $v) {
            $this->widgets[$k]->setValue($v);
        }
    }
Пример #5
0
 function AppdocTranslationAddForm()
 {
     parent::MailForm();
     $this->parseSettings('inc/app/appdoc/forms/translation/add/settings.php');
     page_title(intl_get('Add Language'));
     global $cgi;
     if ($cgi->appname == 'GLOBAL') {
         $this->_file = 'inc/lang/languages.php';
     } else {
         $this->_file = 'inc/app/' . $cgi->appname . '/lang/languages.php';
     }
     $list = array('no' => 'None');
     $info = ini_parse($this->_file);
     foreach ($info as $k => $v) {
         $list[$k] = $v['name'];
     }
     $this->widgets['fallback']->setValues($list);
     $this->widgets['default']->setValues(array('yes' => 'Yes', 'no' => 'No'));
     if (count($list) == 1) {
         $this->widgets['default']->setDefault('yes');
     } else {
         $this->widgets['default']->setDefault('no');
     }
     $this->widgets['submit_button']->buttons[1]->extra = 'onclick="window.history.go (-1); return false"';
 }
Пример #6
0
 function BoxchooserSettingsForm()
 {
     parent::MailForm();
     page_title(intl_get('Box Settings'));
     //set(array('title'=>'Add a Box'));
     global $cgi;
     //set
     if (!$cgi->box) {
         echo 'Missing parameter: box';
         exit;
     }
     ini_add_filter('ini_filter_split_comma_single', array('rule 0', 'rule 1', 'rule 2', 'rule 3', 'rule 4', 'rule 5', 'rule 6', 'rule 7', 'rule 8', 'button 0', 'button 1', 'button 2', 'button 3', 'button 4', 'button 5', 'button 6', 'button 7', 'button 8'));
     $this->_box_settings = ini_parse('inc/app/' . $cgi->app . '/boxes/' . $cgi->box . '/settings.php');
     ini_clear();
     unset($this->_box_settings['Meta']);
     if (count($this->_box_settings) === 0) {
         $this->onSubmit((array) $cgi);
         return;
     }
     foreach ($this->_box_settings as $k => $v) {
         $this->createWidget($k, $v);
     }
     $this->addWidget('hidden', 'app');
     $this->addWidget('hidden', 'box');
     $this->addWidget('hidden', 'name');
     $w =& $this->addWidget('submit', 'sub');
     $w->setValues(intl_get('Done'));
 }
Пример #7
0
function filter_translation_default($v)
{
    if ($v) {
        return intl_get('Yes');
    }
    return intl_get('No');
}
Пример #8
0
 function SitetemplateEditsetForm()
 {
     parent::MailForm();
     global $cgi;
     $set = $cgi->set;
     $this->parseSettings('inc/app/sitetemplate/forms/editset/settings.php');
     $settings = array();
     if (file_exists('inc/html/' . $set . '/config.ini.php')) {
         $settings = ini_parse('inc/html/' . $set . '/config.ini.php', false);
     }
     $name = $settings['set_name'];
     if (!$name) {
         $name = $set;
     }
     $settings['set'] = $set;
     //put form values into respective forms
     foreach ($settings as $k => $v) {
         $this->widgets[$k]->setDefault($v);
     }
     if (@file_exists('inc/html/' . $set . '/modes.php')) {
         $this->widgets['modes']->setDefault(@join('', @file('inc/html/' . $set . '/modes.php')));
     } else {
         $this->widgets['modes']->setDefault($modesd);
     }
     $this->widgets['submit_button']->buttons[1]->extra = 'onclick="history.go (-1); return false"';
     page_title(intl_get('Editing Properties') . ': ' . $name);
 }
Пример #9
0
 function onSubmit($vals)
 {
     $vals['name'] = strtolower($vals['name']);
     //make sure that file doesnt exit
     if (file_exists('inc/html/' . $vals['set_name'] . '/' . $vals['name'] . '.css')) {
         echo '<p>' . intl_get('A file with that name already exists. Choose a different file name.') . '</p>';
         echo '<p>' . intl_get('Go <a href=javascript:history.back()>back</a> to choose a different file name.') . '</p>';
     }
     if (preg_match('/\\.css$/i', $vals['name'])) {
         $ext = '';
     } else {
         $ext = '.css';
     }
     if (!file_overwrite('inc/html/' . $vals['set_name'] . '/' . $vals['name'] . $ext, $vals['body'])) {
         page_title(intl_get('An Error Occurred'));
         echo '<p>' . intl_get('The file was unable to be saved.  Please verify your server settings before trying again.') . '</p>';
         return;
     }
     umask(00);
     chmod('inc/html/' . $vals['set_name'] . '/' . $vals['name'] . $ext, 0777);
     list($set, $tpl) = explode('/', $vals['path']);
     echo $set . ' ' . $tpl;
     page_title('File Saved');
     echo '<p><a href="' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $vals['set_name'] . '">' . intl_get('Return to template set') . '</a></p>';
 }
Пример #10
0
 function EditForm()
 {
     parent::MailForm();
     global $cgi, $_helpdoc;
     $this->addWidget('hidden', 'appname');
     $this->addWidget('hidden', 'lang');
     $this->addWidget('hidden', 'helpfile');
     $w =& $this->addWidget('text', 'filename');
     $w->alt = intl_get('File Name (ie. 001-about-myApp)');
     $w->addRule('not empty', intl_get('You must specify a file name.'));
     $w->addRule('not contains ".."', intl_get('Your file name contains invalid characters.'));
     $w->setValue($cgi->helpfile);
     $w =& $this->addWidget('text', 'title');
     $w->alt = intl_get('Title');
     $w->addRule('not empty', intl_get('You must specify a title.'));
     $w->setValue($_helpdoc->title);
     session_set('imagechooser_path', 'inc/app/' . $cgi->appname . '/pix');
     $this->extra = 'onsubmit="xed_copy_value (this, \'body\')"';
     $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
     $w->setValue($_helpdoc->body);
     $w =& $this->addWidget('msubmit', 'submit_button');
     $b =& $w->getButton();
     $b->setValues(intl_get('Save'));
     $b =& $w->addButton('submit_button');
     $b->setValues(intl_get('Cancel'));
     $b->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $cgi->appname . '&lang=' . $cgi->lang . '\'; return false"';
 }
Пример #11
0
 function onSubmit($vals)
 {
     global $cgi;
     if ($vals['submit_buttons'] == 'Cancel') {
         header('Location: ' . $vals['refer']);
         exit;
     }
     loader_import('cms.Versioning.Rex');
     $rex = new Rex('siteblog_post');
     $id = $cgi->_key;
     $subject = $vals['subject'];
     $author = $vals['author'];
     $status = $vals['status'];
     $category = $vals['category'];
     $created = $vals['created'];
     $body = $vals['body'];
     $data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'created' => $created, 'body' => $body);
     if (!empty($id)) {
         if (!$data['created']) {
             unset($data['created']);
         }
         $method = $rex->determineAction($id);
         $rex->{$method}($id, $data);
     } else {
         if (!$data['created']) {
             $data['created'] = date('Y-m-d H:i:s');
         }
         $id = $rex->create($data);
     }
     session_set('sitellite_alert', intl_get('Your item has been saved.'));
     // view post
     if (!empty($vals['_return'])) {
         header('Location: ' . $vals['_return']);
     } else {
         header('Location: ' . site_prefix() . '/index/siteblog-post-action/id.' . $id . '/title.' . siteblog_filter_link_title($subject));
     }
     // ping blog directories via pingomatic.com
     $host = 'rpc.pingomatic.com';
     $path = '';
     $out = template_simple('ping.spt', $obj);
     $len = strlen($out);
     $req = 'POST /' . $path . " HTTP/1.0\r\n";
     $req .= 'User-Agent: Sitellite ' . SITELLITE_VERSION . "/SiteBlog\r\n";
     $req .= 'Host: ' . $host . "\r\n";
     $req .= "Content-Type: text/xml\r\n";
     $req .= 'Content-Length: ' . $len . "\r\n\r\n";
     $req .= $out . "\r\n";
     if ($ph = @fsockopen($host, 80)) {
         @fputs($ph, $req);
         //echo '<pre>';
         //echo htmlentities ($req);
         while (!@feof($ph)) {
             $res = @fgets($ph, 128);
             //echo htmlentities ($res);
         }
         @fclose($ph);
     }
     exit;
 }
Пример #12
0
 function ExampleContactForm()
 {
     parent::MailForm();
     // load settings file
     $this->parseSettings('inc/app/example/forms/contact/settings.php');
     // set the page title
     page_title(intl_get('Contact Us'));
 }
Пример #13
0
function usradm_msg($msg)
{
    $messages = array('restored' => intl_get('The item has been restored.'), 'deleted' => intl_get('The items have been deleted.'), 'sent' => intl_get('Your message has been sent.'));
    if (isset($messages[$msg])) {
        return $messages[$msg];
    } else {
        return intl_get($msg);
    }
}
Пример #14
0
 function onSubmit($vals)
 {
     if (!@mail($this->member->email, $vals['subject'], $vals['message'], 'From: ' . $vals['email'])) {
         page_title('Unknown Error');
         echo '<p>' . intl_get('An error occurred trying to send the message.  Please try again later.') . '</p>';
         return;
     }
     page_title(intl_get('Message Sent'));
     echo '<p>' . intl_get('Your message has been sent.') . '</p>';
 }
Пример #15
0
 function onSubmit($vals)
 {
     loader_import('news.Comment');
     $c = new NewsComment();
     $vals['ts'] = date('Y-m-d H:i:s');
     unset($vals['submit_button']);
     $c->modify($vals['id'], $vals);
     page_title(intl_get('Comment Updated'));
     echo template_simple('comment_updated.spt', $vals);
 }
Пример #16
0
function siteevent_virtual_recurring($vals)
{
    if ($vals->until_date > $vals->date) {
        if ($vals->recurring == 'no') {
            return intl_get('Daily');
        }
        return ucfirst($vals->recurring);
    }
    return intl_get('No');
}
Пример #17
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['collection'];
     unset($vals['collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $rex = new Rex($collection);
     //$vals['sitellite_owner'] = session_username ();
     //$vals['sitellite_team'] = session_team ();
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     unset($vals['header_properties']);
     unset($vals['header_contact']);
     unset($vals['header_loc']);
     if ($vals['contact_url'] == 'http://') {
         $vals['contact_url'] = '';
     }
     if ($vals['loc_map'] == 'http://') {
         $vals['loc_map'] = '';
     }
     $res = $rex->create($vals, $changelog);
     if (isset($vals[$rex->key])) {
         $key = $vals[$rex->key];
     } elseif (!is_bool($res)) {
         $key = $res;
     } else {
         $key = 'Unknown';
     }
     if (!$res) {
         if (!$return) {
             $return = site_prefix() . '/index/cms-browse-action?collection=siteevent_event';
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         loader_import('cms.Workflow');
         echo Workflow::trigger('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => intl_get('Item added.'), 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been created.'));
         if ($return) {
             header('Location: ' . $return);
             exit;
         }
     }
     header('Location: ' . site_prefix() . '/index/siteevent-app/id.' . $res);
     exit;
 }
Пример #18
0
 function onSubmit($vals)
 {
     if (!file_overwrite('inc/html/' . $vals['path'], $vals['body'])) {
         page_title(intl_get('An Error Occurred'));
         echo '<p>' . intl_get('The file was unable to be saved.  Please verify your server settings before trying again.') . '</p>';
         return;
     }
     list($set, $tpl) = explode('/', $vals['path']);
     page_title('Template Saved');
     echo '<p><a href="' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $set . '">' . intl_get('Return to template set') . '</a></p>';
 }
Пример #19
0
 function SitelliteExportForm()
 {
     parent::MailForm(__FILE__);
     $user = session_get_user();
     $groups = array('' => '- All -');
     foreach (db_pairs('select id, name from sitellite_form_type order by name asc') as $k => $v) {
         $groups[$k] = $v;
     }
     $this->widgets['group']->setValues($groups);
     page_title(intl_get('Export Contacts'));
 }
Пример #20
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)
 {
     parent::display($generate_html);
     global $intl, $simple;
     $attrstr = $this->getAttrs();
     $len = $this->length > 0 ? 'maxlength="' . $this->length . '" ' : '';
     if ($generate_html) {
         return "\t" . '<tr>' . "\n\t\t" . '<td class="label" valign="top"><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"><textarea rows="' . $this->rows . '" cols="' . $this->cols . '" ' . $attrstr . ' ' . $len . $this->extra . '>' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '</textarea><br />' . '<a href="#" onclick="this.blur (); window.open (\'' . site_prefix() . '/index/cms-keywords-action?el=' . $this->name . '&sel=\' + document.forms[0].elements.' . $this->name . '.value, \'KeywordsWindow\', \'top=100,left=100,width=350,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,fullscreen=no\'); return false">' . intl_get('Global Keyword List') . '</a>' . '</td>' . "\n\t" . '</tr>' . "\n";
     } else {
         return '<input type="text" ' . $attrstr . ' value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" ' . $this->extra . ' />';
     }
 }
Пример #21
0
 function XedImporterForm()
 {
     parent::MailForm();
     $this->extra = 'enctype="multipart/form-data"';
     $this->uploadFiles = false;
     $w =& $this->addWidget('hidden', 'ifname');
     $w =& $this->addWidget('file', 'doc');
     $w->alt = intl_get('Word Document');
     $w =& $this->addWidget('submit', 'submit_button');
     $w->setValues(intl_get('Import'));
     page_title(intl_get('Word Importer'));
 }
Пример #22
0
function sitefaq_facet_assigned_to()
{
    $res = db_shift_array('select distinct assigned_to from sitefaq_submission order by assigned_to asc');
    $ret = array();
    foreach ($res as $a) {
        if (empty($a)) {
            continue;
            $ret[''] = intl_get('None');
        } else {
            $ret[$a] = db_shift('select concat(lastname, ", ", firstname, " (", username, ")") from sitellite_user where username = ?', $a);
        }
    }
    return $ret;
}
Пример #23
0
 function onSubmit($vals)
 {
     loader_import('sitepoll.Comment');
     $c = new SitepollComment();
     $vals['ts'] = date('Y-m-d H:i:s');
     unset($vals['submit_button']);
     $c->add($vals);
     $ce = appconf('comments_email');
     if ($ce) {
         @mail($ce, intl_get('Poll Comment Notice'), template_simple('comment_email.spt', $vals), 'From: ' . 'sitepoll@' . site_domain());
     }
     page_title(intl_get('Comment Added'));
     echo template_simple('comment_added.spt', $vals);
 }
Пример #24
0
 function onSubmit($vals)
 {
     if (!empty($vals['msg'])) {
         $vals['msg'] .= "\n\n";
     }
     // build message
     $message = array('subject' => 'Interesting web site from ' . $vals['yourEmail'], 'body' => $vals['msg'] . "Check it out at:\n\n" . site_url() . $vals['url'] . "\n\n- " . $vals['yourEmail'], 'from' => 'From: ' . $vals['yourEmail']);
     if (!@mail($vals['email'], $message['subject'], $message['body'], $message['from'])) {
         page_title(intl_get('Unknown Error'));
         return '<p>' . intl_get('Your email was unable to be sent at this time.') . '</p>';
     }
     page_title(intl_get('Thank You'));
     return '<p>' . intl_get('Your message has been sent.') . '</p>';
 }
Пример #25
0
 function WysiwygEditorForm()
 {
     parent::MailForm();
     $this->addWidget('hidden', 'field_name');
     $this->addWidget('hidden', 'form_name');
     $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
     $w =& $this->addWidget('msubmit', 'submit_button');
     $b =& $w->getButton();
     $b->setValues(intl_get('Submit'));
     $b->extra = 'onclick="return xed_window_submit (this.form)"';
     $b =& $w->addButton('cancel_button');
     $b->setValues(intl_get('Cancel'));
     $b->extra = 'onclick="return xed_window_cancel (this.form)"';
 }
Пример #26
0
 function SitegalleryEditForm()
 {
     parent::MailForm(__FILE__);
     page_title(intl_get('Edit Album Description'));
     $multi = false;
     if (intl_lang() == intl_default_lang()) {
         $ps1 = new PropertySet('sitegallery', 'album_title');
         $ps2 = new PropertySet('sitegallery', 'album_description');
         $ps3 = new PropertySet('sitegallery', 'album_date');
     } else {
         $this->lang = intl_lang();
         $this->reflang = intl_default_lang();
         $multi = true;
         $ps1 = new PropertySet('sitegallery', 'album_title_' . intl_lang());
         $ps2 = new PropertySet('sitegallery', 'album_description_' . intl_lang());
         $ps3 = new PropertySet('sitegallery', 'album_date');
         $ps4 = new PropertySet('sitegallery', 'album_title');
         $ps5 = new PropertySet('sitegallery', 'album_description');
     }
     global $cgi;
     $name = $ps1->get($cgi->album);
     if (!empty($name)) {
         $this->widgets['title']->setValue($name);
     }
     $desc = $ps2->get($cgi->album);
     if (!empty($desc)) {
         $this->widgets['description']->setValue($desc);
     }
     $date = $ps3->get($cgi->album);
     if (!empty($date)) {
         $this->widgets['date']->setValue($date);
     }
     if ($multi) {
         $n = $ps4->get($cgi->album);
         if (!empty($n)) {
             $this->widgets['title_ref'] =& $this->widgets['title_ref']->changeType('info');
             $this->widgets['title_ref']->setValue($n);
             $this->widgets['title_ref']->htmlentities = false;
         }
         $n = $ps5->get($cgi->album);
         if (!empty($n)) {
             $this->widgets['description_ref'] =& $this->widgets['description_ref']->changeType('info');
             $this->widgets['description_ref']->setValue(nl2br($n));
             $this->widgets['description_ref']->alt = intl_get('Reference Description');
             $this->widgets['description_ref']->htmlentities = false;
         }
         $langs = intl_get_langs();
         $this->message = intl_get('Language') . ': ' . $langs[intl_lang()];
     }
 }
Пример #27
0
 function onSubmit($vals)
 {
     loader_import('cms.Workspace.Message');
     $msg = new WorkspaceMessage();
     if (!$vals['response_id']) {
         $vals['response_id'] = '0';
     }
     $res = $msg->send($vals['subject'], $vals['body'], explode(',', $vals['recipients']), array(), $vals['response_id'], $vals['priority'], session_username());
     if (!$res) {
         echo '<p>Error: ' . $msg->error . '</p>';
     }
     session_set('sitellite_alert', intl_get('Your message has been sent.'));
     header('Location: ' . site_prefix() . '/index/cms-cpanel-action?_msg=sent');
     exit;
 }
Пример #28
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['collection'];
     unset($vals['collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $rex = new Rex($collection);
     //$vals['sitellite_owner'] = session_username ();
     //$vals['sitellite_team'] = session_team ();
     unset($vals['submit_button']);
     unset($vals['edit-top']);
     unset($vals['edit-middle']);
     unset($vals['edit-middle2']);
     unset($vals['edit-middle3']);
     unset($vals['edit-bottom']);
     unset($vals['cover_heading']);
     $vals['ts'] = date('YmdHis');
     $res = $rex->create($vals, $changelog);
     if (isset($vals[$rex->key])) {
         $key = $vals[$rex->key];
     } elseif (!is_bool($res)) {
         $key = $res;
     } else {
         $key = 'Unknown';
     }
     if (!$res) {
         if (!empty($return)) {
             $return = site_prefix() . '/index/cms-browse-action?collection=sitepresenter_presentation';
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         loader_import('cms.Workflow');
         echo Workflow::trigger('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => intl_get('Item added.'), 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been created.'));
         //if ($return) {
         //	header ('Location: ' . $return);
         //	exit;
         //}
         header('Location: ' . site_prefix() . '/index/sitepresenter-slides-action/id.' . $res);
         exit;
     }
 }
Пример #29
0
 function onSubmit($vals)
 {
     loader_import('siteforum.Post');
     loader_import('siteforum.Filters');
     loader_import('siteforum.Topic');
     $p = new SiteForum_Post();
     if (!$p->modify($vals['id'], array('subject' => $vals['subject'], 'body' => $vals['body']))) {
         page_title(intl_get('Database Error'));
         echo '<p>' . intl_get('An error occurred.  Please try again later.') . '</p>';
         echo '<p>' . intl_get('Error Message') . ': ' . $p->error . '</p>';
         return;
     }
     $post = $p->get($vals['id']);
     page_title(intl_get('Post Updated'));
     echo template_simple('post_updated.spt', $post);
 }
Пример #30
0
 function getTrail($id, $limit, $incl_self = false)
 {
     if (!$id || $id == '') {
         return array();
     }
     $trail = array();
     if ($incl_self) {
         $trail[] = (object) array('id' => $id, 'title' => $this->getTitle($id));
     }
     $parent = db_shift('select below_page from sitellite_page where id = ?', $id);
     while ($parent) {
         $next = db_single('select id, if(nav_title != "", nav_title, if(title != "", title, id)) as title, below_page from sitellite_page where id = ?', $parent);
         if (is_object($next)) {
             $trail[] = (object) array('id' => $next->id, 'title' => $next->title);
             $parent = $next->below_page;
         } else {
             $parent = false;
         }
     }
     $trail = array_reverse($trail);
     $out = array((object) array('id' => '', 'title' => intl_get('Root')));
     foreach ($trail as $item) {
         //info ($item);
         if (!$incl_self && $item->id == $id) {
             continue;
         }
         $out[] = (object) array('id' => $item->id, 'title' => $item->title);
     }
     //exit;
     return $out;
     /*
     		if (! $id || $id == '') {
     			return array ();
     		}
     		global $menu;
     		$out = array ((object) array ('id' => '', 'title' => intl_get ('Root')));
     		foreach ($menu->trail ($id) as $item) {
     			//info ($item);
     			if (! $incl_self && $item->id == $id) {
     				continue;
     			}
     			$out[] = (object) array ('id' => $item->id, 'title' => $item->title);
     		}
     		//exit;
     		return $out;
     */
 }