Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- if(!$_POST){
- ?>
- <form name="input" action="/confluence/create-file.php" method="POST">
- Space key: <input type="text" name="space_key" value="TO" /><br />
- Titel pagina: <input type="text" name="page_title" value="" /><br />
- <input type="submit" value="Aanmaken" />
- </form>
- <?php
- die;
- }
- $soapClient = new SoapClient(null, array(
- "location" => "http://shopworks.atlassian.net/confluence/rpc/soap-axis/confluenceservice-v1?wsdl",
- "uri" => "http://soap.rpc.confluence.atlassian.com",
- "trace" => TRUE));
- $soapClient = new SoapClient(
- "http://shopworks.atlassian.net/confluence/rpc/soap-axis/confluenceservice-v2?wsdl"
- ,array("trace" => 1, "exceptions" => 0)
- );
- $token = $soapClient->login('username', 'password');
- if(isset($_POST['space_key']) && isset($_POST['page_title']) && strlen($_POST['page_title'])>0 && strlen($_POST['space_key'])>0){
- $name = $_POST['page_title'];
- $key = $_POST['space_key'];
- }else{
- echo 'Geen space key of pagina title opgegegeven <a href="/confluence/create-file.php">Terug</a>';
- die;
- }
- $page = $soapClient->getPage($token,$key,$name);
- $page2 = $soapClient->renderContent($token, $key, $page->id);
- $attachments = $soapClient->getAttachments($token,$page->id);
- foreach($attachments as $attachment){
- $file = file_get_contents((string)$attachment->url.'&os_username=username&os_password=password');
- $dir = "/home/shopworks/www/wiki/download/attachments/".$page->id.'/';
- if(!is_dir($dir)){
- mkdir($dir, 0777);
- chmod($dir, 0777);
- }
- file_put_contents($dir.$attachment->fileName, $file);
- }
- $style ='
- div#Content {
- width: 1160px;
- margin: 0px auto;
- padding: 0px 20px 300px 20px !important;
- background-color: #fff;
- border-left: 1px solid #efefef;
- border-right: 1px solid #efefef;
- }
- h1, h2, h3, h4 {
- font: normal 11px/30px Arial, sans-serif;
- margin: 0px 0px 5px 0px;
- }
- h1 {
- color: #b01f24;
- font-size: 30px;
- }
- h2 {
- color: #be3f43;
- font-size: 25px;
- }
- h3 {
- color: #e843494;
- font-size: 20px;
- }
- h4 {
- color: #feacaf4;
- font-size: 15px;
- }
- body, p, td, table, tr, .bodytext, .stepfield {
- font: normal 12px/20px Arial, sans-serif;
- }
- a:link, a:visited, a:focus, a:hover, a:active, a.blogHeading {
- color: #b01f24;
- text-decoration: none;
- }
- a:hover {
- text-decoration: underline;
- }
- h1, h2, h3, h4, h5, h6, .wiki-content h1, .wiki-content h2, .wiki-content h3, .wiki-content h4, .wiki-content h5, .wiki-content h6, .pagetitle, .steptitle, .substeptitle, .formtitle, table.confluenceTable td.confluenceTd.highlight, table.confluenceTable td.confluenceTd.highlight > p, table.confluenceTable th.confluenceTh, table.confluenceTable th.confluenceTh > p, table.admin th, .form-element-large, .form-element-small, #toolbar #format-dropdown .format-h1 a, #toolbar #format-dropdown .format-h2 a, #toolbar #format-dropdown .format-h3 a, #toolbar #format-dropdown .format-h4 a, #toolbar #format-dropdown .format-h5 a, #toolbar #format-dropdown .format-h6 a {
- color: #be3f43;
- }
- div#holderFooterShopWorks {
- position: fixed;
- bottom: 0px;
- width: 100%;
- color: #fff;
- /*background-color: rgba(167,31,36,0.9);*/
- background-color: #a71f24;
- opacity: 0.90; /* CSS3 standard */
- filter:alpha(opacity=90); /* for internet explorer */
- -moz-opacity:0.90; /* for older gecko browsers */
- -khtml-opacity: 0.90; /* for older webkit browsers */
- }
- div#footerShopWorksContent {
- width: 1160px;
- margin: 0px auto;
- padding: 20px;
- overflow: hidden;
- }
- div#holderFooterShopWorks ul, div#holderFooterShopWorks ul li {
- margin: 0px;
- padding: 0px;
- }
- div#holderFooterShopWorks ul li {
- float: left;
- list-style: outside;
- list-style: none;
- line-height: 22px;
- }
- div#holderFooterShopWorks ul li ul li {
- display: block;
- width: 100%;
- }
- div#holderFooterShopWorks ul li a {
- color: #fafafa; /*rgba(255,255,255,0.6);*/
- opacity: 0.60; /* CSS3 standard */
- filter:alpha(opacity=60); /* for internet explorer */
- -moz-opacity:0.60; /* for older gecko browsers */
- -khtml-opacity: 0.60; /* for older webkit browsers */
- }
- div#holderFooterShopWorks ul li.title {
- color: #fff;
- font-size: 22px;
- margin: 0px 0px 20px 0px;
- }
- div#holderFooterShopWorks ul li#contact {
- float:right;
- width: 140px;
- }
- </style>
- <meta http-equiv="X-UA-Compatible" content="IE-edge,chrome=1" />
- ';
- $footer = '<div id="holderFooterShopWorks">
- <div id="footerShopWorksContent">
- <ul>
- <li>
- <ul>
- <li class="title">ShopWorks</li>
- <li><a href="http://www.shopworks.nl" title="ShopWorks">ShopWorks.nl</a></li>
- <li><a href="http://twitter.com/shopworks_nl" title="Twitter">Twitter</a></li>
- <li><a href="http://www.linkedin.com/company/shopworks_nl" title="Twitter">LinkedIn</a></li>
- </ul>
- </li>
- <li>
- <ul>
- <li class="title">ShopWorks Support</li>
- <li><a href="https://shopworksnl.zendesk.com" title="Zenddesk">Supportdesk</a></li>
- <li><a href="https://shopworks.atlassian.net/" title="Zenddesk">Wiki (handleidingen)</a></li>
- </ul>
- </li>
- <li id="contact">
- <ul>
- <li class="title">Contact</li>
- <li>ShopWorks B.V.</li>
- <li>Kanaalweg 29</li>
- <li>3526 KM, Utrecht</li>
- <li>T: +31(0)30-6023759</li>
- <li>E: <a href="mailto:info@shopworks.nl">info@shopworks.nl</li>
- </ul>
- </li>
- </ul>
- </div>
- </div></body>';
- function niceName($name){
- $name = str_replace(' ', '_', $name);
- $name = strtolower($name);
- return $name;
- }
- $str = str_replace('</style>',$style, $page2);
- $str = str_replace('</body>',$footer, $str);
- $str = str_replace('<base href="https://shopworks.atlassian.net/wiki"/>','',$str);
- $str = str_replace('+','%20',$str);
- $str = str_replace('%3A',':',$str);
- $str = str_replace('thumbnails','attachments',$str);
- $str = str_replace('<html>','<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', $str);
- $newName = md5(time()).'-'.niceName($name).'.html';
- file_put_contents($newName, $str);
- chmod($newName, 0777);
- echo 'http://www.shopworks.nl/confluence/'.$newName;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement