comments needed: more modifications

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

comments needed: more modifications

Post by sergey.khodjamirian »

Hello,

I am making some more modifications and was wondering if you could tell me whether these will work and if I need to alter anything further.




When viewing a record I want to get rid of some things that i dont need. So I got rid of the following stuff from index.tpl:

--------DELETED----------

<!-- Voting Form -->
<form action="{saveVotingPATH}" method="post" style="display: inline;">
<fieldset>
<legend>{msgVoteUseability}</legend>
<input type="hidden" name="artikel" value="{saveVotingID}" />
<input type="hidden" name="userip" value="{saveVotingIP}" />
<p align="center"><strong>{msgAverageVote}</strong> {printVotings}</p>
<p align="center">{msgVoteBad}
<input class="radio" type="radio" name="vote" value="1" /> 1
<input class="radio" type="radio" name="vote" value="2" /> 2
<input class="radio" type="radio" name="vote" value="3" /> 3
<input class="radio" type="radio" name="vote" value="4" /> 4
<input class="radio" type="radio" name="vote" value="5" /> 5
{msgVoteGood}<br />
<input class="submit" type="submit" name="submit" value="{msgVoteSubmit}" />
</p>
</fieldset>
</form>
<!-- /Voting Form -->

--------DELETED----------

+

--------DELETED----------

<img src="images/email.gif" alt="{writeSend2FriendMsgTag}" title="{writeSend2FriendMsgTag}" width="16" height="16" border="0" /> {writeSend2FriendMsg}<br />
<img src="images/pdf.gif" alt="{writePDFTag}" title="{writePDFTag}" width="16" height="16" border="0" /> {writePDF}<br />
<img src="images/xml.gif" alt="{writeXMLMsgTag}" title="{writeXMLMsgTag}" width="24" height="16" border="0" /> {writeXMLMsg}

--------DELETED----------

+

--------DELETED----------

{switchLanguage}

--------DELETED----------
The first two are the voting bit and some of the icons with actions. Is there more I have to do to remove those features? Altough I am quite confused by the last item - what is switchLanguage? I dont see anything like that in the middle column when viewing an article. Is this related to the language drop down menu on the left column?







Also I want to remove the right hand column completely, as well as some other components of the left hand column. Does this mean the following changes to index.tpl?
-----------------DELETED-------------------
<!-- start right sidebar -->
<div class="rightcolumn sidebar" id="sidebar-right">
<div class="rightpadding">

<div class="content">
<div id="topten">
<h3>{writeTopTenHeader} <a href="feed/topten/rss.php" target="_blank"><img src="images/rss.png" width="28" height="16" alt="RSS" /></a></h3>
{writeTopTenRow}
</div>
</div>

<div class="content">
<div id="latest">
<h3>{writeNewestHeader}&nbsp;<a href="feed/latest/rss.php" target="_blank"><img src="images/rss.png" width="28" height="16" alt="RSS" /></a></h3>
{writeNewestRow}
</div>
</div>

</div>
</div>
<!-- end right sidebar -->

---------------------DELETED----------------

+

--------DELETED---------------------------

<!-- start language selection box -->
<div class="content">
<div id="langform">
<form action="{writeLangAdress}" method="post">
<label for="language">{languageBox}</label>
{switchLanguages}<br />
<input type="submit" name="submit" value="Go" class="submit" />
</form>
</div>
</div>
<!-- end -->

----------DELETED----------------

+

----------DELETED----------------

<!-- start language selection box -->
<div class="content">
<div id="langform">
<form action="{writeLangAdress}" method="post">
<label for="language">{languageBox}</label>
{switchLanguages}<br />
<input type="submit" name="submit" value="Go" class="submit" />
</form>
</div>
</div>
<!-- end -->

<div class="content">
<div id="useronline">
{userOnline}
</div>
</div>

---------DELETED------------------
Is this enough? Should I do something else?







Another thing that I want to change is the first page someone sees so that instead of the news there is a list of Recent 15 entries. These are the steps that I plan to take


########################################################
template/main.tpl
#######################################################

---------DELETED-----------------

<!-- begin news -->
<div id="news">
<h2>{writeNewsHeader}&nbsp;<a href="feed/news/rss.php" target="_blank"><img src="images/rss.png" width="28" height="16" alt="RSS" /></a></h2>
{writeNews}
<p align="center">{writeNumberOfArticles}</p>
</div>
<!-- end news -->

---------DELETED-----------------

+

-------------ADDED-----------------------------------
<!-- begin Recent -->
<div class="content">

<div id="latest">

<h3>{writeNewestHeader}</h3>
{writeNewestRow}

</div>

</div>
<!-- end Recent -->

<br />

<br />
<p align="center">{writeNumberOfArticles}</p>
--------------ADDED----------------------------------


########################################################
inc/constants.php
#######################################################

---------CHANGED---------------------
/**
* Number of records for the latest entries
*
* @var const 5
*/
define('PMF_NUMBER_RECORDS_LATEST', 5);

TO

/**
* Number of records for the latest entries
*
* @var const 15
*/
define('PMF_NUMBER_RECORDS_LATEST', 15);

-------------CHANGED-----------------

Again, is this sufficient?
Last edited by sergey.khodjamirian on Fri Aug 25, 2006 10:31 am, edited 1 time in total.
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey,
sergey.khodjamirian wrote:The first two are the voting bit and some of the icons with actions. Is there more I have to do to remove those features?
It depends on your "application security policy": you should remove also the PHP files that implement those features to be sure that no one we'll use it.
sergey.khodjamirian wrote:Altough I am quite confused by the last item - what is switchLanguage? I dont see anything like that in the middle column when viewing an article. Is this related to the language drop down menu on the left column?
No. It's used for multilanguage faq contents.
sergey.khodjamirian wrote:Also I want to remove the right hand column completely, as well as some other components of the left hand column. Does this mean the following changes to index.tpl? Is this enough? Should I do something else?
Yes, it's enough. If you do not remove the deleted {key} fields from the PHP files, they'll be always evaluated even if you cannot see them: this means that your server will do some unuseful works, not really an issue if your server is a dedicated one.
sergey.khodjamirian wrote:Another thing that I want to change is the first page someone sees so that instead of the news there is a list of Recent 15 entries. These are the steps that I plan to take. Again, is this sufficient?
Yes.

A general rule for the customization work should be to change as most TPL files as needed instead of the PHP files (but in your case, e.g.: copy-to-clipboard some PHP changes are needed) in order to reduce the efforts when migrating to a newer PMF version.

Regards,
Matteo

P.S.: just an hint, when posting the code you could use the

Code: Select all

 tag instead of the [quote] one ;).
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Okay thanks matteo. I will get the IT guy to upload these changes.

One more question:

I made some changes to language_en.php. As a result, when the I launch the Faq just a blank page shows up - I also noticed that /admin also gives a blank page.

I changed a lot of the wording to fit my project, which I don't think made that much of an impact.

Also added a PMF

$PMF_LANG["msgCopyToClipboard"] = "Copy Answer to Clipboard";

This was of course for the Copy to Clipboard thing:

viewtopic.php?t=2737

When this occured, I did a re-install and uploaded just this file to see if its the one that caused the trouble and it was.

So what am I doing wrong?
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey,
try to use the language_en.php of my revision: you used a " without escaping it, \". You should also ask to your IT to configure the server in order to let you see any warning or notice errors coming from PHP: it will help you in finding the reason why some of your changes break the code.

Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Okay matteo - I will ask them to do that.

Sorry matteo - I don't understand what you mean about the language_en.php - should I add a forward slash infront of the " ??

thanks

sergey
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey,
sergey.khodjamirian wrote:I don't understand what you mean about the language_en.php - should I add a forward slash infront of the " ??
Yes, char escaping is a need. Find below some samples just to help you:
  1. $PMF_LANG['testKey'] = 'No "escape char" is needed';
  2. $PMF_LANG['testKey'] = "No 'escape char' is needed";
  3. $PMF_LANG['testKey'] = ""Escape char" is needed";
  4. $PMF_LANG['testKey'] = '\'Escape char\' is needed';
Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Okay. Do you mean: If I want the PMF variable to contain a string with " or ' in the beginning, I have to add a \ so that PHP doesn't get confused.

But

$PMF_LANG["msgCopyToClipboard"] = "Copy Answer to Clipboard";

doesnt contain such a thing. Plus, I tried to define the above PMF just like the rest of the PMFs.

So how should I do this then?
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey
sergey.khodjamirian wrote:$PMF_LANG["msgCopyToClipboard"] = "Copy Answer to Clipboard";

doesnt contain such a thing. Plus, I tried to define the above PMF just like the rest of the PMFs.

So how should I do this then?
See below an error from the language_en.php that you provided me for testing Copy-To-Clipboard:

Code: Select all

// Help
$PMF_LANG["msgHelpText"] = "If you need help using the RFP Q&A Knowledgebase, please consult the XYZ instructions manual. If you have misplaced this document you can download it <a href="filename.doc">here</a>.";
What about the missing escape chars in "filename.doc"? ;)

Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Ahhh!! Yes. Thank you! You guys are great.

So this is fine then?

Code: Select all

// Help
$PMF_LANG["msgHelpText"] = "If you need help using the RFP Q&A Knowledgebase, please consult the TMSO/TMSA instructions manual. If you have misplaced this document you can download it <a href=\"tmsatmsomanual.doc\">here</a>.";
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey,
yes, it is correct.
My suggestion is to use ' for closing the string so no escape is needed according to my sample #1.

Ciao,
Matteo

PS: Have you received my email with the new zip file? This error and some other minor issues and hints has been fixed with that reply ;).
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Cool, will do that then.


No I actually haven't received it. Please try sending it to sergey.khodjamirian@gmail.com

Thanks!
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Here is the print out of errors

Code: Select all

[Fri Aug 25 04:02:38 2006] [notice] Digest: done
[Fri Aug 25 04:02:38 2006] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Fri Aug 25 04:02:38 2006] [notice] LDAP: SSL support unavailable
[Fri Aug 25 04:02:38 2006] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Fri Aug 25 04:02:38 2006] [notice] Apache/2.0.52 (Red Hat) configured -- resuming normal operations
[client 165.47.238.24] PHP Parse error:  parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/html/rfpqakb/savecomment.php on line 47, referer: http://lonvmmldap02/rfpqakb/index.php?action=writecomment&id=1&artlang=en
[client 165.47.238.24] PHP Parse error:  parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/html/rfpqakb/savecomment.php on line 47, referer: http://lonvmmldap02/rfpqakb/index.php?action=writecomment&id=1&artlang=en
[client 165.47.238.24] PHP Parse error:  parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/html/rfpqakb/savecomment.php on line 47, referer: http://lonvmmldap02/rfpqakb/index.php?action=writecomment&id=1&artlang=en
[Fri Aug 25 12:18:22 2006] [error] [client 165.47.238.24] File does not exist: /var/www/html/favicon.ico
[Fri Aug 25 12:22:23 2006] [error] [client 165.47.238.24] Directory index forbidden by rule: /var/www/html/
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey,
check the line 47 or post it here:
  1. I made an error on copying the code from my savecomment.php into the post;
  2. You made an error on copying the code from the post into your savecomment.php.
Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
sergey.khodjamirian
Posts: 35
Joined: Wed Aug 09, 2006 11:36 am

Post by sergey.khodjamirian »

Code: Select all

$commentMail = "User: ".$comment_by_user.", mailto:".$comment_by_mail."\n"
"has requested a review of http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?action=artikel&cat=".$cat."&id=".$id."&artlang=".$lang. 
"\n\n". 
wordwrap($_POST["comment"], 72); 
Line 47 is the second line in the above snippet of code.
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi Sergey,
from my post:

Code: Select all

    $commentMail =  "User: ".$comment_by_user.", mailto:".$comment_by_mail."\n".
                    "New comment posted on: http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?action=artikel&cat=".$cat."&id=".$id."&artlang=".$lang.
                    "\n\n".
                    wordwrap($_POST["comment"], 72);
you've changed a little bit my (working) code and you've missed to use . (dot) needed for PHP string concatenation.
It should be:

Code: Select all

$commentMail = "User: ".$comment_by_user.", mailto:".$comment_by_mail."\n".
"has requested a review of http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?action=artikel&cat=".$cat."&id=".$id."&artlang=".$lang.
"\n\n". 
(not tested).

Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Post Reply