Example #1
0
 function onSubmit($vals)
 {
     // here is where we handle the form.
     // in this case, we simply display its output to the screen
     page_title($vals['title']);
     return $vals['body'];
 }
Example #2
0
    function SiteglossaryEditForm()
    {
        parent::MailForm();
        $this->parseSettings('inc/app/siteglossary/forms/edit/settings.php');
        global $cgi;
        page_title(intl_get('Editing Glossary Term') . ': ' . $cgi->_key);
        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/siteglossary-app";
					}
				}
				return false;
			}
		');
        // add cancel handler
        $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
        $res = db_single('select * from siteglossary_term where word = ?', $cgi->_key);
        foreach (get_object_vars($res) as $k => $v) {
            $this->widgets[$k]->setValue($v);
        }
    }
Example #3
0
    function SitefaqEditForm()
    {
        parent::MailForm();
        global $page, $cgi;
        $this->extra = 'id="cms-edit-form"';
        // get copy from repository
        loader_import('cms.Versioning.Rex');
        $rex = new Rex($cgi->_collection);
        // default: database, database
        $_document = $rex->getCurrent($cgi->_key);
        $widgets = $rex->getStruct();
        if (!$widgets) {
            $widgets = array();
        }
        // edit widgets go here
        $this->widgets = array_merge($this->widgets, $widgets);
        foreach ($this->widgets as $k => $v) {
            if (isset($_document->{$k})) {
                $this->widgets[$k]->setValue($_document->{$k});
            }
        }
        $w =& $this->addWidget('hidden', '_key');
        $w =& $this->addWidget('hidden', '_collection');
        $w =& $this->addWidget('hidden', '_return');
        if ($rex->isVersioned) {
            $t =& $this->addWidget('textarea', 'changelog');
            $t->alt = intl_get('Change Summary');
            $t->rows = 3;
            $t->labelPosition = 'left';
            $t->extra = 'id="changelog"';
        }
        // submit buttons
        $w =& $this->addWidget('msubmit', 'submit_button');
        $b =& $w->getButton();
        $b->setValues(intl_get('Save'));
        $b =& $w->addButton('submit_button', intl_get('Cancel'));
        $b->extra = 'onclick="return cms_cancel (this.form)"';
        $this->error_mode = 'all';
        if ($rex->info['Collection']['singular']) {
            page_title(intl_get('Editing') . ' ' . $rex->info['Collection']['singular'] . ': ' . $_document->{$rex->key});
        } else {
            page_title(intl_get('Editing Item') . ': ' . $_document->{$rex->key});
        }
        // the SiteFAQ additions:
        if (appconf('user_anonymity')) {
            unset($this->widgets['name']);
            unset($this->widgets['email']);
            unset($this->widgets['url']);
            unset($this->widgets['ip']);
            unset($this->widgets['member_id']);
        }
        $admin_roles = session_admin_roles();
        $this->widgets['assigned_to']->setValues(db_pairs('select username, concat(lastname, ", ", firstname, " (", username, ")")
				from sitellite_user
				where role in("' . join('", "', $admin_roles) . '")
				order by lastname, firstname, username'));
        if (!$_document->assigned_to) {
            $this->widgets['assigned_to']->setValue(session_username());
        }
    }
Example #4
0
 function SiteblogEditForm()
 {
     parent::MailForm();
     global $cgi;
     $refer = $_SERVER['HTTP_REFERER'];
     $this->parseSettings('inc/app/siteblog/forms/edit/settings.php');
     $this->widgets['refer']->setValue($refer);
     //if add is true, we're creating a blog post, otherwise we're editing a blog post
     $add = isset($cgi->_key) && !empty($cgi->_key) ? false : true;
     $this->widgets['status']->setValues(array('Live', 'Not Live'));
     $cats = db_pairs('select id, title from siteblog_category where status = "on"');
     if ($add) {
         page_title('Adding a Blog Post');
         $this->widgets['author']->setValue(session_username());
         unset($this->widgets['icategory']);
         $this->widgets['category']->setValues($cats);
     } else {
         loader_import('cms.Versioning.Rex');
         $rex = new Rex('siteblog_post');
         $document = $rex->getCurrent($cgi->_key);
         page_title('Editing a Blog Post');
         //populate fields
         $this->widgets['subject']->setValue($document->subject);
         $this->widgets['author']->setValue($document->author);
         $this->widgets['status']->setValue($document->status);
         unset($this->widgets['category']);
         $catname = db_shift('select title from siteblog_category where id = ?', $document->category);
         $this->widgets['icategory']->setValue($catname);
         $this->widgets['oldcat']->setValue($document->category);
         $this->widgets['body']->setValue($document->body);
     }
 }
Example #5
0
 function RealtyAddForm()
 {
     parent::MailForm();
     $w =& $this->addWidget('hidden', 'collection');
     $w =& $this->addWidget('hidden', '_return');
     global $cgi;
     loader_import('cms.Versioning.Rex');
     $rex = new Rex($cgi->collection);
     $widgets = $rex->getStruct();
     if (!$widgets) {
         die($rex->error);
     }
     $this->widgets = array_merge($this->widgets, $widgets);
     foreach (array_keys($this->widgets) as $k) {
         if (strtolower(get_class($this->widgets[$k])) == 'mf_widget_xeditor') {
             $this->extra = 'onsubmit="xed_copy_value (this, \'' . $k . '\')"';
         }
     }
     if (isset($rex->info['Collection']['singular'])) {
         page_title(intl_get('Adding') . ' ' . $rex->info['Collection']['singular']);
     } else {
         page_title(intl_get('Adding Item'));
     }
     $w =& $this->addWidget('msubmit', 'submit_button');
     $b =& $w->getButton();
     $b->setValues(intl_get('Create'));
     $b =& $w->addButton('submit_button', intl_get('Cancel'));
     $b->extra = 'onclick="return cms_cancel (this.form)"';
 }
Example #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'));
 }
Example #7
0
function page_breadcrumb($page, $sidebar)
{
    $title = preg_quote(page_title($page), '!');
    $lines = explode("\n", $sidebar);
    $index = $level = null;
    foreach ($lines as $line_no => $line) {
        if (preg_match('![\\[\\*\\|]' . $title . '[\\]\\*]!', $line)) {
            $index = $line_no;
            $level = strpos($line, '* ');
            break;
        }
    }
    if (!$index) {
        return [];
    }
    for ($i = $index - 1; $i > 0; $i--) {
        $line = $lines[$i];
        if (strpos($line, '* ') < $level) {
            $level = strpos($line, '* ');
            if (preg_match('|(\\[\\[[^\\]]+\\]\\])|', $line, $matches)) {
                list($page, $title) = parse_wikilink($matches[1]);
                $breadcrumb[] = [$title, $page];
            } else {
                if (preg_match('|\\* \\*\\*([^\\*]+)\\*\\*|', $line, $matches)) {
                    $breadcrumb[] = [$matches[1], null];
                }
            }
        }
        if (!$level) {
            break;
        }
    }
    $breadcrumb[] = ['Home', 'Home'];
    return array_reverse($breadcrumb);
}
Example #8
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"';
 }
