diff options
author | zotlabs <mike@macgirvin.com> | 2016-11-28 11:19:20 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2016-11-28 11:19:20 -0800 |
commit | 90f3cc7328511083ec226305a7bd7faeda12cb39 (patch) | |
tree | d99b779b87cd483ee114b73118dfe6269d95c668 /Zotlabs/Module | |
parent | 7de4f1d96f5f1fe4dccd56c1456df1d82aa5c30b (diff) | |
parent | 683a09781ad9c9be00ce67e35f560e6fca051f3b (diff) | |
download | volse-hubzilla-90f3cc7328511083ec226305a7bd7faeda12cb39.tar.gz volse-hubzilla-90f3cc7328511083ec226305a7bd7faeda12cb39.tar.bz2 volse-hubzilla-90f3cc7328511083ec226305a7bd7faeda12cb39.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Help.php | 33 | ||||
-rw-r--r-- | Zotlabs/Module/Wiki.php | 13 |
2 files changed, 44 insertions, 2 deletions
diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index 570e8e0cf..27d94e405 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -44,8 +44,39 @@ class Help extends \Zotlabs\Web\Controller { return $o; } + + + if(argc() > 2 && argv(argc()-2) === 'assets') { + $path = ''; + for($x = 1; $x < argc(); $x ++) { + if(strlen($path)) + $path .= '/'; + $path .= argv($x); + } + $realpath = 'doc/' . $path; + //Set the content-type header as appropriate + $imageInfo = getimagesize($realpath); + switch ($imageInfo[2]) { + case IMAGETYPE_JPEG: + header("Content-Type: image/jpeg"); + break; + case IMAGETYPE_GIF: + header("Content-Type: image/gif"); + break; + case IMAGETYPE_PNG: + header("Content-Type: image/png"); + break; + default: + break; + } + header("Content-Length: " . filesize($realpath)); - $content = get_help_content(); + // dump the picture and stop the script + readfile($realpath); + killme(); + } + + $content = get_help_content(); return replace_macros(get_markup_template('help.tpl'), array( '$title' => t('$Projectname Documentation'), diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 0c848bc7c..37ebe2a38 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -382,7 +382,18 @@ class Wiki extends \Zotlabs\Web\Controller { } $page = wiki_create_page($name, $resource_id); if ($page['success']) { - json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']), 'success' => true)); + $ob = \App::get_observer(); + $commit = wiki_git_commit(array( + 'commit_msg' => t('New page created'), + 'resource_id' => $resource_id, + 'observer' => $ob, + 'files' => array($page['page']['urlName'].'.md') + )); + if($commit['success']) { + json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.$page['page']['urlName'], 'success' => true)); + } else { + json_return_and_die(array('message' => 'Error making git commit','url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']),'success' => false)); + } } else { logger('Error creating page'); json_return_and_die(array('message' => 'Error creating page.', 'success' => false)); |