示例#1
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $rex = new Rex($collection);
     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['solution_header']);
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     // remove lock when editing is finished
     lock_remove($collection, $key);
     if (!$res) {
         if (!empty($return)) {
             $return = site_prefix() . '/index/cms-browse-action?collection=sitestudy_item';
         }
         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('edit', array('collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been saved.'));
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/sitestudy-app/case.' . $key);
         exit;
     }
 }
示例#2
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $rex = new Rex('sitewiki_page');
     unset($vals['editing']);
     unset($vals['instructions']);
     unset($vals['security_test']);
     unset($vals['submit_button']);
     $vals['id'] = $vals['page'];
     unset($vals['page']);
     if ($this->new_page) {
         $vals['created_on'] = date('Y-m-d H:i:s');
         $vals['updated_on'] = date('Y-m-d H:i:s');
         $vals['owner'] = session_username();
         if (!$vals['owner']) {
             $vals['owner'] = 'anonymous';
         }
         $vals2 = $vals;
         unset($vals2['files']);
         unset($vals2['file_1']);
         unset($vals2['file_2']);
         unset($vals2['file_3']);
         $res = $rex->create($vals2, 'Page created.');
     } else {
         $vals['updated_on'] = date('Y-m-d H:i:s');
         $vals2 = $vals;
         unset($vals2['files']);
         unset($vals2['file_1']);
         unset($vals2['file_2']);
         unset($vals2['file_3']);
         $method = $rex->determineAction($vals['id']);
         $res = $rex->{$method}($vals['id'], $vals2);
     }
     if (session_valid()) {
         // handle files
         $types = preg_split('/, ?/', appconf('allowed_file_types'));
         if (is_object($vals['file_1'])) {
             $info = pathinfo($vals['file_1']->name);
             if (in_array(strtolower($info['extension']), $types)) {
                 db_execute('insert into sitewiki_file values (null, ?, ?, now(), ?)', $vals['id'], $vals['file_1']->name, session_username());
                 $file_id = db_lastid();
                 $vals['file_1']->move('inc/app/sitewiki/data', $vals['id'] . '_' . $file_id);
             }
         }
         if (is_object($vals['file_2'])) {
             $info = pathinfo($vals['file_2']->name);
             if (in_array(strtolower($info['extension']), $types)) {
                 db_execute('insert into sitewiki_file values (null, ?, ?, now(), ?)', $vals['id'], $vals['file_2']->name, session_username());
                 $file_id = db_lastid();
                 $vals['file_2']->move('inc/app/sitewiki/data', $vals['id'] . '_' . $file_id);
             }
         }
         if (is_object($vals['file_3'])) {
             $info = pathinfo($vals['file_3']->name);
             if (in_array(strtolower($info['extension']), $types)) {
                 db_execute('insert into sitewiki_file values (null, ?, ?, now(), ?)', $vals['id'], $vals['file_3']->name, session_username());
                 $file_id = db_lastid();
                 $vals['file_3']->move('inc/app/sitewiki/data', $vals['id'] . '_' . $file_id);
             }
         }
     }
     lock_remove('sitewiki_page', $vals['id']);
     header('Location: ' . site_prefix() . '/index/sitewiki-app/show.' . $vals['id']);
     exit;
 }
示例#3
0
 function onSubmit($vals)
 {
     if ($vals['below_page'] == $vals['id']) {
         $this->invalid_field = 'below_page';
         $this->invalid['below_page'] = intl_getf('You cannot set this page to be a child of itself.');
         return $this->show();
     }
     loader_box('sitellite/nav/init');
     if (menu_is_child_of($vals['below_page'], $vals['id'])) {
         $this->invalid_field = 'below_page';
         $this->invalid['below_page'] = intl_getf('You cannot set this page to be a child of one of its own child pages.');
         return $this->show();
     }
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $rex = new Rex($collection);
     // default: database, database
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     unset($vals['section1']);
     unset($vals['section3']);
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     // remove lock when editing is finished
     lock_remove($collection, $key);
     if ($key != $vals[$rex->key]) {
         if ($return == site_prefix() . '/index/' . $key || $return == site_prefix() . '/' . $key) {
             $return = '';
         }
     }
     if (!$res) {
         if (empty($return)) {
             $return = site_prefix() . '/index/' . $key;
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         foreach (db_shift_array('select id from sitellite_page where below_page = ?', $key) as $child) {
             $method = $rex->determineAction($key);
             if (!$method) {
                 die($rex->error);
             }
             $rex->{$method}($child, array('below_page' => $vals['id']), 'Updating renamed parent reference');
         }
         loader_import('cms.Workflow');
         echo Workflow::trigger('edit', array('collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been saved.'));
         if ($key != $vals[$rex->key]) {
             if ($return == site_prefix() . '/index/' . $key || $return == site_prefix() . '/' . $key) {
                 $return = '';
             }
         }
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/' . $vals[$rex->key]);
         exit;
     }
 }
示例#4
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     if (is_object($vals['file'])) {
         $vals['body'] =& $vals['file'];
         unset($vals['file']);
     } else {
         unset($vals['file']);
     }
     if (!empty($vals['name'])) {
         $vals['name'] = $vals['folder'] . '/' . $vals['name'];
     } elseif ($this->isNewFolder($vals['folder'], $key)) {
         $vals['name'] = $vals['folder'] . '/' . basename($key);
     } elseif (is_object($vals['body'])) {
         $vals['name'] = $vals['folder'] . '/' . $vals['body']->name;
     } else {
         unset($vals['name']);
     }
     if (strpos($vals['name'], '/') === 0) {
         $vals['name'] = substr($vals['name'], 1);
     }
     unset($vals['folder']);
     $rex = new Rex($collection);
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     // remove lock when editing is finished
     lock_remove($collection, $key);
     if (!empty($return)) {
         $return = site_prefix() . '/index/cms-browse-action?collection=sitellite_filesystem';
     }
     if (!$res) {
         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('edit', array('collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been saved.'));
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/cms-browse-action?collection=sitellite_filesystem');
         exit;
     }
 }
示例#5
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_sidebar';
     }
     $rex = new Rex($collection);
     // default: database, database
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     //unset ($vals['section1']);
     unset($vals['section3']);
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     if (!$vals['show_on_pages']) {
         $vals['show_on_pages'] = '';
     }
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     // remove lock when editing is finished
     lock_remove($collection, $key);
     if (!empty($return)) {
         $return = site_prefix() . '/index/cms-browse-action?collection=sitellite_sidebar';
     }
     if (!$res) {
         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('edit', array('collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been saved.'));
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/cms-browse-action?collection=sitellite_sidebar');
         exit;
     }
 }
示例#6
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;
示例#7
0
 /**
  * UNLOCK method handler
  *
  * @param  array  general parameter passing array
  * @return bool   true on success
  */
 function UNLOCK(&$options)
 {
     $path = trim($this->_path(), '/');
     $fspath = $this->base . '/' . $path;
     if ($this->checkLock($path, true)) {
         $this->_debug(__LINE__, 409, 'Locked: ' . $path);
         return '409 Conflict';
     }
     loader_import('cms.Workflow.Lock');
     lock_init();
     if (is_dir($fspath)) {
         $info = lock_info('sitellite_filesystem', $path);
         if ($options['token'] != $info->token) {
             $this->_debug(__LINE__, 403, 'Token didn\'t match: ' . $path . ' (real: ' . $info->token . ', sent: ' . $options['token'] . ')');
             return '403 Forbidden';
         }
         if (lock_remove('sitellite_filesystem', $path)) {
             return true;
         }
     } else {
         $info = lock_info('sitellite_filesystem', $path);
         if ($options['token'] != $info->token) {
             $this->_debug(__LINE__, 403, 'Token didn\'t match: ' . $path . ' (real: ' . $info->token . ', sent: ' . $options['token'] . ')');
             return '403 Forbidden';
         }
         if (lock_remove('sitellite_filesystem', $path)) {
             return true;
         }
     }
     $this->_debug(__LINE__, 500, 'Lock remove must have failed: ' . $path);
     return '500 Internal server error';
 }
示例#8
0
     $path = webfiles_request();
     if (!file_exists($prefix . $path)) {
         webfiles_error(404, 'Not found');
     }
     //if (is_dir ($prefix . $path)) {
     //	webfiles_error (500, 'Locks not supported on directories');
     //}
     // it's someone else's lock
     $lock = webfiles_lock($path);
     if ($lock && $lock->owner != session_username()) {
         webfiles_error(409, 'Conflict');
     }
     //if (lock_exists ('sitellite_filesystem', ltrim ($path, '/'))) {
     //	webfiles_error (409, 'Conflict');
     //}
     if (!lock_remove('sitellite_filesystem', trim($path, '/'))) {
         webfiles_error(500, 'Internal server error');
     }
     webfiles_response(true);
     break;
 case 'statuses':
     webfiles_response(session_get_statuses());
     break;
 case 'access-levels':
     webfiles_response(session_get_access_levels());
     break;
 case 'teams':
     $teams = session_allowed_teams_list();
     if (in_array('all', $teams)) {
         $teams = session_get_teams();
     }