function get_re($ids) { $result = get_table_where_order("chat", "*", "`RE_TO` = " . $ids . "", "`DATE` ASC"); if ($result->num_rows != 0) { while ($row = $result->fetch_assoc()) { $re[] = array('id' => $row["ID"], 'name' => get_name($row["OWNER_ID"]), 'text' => $row["TEXT"], 'date' => $row["DATE"], 'RE' => get_re($row["ID"])); } return $re; } else { return ""; } }
function show_one_tad_web_discuss($DiscussID = "") { global $xoopsDB, $xoopsUser, $isAdmin, $xoopsTpl, $web_cate; if (empty($DiscussID)) { return; } else { $DiscussID = intval($DiscussID); } add_tad_web_discuss_counter($DiscussID); $sql = "select * from " . $xoopsDB->prefix("tad_web_discuss") . " where DiscussID='{$DiscussID}'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $all = $xoopsDB->fetchArray($result); //以下會產生這些變數: $DiscussID , $ReDiscussID , $uid , $DiscussTitle , $DiscussContent , $DiscussDate , $WebID , $LastTime , $DiscussCounter foreach ($all as $k => $v) { ${$k} = $v; } //$fun=(isMine($uid))?" //<a href='{$_SERVER['PHP_SELF']}?op=tad_web_discuss_form&DiscussID=$DiscussID' class='link_button_r'>"._TAD_EDIT."</a> //<a href=\"javascript:delete_tad_web_discuss_func($DiscussID);\" class='link_button_r'>"._TAD_DEL."</a> //":""; $xoopsTpl->assign('op', 'show_one_tad_web_discuss'); $xoopsTpl->assign('isMineDiscuss', isMineDiscuss($MemID, $WebID)); $xoopsTpl->assign('DiscussTitle', $DiscussTitle); $xoopsTpl->assign('MemID', $MemID); $xoopsTpl->assign('DiscussContent', nl2br($DiscussContent)); $xoopsTpl->assign('DiscussDate', $DiscussDate); $xoopsTpl->assign('LastTime', $LastTime); $xoopsTpl->assign('MemName', $MemName); $xoopsTpl->assign('WebID', $WebID); $xoopsTpl->assign('DiscussCounter', $DiscussCounter); $xoopsTpl->assign('DiscussID', $DiscussID); $xoopsTpl->assign('DiscussInfo', sprintf(_MD_TCW_INFO, $MemName, $DiscussDate, $DiscussCounter)); $xoopsTpl->assign('re', get_re($DiscussID)); $xoopsTpl->assign('LoginMemID', $_SESSION['LoginMemID']); //取得單一分類資料 $cate = $web_cate->get_tad_web_cate($CateID); $xoopsTpl->assign('cate', $cate); }
/** * Form Validator * This function used to valid form fields */ function validate_form($field, $method, $syntax = NULL) { switch ($method) { case 'username': $syntax = get_re('username'); } }
/** * Function used to check field directly */ function validate_field($code, $text) { $syntax = get_re($code); if (empty($syntax)) { return true; } return check_regular_expression($syntax, $text); }