Example #9
0
 function SiteblogCommentForm()
 {
     parent::MailForm();
     global $cgi;
     $this->parseSettings('inc/app/siteblog/forms/comment/settings.php');
     if (isset($cgi->_key) && !empty($cgi->_key)) {
         //edit a comment
         page_title('Editing Comment');
         $comment = db_single('select * from siteblog_comment where id = ?', $cgi->_key);
         $this->widgets['name']->setValue($comment->author);
         $this->widgets['email']->setValue($comment->email);
         $this->widgets['url']->setValue($comment->url);
         $this->widgets['body']->setValue($comment->body);
     } elseif (!isset($cgi->post)) {
         header('Location: ' . site_prefix() . '/index');
         exit;
     } else {
         if (session_valid()) {
             $this->widgets['name']->setValue(session_username());
             $user = session_get_user();
             $this->widgets['email']->setValue($user->email);
             $this->widgets['url']->setValue($user->website);
         }
         $this->widgets['post']->setValue($cgi->post);
         //page_title ('Post a Comment');
     }
     if (!appconf('comments_security')) {
         unset($this->widgets['security_test']);
     }
 }
Example #10
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);
 }
Example #11
0
 function SiteblogPropertiesForm()
 {
     parent::MailForm();
     global $cgi;
     if (empty($cgi->blog)) {
         return;
     }
     $this->parseSettings('inc/app/siteblog/forms/properties/settings.php');
     page_title('Editing Category Properties: ' . $cgi->blog);
     $category = db_single('select * from siteblog_category where id = ?', $cgi->blog);
     $set = array();
     if ($category->comments == 'on') {
         $set[] = 'Enable Comments';
     }
     if ($category->poster_visible == 'yes') {
         $set[] = 'Author Visible';
     }
     if ($category->display_rss == 'yes') {
         $set[] = 'Include RSS Links';
     }
     if ($category->status == 'on') {
         $set[] = 'Enabled';
     }
     $this->widgets['blog_properties']->setValue($set);
     $this->widgets['blog']->setValue($cgi->blog);
     $this->widgets['refer']->setValue($_SERVER['HTTP_REFERER']);
 }
