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'); }
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; }
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; }
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; }
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; } }
/** * 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.'); } } } }
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']); $rex = new Rex($collection); // default: database, database unset($vals['submit_button']); $vals['photo1'] = ''; $vals['photo2'] = ''; $vals['photo3'] = ''; $vals['photo4'] = ''; $vals['photo5'] = ''; $vals['photo6'] = ''; $vals['photo7'] = ''; $vals['photo8'] = ''; $res = $rex->create($vals); if (isset($vals[$rex->key]) && $vals[$rex->key] != false) { $key = $vals[$rex->key]; } elseif (!is_bool($res)) { $key = $res; } else { $key = 'Unknown'; } if (!$res) { die($rex->error); } else { global $cgi; $alpha = range('a', 'h'); for ($i = 0; $i < 8; $i++) { $n = $i + 1; if (is_object($cgi->{'photo' . $n})) { $cgi->{'photo' . $n}->move('inc/app/realty/pix', $key . $alpha[$i] . '.jpg'); db_execute('update realty_listing set photo' . $n . ' = "/inc/app/realty/pix/' . $key . $alpha[$i] . '.jpg" where id = ' . $key); } } 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)); header('Location: ' . site_prefix() . '/index/realty-details-action/id.' . $key); exit; } }
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; } }
function onSubmit($vals) { // 1. add author if necessary if (!db_shift('select * from sitellite_news_author where name = ?', $vals['author'])) { db_execute('insert into sitellite_news_author (name) values (?)', $vals['author']); } // 2. submit story as 'draft' loader_import('cms.Versioning.Rex'); $rex = new Rex('sitellite_news'); $res = $rex->create(array('title' => $vals['title'], 'author' => $vals['author'], 'category' => $vals['category'], 'summary' => $vals['summary'], 'body' => $vals['body'], 'date' => date('Y-m-d'), 'sitellite_status' => 'draft', 'sitellite_access' => 'public'), 'Story submission.'); $vals['id'] = $res; // 3. email notification @mail(appconf('submissions'), 'News Submission Notice', template_simple('submission_email.spt', $vals)); // 4. thank you screen page_title(intl_get('Thank You!')); echo template_simple('submissions.spt'); }
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['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'] = ''; } $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=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('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/siteevent-details-action/id.' . $key); exit; } }
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'; } $return = $vals['_return']; unset($vals['_return']); $changelog = $vals['changelog']; unset($vals['changelog']); unset($vals['section']); unset($vals['submit_button']); $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/siteglossary-app'; } 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/siteglossary-app#' . $vals['word']); exit; }
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; }
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; } }
switch ($parameters['action']) { case 'modify': /* For this collection, since it doesn't support versioning, * the action will always be 'modify'. */ if ($parameters['data']['sitellite_status'] == 'approved') { if (conf('App', 'sitefaq', 'user_anonymity')) { $parameters['data']['email'] = db_shift('select email from sitefaq_submission where id = ?', $parameters['data']['id']); } if (!empty($parameters['data']['email'])) { // reply to user @mail($parameters['data']['email'], intl_get('FAQ Response'), template_simple('email_answer.spt', $parameters['data']), 'From: faq@' . str_replace('www.', '', site_domain())); } if (conf('App', 'sitefaq', 'user_anonymity')) { // erase user's contact info loader_import('cms.Versioning.Rex'); $rex = new Rex('sitefaq_submission'); $rex->modify($parameters['data'][$rex->key], array('name' => '', 'email' => '', 'url' => '', 'ip' => '', 'member_id' => '')); } } break; case 'replace': break; case 'republish': break; case 'update': break; default: // error }
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']); $rex = new Rex($collection); // default: database, database unset($vals['submit_button']); foreach ($this->widgets as $k => $w) { if ($w->type == 'joiner') { unset($vals[$k]); } } $res = $rex->create($vals); if (isset($vals[$rex->key]) && $vals[$rex->key] != false) { $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=' . urlencode($collection); } echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return)); } else { foreach ($this->widgets as $k => $w) { if ($w->type == 'joiner') { $w->saveSelected($key); } } 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.')); header('Location: ' . site_prefix() . '/index/cms-browse-action?collection=' . urlencode($collection)); exit; } }
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; } }
$acl = session_approved_sql(); } $res = db_shift('select name from sitellite_filesystem where path = ? and name = ? and extension = ? and ' . $acl, $info['dirname'], $info['basename'], $info['extension']); if (!$res) { header('Location: ' . site_prefix() . '/index'); exit; } if ($parameters['rid']) { // retrieve a specific revision (only if current file's permissions pass though) loader_import('cms.Versioning.Rex'); $r = new Rex('sitellite_filesystem'); $revision = $r->getRevision($parameters['file'], $parameters['rid'], true); header('Cache-control: private'); header('Content-Type: ' . str_replace('|[,;].*$|i', '', mime($parameters['file']))); header('Content-Disposition: inline; filename="' . basename($parameters['file']) . '"'); header('Content-Length: ' . $revision->filesize); echo $revision->body; exit; } set_time_limit(0); if (isset($_SERVER['HTTP_RANGE'])) { $size = filesize('inc/data/' . $parameters['file']); if (preg_match('/^bytes=(\\d+)-(\\d*)$/', $_SERVER['HTTP_RANGE'], $matches)) { $from = $matches[1]; $to = $matches[2]; if (empty($to)) {
<?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;
<?php loader_import('cms.Versioning.Rex'); loader_import('saf.Date'); $rex = new Rex($parameters['_collection']); // default: database, database if (!$rex->collection) { header('Location: ' . $_SERVER['HTTP_REFERER']); exit; } $revision = $rex->getRevision($parameters['_key'], $parameters['_rid'], true); if (!$revision) { header('Location: ' . $_SERVER['HTTP_REFERER']); exit; } $current = $rex->getRevision($parameters['_key'], $parameters['_current'], true); if (!$current) { header('Location: ' . $_SERVER['HTTP_REFERER']); exit; } $info = array('r_autoid' => $revision->sv_autoid, 'r_author' => $revision->sv_author, 'r_action' => $revision->sv_action, 'r_revision' => Date::timestamp($revision->sv_revision, 'F j, Y - g:ia'), 'r_changelog' => $revision->sv_changelog, 'r_current' => $revision->sv_current, 'r_deleted' => $revision->sv_deleted); unset($revision->sv_autoid); unset($revision->sv_author); unset($revision->sv_action); unset($revision->sv_revision); unset($revision->sv_changelog); unset($revision->sv_current); unset($revision->sv_deleted); $cinfo = array('c_autoid' => $current->sv_autoid, 'c_author' => $current->sv_author, 'c_action' => $current->sv_action, 'c_revision' => Date::timestamp($current->sv_revision, 'F j, Y - g:ia'), 'c_changelog' => $current->sv_changelog, 'c_current' => $current->sv_current, 'c_deleted' => $current->sv_deleted); unset($current->sv_autoid); unset($current->sv_author);
if (!$q->execute($bind)) { die($q->error()); } $total = $q->rows(); $res = $q->fetch($cgi->offset, $limit); $q->free(); loader_import('saf.GUI.Pager'); $pg = new Pager($cgi->offset, $limit, $total); $pg->url = site_prefix() . '/index/usradm-browse-action?list=log&orderBy=' . urlencode($cgi->orderBy) . '&sort=' . urlencode($cgi->sort) . '&_type=' . urlencode($cgi->_type) . '&_user='******'&_range=' . urlencode($cgi->_range); $pg->setData($res); $pg->update(); loader_import('saf.Misc.TableHeader'); $headers = array(new TableHeader('ts', intl_get('Date/Time')), new TableHeader('type', intl_get('Type')), new TableHeader('user', intl_get('User')), new TableHeader('ip', intl_get('IP Address')), new TableHeader('message', intl_get('Message'))); loader_import('cms.Versioning.Rex'); loader_import('cms.Versioning.Facets'); $rex = new Rex(false); $rex->bookmark = true; $rex->facets['type'] = new rSelectFacet('type', array('display' => intl_get('Type'), 'type' => 'select')); $rex->facets['type']->preserve = array('list', 'offset', 'orderBy', 'sort'); $rex->facets['type']->options = assocify(db_shift_array('select distinct type from sitellite_log where type != "" order by type asc')); $rex->facets['type']->count = false; $rex->facets['user'] = new rSelectFacet('user', array('display' => intl_get('User'), 'type' => 'select')); $rex->facets['user']->preserve = array('list', 'offset', 'orderBy', 'sort'); $rex->facets['user']->options = assocify(db_shift_array('select distinct user from sitellite_log where user != "" order by user asc')); $rex->facets['user']->count = false; $rex->facets['range'] = new rSelectFacet('range', array('display' => intl_get('Date Range'), 'type' => 'select')); $rex->facets['range']->preserve = array('list', 'offset', 'orderBy', 'sort'); $rex->facets['range']->options = array('day' => intl_get('Day'), 'week' => intl_get('Week'), 'month' => intl_get('Month'), 'year' => intl_get('Year')); $rex->facets['range']->count = false; $rex->facets['range']->all = false; echo '<p style="clear: both">' . $rex->renderFacets() . '</p>';
function MultilingualTranslateForm() { parent::MailForm(); $this->autosave = true; global $page, $cgi, $intl; $intl->language = $cgi->_lang; $intl->charset = $intl->languages[$intl->language]['charset']; $this->extra = 'id="multilingual-translate-form"'; $w =& $this->addWidget('template', '_header'); $this->lang = multilingual_filter_lang($cgi->_lang); $this->reflang = multilingual_filter_lang(intl_default_lang()); $w->template = '<tr><th colspan="2" width="50%">{intl Language}: {lang}</th><th width="50%">{intl Reference}: {reflang}</th></tr>'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); $doc = $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 (in_array($k, array($rex->key, 'sitellite_status', 'sitellite_access', 'sitellite_startdate', 'sitellite_expirydate', 'sitellite_owner', 'sitellite_team'))) { unset($this->widgets[$k]); continue; } if ($v->name != '_header' && !in_array($v->type, array('text', 'textarea', 'xeditor'))) { unset($this->widgets[$k]); continue; } if (strtolower(get_class($this->widgets[$k])) == 'mf_widget_xeditor') { $this->extra = 'onsubmit="xed_copy_value (this, \'' . $k . '\')"'; } if (isset($doc->{$k})) { $this->widgets[$k]->reference = $doc->{$k}; } } $w =& $this->addWidget('hidden', '_key'); $w =& $this->addWidget('hidden', '_collection'); $w =& $this->addWidget('hidden', '_lang'); $w =& $this->addWidget('status', '_status'); $w->alt = intl_get('Translation Status'); $w->setValue('draft'); $w->reference = ''; // submit buttons $w =& $this->addWidget('msubmit', 'submit_button'); $w->reference = ''; $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('Translating') . ' ' . $rex->info['Collection']['singular'] . ': ' . $doc->{$rex->key}); } else { page_title(intl_get('Translating Item') . ': ' . $doc->{$rex->key}); } $tr = new Translation($cgi->_collection, $cgi->_lang); $curr = $tr->get($cgi->_key); if ($curr) { foreach ($curr->data as $k => $v) { if (isset($this->widgets[$k])) { $this->widgets[$k]->setDefault($v); } } $this->widgets['_status']->setDefault($curr->sitellite_status); } }
function onSubmit($vals) { loader_import('cms.Versioning.Rex'); $collection = $vals['collection']; unset($vals['collection']); if (empty($collection)) { $collection = 'sitellite_sidebar'; } $return = $vals['_return']; unset($vals['_return']); $changelog = $vals['changelog']; unset($vals['changelog']); $rex = new Rex($collection); // default: database, database //$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['section1']); unset($vals['section3']); if (!$vals['show_on_pages']) { $vals['show_on_pages'] = ''; } $res = $rex->create($vals, $changelog); if (isset($vals[$rex->key])) { $key = $vals[$rex->key]; } elseif (!is_bool($res)) { $key = $res; } else { $key = 'Unknown'; } 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('add', array('collection' => $collection, 'key' => $key, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key)); session_set('sitellite_alert', intl_get('Your item has been created.')); if (!empty($return)) { header('Location: ' . $return); exit; } header('Location: ' . site_prefix() . '/index/cms-browse-action?collection=sitellite_sidebar'); exit; } }
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; }
<?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.'); } }
* - 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.'); } } }
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; } }
global $cgi; if (empty($cgi->collection)) { header('Location: ' . site_prefix() . '/index/cms-cpanel-action'); exit; } loader_import('cms.Versioning.Rex'); loader_import('saf.GUI.Pager'); //loader_import ('saf.Misc.TableHeader'); //loader_import ('cms.Versioning.Facets'); $limit = session_pref('browse_limit'); if (!isset($cgi->offset)) { $cgi->offset = 0; } $data = array('collection' => $cgi->collection); $rex = new Rex($cgi->collection); if (!$rex->collection) { header('Location: ' . site_prefix() . '/index/cms-cpanel-action'); exit; } // get access control $struct = array_keys($rex->getStruct()); $acl = array(); if (!$struct) { $struct = array(); } else { $acl_list = session_allowed_access_list(); if (!in_array('all', $acl_list)) { foreach ($struct as $k) { if ($k == 'sitellite_access') { $acl = array('sitellite_access' => new rList('sitellite_access', session_allowed_access_list()));
<?php // BEGIN CLI KEEPOUT CHECKING if (php_sapi_name() !== 'cli') { // Add these lines to the very top of any file you don't want people to // be able to access directly. header('HTTP/1.1 404 Not Found'); echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" . "<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n" . "The requested URL " . $PHP_SELF . " was not found on this server.<p>\n<hr>\n" . $_SERVER['SERVER_SIGNATURE'] . "</body></html>"; exit; } // END CLI KEEPOUT CHECKING loader_import('cms.Versioning.Rex'); foreach (Rex::getCollections() as $collection) { $rex = new Rex($collection); if ($rex->isVersioned) { $rex->scan(); if (count($rex->fixed) > 0) { echo count($rex->fixed) . ' items were synchronized from collection: ' . $collection . ".\n"; } } }
<?php header('Location: ' . site_prefix() . '/index/siteblog-app'); exit; global $cgi; foreach ($parameters as $k => $p) { $cgi->{$k} = $p; } loader_import('cms.Versioning.Rex'); $rex = new Rex('siteblog_post'); loader_import('siteblog.Filters'); page_add_style(site_prefix() . '/inc/app/siteblog/html/post.css'); //if (! empty ($cgi->template)) { // $template = $cgi->template; //} else { $template = 'posts.spt'; //} if (!empty($cgi->maxlen)) { $maxlen = $cgi->maxlen; } else { $maxlen = false; } $tproperties = db_fetch_array('select * from siteblog_category'); foreach ($tproperties as $t) { $properties[$t->id] = array('poster_visible' => $t->poster_visible, 'comments' => $t->comments); } if (isset($cgi->complex)) { if (isset($cgi->head)) { echo template_simple('browsehead.spt', array('title' => 'Search Results')); } $query = 'select * from siteblog_post ';
// BEGIN CLI KEEPOUT CHECKING if (php_sapi_name() !== 'cli') { // Add these lines to the very top of any file you don't want people to // be able to access directly. header('HTTP/1.1 404 Not Found'); echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" . "<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n" . "The requested URL " . $PHP_SELF . " was not found on this server.<p>\n<hr>\n" . $_SERVER['SERVER_SIGNATURE'] . "</body></html>"; exit; } // END CLI KEEPOUT CHECKING // googlesitemap scheduler task // Generates a Google Site Map of your website. // Note: Only works in document root installations. $urls = array(); loader_import('cms.Versioning.Rex'); foreach (Rex::getCollections() as $table) { $rex = new Rex($table); if (!$rex->collection) { echo 'Collection "' . $table . '" failed to load. Continuing.' . NEWLINE; continue; } if (empty($rex->info['Collection']['sitesearch_url'])) { continue; } $find = array(); if (!empty($rex->info['Collection']['sitesearch_include_field'])) { $find[$rex->info['Collection']['sitesearch_include_field']] = new rEqual($rex->info['Collection']['sitesearch_include_field'], 'yes'); } $struct = $rex->getStruct(); if (isset($struct['sitellite_status'])) { $find['sitellite_status'] = new rEqual('sitellite_status', 'approved'); }