Пример #1
0
 public function testAutoSaveRemoveByPrefix()
 {
     AutoSave::add('red', 'value');
     AutoSave::add('really', 'value');
     AutoSave::add('reaper', 'value');
     AutoSave::removeAllByPrefix('rea');
     $this->assertEquals(Autosave::get('red'), 'value');
     $this->assertNull(Autosave::get('really'));
     $this->assertNull(Autosave::get('reaper'));
 }
Пример #2
0
<?php

loader_import('saf.MailForm.Autosave');
$a = new Autosave();
$list = $a->retrieve_all();
if (count($list) > 0) {
    loader_import('cms.Filters');
    page_title(intl_get('Drafts'));
    echo template_simple('autosave_drafts.spt', $list);
} else {
    echo '<p>' . intl_get('No drafts.') . '</p>';
}
Пример #3
0
 /**
  * Runs the form and returns either the rendered form or the output
  * of the handler function.  $uploadFiles can be set to false to cause the
  * getValues() method not to call move() on File widgets.  This is useful
  * for situations when you need to do something other than simply save the
  * file to a predetermined folder.  Please note: The $uploadFiles parameter
  * is deprecated in favour of the $uploadFiles property of the MailForm
  * class.  This allows the setting to be managed via a settings.php file.
  * 
  * @access	public
  * @param	boolean	$uploadFiles
  * @return	string
  * 
  */
 function run($uploadFiles = true)
 {
     global $cgi;
     if (!$uploadFiles) {
         $this->uploadFiles = $uploadFiles;
     }
     if ($this->invalid($cgi)) {
         $this->setValues($cgi);
         if ($this->verify_session) {
             @session_start();
             $_SESSION['mf_verify_session'] = 'mf_verified';
         }
         return $this->show();
     } else {
         if ($this->verify_session) {
             @session_start();
             if ($_SESSION['mf_verify_session'] != 'mf_verified') {
                 die('This form requires that you enable cookies in your browser, which helps us to prevent abuse of our forms by automated spam systems.');
             }
         }
         if ($this->blacklist) {
             if (db_shift('select count(*) from sitellite_form_blacklist where ip_address = ?', $_SERVER['REMOTE_ADDR'])) {
                 die('The IP address submitting this form has been blacklisted due to abuse.  If you feel this has been done in error, please contact the website owner.');
             }
         }
         if ($this->autosave) {
             loader_import('saf.MailForm.Autosave');
             $a = new Autosave();
             $a->clear($_SERVER['HTTP_REFERER']);
         }
         $this->setValues($cgi);
         $vals = $this->getValues();
         if ($this->clean_input) {
             foreach ($vals as $k => $v) {
                 $vals[$k] = strip_tags($v);
             }
         }
         return call_user_func($this->handler, $vals);
     }
 }
Пример #4
0
<?php

global $cgi;
loader_import('cms.Workflow.Lock');
lock_init();
lock_remove($cgi->collection, $cgi->key);
loader_import('saf.MailForm.Autosave');
$a = new Autosave();
$a->clear($_SERVER['HTTP_REFERER']);
header('Location: ' . $cgi->return);
exit;
Пример #5
0
<?php

loader_import('saf.MailForm.Autosave');
$a = new Autosave();
if (!empty($parameters['url'])) {
    $a->clear($parameters['url']);
} else {
    $a->clear_all();
}
if (!empty($parameters['forward'])) {
    header('Location: ' . $parameters['forward']);
    exit;
}
header('Location: ' . site_prefix() . '/index/cms-cpanel-action');
exit;