children() as $name => $value) { $config[$name] = (string) $value; } if($_POST['submit_reply'] == 'Post') { //Initialize Cascade Interface Handler $service = new AssetOperationHandlerService; $service->url = $config['cascade-url'] . 'ws/services/AssetOperationService?wsdl'; //Create Authentication Object $auth = new authentication; $auth->username = $config['cascade-user']; $auth->password = $config['cascade-pass']; //Create the page for the new post $page = new page; $page->name = 'post' . date('mdy') . '_'; $page->parentFolderPath = $config['discussion-path']; $page->configurationSetPath = $config['post-config-set']; $page->metadataSetPath = "Default"; $page->shouldBePublished = true; $page->shouldBeIndexed = true; //Populate the structured data definition $page->structuredData = new structuredData; $page->structuredData->definitionPath = $config['post-data-def']; $page->structuredData->structuredDataNodes = new structuredDataNodes; //Define Parent Post asset $page->structuredData->structuredDataNodes->structuredDataNode[0] = new structuredDataNode; $page->structuredData->structuredDataNodes->structuredDataNode[0]->type = 'asset'; $page->structuredData->structuredDataNodes->structuredDataNode[0]->assetType = 'page'; $page->structuredData->structuredDataNodes->structuredDataNode[0]->identifier = 'parent'; $page->structuredData->structuredDataNodes->structuredDataNode[0]->pagePath = $_POST['path']; //Define username text node $page->structuredData->structuredDataNodes->structuredDataNode[1] = new structuredDataNode; $page->structuredData->structuredDataNodes->structuredDataNode[1]->type = 'text'; $page->structuredData->structuredDataNodes->structuredDataNode[1]->identifier = 'username'; $page->structuredData->structuredDataNodes->structuredDataNode[1]->text = $_POST['username']; //Define subject text node $page->structuredData->structuredDataNodes->structuredDataNode[2] = new structuredDataNode; $page->structuredData->structuredDataNodes->structuredDataNode[2]->type = 'text'; $page->structuredData->structuredDataNodes->structuredDataNode[2]->identifier = 'subject'; $page->structuredData->structuredDataNodes->structuredDataNode[2]->text = $_POST['subject']; //Define body of post $page->structuredData->structuredDataNodes->structuredDataNode[3] = new structuredDataNode; $page->structuredData->structuredDataNodes->structuredDataNode[3]->type = 'text'; $page->structuredData->structuredDataNodes->structuredDataNode[3]->identifier = 'body'; $page->structuredData->structuredDataNodes->structuredDataNode[3]->text = $_POST['body']; //Execute call to create new asset $asset = new asset; $asset->page = $page; $service->create($auth, $asset); //Publish the discussion board $id = new identifier; $id->path = $config['discussion-path']; $id->type = 'folder'; $service->publish($auth, $id); header('Location: ' . $_POST['php_path']); }elseif($_POST['submit_topic'] == 'Create') { //Initialize Cascade Interface Handler $service = new AssetOperationHandlerService; $service->url = $config['cascade-url'] . 'ws/services/AssetOperationService?wsdl'; //Create Authentication Object $auth = new authentication; $auth->username = $config['cascade-user']; $auth->password = $config['cascade-pass']; //Create the page for the new post $page = new page; $page->name = 'topic_' . strtolower(str_replace(' ', '', $_POST['topic'])); $page->parentFolderPath = $config['discussion-path']; $page->configurationSetPath = $config['topic-config-set']; $page->metadataSetPath = "Default"; $page->shouldBePublished = true; $page->shouldBeIndexed = true; //Populate the structured data definition $page->structuredData = new structuredData; $page->structuredData->definitionPath = $config['topic-data-def']; $page->structuredData->structuredDataNodes = new structuredDataNodes; //Define subject text node $page->structuredData->structuredDataNodes->structuredDataNode[0] = new structuredDataNode; $page->structuredData->structuredDataNodes->structuredDataNode[0]->type = 'text'; $page->structuredData->structuredDataNodes->structuredDataNode[0]->identifier = 'topic'; $page->structuredData->structuredDataNodes->structuredDataNode[0]->text = $_POST['topic']; //Define body of post $page->structuredData->structuredDataNodes->structuredDataNode[1] = new structuredDataNode; $page->structuredData->structuredDataNodes->structuredDataNode[1]->type = 'text'; $page->structuredData->structuredDataNodes->structuredDataNode[1]->identifier = 'description'; $page->structuredData->structuredDataNodes->structuredDataNode[1]->text = $_POST['description']; //Execute call to create new asset $asset = new asset; $asset->page = $page; $service->create($auth, $asset); //Publish the discussion board $id = new identifier; $id->path = $config['discussion-path']; $id->type = 'folder'; $service->publish($auth, $id); header('Location: ' . $_POST['php_path']); }else { if($_POST['php_path'] != '') { header('Location: ' . $_POST['php_path']); } else{ print("This script was called from an invalid page."); } } ?>