protected function render($view, $vars = array(), $echo = true) { $reflect = new ReflectionClass($this); $path = str_replace('Controller', '', $reflect->getShortName()); $html = get_element($path, $view, $vars, $echo); if ($echo) { echo $html; } else { return $html; } }
function create_string() { $field_list = array("Date", "Page"); $allow_list = array("1", "1"); $element_list = array(); for ($i = 0; $i < sizeof($field_list); $i++) { if ($allow_list[$i] == "1") { $element_list[] = get_element($i); } } return join("\t", $element_list); }
<table border="1" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/mob/<?php echo $row['ID']; ?> .gif"></td> <td> <table> <tr> <td colspan="2"><?php echo $row['kName']; echo $row['ID']; ?> </td> <td><?php echo get_element($row['Element']); ?> | <?php echo $race_arg[$row['Race']]; ?> </td> </tr> </table> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td>Level</td><td><?php echo $row['LV']; ?> </td> <td>STR</td><td><?php
function get_view($path = '', $template, $vars = array(), $echo = false) { $html = get_element($path, $template, $vars, $echo); if ($echo) { echo $html; } else { return $html; } }
function getTestTeamPuzzles($tid) { $sql = sprintf("SELECT pstatus.id FROM pstatus WHERE pstatus.inTesting = '1'"); $testingstatusid = get_element($sql); $sql = sprintf('SELECT pid FROM testsolve_team_queue, puzzle_idea WHERE tid=%s AND puzzle_idea.id = testsolve_team_queue.pid AND puzzle_idea.pstatus = %s', mysql_real_escape_string($tid), mysql_real_escape_string($testingstatusid)); return get_elements($sql); }
function leveled_ele($str, $max, $skill_id) { if (strpos($str, ':') == true) { $lvs = explode(":", $str); $retval = "{\n"; for ($i = 0; $i < $max && isset($lvs[$i]); $i++) { $retval .= "\t\tLv" . ($i + 1) . ": \"" . get_element($lvs[$i], $skill_id) . "\"\n"; } $retval .= "\t}"; } else { $retval = "\"" . get_element($str, $skill_id) . "\""; } return $retval; }
$cleanTitle = htmlspecialchars($title); // I don't think we need or want HTML in titles... do we? $cleanSummary = $purifier->purify($summary); $cleanDescription = $purifier->purify($description); if ($summary == '' || $description == '') { echo "<div class='errormsg'>You must enter a summary and a description</div>"; newIdeaForm($uid, $summary, $description); foot(); exit(1); } $time = time(); mysql_query('START TRANSACTION'); $sql = sprintf("INSERT INTO puzzle_idea (title, summary, description, needed_editors) VALUES ('%s', '%s', '%s', '%s')", mysql_real_escape_string($cleanTitle), mysql_real_escape_string($cleanSummary), mysql_real_escape_string($cleanDescription), mysql_real_escape_string(MIN_EDITORS)); query_db($sql); $sql = sprintf("SELECT id FROM puzzle_idea WHERE summary='%s' AND description='%s'", mysql_real_escape_string($cleanSummary), mysql_real_escape_string($cleanDescription)); $id = get_element($sql); $sql = sprintf("INSERT INTO authors (pid, uid) VALUES ('%s', '%s')", mysql_real_escape_string($id), mysql_real_escape_string($uid)); query_db($sql); foreach ($coauthors as $author) { if ($author != $uid) { $sql = sprintf("INSERT INTO authors (pid, uid) VALUES ('%s', '%s')", mysql_real_escape_string($id), mysql_real_escape_string($author)); query_db($sql); } } mysql_query('COMMIT'); // Subscribe authors and coauthors to comments on their own puzzles subscribe($uid, $id); foreach ($coauthors as $auth) { if ($auth != $uid) { subscribe($auth, $id); }