Announcements

The New PHP-Fusion USA
by Homdax - 2 weeks ago
Free Hosting
by NetriX - 3 weeks ago

View Thread

 Print Thread
Question and Answer Infusion [DEV]
Driv3r
So a I started to develop the infusion, so here is some information about it.

There is a main page where all the questions ban be seen (titles and some additional info), and they can be opened, for the complete description and answers. This part is basically done, also to be able to post new questions, answers, to edit the questions and to edit the answers. Also the main thing, to be able to solve a question is done. You can do this by selecting an answer as a solution, or during editing the question.

The permissions are also basic, all the questions and answers can be seen by the public. Only members can post questions and answers, and the author of the question/answer and the admins can edit them (I used "HLP" as rights). Deleting is not done yet, but I think this is going to be an admin function only.

Some things still need to be done (a lot actually). There will be categorizes, to be more easy to find questions and to order them. I also planing to make pages like "My questins", "Solved", "Unsolved" and so on... Also need some bug fixing, styling (probably separate style sheet), and localing the whole thing. I will try to release an alpha/beta version, because I not really confident at PHP yet, and there could be some security holes.

If anyone has any ideas or thoughts, feel free to share with me.
 
Driv3r
I might need some help. I want to make a search feature too, but I'm not good at this. I can make a very basic one with can search for words, but I want something more accurate.

Another thing: How can I list files from a directory? I need to list images for the categories.
Edited by Driv3r on 06-18-2015 01:04
 
NetriX
The only way to get proficient at developing is to jump in and get your hands dirty. You're on the right track!

For some guidelines, follow PHP-Fusion Coding Standards.
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Sun-Wed. Send me a PM if urgent.
 
Driv3r
So here is the first preview/alpha/beta whatever version. Most of the features are ready what I mentioned in my first post. I just need someone to check it because I'm a rookie in PHP. Also there could be security holes, and probably some mistakes, or stupid things.

SO PLEASE DO NOT USE THIS ON A REAL SITE!

Some things that still need to be done:
- Search (probably a search include)
- Panel
- Like, Dislike answers (not sure)
- Admin? (probably not)
- Code cleanup and bug fixing
Driv3r attached the following file:
You must register or login in order to download this file.

Edited by Driv3r on 06-30-2015 07:48
 
NetriX
Please attach your downloads in the future. Offsite host such as the one your provided a link to are known to be malicious.
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Sun-Wed. Send me a PM if urgent.
 
KasteR
Driv3r, good work so far. I'll try to test it out further later. I noticed a few things that may need cleanup. I'll let you know. Good work though. Thumb Up
 
NetriX
I looked over some of the files and like KasteR noticed a few unnecessary lines of code, but nevertheless great work!

I fail to realize that you're a "rookie" in development, your code appears to be clean and secure.

Keep it up. Thumb Up

Feel free to post what you need help with. I believe you requested help with a search feature?
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the Getting Started section!
» Attach Log Files and Screenshots when reporting issues
» My support days are usually Sun-Wed. Send me a PM if urgent.
 
Driv3r
Thank you!

Yes a little bit of help would be nice with the search.

First of all I don't know if I should create a separate one, or an include.

I probably try the second one, but I need to look into the codes more deeply for that.

Update:
I managed to do the search include, actually was quite easy, and working pretty well.

Update 2:
I might be completely mad, but I decided to add sub cats, and also a function to Like answers.
Edited by Driv3r on 07-01-2015 10:59
 
skpacman
It should be an upvote/downvote system for answers similar to stackoverflow and yahoo answers. answers are ordered by "score" (upvote_count - downvote_count) so that the "best" answer is always at the top of the list. I wouldn't copy stackoverflow's Q&A system verbatim, but something close to it for php-fusion would be nice.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
Driv3r
Well I made a lot of modification on it. Currently it orders the questions by solution, so that's the first one, and than by date. The Likes are just kind of "there", so they don't have any real part in that. I might change that later, but I already worked to much on this infusion. :D

Also did some security related stuff, for example when solving/unsolving, because of the GET values, it was possible to manually mess up things. I sorted that out by checking the database first, so hopefully it will work well. I also changed many database query, joining some tables together and so on.

One level subcats are also possible now, that also took some time for me.

I'll upload it here soon.

By the way, is there a more elegant way to do this?
Download source  Code
if ($userdata['user_id'] == $authdata['question_user_id'] OR (iADMIN && checkrights("HLP"))) {
//Nothing here
} else {
redirect(INFUSIONS."help_panel/index.php?question_id=".$_GET['question_id']."");
}


 
Harlekin
I use this codesnippet for list images from a directory:

Download source  Code
<?php
require_once "../../maincore.php";
require_once THEMES."templates/header.php";

$directory = "show_images";
$allfiles = scandir($directory);         
 
foreach ($allfiles as $file) {
$fileinfo = pathinfo($directory."/".$file);
$size = ceil(filesize($directory."/".$file)/1024);
if ($file != "." && $file != ".."  && $file != "_notes" && $imageinfo['basename'] != "Thumbs.db") {
 
$imagetype= array("jpg", "jpeg", "gif", "png");
//Dateien nach Typ pr?fen, in dem Fall nach Endungen f?r Bilder filtern
if(in_array($fileinfo['extension'],$imagetype))
   {
?>
<style type="text/css">
div.galerie{
padding: 3px;
background-color:#ebebeb;
border:1px solid #CCC;
float:left;
margin:10px 10px 0  0;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
color:#000000;   
}
</style>
<?php
           echo "<div class='galerie'>
              <img src='".$fileinfo['dirname']."/".$fileinfo['basename']."' alt='Vorschau' />
                <br /><center><span>".$fileinfo['basename']."</span></center><br />";
           echo "</div>";
}
};
};
?>



Edited by Harlekin on 07-10-2015 04:54
 
Driv3r
Sorry for beeing inactive, the porject is not dead. Corrently I testing it on my website, which was a good idea, because I managed to fix some tiny little bugs. Soon I will publish the probably "final" version here.
 
3Xpl01t
Hi Driv3r I try it the help panel , and I like it so cool.
I made subcats but is bad not working (The Cats and subcats isn't display) I attached the file Anyway can you help me or publicate the better version?

Thanks for the answers.. Smile
3Xpl01t attached the following file:
You must register or login in order to download this file.

Edited by 3Xpl01t on 07-23-2015 13:05

"The way I see it, every life is a pile of good things and bad things. The good things don't always soften the bad things, but vice versa, the bad things don't necessarily spoil the good things, and make them unimportant."
 
3Xpl01t
Hi (again)!

I found some bug but I don't know how to fix it because I couldn't found cause of the bug..

The bug:

I write a question with an admin user, that is good..

Now I write answer to the admin's question, and I couldn't edit my answer
I'dont know how?!:insomnia:

And a similar bug:

I write a question a simple user and the questioner write a answer and It's WORKING I see the edit option! LOL :D (but an admin question I don't see why? :workPC: )

Oh and I write an answer with thrid simple user to the second simple user's question and I do not see the edit option (AGAIN):jdrop:

Sorry my bad bad english I hope understand anyone the bugs..

these two annoying bugs:@, but nice and clean coding, keep it up:clap:


Edit1

my friend help me and it's now working the edit option, the solution is in the index.php line 196:
Download source  Code
if ($userdata['user_id'] == $question_user_id OR (iADMIN && checkrights("HLP"))) {




replace to this:
Download source  Code
if ($userdata['user_id'] == $data['answer_user_id'] OR (iADMIN && checkrights("HLP"))) {




Done! :D

Anyone can u help me the subcats?

Edit 2

Ahm the edit files (edit_question.php and edit_answer.php)

edit_question.php line 35 (maybe)

This:
Download source  Code
$auth = dbquery("SELECT question_user_id FROM ".DB_HELP_Q." WHERE question_id='".$_GET['question_id']."'");
   if (dbrows($auth)) {
if ($userdata['user_id'] == $authdata['question_user_id'] OR (iADMIN && checkrights("HLP"))) {

} else {
redirect(INFUSIONS."help_panel/index.php?question_id=".$_GET['question_id']."");
}




Replace to:
Download source  Code
$auth = dbquery("SELECT question_user_id FROM ".DB_HELP_Q." WHERE question_id='".$_GET['question_id']."'");
 if (dbrows($auth)) {
 $authdata = dbarray($auth);
  if(iADMIN && checkrights('HLP')  && $userdata['user_id'] == $authdata['question_user_id']) {
   redirect(INFUSIONS."help_panel/index.php?question_id=".$authdata['question_id']."");
   }
 }




And the edit_answer.php lin 35:

Download source  Code
$auth = dbquery("SELECT answer_user_id, question_id FROM ".DB_HELP_A." WHERE answer_id='".$_GET['answer_id']."'");
   if (dbrows($auth)) {
if ($userdata['user_id'] == $authdata['answer_user_id'] OR (iADMIN && checkrights("HLP"))) {
//Nothing here
} else {
redirect(INFUSIONS."help_panel/index.php?question_id=".$_GET['question_id']."");
}
   }




Replace to:
Download source  Code
$auth = dbquery("SELECT answer_user_id, question_id FROM ".DB_HELP_A." WHERE answer_id='".$_GET['answer_id']."'");
 if (dbrows($auth)) {
 $authdata = dbarray($auth);
  if(iADMIN && checkrights('HLP')  && $userdata['user_id'] == $authdata['answer_user_id']) {
   redirect(INFUSIONS."help_panel/index.php?question_id=".$authdata['question_id']."");
   }
 }




I tested and working.. B)

Anyone can u help me the subcats?
Edited by 3Xpl01t on 07-27-2015 13:09

"The way I see it, every life is a pile of good things and bad things. The good things don't always soften the bad things, but vice versa, the bad things don't necessarily spoil the good things, and make them unimportant."
 
Driv3r
3Xpl01t: Sorry for being inactive. I fixed all those issues, and I've been testing it on my site. So here is the corrently final version, let me know if there any problem with it.
Driv3r attached the following file:
You must register or login in order to download this file.
 
3Xpl01t
No problem! Thank you Driv3r!!

Like the answers is good and simple Thumb Up
The subcats is very good..Clap
"The way I see it, every life is a pile of good things and bad things. The good things don't always soften the bad things, but vice versa, the bad things don't necessarily spoil the good things, and make them unimportant."
 
alperi
Thank you Driv3r good job Wink
 
Driv3r
I discovered a small little bug with page navigation. It's a very simple fix, so if you want, you can do it yourself:
In index.php at line 357:
From:
Download source  Code
$location = "";



To:
Download source  Code
$location = "?";



So basically just a question mark missing.

I updated the pack with the fix.

If you want to update with this, just overwrite the index.php file, in infusions/help_panel directory.
Driv3r attached the following file:
You must register or login in order to download this file.
 
Advertisement
Driv3r
Hi!

This might not be the right place to ask, but I don't want to create a new thread to do so.

I plan to port this infusion to v9, and I would be thankful for a little bit of help. Are there any big changes? So far I only saw the multi-language support.

Any other things to look out for?

Thank you!
 
Advertisement
FreedomIOPList
Nice little Infusion here... Very unique. I installed it and it works perfectly, like a charm. It did not even log errors in the Error Log.

One thing, I don't like how the Questions are in Blue. Could you edit that so that it conforms to the site theme or something or add an area in the admin panel for the Infusion so admins can change it? That would be awesome... See what I mean here:
http://freedomiop.../index.php

 
Jump to Forum:

Users Online

Statistics
> New Members:
Today: 0 » Last 7 Days: 4 » Last 30 Days: 14
> Guests Online:
> Members Online: 0

> Welcome to our newest member, harvey
> Total Members: 1013
> Total members who have visited today: 5
NetriX , lundeborg , douwe_yntema , afoster , daimonbok
Birthdays No Birthdays Today