Go Back   vb.org Archive > Community Central > Community Lounge
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-04-2002, 01:40 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Would you like it if I released a phpinclude API?

It would greatly simplify making phpinclude mods, and what's more even speed them up, depending on the situation. Also it would become so easy that you don't really need an inner working knowledge of vB to start making them.

For example, this code (sorry about the indenting, the code tag's doublespacing is incredibly irritating):

if (strpos($_SERVER['PHP_SELF'], 'showthread.php') != false)
{
if (in_array($bbuserinfo['usergroupid'], array(5, 6, 7)))
{
if ($thread['notes'] == '') $thread['notes'] = 'None.';
eval("\$threadnotes = \"" . gettemplate("showthread_threadnotes") . "\";");
}
else $threadnotes = '';
}

Would be simplified to:

if (thisis("showthread"))
{
if (userisingroup("5,6,7"))
{
if ($thread['notes'] == "") $thread['notes'] = "None.";
evaltemplate("showthread_threadnotes", "threadnotes");
}
else $threadnotes = "";
}



And another example:

if (strpos($_SERVER['PHP_SELF'], 'index.php') != false)
{
$totalchars = $DB_site->query("SELECT SUM(LENGTH(pagetext)) AS totalchars FROM post");
$totalchars = $DB_site->fetch_array($totalchars);
$totalchars = number_format($totalchars['totalchars']);
}

becomes:

if (thisis("index"))
{
$totalchars = numberformat(mysqlonlyresult("SELECT SUM(LENGTH(pagetext)) AS totalchars FROM post"));
}
Reply With Quote
  #2  
Old 12-04-2002, 05:40 AM
Tony G's Avatar
Tony G Tony G is offline
 
Join Date: Nov 2001
Location: Melbourne, Australia
Posts: 8,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats one big change in code, guess it could help.
Reply With Quote
  #3  
Old 12-04-2002, 06:46 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, since it seems to be welcomed I'll do it (or rather continue it since I had already started it).

It's more of a wrapper set of functions than an API but useful nonetheless. What I've coded but not tested so far:

function thisis($filename)
// returns true if $phpself contains $filename

function evaltemplate($templatename, $storagevar)
// evals $templatename and stores the output in $storagevar

function mysqlonlyresult($query)
// returns the first result array of $query

function userisingroup($usergroupids)
// returns true of the current user is a member of the given
// comma-delimited list of usergroupids

function setempty($varlist)
// sets the variable names in $varlist (comma-delimited, no
// leading $) to empty (''). This avoids security issues,
// particurally those arising where register_globals allows
// users to directly edit variable contents by simply
// changing the page's URL.

I'll be looking for testers, soon.
Reply With Quote
  #4  
Old 12-04-2002, 08:09 PM
Cypher720's Avatar
Cypher720 Cypher720 is offline
 
Join Date: Aug 2002
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i honestly dont know whawt this is...but if it helps make coding easier for mods...why not!
Reply With Quote
  #5  
Old 12-05-2002, 12:02 AM
Rufus69's Avatar
Rufus69 Rufus69 is offline
 
Join Date: Oct 2002
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

heh I have no idea what it is either but if it helps

what someone needs to do is make a WYSIWYG program so even stupid people like me can make mods l
Reply With Quote
  #6  
Old 12-05-2002, 12:19 PM
Cypher720's Avatar
Cypher720 Cypher720 is offline
 
Join Date: Aug 2002
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol...that would be funny
Reply With Quote
  #7  
Old 12-05-2002, 12:26 PM
imported_plattopus imported_plattopus is offline
 
Join Date: Jun 2002
Location: Melbourne, Australia
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's just a set of functions designed to make things easier for people creating mods that use the phpinclude. It's basically a time-saver (and a very good one at that).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04666 seconds
  • Memory Usage 2,216KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete