Coder Social home page Coder Social logo

devaneando / wikitten Goto Github PK

View Code? Open in Web Editor NEW
735.0 50.0 174.0 2.34 MB

Wikitten is a small, fast, PHP wiki, and the perfect place to store your notes, code snippets, ideas, and so on.

License: MIT License

PHP 77.54% HTML 4.29% Shell 1.19% CSS 13.42% JavaScript 0.54% Python 0.66% Ruby 0.53% Scheme 1.49% Dockerfile 0.09% TSQL 0.26%

wikitten's Introduction

Wikitten

Wikitten is a small, fast, PHP wiki, and the perfect place to store your notes, code snippets, ideas, etc.

Check out the project website for more details and features.

Wikitten

Docker

Wikitten is Docker ready. To configure it, copy the first create a docker/.env file and set the HTTP port and your library folder.

wikitten's People

Contributors

1element avatar caffe1neadd1ct avatar datkinson avatar devaneando avatar eightminuseight avatar filp avatar guillermocalvo avatar isaac-perkins avatar jacobgreenleaf avatar jbchouinard avatar johnolinda avatar kovah avatar oldratlee avatar pherrymason avatar praveenscience avatar s-n-i-p-e-r avatar spfng avatar victorstanciu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wikitten's Issues

HTTP 200 when page doesn't exist

index2.md doesn't exist and thus goes to the uhoh.php page:

curl -I http://wikitten.vizuina.com/index2.md
HTTP/1.1 200 OK
Date: Tue, 19 Jan 2016 15:32:37 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.45-3+deb.sury.org~precise+1
Vary: Accept-Encoding
Content-Type: text/html

By inserting the following in uhoh.php, it returns a 404 and prevents dead links from being indexed:

<?php header("HTTP/1.0 404 Not Found"); ?>

XSS vulnerabilities

Is it possible to forbid the javascript code execution and avoid the xss vulnerabilities ?
or add an option to forbid the html code execution and only allow markdown code.

PHP 7 support?

This may just be a case of lack of documentation.

The README only mentions PHP5. Does this software work with PHP 7? More specifically 7.3 and the upcoming PHP 7.4?

Nginx?

What would be nginx equivalent of .htaccess rewrite rules for the wiki to run properly?

Update project website

Might be a good idea to update the project website, since quite a few new features were added since then :)

Cheers!

Saving changes converts Unix to Mac

When editing a file in the interface and saving, all existing Unix line-endings and any new ones are converted to Mac line-endings.

This leads to ugly diffs and other issues for anyone who keeps their library directory under version control

Add jquery.min.map to /static/js/

Modern Browsers (Safari, Chrome) throw a HTTP 404 in the development tools, because the map file for the used query.min.js is missing.

You're currently using Version 1.9.1 of JQuery, so the correct map file is located here:
http://code.jquery.com/jquery-1.9.1.min.map

You additionally need to change the filename in the first line of that map file into jquery.min.js, because you're not providing the JQuery version in your js-filename.

Cheers!

stylefixes on a fork

hello, tonight i saw your project and begann to "merge" into my pluginsys.. it looks really nice. because my project don't use rewrites right now, i've rewritten some stuff, so it recive data over a get-variable now. Also not possible is the base-tag since he kills everything else there (links).

there's something to do, may you like it, may you ignore it.. anyway, my question is about style.. whenever i press "Toggle source" code will go on the right boarder with one sign per line.

weird because i didn't change any css and on your project it's working nice.. i have no idea. may for you it's something on first view.

and maybe your interessted in that fork too.
http://dev.thoeni.me/peta/plugin.php?plugin=30&page=nospacefoldr%2FBash.sh
(dont delete pluginid there)
https://github.com/skamster/Peta/tree/master/plugins/wikittenPlugin
changes are mostly made by discount index.php and mod wiki.php + tree.php

so, i'm very tired, good day/night..

EDIT: should be marked as question, not as bug. of course it's not your issue, it's mine.. sry, i fail there..

Everything except index.md does not work

I think there is an error with this.

If you download/clone the repository, put the files in your documentRoot i.e for apache on linux:

/var/www/Wikitten/

Then go to
http://[your ip]/Wikitten the index page loads, however none of the links on the side, in the tree work - they all result in page could not be found.

So for me I can see inthe browser that is is trying to go to:

https://[my ip]/Wikitten/Sample%20HTML%20document.html

Which does not exist.

I may have set it up incorrectly however I believe I am following the instructions properly.

how to customize css

hi
i write my markdown file use typora local,then upload the .md file to library,but it can't nicely render. such as line feed.
how can i sove this problem? Could i use my typora css?

thank you very much.

Feature Request

Can we use ParseDown instead of Markdown original? This also has Extra and other features that Markdown has. :) Do let me know if I can help in finishing this work?

Use PJAX

It would be interesting to use PJAX to load only the content and not the entire page each time we click on a link.

I begin the integration, but when I load a page of code, codemirror don't load.

`Code` block does not wrap

Lines quoted with backticks (`) don't wrap and continue off the screen. This happens whether there are spaces or not.

Here's an example of proper implementation:

A-Really-Long-Line-of-Text:WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

Wikitten not work on windows

Hello,

i use wikitten on a linux server.
It works fine.

When i start the wiki on a windows server i get a error message.

PHP Fatal error: Uncaught exception 'Exception' with message 'Page 'index.md' was not found' in C:\xampp\htdocs\wikitten\wiki.php:41

And here the trace:

Stack trace:
#0 C:\xampp\htdocs\wikitten\wiki.php(45): Wiki->{closure}()
#1 C:\xampp\htdocs\wikitten\wiki.php(331): Wiki->_render('index.md')
#2 C:\xampp\htdocs\wikitten\wiki.php(269): Wiki->indexAction()
#3 C:\xampp\htdocs\wikitten\index.php(52): Wiki->dispatch()
#4 {main}

thrown in C:\xampp\htdocs\wikitten\wiki.php on line 41

Who can help?

Your sincerly

Stephan

Wiki is vulnerable to injection

The wiki pages are vulnerable to javascript injection. Putting this on a page is risky.

can a routine be run on "Saving changes" to check for and encode any script tags in the wiki are protected against?

Add RewriteBase to .htaccess

I run my local webpage out of my home directory using mod_userdir. Whenever I would click a link I would get "index.php was not found on this server". Eventually I figured out it was necessary to add RewriteBase /~my-user-name/ to the .htaccess. It might be useful to mention in the installation instructions that you need to set the RewriteBase directive if you don't want to or can't run the wiki from the webroot.

if no index.md found, try README.md

It would be nice to be able to mirror Github repos/docs on WIkitten. Currently Github displays contents of README.md in each directory, if found.

Can we add a check so if no index.md is found, the wiki tries README.md?

feature request: added markdown extension

.htm and .html are valid extensions for HTML files. Could a change be made to add .mdown and .markdown as valid MARKDOWN extensions to the existing .md to allow the rederer to render them? Personally I only use .markdown (and .md if the file is from someone else) but I have seen .mdown as a MARKDOWN extension.

PHP Syntax Highlighting Broken in codemirror.min.js

The latest version of Wikitten/static/js/codemirror.min.js seems to have broken PHP syntax highlighting.

Pulling back in the Wikitten/static/js/codemirror.min.js file from commit 063f1bf fixes the sample PHP.php files highlighting.

Trying to work out the cause however working through this file could be fun! Any help would be appreciated 👍

Have you considered being able to add new pages to folders?

I was wondering whether adding new pages to the wiki from the web page is possible or is a future idea?

It could just be a button that adds a .md file to a folder with a name set by the user. Then the user edits it in the normal way(s).

scandir and character encoding

I've just installed Wikitten and started to play with it (looks very nice!), adding files and directories. My OS is Windows 7 and I've noticed that when files and folder names have special characters (e.g. accented chars), they're not properly rendered. A quick workaround for my particular situation was to add:

$item = iconv("windows-1250", "UTF-8", $item);

after https://github.com/victorstanciu/Wikitten/blob/master/wiki.php#L238
(EDIT: not a workaround because then the links don't work anymore).

Any idea for some more general and robust solution that could be included in your code?

finfo_open()

PHP Version 5.4.7

Fatal error: Call to undefined function finfo_open()

Major Upgrade Features Planned to make this my Evernote replacement...

Upgrades to Wikitten to make it my Evernote Replacement!

Below is my to modify the app to fit my own personal needs. If anyone has ideas, feel free the mention in the comments and I might implement them as well.

My goal is to remain a file, non-DB app for easy portability. However many of my upgrades below would benefit and open up more possibilities if I decided to switch to a database down the road.

Luckily there is SQLite which is a file based Database. SO I could easily use SQLite and still be a file based portable app! For now though I am going to not use a DB if I can.

Real Plugin System

  • I have a Plugin system that is exact clone of WordPress plugin system.
  • Has action hooks which can be ran in the code-base everywhere some sort of action happens.
  • plugin folder, reads the top comment block of plugin files to get the name, description, version, author, etc...
  • in the plugins, they can hook into the above action hooks to truly have a realy working plugin system that allows people the extend this beyond the imagination without touching the core code base! Right now the plugins folder has the PluginBin.php file and it is enabled in the config file manually and then it is manually called in the render.php file. With the new system, any plugin could hook into the render.php file without any manual hard coding names like it is now.

New Default Plugins that I have planned so far. Please do mention your ideas for other plugins!

Most of these plugins mentioned here can hook into the on-save action event or on the render action event. The embed plugins below might be best hooked in on the render action so that files saved outside of the app will also be processed. Something like the JS beatificastion might be better to run on save so that it doesnt have to run on every view! Really up to the user though.

Embed style plugins

These things might be called in the format of a short_code like WordPress uses. So when the file is parsed and a shortcode is detected it is replaced with the embed code for that plugin.

  • CodePen embed plugin to show embedded CodePens
  • JSFiddle embed plugin to show embedded JSFiddles
  • GitHub Gist embed plugin to show embedded GitHub Gists
  • YouTube Video embed plugin to show embedded Videos
  • SlideShare.net Slideshow Embed Plugin

Render plugins

  • JavaScript Beautification Plugin - can be a button or a setting in config to pass JS files though this to format them nicely.
  • CSSComb Sort CSS Properties Plugin - Button and/or config setting to pass CSS files thorugh CSSComb whichsorts CSS definition properties in a set uniform order.
  • images Optimization Plugin - are uploaded into the media manger mentioned below, pass them through an online service to compress/optimize the image before saving.
  • Format SQL Plugin Its a JavaScript library that formats SQL into clean readable syntax

Build File Type Render Mapping

The idea here is to have a list of file extensions and map each one to a render() function.

Right now the MarkDown file maps to render with the Markdown parser.

With this re-engineered and the plugin system, you would be able to add your own custom file types and render() functions for them. This opens up the door to many unique things.

Example....A new Book COllection file type might hold a collection of my programming books in a certain format and my render function could format these type of files to show in a nice tabular format with thumbnail image to the left, book data to the right and format it in a nice way to easily view the collection.

Basically allow you to create templates for different file types to show when viewing them. THe template would have placeholder variables and the render() function for your file type would parse the file to get the template var values and build the final output.

File CRUD Actions

Sidebar

  • Create Folder
  • Rename Folder
  • Delete Folder (if not empty, dialog to ask if child files in the folder should be deleted as well or if they should be removed to another folder first?)

Files

  • Create File
  • Delete File (show confirmation dialog. Also ask if revision/version copies should also be deleted i they exist?)
  • Rename a File
  • Move file to new folder dialog. Click a button to move a file which would then list all folder in a drop-down list and let you select one and on submit it would copy the file to the new location. (the history folder for file revision./versions would have a similar copy of the folder/file structure so will have to also copy the history versions of a file that is moved into its new folder too.)
  • Set another file as the current files Parent file.
    • If this is done, then this file will no longer show up in the sidebar in the list of files unless a switch is toggled to show hidden child files
    • This child file will also now show up on the parent file render page. Just like multiple files shown on a GitHub Gist page!
  • Each file will have the option of turning the file revision/versions on or off for that individual file.
  • Render PDF files in an embedded PDF viewer like Gmail and many other sites use.
  • If a folder has images, show images in a nice large modal window when clicked on and allow keyboard arrow navigation to view through all images in a folder at alarge scale quickly.

Media Manger

  • Just like the Media Manager Modal window in WordPress. It will allow you to biew and insert existing used files over and over> It will also allow you to upload files from computer and from remote URL.
  • On a MarkDown file you can simply click an insert image button or media manager button and the media manger modal window will open up and you can upload a new image or click to insert an existing used image into the document.
  • The files uploaded into Media Manger will be uploaded to a folder that is not shown in the sidebar.
  • When uploading a new file it will also have the option to Crop the image if you want to.

Other File Features

  • Make all files have a distinct view mode and edit mode. Right now only markdown files have a view and edit mode. Code files are always edit mode and I want them to have to click a button to go into edit mode on all files first!
  • Add MarkDown buttons like BBCode style button for quick click to format.
  • If it doesn't exist already, switch the Markdown parser with one that supports GitHub Flavored Markdown so that Tables can be used in Markdown docs.
  • Show Window onUnload Alert if you try to navigate away from the page with un-saved edits.

Multi-file in 1 support like GitHub Gist

  • add capability to embed multiple files into 1 files. Example 1 file could have markdown file and below it a code PHP file and below that a CSS file. The PHP and CSS file embed would then not show up as files in the file lists. Similar to how GitHub Gists can have multiple files in a single Gist. When showing a plugin or code project, often it makes more sense to have them all on 1 page instead of spread out.
    • Solution Idea 1) since it currently is 100% file based with no database. 1 idea to achieve this is to use a file based SQLite Database to store the file name and a parent filed to designate that a file is to belong to a parent file and then do not show any child files in the menu.
    • Solution Idea 2) Same as idea #1 but instead of a SQLite database, use a JSON file to s tore this info.

File Versions/Revisions with DIFF view

  • I really like the DIFF viewer you see on StackOverflow and WordPress used to compare versions of a file/record. The nice side by side DIFF view and Inline DIFF view.
  • Generally apps that do this store the content in a DB but to remain file based the idea is:
    • Anytime a file is saved, from within the apps editor. Save the file as a new version and move the previous file to a history folder.
    • So every save button click if there are changes, would create a new file and then copy/move the existing file to that history folder and would change the file name of the history version to include a DateTime time-stamp in the filename.
    • The DIFF viewer page would then have the capability to compare any 2 files for
      that file record and restore one as the "current".



If I use SQLite Database, it opens up all these possibilities down he road...

  • Store File record for each file that will hold:
    • ID - auto generated ID to use when modifying records and Index
    • File Name
    • File Path
    • File Size
    • File Type
    • create_on Date
    • modified_on Date
    • created_by - User_id of a user in the Users DB table who created the file
    • modified_by - User ID of user who made the last edit.
    • parent_file - If this file is to be shown on another parent files view page, its parent file ID will be here.
    • hide_from_menu - false by default but when a record gets a parent set, based on a setting in the app it will auto set this child file to be hidden from the menu and only show up inside the parent files view page.
    • revisions_on - turn on/off the Revision/Versions capability on a per file basis
    • max_revisions - set the max number of revision files to create. Once this number is reach and a new revision file is made, it will rotate the files deleting the oldest file first.
    • current_version - will be the ID of the current file. This allows an older version in the revisions to be restored and be the set file for this file event though it would have an older date and higher ID number than the most recent copy. (Word Press stores revision records in the same DB table as the post records which makes sense since they have the same exact columns and also mean they don't have to do any JOIN queries to get the versions and change versions. I am undecided on making a new Versions DB table or storing in the FIles table and having a type filed determine a version record vs a file record.)
    • record_type - file, version, image
    • deleted - soft delete.
  • Plugins DB Table
  • Settings table for app and also API for plugins to use it.
  • Could store a folder drag and drop sort order in the sidebar to DB table.
  • Could do a basic user authentication system with ACL and then set view and edit, delete, create permissions on a per user basis and on a ACL group basis. So you could enable/disable the CRUD functionality for a user group and on a per user basis. This could also be set on a per file or per folder basis.
  • Could do things like restrict access to certain files with a password or something similar. Would probably do something like encrypt the file and folder-names shown in the URL to prevent user from easily getting around the password system. SugarCRM makes there upload files only viewable after passing through a script so user can never know where they are saved. Also they encrypt the URL ID to view the file
  • Audit Log DB table - store every action by every user.

Proposal: Use composer?

This point of this issue is to gather opinions on the possibility of using Composer with Wikitten.

Pros:

  • Better dependency management, code structure
  • No need to include Markdown.php and other future deps. in the code-base
  • Better future-proofness, would allow bringing in some external code for things like a search feature

Cons:

  • One more installation step
  • ?

Problem about APP_DIR

I'm confused about APP_DIR.
If I touch a file named /library/linux/bash.md (with no space),I‘ll get errors when I access http://host.com/linux/bash.md

 `could not find file bash.md` .

That is because of php gets a wrong APP_DIR in index.php:

 /code%20snippets/Bash.sh ->  APP_DIR=
/linux/bash.sh ->  APP_DIR=/linux

I've fixed it by reset APP_DIR as defined('APP_DIR', ''); in index.php

BTW, I'm looking forward that creating / updating files directly through the web interface. It would be awesome if you add this markdown editor: https://stackedit.io/

Index wrong on windows

image

image

Hi, could get some help from you.
as you can see, the index on the left is not refer to the exact place 'library', while refer to the root place. It troubles me long time. How can I make the left index refer to where it being list.

How about disqus support?

Is it possible to add disqus support under Markdown document page?
This should be good if visiters want to leave some comments on my Wiki page.

Thanks

Uranus

Default file extension

Would be nice to have cleaner URLs such as

http://server/support (really support.md on disk)
http://server/contact (really contact.md on disk)
http://server/todo (really todo.md on disk)

and when Wikitten notices there's no extension, it implies ".md" at the end. This allows a "pretty" URL and on disk, still stored as MarkDown. This would require tweaks of the tree.php as well. I made this change in index.php, just after $request_uri = parse_url($_SERVER['REQUEST_URI']);

if( strlen(pathinfo($request_uri['path'], PATHINFO_EXTENSION)) === 0) {
    $request_uri['path'] .= ".md";
}

but I think there's more work to be done

Proposal: new theme-s

First of all thank you for this great wiki script based on md - I am in love with it, completely!

As I discovered this only last night and had play with it and fixed prettyfi.css for your default theme and also today I created new theme.. its main.css changes mainly but there is one line modified in php - toggle source button - Just renamed to Raw Source. Also I added print overrides to main.css so when you printing the page you see only content, no sidebar and breadcrumbs. Breadcrumbs are also not visible on mobile phones as main menu is on top of the screen. In the end I've decided to add also scroll to top button as I do have some document contents quiet long and its quiet good when you viewing wiki from mobile.

My private personal documentation (as you can see I still have even original md files which came with cms)

gswiki

URL Rewriting?

I believe this is an issue with the configuration of URL rewriting. I'm running Wikitten internally on an Ubuntu server. It's installed in the Apache root /var/www/html. Wikitten loads fine for the homepage, but as soon as I click a link in the nav it attempts to go to say http://{ip}/Sample HTML document.html and I get a 404 since that file is actually in http://{ip}/library/Sample HTML document.html.

Do I need other rewrite rules that aren't included in the default install? Seems like a great project, but documentation is certainly light.

Possible failure when running built-in php server

In routing.php new code has been added:

<?php
if (!defined('APP_STARTED')) {
    die('Forbidden!');
}

But, wouldn't APP_STARTED be false when runningphp -S 0.0.0.0:8888 routing.php? Because, routing.php has not had a chance to run index.php where APP_STARTED is set to true?

Steven

blank page

so i loaded everything up and all was well. so i removed all the files in library and changed index.md to my liking and reloaded and i get a blank page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.