function show_hint($wid) { $hint = get_hint($wid); if ($hint) { $hint = htmlspecialchars(stripslashes($hint)); } else { $hint = "No hint!"; } $response = new xajaxResponse(); $response->assign("result", "innerHTML", $hint); $response->assign("result", "style.display", "block"); return $response; }
if ($last_modified_id == $arr['id']) { echo ' last_modified'; } echo "' height='36'>" . $arr['id'] . "</td>"; echo "<td class='list'><span class='number'>" . $arr['number'] . "</span> <div style='float:right'><span class='shift_ch' data-direction='1'>↓</span> <span class='shift_ch' data-direction='-1'>↑</span></div></td>"; echo "<td class='list'>" . $arr['service_id'] . "</td>"; echo "<td class='list'>"; echo '<table cellpadding="0" cellspacing="0">'; echo '<tr>'; echo '<td>'; if ($ch_logo = Itv::getLogoUriById(intval($arr['id']), 120)) { echo '<img src ="' . $ch_logo . '"/ >'; } echo '</td>'; echo '<td>'; echo '<b style="color:' . get_color($arr) . '" title="' . get_hint($arr) . '">' . $arr['name'] . '</b>'; echo '</td>'; echo '</tr>'; echo '</table>'; echo "</td>"; echo "<td class='list'>" . $arr['cmd'] . "</td>"; echo "<td class='list'>" . $arr['xmltv_id'] . "</td>"; echo "<td class='list'>" . (!empty($arr['genres_name']) ? _($arr['genres_name']) : '----') . "</td>"; echo "<td class='list' align='center'>" . ($arr['enable_tv_archive'] == 1 ? '•' : '') . "</td>"; echo "<td class='list'>" . $arr['volume_correction'] . "</td>"; echo "<td class='list' align='center'>\n"; if (Admin::isActionAllowed()) { echo "<a href='#' onclick='if(confirm(\"" . _('Do you really want to reset claims counter?') . "\")){document.location=\"claims.php?reset=1&media_id=" . $arr['media_id'] . "&media_type=" . $arr['media_type'] . "\"}'>"; } echo "<span style='color:red;font-weight:bold'>" . $arr['video_counter'] . " / " . $arr['sound_counter'] . " / " . $arr['no_epg'], " / " . $arr['wrong_epg'] . "</span>"; if (Admin::isActionAllowed()) {
function browse_word($ch, $form = '') { global $dbconn; global $uid; $ch = strtolower($ch); $sql = ''; $num_res = 0; $response = new xajaxResponse(); connect_db(); $goman = substr($form, 0, 5) == 'goman' ? TRUE : FALSE; if ($form) { if ($goman) { $page = $ch + 500; $sql = "select * from hangee_words where page={$page}"; if (substr($form, -1) == 'm') { $sql .= " and id in (select wid from hangee_marked where uid={$uid})"; } $sql .= " order by word asc"; } else { $column = $form['column']; $key = trim($form['key']); if (strlen($key) == 0) { $response->assign("result", "innerHTML", "No search word is given!"); $response->assign("result", "style.display", "block"); return $response; } switch ($column) { case 'word': $sql = "select * from hangee_words where word like '%{$key}%' order by word asc"; break; case 'sense': $sql = "select * from hangee_words where sense like '%{$key}%' order by word asc"; break; case 'SQL': $sql = "select * from hangee_words where " . $key; break; default: $response->assign("result", "innerHTML", "Internal Error!"); $response->assign("result", "style.display", "block"); return $response; break; } } } else { if (strlen($ch) == 2) { $ch = substr($ch, 0, 1); $sql = "select * from hangee_words where word like '{$ch}%' and page < 300 " . "and id in (select wid from hangee_marked where uid = {$uid})"; } else { $sql = "select * from hangee_words where word like '{$ch}%' and page < 300 order by word asc"; } } $res = mysql_query($sql, $dbconn); if (!$res) { $response->assign("debug", "innerHTML", "query failed: {$sql}" . mysql_error($dbconn)); $response->assign("debug", "style.display", "block"); return $response; } if (($num_res = mysql_num_rows($res)) == 0) { $response->assign("word_browser", "innerHTML", "<strong>No words, lucky you!</strong>"); $response->assign("word_browser", "style.display", "block"); return $response; } $num = 0; if (isset($key)) { if ($column == 'SQL') { $caption = "Search result of SQL"; } else { $caption = "Search result of '<strong>" . htmlspecialchars($key) . "</strong>'"; } } else { if ($goman) { $caption = "GoMAN DAY {$ch}"; } else { $caption = "HanGEE words starting with '<strong>" . strtoupper($ch) . "</strong>'"; } } $pstr = $goman ? "Day" : "Page"; $html = "<p>{$num_res} words are found</p>" . "<p><a href='javascript:void(0);' onClick=\"show_sense({$num_res});\"><strong>Show Sense</strong></a> | " . "<a href='javascript:void(0);' onClick=\"hide_sense({$num_res});\"><strong>Hide Sense</strong></a> | " . "<a href='javascript:void(0);' onClick=\"words_upper({$num_res});\"><strong>Upper</strong></a> | " . "<a href='javascript:void(0);' onClick=\"words_lower({$num_res});\"><strong>Lower</strong></a></p>" . "<center>" . "<table id='word_table'>" . "<caption>{$caption}</caption>" . "<tr><th id='num' width='5%'>Num</th><th id='page' width='8%'>{$pstr}</th><th id='word' width='15%'>Word</th>" . "<th id='sense' width='40%'>Sense</th><th id='hint'>Hint</th>" . "<!-- <th id='edit'>Edit</th></tr> -->"; while ($row = mysql_fetch_array($res)) { $num++; $id = $row['id']; $page = $row['page']; $word = $row['word']; $sense = htmlspecialchars(stripslashes($row['sense'])); if (!$goman && $page < 500) { $pattern = '/((a|v|vi|n|ad|pre)\\.)/'; $replace = '<br>$1'; $sense = preg_replace($pattern, $replace, $sense); $sense = substr($sense, 4); // delete leading <br> } $grade = get_user_grade(); if ($grade == '1' || $grade == '0') { $numstr = "<a name='{$num}' href=\"javascript:openPopup('edit.php?id={$id}', 'editwin');\"><b>{$num}</b></a>"; } else { $numstr = "<a href='mailto:sandrain@gmail.com'><b>{$num}</b></a>"; } $word = "<a href=\"javascript:mark_word({$id}, {$num})\"><span id='w{$num}'>" . strtoupper($word) . "</span></a>"; $mcount = get_marked_count($id); if ($mcount > 0) { $wbackcolor = "#ffcc00"; $word .= " <a href=\"javascript:unmark_word({$id}, {$num})\"><font color='#cc0000'>"; while ($mcount--) { $word .= "*"; } $word .= "</font></a>"; } else { $wbackcolor = "#ffff99"; } $bgcolor = ''; if ($page > 500) { $page = "D - " . ($page - 500); $bgcolor = "bgcolor='#ccffff'"; } $dict = "<a href='javascript:void(0); return false;' onClick=\"openPopup('dict.php?id={$id}', 'dictwin')\">{$page}</a>"; $hint = get_hint($id); $hintlink = "<a href='javascript:void(0);' " . "onClick=\"javascript:openPopup('hint.php?id={$id}', 'hintwin');\">Edit</a>"; if ($hint) { $hint = htmlspecialchars(stripslashes($hint)) . " <span style='font-size:8pt;'>({$hintlink})</span>"; } else { $hint = $hintlink; } $html .= "<tr onMouseOver=\"this.bgColor='#ccff99'\" onMouseOut=\"this.bgColor='#ffffff'\">" . "<td headers='num' align='right' style='padding-right:10px;'>{$numstr}</td>" . "<td headers='page' align='center' {$bgcolor}>{$dict}</td>" . "<td headers='word' bgcolor='{$wbackcolor}' align='left'><p class='table_word'>{$word}</p></td>" . "<td headers='sense' align='left' id='td{$num}' class='answer_off' " . "onMouseOver=\"className='answer_on'\" onMouseOut=\"className='answer_off'\">" . "<p class='table_text'>{$sense}</p></td>" . "<td headers='hint' align='left'><p class='table_text'>{$hint}</p></td>"; } $html .= "</table></center>"; disconnect_db(); if (isset($column) && isset($key)) { $response->script("set_search_active('{$column}', '{$key}')"); } else { $response->script("update_current_ch('{$ch}');"); } $response->assign("word_browser", "innerHTML", $html); $response->assign("word_browser", "style.display", "block"); $response->script("num_res = {$num_res};"); return $response; }