vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   The Ultimate Quote Hack!! (https://vborg.vbsupport.ru/showthread.php?t=38906)

KuraFire 05-21-2002 10:00 PM

The Ultimate Quote Hack!!
 
IF THIS HACK DOESN'T RANDOMIZE WELL FOR YOU, DO THIS:
(by Boofo)
"You need to change the RAND() to RAND(NOW()) to make it more random with the new versions of mySQL since version .54

The NOW will seed it and make it more random that it was before. "

That should fix the problem for a lack of randomized quotes.
ALSO NOTE THIS:
There's a bit of code going around that's 'unofficial' (ie. looks like it's from this hack, but it's adjusted and now flawed), saying "ORDER BY id" in the Query that gets the random quote. This is BAD CODE as it doesn't randomize anything at all. It should say "ORDER BY RAND(NOW())" instead.

</end Hack Issue Fix>


*drumroll*

It's here! :D

What does this hack do:

* it's an extension (big time!) on the Admin-only controlled hack I released earlier. If you installed that hack already, it should be pretty clear for you which steps you should ignore in the Instructions for this hack. What you Cannot ignore is the step about your Admin Panel, and the lines to add to admin/index.php !

* It lists a random quote either on your Forum Home, or in your Header. Next to that, it adds a Quote List, which is just a massive database of quotes that works just like the Memberlist, but with your quotes. It's searchable, and with the Add-on (see post #2!) users can also add quotes in it (which need moderation, before showing up online).

* Quotes can be added, edited and deleted from your Admin Panel. With the add-on, you can moderate quotes from your AP as well.

* There are no hard-coded colors. All colors are taken from your style, so all pages will appear in concordance of whatever style it is you're using.

Install instructions are in the zipfile: uqh_instructions.txt

For the add-on, see the second post, instructions file: w-add_instructions.txt


Have fun!

KuraFire 05-22-2002 08:22 AM

Attached is the zipfile with the Add-on which allows Users to add quotes themselves. Those will then fall in the moderation queue and won't appear on the site until you've moderated them in your Admin Panel.

*edit* There was one query left out in the instructions file, it's included now. See post #15 in this thread for the query, it's all you need to do if you upgraded from my former hack to this one.

KuraFire 05-22-2002 08:22 AM

This is a screenshot of what the Quotes List looks like WITHOUT the add-on:

KuraFire 05-22-2002 08:22 AM

This is a screenshot of what the Quotes List looks like WITH the add-on:

KuraFire 05-22-2002 08:22 AM

This is a screenshot of the Search page for quotes:

KuraFire 05-22-2002 08:23 AM

This is a screenshot of the Moderate Quotes page in your admin panel:

KuraFire 05-22-2002 08:23 AM

This is a screenshot of the Add a Quote page for your users, which is part of the Add-on!

scsa20 05-22-2002 08:25 AM

seems cool, I'll install it when I wake up this morring (oh no, forgot there's school :eek: )

afterlab 05-22-2002 10:31 AM

Pretty kinky hack ya got there KuraFire ;). I'll install it when I get home. :D

KuraFire 05-22-2002 10:41 AM

Sweet, the FFR is gonna have my hack?! :D

Kick-ass! ^_^

btw, I will be back to the FFR pretty soon, now that Project 3.5 is nearly done and all. :)
Heard you got the battle system working, good job man. :):up:

Boofo 05-22-2002 10:50 AM

I just noticed after upgrading the hack, that if you try to edit a quote that has quotes around it, it does not show up in the editor. The quoter will and the letter, just not the quote. Also, it is now impossible to save a quote or edit one without filling in the quoter variable. It says that all variables must be completed. I would like to be able to save it without the quoter or letter if possible, since I will not be adding the part to my board for the listing of the quotes. Can this be done?

KuraFire 05-22-2002 11:07 AM

Ah, yes, I haven't htmlspecialchar'd the inputs, since on my own board I use no ""s around quotes. If you want them to display around each quote (ie. "this is a quote") you should better just add &quot; in your templates. Much easier to take them off again if you decide to, at one point.

To fix that problem though, find in your admin/quotes.php this line:

PHP Code:

$quote=$DB_site->query_first("SELECT * FROM quotes WHERE id=$quoteid"); 

And add below it:

PHP Code:

$quote[quote] = htmlspecialchars($quote[quote]); 

(if you use ""s in your name input as well, add `$quote[name] = htmlspecialchars($quote[name]);` below that).


The other issue: if you save without a letter, the quote will not show up in the Quotes List, Ever. And if you intend to disband the Quoter (Name) part, you can just fill in a dash ( - ) or so for the quoter name, or "Unknown" or whatever. Filling in nothing is a bad idea.

John 05-22-2002 11:11 AM

Database error in vBulletin Control Panel 2.2.4:

Invalid SQL: SELECT * FROM quotes WHERE mod='N'
mysql error: Unknown column 'mod' in 'where clause'

mysql error number: 1054

Database error in vBulletin 2.2.4:

Invalid SQL: SELECT *
FROM quotes
WHERE 1=1 AND mod!='N'
ORDER BY letter,name ASC
LIMIT 0,30
mysql error: Unknown column 'mod' in 'where clause'

mysql error number: 1054

John 05-22-2002 11:23 AM

Help! (These errors are from when I installed the second addon hack) The first hack worked fine :(

KuraFire 05-22-2002 11:30 AM

Hmmm. The zipfile didn't update my new query it seems..

John, run this query on your quotes table:

ALTER TABLE quotes ADD mod VARCHAR(1) NOT NULL;

That should fix it. *goes update the zipfile again, hoping it WILL add the new query file this time*

John 05-22-2002 11:32 AM

It works! Thank you! :)

KuraFire 05-22-2002 11:50 AM

I updated the second post, with the instructions for the Moderation add-on. It now includes the query in post #15 in its instructions. The original file is untouched though, since the original hack doesn't need the mod column. :)

Glad it works, JW :):up:

John 05-22-2002 11:58 AM

Kura, I've love to see something on the front page of the AdminCP like "There are currently [number] quotes awaiting moderation." - I can see myself forgetting tha people have added quotes :(

KuraFire 05-22-2002 12:10 PM

Erm, I'll see what I can do.

If you prefer, I can also write a line of code that will e-mail you whenever a user adds a new quote... though this could become quite tedious & annoying if you have a lot of users. :)

I'll let you know in this thread once I have it done, okay? :)

John 05-22-2002 12:15 PM

Quote:

Originally posted by KuraFire
Erm, I'll see what I can do.

If you prefer, I can also write a line of code that will e-mail you whenever a user adds a new quote... though this could become quite tedious & annoying if you have a lot of users. :)

I'll let you know in this thread once I have it done, okay? :)

How about a PM that is sent to a specified user (i.e. the admin) at a set time each day to inform of new quotes?

So, at the time "6.00pm" a PM is sent to the admin "John" if there are any new quotes for moderation.
e.g.
"Hi [admin's name], there are [number of new quotes] new quotes waiting to be moderated. Click here to moderate them"

KuraFire 05-22-2002 12:28 PM

That's WAY more complex than the admin panel home thingy! :eek:

Too ****ing complex, for my taste. :)


This is what to do if you installed Freddie's Quick Stats hack, for your admin panel home:

Find in admin/index.php :

PHP Code:

$mysqlversion $DB_site->query_first("SELECT VERSION() AS version"); 


ADD BELOW:

PHP Code:

$quotesmod    $DB_site->query_first("SELECT count(*) AS count FROM quotes WHERE mod='N'"); 



FIND:

PHP Code:

makelabelcode('New Posts Today:'$newposts['count']); 

ADD BELOW:

PHP Code:

makelabelcode("Quotes awaiting <a href=\"quotes.php?s=$session[sessionhash]&action=moderate\">moderation</a>:"$quotesmod['count']); 

(edited: I turned "moderation" into a link, even easier now ^_^)

Again, this is if you have Freddie's hack already installed. If not, then you'll have to do a manual output of some kind. The query to add doesn't need changing, though the output will probably need changing if you don't have Freddie's hack.

And with this, it'll display "Quotes awaiting moderation: [number]" in your Admin Panel Home. :)

Boofo 05-22-2002 12:35 PM

Thanks, that fixed my problem. It might not be a bad idea to add that to the quotes.php in your hack in case someone esle runs into that. :)

As far as having to put a name or letter in, with the editing capabilites, that is something that could always be done later if someone decided to go that route. I will never use that on my site as I will not doing the quote listing for the users. :)

Quote:

Originally posted by KuraFire
Ah, yes, I haven't htmlspecialchar'd the inputs, since on my own board I use no ""s around quotes. If you want them to display around each quote (ie. "this is a quote") you should better just add &quot; in your templates. Much easier to take them off again if you decide to, at one point.


The other issue: if you save without a letter, the quote will not show up in the Quotes List, Ever. And if you intend to disband the Quoter (Name) part, you can just fill in a dash ( - ) or so for the quoter name, or "Unknown" or whatever. Filling in nothing is a bad idea.


KuraFire 05-22-2002 12:51 PM

to add _what_ to quotes.php ?

The Admin Panel Home moderation queue? That's an admin/index.php hack...

if not, then what? :)

Boofo 05-22-2002 01:14 PM

The fix you gave me in Post #12, remember? :)

Quote:

Originally posted by KuraFire
to add _what_ to quotes.php ?

The Admin Panel Home moderation queue? That's an admin/index.php hack...

if not, then what? :)


KuraFire 05-22-2002 01:19 PM

Ah, yes, well, since it's a bad idea to have ""s in quotes themselves, why bother, really?

And for those who think their users will accidentally add quotes, there's two things to do: read the whole of this thread (it won't hurt them), or edit that template so that it says "Don't add ""s to your quote!" or whatever. :)

Boofo 05-22-2002 01:24 PM

Well, whatever you think is fine by me. It was just a suggestion to avoid a lot of questions later. :) I only wanted it for the editor anyway.

MrLister 05-22-2002 01:27 PM

Thanks, looks great

Floris 05-22-2002 01:28 PM

Ah, very cool, .. Does this also show in the profile of a member the total amount of quotes they have added? And .. does this also show on the frontpage, the total amount of quotes in the database, and maybe on top, top quoter:
Would be nice (no, it would be sweet)

This probably is the reason I haven't seen you on IRC for a while :P You were coding leetnez

KuraFire 05-22-2002 01:49 PM

boofo, btw, that htmlspecialchars fix isn't necessary in this hack. The hack has a TEXTAREA field for the Quote, the former hack (which you have) still used a Text Input field for the quote, but with TEXTAREA ""s don't matter anymore. So people who install this from scratch won't have a problem at all...

Boofo 05-22-2002 01:54 PM

Do I need to upgrade anything then? Or will it work the same after adding what you told me to add? I uploaded the new quote.php (with your fix added) and did the admin/index.php, but other than that I didn't add anything else. Is there anything I should replace?

KuraFire 05-22-2002 02:12 PM

Xiph: no, this hack does not, in any way, keep track of what user submits which and how many quotes. If you want that, use Lesane's hack. Mine is a more neutral, unbiased hack with an add-on that makes it a bit less neutral and unbiased, but still more than Lesane's.

If you want the total amount of quotes on forumhome, you should be able to easily add a query for that. Something like this:


in root/index.php find:

PHP Code:

// get total posts 

ADD ABOVE:

PHP Code:

$quotetotal=$DB_site->query_first('SELECT COUNT(*) AS count FROM quotes'); 

(or, to include only quotes that are moderated, if you use the Add-on hack: )

PHP Code:

$quotetotal=$DB_site->query_first("SELECT COUNT(*) AS count FROM quotes WHERE mod!='N'"); 


And I've not been in IRC much because of this and other things. Project 3.5 is 99% done, I'm almost ready to send everything online and do the online debugging before opening up. ^_^

Boofo: No, not really. The only difference really, is that the old hack used a Text Input field for Quote, and the new (this) hack uses a Textarea field for Quote, in the Edit page. That, and the new hack doesn't allow empty entries...

Roxie 05-22-2002 04:37 PM

I don't have

// ###################### Start templates #######################

in my global.php

Roxie 05-22-2002 04:46 PM

Nevermind. :/

Roxie 05-22-2002 05:08 PM

Is there away to delete the quotes that come with the hack?
Thanks :)

Roxie 05-22-2002 05:16 PM

Nevermind :/

I really should think before I ask these dumb questions.

KuraFire 05-22-2002 07:28 PM

That's a valuable lesson in life, don't forget it. :)

;)

KuraFire 05-28-2002 01:59 PM

Okay, out of boredom I added user-submission-tracking to this hack. It tracks which quotes a user submits, and shows the total number of quotes on their profile (only moderated quotes, not unmoderated submissions), and lastly, it uses the quotelist.php to display all the quotes that one particular user submitted, but in a silent way.

So in the end, it's got the same basic things as Lesane's hack, but taken to a whole new level with better code and a big searchable listing. :/

Instructions for user-tracking only on request by PM/mail, btw.

Kalen 05-29-2002 02:37 AM

this may sound stupid but what is phpmyadmin? =\ thats the only part of the instructions i havent finished because i dont know what it is

KuraFire 05-29-2002 08:26 AM

phpMyAdmin is a 3rd Party Program to run on your server. It's a graphical interface for Database control.

You can find it at www.phpwizards.net I believe, or at phpmyadmin.scourgeforge.net - most webservers have phpMyAdmin pre-installed for you anyway, so check that first!

Basically, it allows you to edit, alter, and add to your database(s). Much easier than doing all that through the mysql command prompt.

Floris 06-02-2002 09:03 PM

Database error in vBulletin 2.2.6:

Invalid SQL: SELECT COUNT(id) AS usertotal FROM quote WHERE ok='Y'
mysql error: Table 'baz.quote' doesn't exist

mysql error number: 1146

Date: Sunday 02nd of June 2002 11:07:11 PM
Script: http://www.marietje.nl/vbb/vbb/userquote.php

Everytime a google searches my site, I get that error. I installed that extra query + result of array to display the quotetotal on the frontpage.


All times are GMT. The time now is 04:47 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01471 seconds
  • Memory Usage 1,839KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete