Saturday, September 22, 2012

My answer to "Installation error on VPS"

This is my answer to a Question on Support site for LampCMS project


A little strange.
Basically this error means that your bootstrap.php was found and loaded, the require.php was found and loaded
and the !inc.php was found and loaded.

Unfortunately the way php outputs the trace from exception is pretty crappy.

This is what you should do:

Open !inc.php in lib directory.
Around line 96 find this line:
echo('Got exit signal in error_handler from ' . $e->getTraceAsString());

replace it with this:
echo('Got exit signal in error_handler. Exception: '.get_class($e).' Error ' . $e->getMessage().' in: '.$e->getFile().' line: '.$e->getLine()."\n<br>Trace: ".$e->getTraceAsString());

This will at least give a much clearer error and will point us to the root of the problem. (hopefully)

Wednesday, September 19, 2012

My answer to "Reputation and ability to post comments"

This is my answer to a Question on Support site for LampCMS project


First of all this is a configurable option. It's set in the [POINTS] of !config.ini
The reason to require some reputation points for comments is to prevent new, less experienced members from potentially taking conversation off-topic with comments. It's also serves as an incentive to earn reputation points with good questions and answers.

These minimal reputation is only required to comment on other people's questions and answers. You can still add comment to your own question without the reputation requirement.



Saturday, September 15, 2012

Image Upload feature added to Lampcms

My Question on Support site for LampCMS project




As you can see, this image has been added using the new uploadfeature.
Now you can upload an image instead of just providing a path to image on the Internet

Image is automatically resized if uploaded image is larger than maximum dimensions defined in config.
If image is resized then resized image will also link to original image which will open in a new window.
Later we can add option to .js file to open original in some type of lightbox.

Default max dimensions are 400 width by 300 height, but you can change these on your site.

This new feature is available on github in the YUIUploader branch and is also included in the official .zip file which can be downloaded from the http://www.lampcms.com/download/ page

There are several configuration options added to !config.ini.dist and also a new permission is added to acl.ini.dist

What you need to do is add this permission to [registered] group in your acl.ini file
upload_image = A

Some new config settings added to [EDITOR] section of !config.ini:

;
; Maximum file size allowed for imageupload
; in megabytes default is 2 meaning 2 Megabytes
;
; To disable imageupload functionality
; set this to 0 or leave empty
;
IMAGE_UPLOAD_FILE_SIZE = 2
;
; Define maximum width,height (comma separated)
; If uploaded image is larger than these limits,
; it will be resized
;
IMAGE_UPLOAD_W_X = "300,200"

;
; Uploads are allowed by logged in users
; Set the min reputation score required to be
; able to upload images
IMAGE_UPLOAD_MIN_REPUTATION = 1
;
; Number of seconds user has to wait between uploads
; Resizing image is CPU and memory intensive.
; This setting helps prevent upload flood
;
MIN_UPLOAD_INTERVAL = 30

This is an initial release of imageuploadfeature. What currently does not work is imageupload in the "Edit" Question or Answer action, it only works during Ask/Answer action

I will add it to Edit soon, it's a bit tricky because what I want to do is when image is removed from the post when post is edited I want to also delete image from the server.

Anyway, it took alot of work to add this seemingly small feature.

Enjoy.

Click here to post your reply


Thursday, September 13, 2012

My answer to "Can this be easily integrated into an existing site?"

This is my answer to a Question on Support site for LampCMS project


Yes, the latest releases of Lampcms make it easy to install in sub-folder of existing website. There are configuration options to define the sub-folder path.

It's also easy to install lampcms libraries in any directory on your server, then just define path to libraries in bootstrap.php

This makes it very easy to host multiple Q&A websites all powered by a single Lampcms distribution. Each site will have own copies of templates and css so you can make them all look unique while still using a single copy of lampcms core library classes.

All you have to do is hook up your existing site's registration/login to the Lampcms. This is a bit of a custom work you have to do but it's not all that difficult if you know how to program in php or know someone who does.

Saturday, September 8, 2012

Image upload for Questions and Answers

My Question on Support site for LampCMS project

Just want to post a little update on the imageupload functionality

I am currently working on adding imageupload functionality to the text editor.
I am using this plugin to YUI RTE as a starting point:
http://allmybrain.com/2010/06/16/yui-image-uploader-works-with-yui-2-8-1/

It's a good start, I have already made changes to JavaScript to make it work with YUI3 based functions.
Now I'm working on the server-side functionality.

It's not a difficult task but there are just a lot of little things I have to implement on the server.
Here is the list:

Only logged-in users will be able to upload images
Uploading of image will be a separate Access permission, configurable in the acl.ini, by default will be enabled for registered users
A configuration option will be used to require minimum reputation in order to allow imageupload
Configuration options for imageupload: max file size, max width and max height.
Image will be resized to fix max width and height. If image had to be resized then the original is also saved separately so that later we can have option to view the original
If user does not have permission or enough reputation to uploadimage then the imageupload button will not even be added to the text editor. Additionally the same permissions/reputation will be checked on the server after image is uploaded just to be sure...
Extra check will be in place to prevent more than "N' uploads per minute. This is to prevent attempts to overload the server by uploading hundreds of images rapidly.

As you can see there are quite a few functions I have to implement and test. It's not very difficult but it will take time, so please be patient - the imageupload functionality is coming... I would estimate to take about 4 more days. I mean working days, and since I work on Lampcms only on weekends it may take up to 4 more weeks.


Click here to post your reply


Friday, September 7, 2012

My answer to "captcha issue - stub.php"

This is my answer to a Question on Support site for LampCMS project


This has been fixed, but it's only available on github. The distribution zip file still has not been updated with all the latest fixes. I'll try to update/upload the new zip file this weekend.

I'm pretty sure that what you have done was actually the fix. The file name was incorrect.

Tuesday, September 4, 2012

My answer to "Search doesn't work for non-english characters"

This is my answer to a Question on Support site for LampCMS project


It seem to not have any problem here. There are no search results but the search for: does show the correct text.

http://support.lampcms.com/search?q=%D0%BD%D0%BE%D0%B2%D0%B0%D1%8F+%D0%B1%D0%BE%D1%80%D1%89

My answer to "Lower case Slug change"

This is my answer to a Question on Support site for LampCMS project


You can do that. Generally I would recommend to always use mb_strtolower instead of strtolower. In this particular case it ok to use strtolower simply because url slugs are converted to ASCII chars. This whole deal with converting slug to ASCII is probably a bad idea, and I will change it in the future.

Anyways, it's just better to use mb_strtolower when developing Lampcms sine all data is stored in utf-8

Problems with this server

My Question on Support site for LampCMS project

I apologize for the downtime today.
I've been having some issues with the server on which this support site and lampcms is hosted.
It may be at the end of it's life, I suspect some problems with the hard drives.

I may have to move to a different host shortly, hopefully will get a brand new dedicated server on the cheap.

Click here to post your reply


Monday, September 3, 2012

My answer to "gibrish when asking questions in non-engilsh characters"

This is my answer to a Question on Support site for LampCMS project


What I mean is that this support site runs on a newer version of Lampcms. If you downloaded the zip file from lampcms.com your version probably does not have the fixes I made for utf8 string handling.

Try to post a new question in your language right here, we'll see how it looks. I just want to know if there is still a problem. I'll delete your question once I see it.

My answer to "rel nofollow to user links"

This is my answer to a Question on Support site for LampCMS project


I see what you mean, the link TO a profile page. No, I never thought of adding nofollow since they link to a page on your own site. Why whould you want to prevent indexing of user profiles?

I was talking about a link that user added in their profile to their own website. That link will have a nofollow

Since I never thought of adding nofollow to internal links I have not even made this an option that you can change in template. It's hard coded and added as html fragment to the actual question.

You can submit feature request to github to make link to user profile not hard-coded.

My answer to "Upload images"

This is my answer to a Question on Support site for LampCMS project


This has been asked before. It's a feature request on github, I am working on it, still not finished. I actually started working on this yesterday, made some progress with adding this to YUI editor.
Once I finish with Javascript side of editor I will have to do a server-side file parsing work.
Currently I plan to allow only image uploads, no regular "attachments" files.

My answer to "Remove the viewquestion"

This is my answer to a Question on Support site for LampCMS project


Yes, it's quite simple. It required to define an alias for the controller name.
Look in [ROUTES] section of !config.ini
Basically there are already some aliases being used in default installation. The /tags/ url is actually an alias for the /viewtags/ controller.
You can define your own alias for viewquestions in the same way, for example
add:
topic = viewquestion

Then the url will be /topic/12/SomeQuestion

The nice thing about it is that you modify alias for routes even after you already have lots of questions on your site.
So if someone bookmarked your link to /viewquestion/quest123/How_are_you
Then you add alias
topic = viewquestion

and then when someone follows the old link the system will use 304 redirect to point to the new url:
/topic/quest123/How_are_you


My answer to "How can I add a logo"

This is my answer to a Question on Support site for LampCMS project


It's all in the templates.
You should get familiar with the templating system used in Lampcms, which is actually very simple.
A template is a class that extends either Lampcms\Template\Fast or Lampcms\Template\Simple
The Lampcms\Template\Fast templates have numbered placeholders. It's not very user-friendly but php parses them much faster by simple using php's vsprintf() function.

The Lampcms\Template\Simple template uses user-friendly named placeholders like {somevar}
The Simple template users php's strtr() function which is slower than vsprintf()


The logo is in the header, the header is in the main template, so open the file
/www/style/1/www/tplMail.php and you can experiment with it.
I suggest you save a copy of the working template first before you start modifying it.

My answer to "get an error when asking question"

This is my answer to a Question on Support site for LampCMS project


Actually this error probably means cannot connect to MySQL database, not Mongo. LampCMS uses MySQL in addition to Mongo to implement "Similar questions" feature and to implement the "Search" feature.
I chose to use MySQL for search because MySQL has full text search capability which makes it very easy to index questions.

All you need to do is to create an empty MySQL database and supply the connection details in the [DB] Section of !config.ini

You don't have to create any tables in MySQL, the program will create table automatically when it's first needed.

My answer to "Where are the administration options"

This is my answer to a Question on Support site for LampCMS project


Admin can see extra icons under each post, for example "delete", "stick", "lock"
Admin can also retag questions and edit questions submitted by other people.

Also when viewing profile of another user admin can delete that user as well as all user's posts with just one click. This is useful for dealing with spammers.

Admin can also "accept" the best answer for any question, not just for their own question.

Also when you on the "settings" page you will also see extra links - "edit categories" and "Clear cache"
You should clear cache after you edit the translation .xlf file, like when you add or modify translation strings for a language. This is because translations are cached, they are not served directly from the .xlf file, that would be pretty slow.

So in short, there is no special admin section, you simple have lots of extra options when logged in as admin.

Sunday, September 2, 2012

My answer to "Signup doesn't work"

This is my answer to a Question on Support site for LampCMS project


You need to have writable permission on directory where captcha images are generated.
directory is /www/w/img/tmp
Basically all directories under the /www/w supposed to have write permissions

My answer to "Default admin username and password"

This is my answer to a Question on Support site for LampCMS project


You have to create admin account yourself
You have to add admin email address to !config.ini as EMAIL_ADMIN
Then register a new account using the normal registration process. When you register with email address that matches the EMAIL_ADMIN your account is automatically an admin account.

Enjoy.