コード例 #1
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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');
 }
コード例 #2
0
ファイル: index.old.php プロジェクト: vojtajina/sitellite
 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;
 }
コード例 #3
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
 }
コード例 #4
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
 }
コード例 #5
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
     }
 }
コード例 #6
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
     }
 }
コード例 #7
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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');
 }
コード例 #8
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
 }
コード例 #9
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
     }
 }
コード例 #10
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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;
     }
 }
コード例 #11
0
ファイル: index.php プロジェクト: vojtajina/sitellite
 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
ファイル: index.php プロジェクト: vojtajina/sitellite
 function onSubmit($vals)
 {
     loader_import('cms.Versioning.Rex');
     unset($vals['collection']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $vals['body'] =& $vals['file'];
     unset($vals['file']);
     if (!empty($vals['name'])) {
         $vals['name'] = $vals['folder'] . '/' . $vals['name'];
     } else {
         $vals['name'] = $vals['folder'] . '/' . $vals['body']->name;
     }
     if (strpos($vals['name'], '/') === 0) {
         $vals['name'] = substr($vals['name'], 1);
     }
     unset($vals['folder']);
     $rex = new Rex('sitellite_filesystem');
     //$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']);
     $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_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('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_filesystem');
         exit;
     }
 }
コード例 #13
0
ファイル: index.php プロジェクト: vojtajina/sitellite
         if (empty($parts['extension'])) {
             $new_name = rtrim($new_name, '.');
         }
         $n++;
     }
     $info->name = ltrim($new_name, '/');
     $size = $info->filesize;
     unset($info->filesize);
     unset($info->last_modified);
     unset($info->date_created);
     $info->sitellite_status = 'draft';
     $info->sitellite_access = 'private';
     $info->sitellite_team = session_team();
     $info->sitellite_owner = session_username();
     // todo: copy directories
     $res = $rex->create((array) $info, 'Duplicated from ' . $path);
     if (!$res) {
         webfiles_error(409, $rex->error);
     }
     chmod($prefix . $new_name, 0777);
     webfiles_workflow('add', $info->name, $info, 'Duplicated from ' . $path . ' via the Sitellite Desktop');
     webfiles_response((object) array('type' => mime($new_name), 'name' => $new_name, 'size' => $size, 'created' => date('Y-m-d H:i:s'), 'modified' => date('Y-m-d H:i:s'), '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($new_name)));
     break;
 case 'delete':
     $path = webfiles_request();
     $info = $rex->getCurrent(ltrim($path, '/'));
     if (!$info) {
         webfiles_error(404, 'Not found');
     }
     $info2 = clone $info;
     unset($info2->body);