Jump to content

jenuine

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jenuine's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well, finally I got it working!, like this: elseif ($size_type == 'mc' && !preg_match("/^([0-9]{1,2})x([0-9]{1,2})$/", $itemsize) && !preg_match("/^[0-9]{1}(?:XS|XL)$/",$itemsize) && !preg_match("/^(XS|Small|Medium|Large|XL|[0-9]{1,2})$/",$itemsize))
  2. I've looked at a number of tutorials and can't figure out what should be a simple regex. I've tried many different ways, and with each change, I'd think "this has to be it", but it never is!! #@$%! Here's a piece of my code: elseif ($size_type == 'mc' && !preg_match("/[0-9]{1,2}x+[0-9]{1,2}/",$itemsize) && !preg_match("/[0-9]{1}(?:XS|XL)/",$itemsize) && !preg_match("/(?:\bXS\b|\bSmall\b|\bMedium\b|\bLarge\b|\bXL\b|[0-9]{1,2})/",$itemsize)) An error message is given if all of these preg_match expressions are false. But it's allowing me to enter "1x" and "123" and "12XL" without error. The first preg_match is supposed to say that there needs to be 1 or 2 digits followed by an "x" followed by 1 or 2 more digits. The second is supposed to allow only 1 digit followed by "XS" or "XL", and the third should allow any of the given words or a 1 or 2 digit number. The curly braces aren't working at all. What is the matter? Also, is there any way to shorten the code and have just a single preg_match?
  3. Hi. First off, thank-you to the makers of this site. My problem involves my forum software, fusionboard, an add-on for php-fusion cms. I'd think it would be a quick solve for a php expert, but they're unresponsive at the fusionboard support forum, so thought I'd try here. My forum: http://meetporthuron.com/forum/index.php There are actually two issues, both to do with the "Last Post" column on the forum index. First, and most important to me, is that when there's a subforum, containing a more recent post than its parent forum, it only shows the last post from the parent forum. I know enough php to serve my purposes, usually, but this one is beyond my knowledge level. I think the problem is somewhere in this bit of code: $children = array(); if(dbrows($c_res)){ while($child_data = dbarray($c_res)){ array_push($children, $child_data['forum_id']); findChildren($child_data['forum_id']); } } if(count($children)){ I put in an echo 'test'; at the end of that and it wasn't displayed in the browser... which should mean that the if(count($children)) isn't finding any children, right? So it's moving on to the else part of the statement? In the func.php file, the findChildren function looks like this: function findChildren($forum, $childArray = "") { if (! isset ( $childArray )) { global $children; } if (! isset ( $children )) { $children = array ( ); } $child_res = dbquery ( "select * from " . DB_PREFIX . "fb_forums f left join " . DB_PREFIX . "forums f2 on f2.forum_id=f.forum_id where " . groupaccess ( "f2.forum_access" ) . " and f.forum_parent='$forum'" ); if (dbrows ( $child_res )) { while ( $child_data = dbarray ( $child_res ) ) { array_push ( $children, $child_data ['forum_id'] ); findChildren ( $child_data ['forum_id'] ); } } } And finally, here's the complete section of applicable code from the forum index.php file: $children = array(); if(dbrows($c_res)){ while($child_data = dbarray($c_res)){ array_push($children, $child_data['forum_id']); findChildren($child_data['forum_id']); } } if(count($children)){ $where = ""; $counter = count($children); $normalWhere = ""; foreach($children as $child){ $where .= "t.forum_id='$child' ".($counter > 1 ? "OR " : ""); $normalWhere .= "forum_id='$child' ".($counter > 1 ? "OR " : ""); $counter--; } $posts = $posts + dbcount("(post_id)", DB_POSTS, $normalWhere); $threads = $threads + dbcount("(thread_id)", DB_THREADS, $normalWhere); $childrenForums = dbquery("select * from ".$db_prefix."threads t left join ".$db_prefix."users u on u.user_id=t.thread_lastuser left join ".$db_prefix."posts p on p.post_id=t.thread_lastpostid where ($where OR t.forum_id='".$data['forum_id']."') order by t.thread_lastpost desc limit 1"); $childrenData = dbarray($childrenForums); if (!dbrows($childrenForums) && !$data['forum_lastpost']) { echo $locale['405']."</td>\n"; } else { echo "<b><a href='viewthread.php?thread_id=".$childrenData['thread_id']."' style='text-decoration:underline;'>".trimlink($childrenData['thread_subject'], 30)."</a></b><br />"; echo "".$locale['406']."<a href='".BASEDIR."profile.php?lookup=".$childrenData['thread_lastuser']."'>".showLabel($childrenData['user_id'], false, "index")."</a><br /> <div align='right'>".timePassed($childrenData['thread_lastpost'], false)." <a href='".FORUM."viewthread.php?thread_id=".$childrenData['thread_id']."&pid=".$childrenData['thread_lastpostid']."#post_".$childrenData['thread_lastpostid']."' title='Go To Last Post'><b>»</b></a></div></td>\n"; } } else { if ($data['forum_lastpost'] == 0) { echo $locale['405']."</td>\n"; } else { $threadData = dbarray(dbquery("select * from ".$db_prefix."threads t left join ".$db_prefix."posts p on p.post_id=t.thread_lastpostid left join ".DB_USERS." u on u.user_id=p.post_author where t.thread_lastpost='".$data['forum_lastpost']."'")); echo "<b><a href='viewthread.php?thread_id=".$threadData['thread_id']."' style='text-decoration:underline;'>".trimlink($threadData['thread_subject'], 30)."</a></b><br />"; echo "".$locale['406']."<a href='".BASEDIR."profile.php?lookup=".$data['forum_lastuser']."' style='text-decoration:underline;'>".showLabel($threadData['user_id'], false, "index")."</a><br /> <div align='right'>".timePassed($data['forum_lastpost'], false)." <a href='".FORUM."viewthread.php?thread_id=".$threadData['thread_id']."&pid=".$threadData['thread_lastpostid']."#post_".$threadData['thread_lastpostid']."' title='Go To Last Post'><b>»</b></a></div></td>\n"; } } The second issue is that sometimes the topic title and author name go completely missing from the Last Post column, as you can see on my site. This only happens sometimes, and I'm not sure if the problem would be in the same section of code or somewhere else. Any help would be greatly appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.