Example #12
0
 function DeadlinesAddForm()
 {
     parent::MailForm();
     $this->parseSettings('inc/app/deadlines/forms/add/settings.php');
     page_title('Deadlines - Add Item');
     $this->widgets['ts']->setDefault(date('Y-m-d H:i:s'));
 }
Example #13
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);
        }
    }
Example #14
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>';
 }
Example #15
0
    function SitepresenterAddForm()
    {
        parent::MailForm();
        global $page, $cgi;
        $this->parseSettings('inc/app/sitepresenter/forms/add/settings.php');
        page_title(intl_get('Adding Presentation'));
        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.js');
        page_add_script(CMS_JS_FORMHELP_INIT);
        page_onload('cms_init_edit_panels ()');
        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;
			}
		');
        // add cancel handler
        $this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
    }
Example #16
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');
 }
Example #17
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'));
 }
Example #18
0
    function onSubmit($vals)
    {
        db_execute('update siteinvoice_client
			set code = ?, name = ?, contact_name = ?, contact_email = ?, contact_phone = ?, address = ?
			where id = ?', $vals['code'], $vals['name'], $vals['contact_name'], $vals['contact_email'], $vals['contact_phone'], $vals['address'], $vals['id']);
        page_title('SiteInvoice - Client Updated');
        echo '<p><a href="' . site_prefix() . '/index/siteinvoice-clients-action">Continue</a></p>';
    }
Example #19
0
    function onSubmit($vals)
    {
        db_execute('insert into siteinvoice_client
				(id, code, name, contact_name, contact_email, contact_phone, address)
			values
				(null, ?, ?, ?, ?, ?, ?)', $vals['code'], $vals['name'], $vals['contact_name'], $vals['contact_email'], $vals['contact_phone'], $vals['address']);
        page_title('SiteInvoice - Client Added');
        echo '<p><a href="' . site_prefix() . '/index/siteinvoice-clients-action">Continue</a></p>';
    }
Example #20
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);
 }
Example #21
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>';
 }
Example #22
0
 function DeadlinesEditForm()
 {
     parent::MailForm();
     $this->parseSettings('inc/app/deadlines/forms/edit/settings.php');
     page_title('Deadlines - Edit Item');
     global $cgi;
     $res = db_single('select * from deadlines where id = ?', $cgi->id);
     foreach ((array) $res as $k => $v) {
         $this->widgets[$k]->setValue($v);
     }
 }
Example #23
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>';
 }
Example #24
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'));
 }
Example #25
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'));
 }
Example #26
0
function show_page()
{
    // Check that the provided ID exists
    $row = DB::queryFirstRow('SELECT test_id, name, total_points FROM tests WHERE test_id=%i LIMIT 1', $_REQUEST['ID']);
    if (is_null($row)) {
        trigger_error('Show_Page: Invalid Test ID', E_USER_ERROR);
    }
    $test_id = $row['test_id'];
    $test_name = $row['name'];
    $total_points = $row['total_points'];
    page_title('Enter Scores');
    echo autocomplete_js("#userAutocomplete", autocomplete_users_data());
    ?>
      <h1>Enter Scores</h1>
      
      <h3><?php 
    echo $test_name;
    ?>
</h3>
      Total Points: <b><?php 
    echo $total_points;
    ?>
</b>
      <br />
      <br />
      <br />
      <form id="enterScore" method="post" action="Enter_Scores" autocomplete="off">
      <table class="spacious">
        <tr>
          <td>Name:</td>
          <td><input type="text" id="userAutocomplete" name="user" class="focus" size="25"/></td>
        </tr><tr>
          <td>Score:&nbsp;</td>
          <td><input type="text" name="score" size="3"/></td>
        </tr><tr>
          <td></td>
          <td>
			<input type="hidden" name="ID" value="<?php 
    echo $test_id;
    ?>
"/>
            <input type="hidden" name="xsrf_token" value="<?php 
    echo $_SESSION['xsrf_token'];
    ?>
"/>
            <input type="submit" name="do_add_score" value="Enter"/>
            &nbsp;&nbsp;<a href="Tests">Back</a>
          </td>
        </tr>
      </table>
      </form>
<?php 
}
Example #27
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)"';
    }
Example #28
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>';
 }
Example #29
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()];
     }
 }
Example #30
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);
 }