Second day tracing the code - acli/ATutor GitHub Wiki
This is the second day tracing the code in html/forum.inc.php.
- If we are prefixing TABLE_PREFIX directly in front of the table name, are we properly checking TABLE_PREFIX for illegal characters?
- There is such a parameter as $num_per_page. Where does this come from?
- $num_per_page is hard-coded on line 19
- How do we determine $start?
- parent_id=0 are thread starters
- So $num_threads is the number of individual threads in the whole forum
- If $start = ($page-1)*$num_per_page (line 25), aren’t $start ALWAYS off by 1?? what are we missing?
- $start specifies an SQL skip count in the LIMIT clause which is zero-based, so the calculation is correct
- $num_pages_2 = ceil(($row['num_comments']+1)/$num_per_page);
- where does $row come from?
- the sql statement in line 44 (with an inline assignment, which is BAD FORM, in line 47)
- num_comments is actually a column in the table that is meaningful only for thread starters
- num_comments counts are CORRECT
- so it’s the calculation that’s incorrect
- Need to create from the "admin" account
- The "upper-left pointing arrow" is not an active link (!)
- The developer's guide is woefully out of date
- The $_module_pages array is no longer used