News:

Wondering if this will always be free?  See why free is better.

Main Menu

Give me a simple project

Started by Thunderace, October 04, 2004, 03:45:20 PM

Previous topic - Next topic

Thunderace

I'm totally new to php coding (ripped a bit but who hasn't) so give me an SMF related project/problem to solve  :D

Don't make it too hard 1st time please  ::)

And no .. "hee hee I'll give him one he won't be able to find easily so I can say "GOD don't you even know that") please

[Unknown]

Hmmm...........

Open Sources/QueryString.php.  There you should find:

void cleanRequest()
- cleans the request variables (ENV, GET, POST, COOKIE, SERVER) and
  makes sure the query string was parsed correctly.
- handles the URLs passed by the queryless URLs option.
- makes sure, regardless of php.ini, everything has slashes.
- sets up $board, $topic, and $scripturl and $_REQUEST['start'].
- determines, or tries to rather, the client's IP.

array addslashes__recursive(array var)
- returns the var, as an array or string, with slashes.
- importantly adds slashes to keys and values!
- calls itself recursively if necessary.

array htmlspecialchars__recursive(array var)
- adds entities (", <, >) to the array or string var.
- importantly, does not effect keys, only values.
- calls itself recursively if necessary.

array urldecode__recursive(array var)
- takes off url encoding (%20, etc.) from the array or string var.
- importantly, does it to keys too!
- calls itself recursively if there are any sub arrays.

array stripslashes__recursive(array var)
- removes slashes, recursively, from the array or string var.
- effects both keys and values of arrays.
- calls itself recursively to handle arrays of arrays.

array htmltrim__recursive(array var)
- trims a string or an the var array using html characters as well.
- does not effect keys, only values.
- may call itself recursively if needed.

string ob_sessrewrite(string buffer)
- rewrites the URLs outputted to have the session ID, if the user
  is not accepting cookies and is using a standard web browser.
- handles rewriting URLs for the queryless URLs option.
- can be turned off entirely by setting $scripturl to an empty
  string, ''. (it wouldn't work well like that anyway.)
- because of bugs in certain builds of PHP, does not function in
  versions lower than 4.3.0 - please upgrade if this hurts you.


This documentation is very helpful to people still learning the SMF code - even experienced developers.  Here, types are made more explicit.  The following are used:

  - resource: something like a MySQL query, an image, or other "resource" variable (often tied to the system.)
  - object: an object, or class.  These aren't used much in SMF.
  - array: an array... these are used a lot.
  - string: a string, or something meant to be one - like "hello".
  - bool: something that is supposed to be on/off, true/false.
  - int: something that should be a number only, and a WHOLE number at that.
  - float: this is just like int, but includes numbers that have parts - like 1.5.
  - void: nothing.  This is only for the return value of functions.
  - mixed: this is special, and means that it could be, possibly, any of many of the above.  Not used much.

Okay, so... first off, make sure the ones in QueryString.php, Subs-Post.php, LockTopic.php, Errors.php, and Who.php.  You don't have to read all of them, or anything, but those are just examples.

Okay, now for the big thing.  Look at Subs.php (RC2.)  You'll notice that many of the functions in there are not defined, and have instead a comment like "// !!!".  This means "ack, this is missing!!!"  While this thing seems minor, it's actually a very cool thing for developers to see, because it makes everything make so much more sense.  This sort of documentation is very important for projects like this, and making sure it's easy to mod and develop.

So, what I'm asking of you, should you accept, is to document... at least a few from Subs.php.  Try your hand at it.  The worst you can do is learn a bit of PHP and a bit of SMF, and the best you can do is help out with SMF, mods to come, and more.

I could go a lot harder, but I could also go easier.  Still, I think it's a goal to get all of things bits documented before release, so anything you could do (even a single function!) would be helpful.

Thanks,
-[Unknown]

Thunderace

Thanks for the thought Unk but it is beyond me to understand and elaborate on these functions, shame as I'd love to be able to help  :(

I think perhaps I should start at the beginning again, hello world!!!  :D and learn some basics first. I'll be back

Meriadoc

in response to your PM , i'll be looking into this today.
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

NoRad

Why not search the forum for other people's problems and try to think of ways to solve them, or read their responses on how they were solved and try to do that yourself.  That's how I learn... modifying the code and lots of trial and error. I have my PHP book next to me so I can look things up when I get lost.

Advertisement: