• Welcome to Simple Machines Community Forum. Please login or sign up.
September 21, 2021, 07:57:04 PM

News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord


PHP 4.4.0 Compatibility

Started by Ben_S, July 13, 2005, 07:50:22 AM

Previous topic - Next topic

worm5252

Problem number 1: Incompleate Subs.php file. Here is what I do have:

<?php
/******************************************************************************
* Subs.php                                                                    *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel (zef@zefhemel.com)                *
* =========================================================================== *
* Software Version:           SMF 1.0.4                                       *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by:     Lewis Media (http://www.lewismedia.com)         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

/*   This file has all the main functions in it that relate to, well,
everything.  It provides all of the following functions:

resource db_query(string database_query, string __FILE__, int __LINE__)
- should always be used in place of mysql_query.
- executes a query string, and implements needed error checking.
- always use the magic constants __FILE__ and __LINE__.
- returns a MySQL result resource, to be freed with mysql_free_result.

int db_affected_rows()
- should always be used in place of db_insert_id.
- returns the number of affected rows by the most recently executed
query.
- handles the current connection so the forum with other connections
active at the same time.

int db_insert_id()
- should always be used in place of mysql_insert_id.
- returns the most recently generated auto_increment column.
- handles the current connection so the forum with other connections
active at the same time.

void updateLastMessages(array ID_BOARDs)
- takes an array of board IDs and updates their last messages.
- if the board has a parent, that parent board is also automatically
updated.
- columns updated are ID_LAST_MSG and lastUpdated.
- note that ID_LAST_MSG should always be updated using this function,
and is not automatically updated upon other changes.

void updateStats(string statistic, string condition = '1')
- statistic can be 'member', 'message', 'topic', 'calendar', or
'postgroups'.
- the condition is optional, and is only used to update post groups.
- the 'member' statistic updates the latest member, the total member
count, and the number of unapproved members.
- updating 'message' changes the total number of messages, and the
highest message id by ID_MSG.
- 'topic' updates the total number of topics.
- the 'calendar' statistic updates the cache of the calendar
information for a day before and after today.
- the 'postgroups' case updates those members who match condition's
post-based membergroups in the database.

void updateMemberData(int ID_MEMBER, array data)
- updates the columns in the members table.
- ID_MEMBER is either an int or an array of ints to be updated.
- data is an associative array of the columns to be updated and their
respective values.
- any string values updated should be quoted and slashed.
- the value of any column can be '+' or '-', which mean 'increment'
and decrement, respectively.
- if the member's post number is updated, updates their post groups.
- this function should be used whenever member data needs to be
updated in place of an UPDATE query.

void updateSettings(array changeArray)
- updates both the settings table and $modSettings array.
- all of changeArray's indexes and values are assumed to have escaped
apostrophes (')!
- if a variable is already set to what you want to change it to, that
variable will be skipped over; it would be unnecessary to reset.

string constructPageIndex(string base_url, int &start, int max_value,
int num_per_page, bool compact_start = false)
- builds the page list, e.g. 1 ... 6 7 [8] 9 10 ... 15.
- compact_start caused it to use "url.page" instead of
"url;start=page".
- handles any wireless settings (adding special things to URLs.)
- very importantly, cleans up the start value passed, and forces it to
be a multiple of num_per_page.
- also checks that start is not more than max_value.
- base_url should be the URL without any start parameter on it.
- uses the compactTopicPagesEnable and compactTopicPagesContiguous
settings to decide how to display the menu.
- an example is available near the function definition.

string comma_format(float number)
- formats a number to display in the style of the admins' choosing.
- uses the format of number_format to decide how to format the number.
- for example, it might display "1 234,50".
- caches the formatting data from the setting for optimization.

string timeformat(int time, bool show_today = true)
- returns a pretty formated version of time based on the user's format
in $user_info['time_format'].
- applies any necessary time offsets to the timestamp.
- if todayMod is set and show_today was not not specified or true, an
alternate format string is used to show the date with something to
show it is "today" or "yesterday".
- performs localization (more than just strftime would do alone.)

string un_htmlspecialchars(string text)
- removes the base entities (&lt;, &quot;, etc.) from text.
- should be used instead of html_entity_decode for PHP version
compatibility reasons.
- additionally converts &nbsp; and &#039;.

int forum_time(bool use_user_offset = true)
- returns the current time with offsets.
- always applies the offset in the time_offset setting.
- if use_user_offset is true, applies the user's offset as well.
- returns seconds since the unix epoch.

string doUBBC(string message, bool enableSmileys = true)
- parses bbc tags in message.
- only parses smileys if enableSmileys is true.
- does nothing if the enableBBC setting is off.
- applies the fixLongWords magic if the setting is set to on.
- returns the modified message.

void parsecode(string &message)
- this very hefty function does the bulk of message parsing.
- only parses BBC tags which are not disabled in disabledBBC.
- also handles basic HTML, if enablePostHTML is on.
- caches the from/to replace regular expressions so as not to reload
them every time a string is parsed.
- returns nothing, but instead modifies message directly.

void parsesmileys(string &message)
- the smiley parsing function which makes pretty faces appear :).
- if custom smiley sets are turned off by smiley_enable, the default
set of smileys will be used.
- these are specifically not parsed in code tags
- caches the smileys from the database or array in memory.
- doesn't return anything, but rather modifies message directly.

string highlight_php_code(string code)
- Uses PHP's highlight_code() to highlight PHP syntax
- does special handling to keep the tabs in the code available.
- used to parse PHP code from inside
and [php] tags.
- returns the code with highlighted HTML.

void writeLog(bool force = false)
// !!!

void redirectexit(string setLocation = '', bool add = true, bool refresh = false)
// !!!

redone

Or you could just upload the Subs file that Ben attatched in his original post.

;)

morph

Go to the first post and download the Subs.php file attached.

EDIT: too quick for me redone :P

Coming soon!

worm5252

I did that too, now I get the following:

Template Parse Error!
It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.

You can also try refreshing this page.

worm5252


kegobeer

Read the first post in this thread for instructions.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

worm5252

I have done that to the best of my abbilities, I am still recieveing a Template Parse Error. How do I get around this error?

redone

Even after uploading the file Ben attatched?


worm5252


JayBachatero

Do you have any mods installed?  If so which ones?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

worm5252

Not that I know of. I am not worried about undoing any mods. Feature wise SMF has been solid for what we want. If I did have any mods none of them work anyways.

I do use a custom theme though, but that worked before, and I dont see how that effects the template.

Owdy

November 21, 2005, 05:23:07 PM #131 Last Edit: November 21, 2005, 05:25:29 PM by Owdy
That error message means that your theme files has something wrong. Does default theme work?

This should work if you are logged in admin: http://www.kromestudio.com/SMF_Forum/index.php?theme=1
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

JayBachatero

Ok he just uploaded all of his files and replace all of them.  It's still giving him the error.  Any ideas Owdy?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

JayBachatero

Quote from: Owdy on November 21, 2005, 06:19:09 PM
Did he try default theme?

Ok problems solved.  I ran repair_settings.php and disabled Queryless URLs.  Everything is up and running.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

worm5252

OMG, Finally after 5 and a hlaf hours it is working. Thanks to the help of JayBachatero. Jay you are awsome, you worked with me on this for some time and thanks to your help everything is working. Great Job Man.

JayBachatero

Quote from: worm5252 on November 21, 2005, 06:26:37 PM
OMG, Finally after 5 and a hlaf hours it is working. Thanks to the help of JayBachatero. Jay you are awsome, you worked with me on this for some time and thanks to your help everything is working. Great Job Man.

You're welcome.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Owdy

2nd?!! We are 'The greatest ones' ;D
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Advertisement: