示例#1
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'] == 1 ? 'not visible' : 'visible';
     if (empty($vals['category'])) {
         $vals['category'] = $vals['oldcat'];
     }
     $category = $vals['category'];
     $body = $vals['body'];
     $data = array('subject' => $subject, 'author' => $author, 'status' => $status, 'category' => $category, 'body' => $body);
     if (!empty($id)) {
         $method = $rex->determineAction($id);
         $rex->{$method}($id, $data);
     } else {
         $data['created'] = date('Y-m-d H:i:s');
         $id = $rex->create($data);
     }
     //view post
     header('Location: ' . site_prefix() . '/index/siteblog-view-action?id=' . $id);
     exit;
 }
示例#2
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;
 }
示例#3
0
/**
 * Updates all pages that reference the specified image.
 */
function imagechooser_update_pages($image, $new)
{
    $links = imagechooser_links($image);
    if (count($links) > 0) {
        loader_import('cms.Versioning.Rex');
        $rex = new Rex('sitellite_page');
        foreach ($links as $id => $title) {
            $c = $rex->getCurrent($id);
            if (is_object($c)) {
                $c->body = str_replace($image, $new, $c->body);
                $method = $rex->determineAction($id, $c->sitellite_status);
                $rex->{$method}($id, (array) $c, 'An image in this page was renamed, updating link.');
            }
        }
    }
}
示例#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']);
     $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;
     }
 }
示例#5
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $rex = new Rex('siteglossary_term');
     $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']);
     unset($vals['section']);
     unset($vals['submit_button']);
     $method = $rex->determineAction($key);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     if (!$res) {
         if (empty($return)) {
             $return = site_prefix() . '/index/siteglossary-app#' . $vals['word'];
         }
         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 ($return) {
             header('Location: ' . $return);
             exit;
         }
     }
     header('Location: ' . site_prefix() . '/index/siteglossary-app#' . $vals['word']);
     exit;
 }
示例#6
0
<?php

if (!$parameters['_key']) {
    return;
}
$key = $parameters['_key'];
if (!$parameters['_downkey']) {
    return;
}
$downkey = $parameters['_downkey'];
$w1 = db_single('select sorting_weight, sitellite_status from sitellite_sidebar where id = ?', $downkey);
$w2 = db_single('select sorting_weight, sitellite_status from sitellite_sidebar where id = ?', $key);
loader_import('cms.Versioning.Rex');
$rex = new Rex('sitellite_sidebar');
$action = $rex->determineAction($key, $w2->sitellite_status);
$rex->{$action}($key, array('sorting_weight' => $w1->sorting_weight));
$action = $rex->determineAction($downkey, $w1->sitellite_status);
$rex->{$action}($downkey, array('sorting_weight' => $w2->sorting_weight));
header('Location: ' . $parameters['_return']);
exit;
示例#7
0
 * - modify: Ordinary modifications (source and store)
 * - replace: A change was approved, overwriting the live version
 * - republish: A change was made as a draft, requiring approval
 * - update: Update to a draft that was republished
 */
// note that changes to ID or file name take effect right away, even though
// the rest of the changes to the document require approval.
loader_import('cms.Versioning.Rex');
if ($parameters['collection'] == 'sitellite_page') {
    $ids = db_shift_array('select id from sitellite_page where body like ?', '%/' . $parameters['key'] . '"%');
    $rex = new Rex('sitellite_page');
    foreach ($ids as $id) {
        $c = $rex->getCurrent($id);
        if (is_object($c)) {
            $c->body = str_replace('/' . $parameters['key'] . '"', '/' . $parameters['data']['id'] . '"', $c->body);
            $method = $rex->determineAction($id, $c->sitellite_status);
            $rex->{$method}($id, (array) $c, 'A page linked to in this page was renamed, updating link.');
        }
    }
} elseif ($parameters['collection'] == 'sitellite_filesystem') {
    $ids = db_shift_array('select id from sitellite_page where body like ?', '%/' . $parameters['key'] . '"%');
    $rex = new Rex('sitellite_page');
    foreach ($ids as $id) {
        $c = $rex->getCurrent($id);
        if (is_object($c)) {
            $c->body = str_replace('/' . $parameters['key'] . '"', '/' . $parameters['data']['name'] . '"', $c->body);
            $method = $rex->determineAction($id, $c->sitellite_status);
            $rex->{$method}($id, (array) $c, 'A file linked to in this page was renamed, updating link.');
        }
    }
}
示例#8
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;
     }
 }
示例#9
0
 function onSubmit($vals)
 {
     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']);
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     foreach ($vals as $k => $v) {
         if ($this->widgets[$k]->ignoreEmpty && empty($v)) {
             unset($vals[$k]);
         }
     }
     if (strpos($rex->key, ',') !== false) {
         $pkeys = preg_split('/, ?/', $rex->key);
         $pvals = explode('|', $key);
         $key = array();
         for ($i = 0; $i < count($pkeys); $i++) {
             $key[$pkeys[$i]] = $pvals[$i];
         }
     }
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     if (!$res) {
         if (empty($return)) {
             $return = site_prefix() . '/index/cms-browse-action?collection=' . urlencode($collection);
         }
         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;
         }
         if ($collection == 'sitellite_page') {
             header('Location: ' . site_prefix() . '/index/' . $key);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/cms-browse-action?collection=' . urlencode($collection));
         exit;
     }
 }
示例#10
0
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     global $cgi;
     if (!is_object($cgi->photo1)) {
         if ($cgi->photo1_clear == 'no') {
             unset($vals['photo1']);
         }
     } else {
         $cgi->photo1->move('inc/app/realty/pix', $vals['_key'] . 'a.jpg');
         $vals['photo1'] = '/inc/app/realty/pix/' . $vals['_key'] . 'a.jpg';
     }
     if (!is_object($cgi->photo2)) {
         if ($cgi->photo2_clear == 'no') {
             unset($vals['photo2']);
         }
     } else {
         $cgi->photo2->move('inc/app/realty/pix', $vals['_key'] . 'b.jpg');
         $vals['photo2'] = '/inc/app/realty/pix/' . $vals['_key'] . 'b.jpg';
     }
     if (!is_object($cgi->photo3)) {
         if ($cgi->photo3_clear == 'no') {
             unset($vals['photo3']);
         }
     } else {
         $cgi->photo3->move('inc/app/realty/pix', $vals['_key'] . 'c.jpg');
         $vals['photo3'] = '/inc/app/realty/pix/' . $vals['_key'] . 'c.jpg';
     }
     if (!is_object($cgi->photo4)) {
         if ($cgi->photo4_clear == 'no') {
             unset($vals['photo4']);
         }
     } else {
         $cgi->photo4->move('inc/app/realty/pix', $vals['_key'] . 'd.jpg');
         $vals['photo4'] = '/inc/app/realty/pix/' . $vals['_key'] . 'd.jpg';
     }
     if (!is_object($cgi->photo5)) {
         if ($cgi->photo5_clear == 'no') {
             unset($vals['photo5']);
         }
     } else {
         $cgi->photo5->move('inc/app/realty/pix', $vals['_key'] . 'e.jpg');
         $vals['photo5'] = '/inc/app/realty/pix/' . $vals['_key'] . 'e.jpg';
     }
     if (!is_object($cgi->photo6)) {
         if ($cgi->photo6_clear == 'no') {
             unset($vals['photo6']);
         }
     } else {
         $cgi->photo6->move('inc/app/realty/pix', $vals['_key'] . 'f.jpg');
         $vals['photo6'] = '/inc/app/realty/pix/' . $vals['_key'] . 'f.jpg';
     }
     if (!is_object($cgi->photo7)) {
         if ($cgi->photo7_clear == 'no') {
             unset($vals['photo7']);
         }
     } else {
         $cgi->photo7->move('inc/app/realty/pix', $vals['_key'] . 'g.jpg');
         $vals['photo7'] = '/inc/app/realty/pix/' . $vals['_key'] . 'g.jpg';
     }
     if (!is_object($cgi->photo8)) {
         if ($cgi->photo8_clear == 'no') {
             unset($vals['photo8']);
         }
     } else {
         $cgi->photo8->move('inc/app/realty/pix', $vals['_key'] . 'h.jpg');
         $vals['photo8'] = '/inc/app/realty/pix/' . $vals['_key'] . 'h.jpg';
     }
     $rex = new Rex($collection);
     // default: database, database
     unset($vals['submit_button']);
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     foreach ($vals as $k => $v) {
         if ($this->widgets[$k]->ignoreEmpty && empty($v)) {
             unset($vals[$k]);
         }
     }
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     if (!$res) {
         die($rex->error);
     } 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));
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/realty-details-action/id.' . $key);
         exit;
     }
 }
示例#11
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;
 }
示例#12
0
<?php

/* Parameters contains:
 * - collection: The collection the item belongs to
 * - key: The primary key value of the item
 * - message: A brief description of the event
 *
 * Note that services are triggered *after* the change has been
 * made.  The only way you can undo changes in a service is by
 * using the cms.Versioning.Rex API if the collection in question
 * supports versioning (not all do).  Also, you can, if necessary,
 * create further modifications to the document, also via the
 * Rex API.
 */
if ($parameters['collection'] == 'sitellite_page') {
    $rex = new Rex($parameters['collection']);
    $current = $rex->getCurrent($parameters['key']);
    if (!$current) {
        $current = new StdClass();
        $current->below_page = '';
    }
    foreach (db_shift_array('select id from sitellite_page where below_page = ?', $parameters['key']) as $child) {
        $method = $rex->determineAction($child);
        if (!$method) {
            die($rex->error);
        }
        $rex->{$method}($child, array('below_page' => $current->below_page), 'Relocated due to deleted parent page.');
    }
}
示例#13
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;
     }
 }
示例#14
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;
     }
 }
示例#15
0
    if (!isset($cols['sitellite_startdate'])) {
        // no scheduling in this collection
        continue;
    }
    $pkcol = $rex->key;
    foreach ($states as $fromState => $state) {
        $toState = $state['to'];
        $find = array('sitellite_status' => new rEqual('sitellite_status', $fromState));
        if (!empty($state['sitellite_startdate'])) {
            $find['sitellite_startdate'] = new rLiteral($state['sitellite_startdate']);
        }
        if (!empty($state['sitellite_expirydate'])) {
            $find['sitellite_expiry'] = new rLiteral($state['sitellite_expirydate']);
        }
        $list =& $rex->getStoreList($find);
        if (!$list) {
            // no results
            continue;
        }
        // got the list
        foreach (array_keys($list) as $k) {
            $record =& $list[$k];
            // set sitellite_status to $toState
            $upd['sitellite_status'] = $toState;
            $action = $rex->determineAction($record->{$pkcol}, $toState);
            if (!$rex->{$action}($record->{$pkcol}, $upd, $state['msg'])) {
                echo $table . '/' . $record->{$pkcol} . ' (' . $record->sitellite_status . ', ' . $toState . ') - ' . $rex->error . NEWLINE;
            }
        }
    }
}
示例#16
0
     if (isset($vals['sitellite_status'])) {
         $new_status = $vals['sitellite_status'];
     } else {
         $new_status = $info->sitellite_status;
     }
     // verify $vals['name'] doesn't already exist if it's a rename
     if (isset($vals['name']) && $vals['name'] != ltrim($path, '/') && file_exists($prefix . '/' . $vals['name'])) {
         webfiles_error(409, 'Conflict');
     }
     // rename folders
     //if (@is_dir (rtrim ($prefix . $path, '/'))) {
     // 1. build duplicate directory structure
     // 2. move all files to new structure
     // 3. delete now-empty old directory structure
     //}
     $method = $rex->determineAction(ltrim($path, '/'), $new_status);
     $res = $rex->{$method}(ltrim($path, '/'), $vals);
     if (!$res) {
         webfiles_error(500, $rex->error);
     }
     if (isset($vals['name'])) {
         $info = $rex->getCurrent($vals['name']);
     } else {
         $info = $rex->getCurrent(ltrim($path, '/'));
     }
     webfiles_workflow('edit', ltrim($path, '/'), $info, 'Edited via the Sitellite Desktop');
     webfiles_response((object) array('type' => mime($info->name), 'name' => '/' . $info->name, '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($info->name)));
     break;
 case 'get':
     $path = webfiles_request();
     $info = $rex->getCurrent(ltrim($path, '/'));