function showIcons($file) { // creates the page showing all icons in a sprite $path = pathinfo($file); $fname = $path['filename']; $fam = end(explode("/", $path['dirname'])); // family name if (file_exists($file)) { $xml = simplexml_load_file($file); // print_r($xml); //->symbol['0']['id'] $i = 0; $html .= ' <ul class="spr-ul">'; foreach ($xml->symbol as $item) { $id = $item[0]['id'][0]; $idwords = array('ic', '24px'); $pcs = explode('_', $id); $result = array_diff($pcs, $idwords); $fid = implode(' ', $result); $path = pathinfo($file); // $filewords=array('symbol.svg', 'svg', 'sprite'); // $pcs = explode('-', $file); // $result = array_diff($pcs, $filewords); // print_r($result); // $ffile = implode(' ', $result); $ffile = $fam . " " . shortname($fname); $html .= ' <li class="mag spr-li col-sm-6 col-xs-12 col-md-4 col-lg-3"> <a class="spr-2x" data-icon="' . $file . '#' . $id . '" href="ico.php?f=' . $file . '&i=' . $id . '">' . $fid . '</a> </li> '; ++$i; } $html .= ' </ul>'; $html = '<div class="col-md-12 heading"><h2>' . $ffile . ' <small>' . $i . ' icons </small></h2></div><!--START-->' . $html . '<!-- END -->'; return $html; } else { return '<h3>Failed to open ' . $file . '.</h3>'; } }
function shortname($name) { if (strlen($name) > 40) { return mb_substr($name, 0, 20) . ' ... ' . mb_substr($name, mb_strlen($name) - 20, mb_strlen($name)); } else { return $name; } } if ($result = $db->db_query($qry)) { while ($row = $db->db_fetch_object($result)) { if ($row->firma_id == $preinteressent->firma_id) { $selected = 'selected'; } else { $selected = ''; } echo "<option value='{$row->firma_id}' {$selected}>{$row->plz} {$row->ort} - " . shortname($row->name) . " ({$row->firma_id})</option>"; } } echo "</SELECT> <a href='../stammdaten/firma_frameset.html' target='_blank'><img src='../../skin/images/preferences-system.png' alt='Schulverwaltung' /></a></td>"; echo '</tr><tr>'; //Anmerkung echo '<td>Anmerkungen:</td>'; echo '<td colspan="7">'; echo "<textarea rows='4' style='width: 100%' name='anmerkung'>" . $preinteressent->anmerkung . "</textarea>"; echo '</td>'; echo '</tr><tr>'; echo '<td></td> <td></td> <td></td> <td></td> <td></td>
" target="_blank"><?php echo $STR['lang'][$f['lang']]; ?> </a></td> </tr> <?php } ?> </table> <table class='table table-condensed table-bordered fiexd'> <tr><th colspan=5> <a href="comments.php?pid=<?php echo $pid; ?> ">关于 <b><?php echo shortname($d['probname']); ?> </b> 的讨论</a> <?php if ($uid) { ?> <a href="comment.php?pid=<?php echo $pid; ?> " class="pull-right btn btn-mini btn-danger">发表评论</a> <?php } ?> </th></tr> <?php $sql = "select comments.*,userinfo.nickname,userinfo.uid,userinfo.email from comments,userinfo where userinfo.uid=comments.uid and comments.pid='{$d['pid']}' order by comments.cid asc";
$counts = Lib::query("SELECT COUNT(*) AS count FROM topics"); $count = (int) $counts[0]["count"]; $info = pageInfo($limit, $count); $topics = Lib::query("SELECT * FROM topics ORDER BY num_followers DESC LIMIT " . $info["start"] . ", " . $limit); render("topics.php", ["title" => "Topics", "topics" => $topics, "page" => $info["page"], "last" => $info["last"]]); } } else { if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { alert("Please name your new topic.", "danger"); exit; } if (empty($_POST["description"])) { alert("Please describe your new topic", "danger"); exit; } $shortname = shortname($_POST["name"]); $rows = Lib::query("SELECT * FROM topics WHERE (name = ? OR shortname = ?)", $_POST["name"], $shortname); if (count($rows) != 0) { alert("This topic already exists.", "warning"); exit; } $result = Lib::query("INSERT IGNORE INTO topics (name, shortname, description) VALUES(?, ?, ?)", $_POST["name"], $shortname, $_POST["description"]); if ($result == 0) { alert("Something went wrong. Please try again later.", "danger"); exit; } // TODO: redirect to "/topics.php?shortname=" + $shortname redirect("/topics.php?shortname=" . $shortname); } }
?> <tr> <td><a href='code.php?id=<?php echo $d['sid']; ?> '><?php echo $d['sid']; ?> </a></td> <td><?php if (!$_GET['pid']) { 是否通过($d['pid'], $q); echo "<a href='?pid={$d['pid']}&uid={$_GET['uid']}'>" . shortname($d['probname']) . "</a>"; echo "<a href='../problem/problem.php?pid={$d['pid']}' target='_blank'><span class='icon-share'></span></a>"; } else { echo "<a href='../problem/problem.php?pid={$d['pid']}' target='_blank'>" . shortname($d['probname']) . "</a>"; } ?> </td> <td><a href='../user/detail.php?uid=<?php echo $d['uid']; ?> ' target='_blank'><?php echo gravatar::showImage($d['email']); ?> </a> <?php echo "<a href='?uid={$d['uid']}&pid={$_GET['pid']}'>"; if (有此权限("查看用户")) { echo $d['realname']; } else {
<?php $file = "svg/material-design/svg-sprite-maps-symbol.svg#ic_place_24px"; $path = pathinfo($file); $fname = $path['filename']; $fam = end(explode("/", $path['dirname'])); echo $fam . " " . shortname($fname); function shortname($fname) { $filewords = array('symbol', 'svg', 'sprite'); $pcs = explode('-', $fname); $result = array_diff($pcs, $filewords); return implode(' ', $result); }
" /> <?php echo $e[csid]; ?> </td> <td><a target="_blank" href="problem.php?ctid=<?php echo $_GET[ctid]; ?> &pid=<?php echo $e[pid]; ?> &uid=<?php echo $d[uid]; ?> "><?php echo shortname($e[probname]); ?> </a></td> <td><a href="code.php?csid=<?php echo $e[csid]; ?> " target="_blank"><?php echo $STR[lang][$e[lang]]; ?> </a></td> <td><?php echo date("m/d H:i:s", $e[subtime]); ?> </td> <td><?php echo 评测结果($e[result], 50);
</td> <td><a href="../user/detail.php?uid=<?php echo $d[uid]; ?> " target="_blank"><?php echo $d[realname]; ?> </a></td> <td><a href="problem.php?pid=<?php echo $d[pid]; ?> &ctid=<?php echo $d[ctid]; ?> " target="_blank"><?php echo shortname($d[probname]); ?> </a></td> <td><code><?php echo $d[filename]; ?> </code></td> <td><a href="code.php?csid=<?php echo $d[csid]; ?> " target="_blank"><?php echo $STR[lang][$d[lang]]; ?> </a></td> <td id="result<?php echo $d[csid];
if ($item->_isFolder) { /* For folders */ $headerlevel = $currentDepth > 8 ? 8 : $currentDepth; echo $spacer . '<li class="description" id="desc' . ($counter + 1) . '" onclick="toggleElement(' . ($counter + 1) . ');"><h' . $headerlevel . '>' . $item->name . '</h' . $headerlevel . '></li>' . "\n"; echo $spacer . '<li><ul class="folder" id="c' . ($counter + 1) . '">' . "\n"; $counter++; $currentDepth++; recomputeSpacer($spacer, $currentDepth); } else { $tt++; /* For bookmarks */ if ($item->ICON) { echo $spacer . '<li class="file">' . "\n"; echo $spacer . "\t" . '<a href="' . $item->HREF . '" target="_blank"><img src="icons/' . $item->ICON . '.ico" alt="" /><span class="txt" title="' . $item->name . '">' . shortname($item->name) . '</span></a>' . "\n"; echo $spacer . '</li>' . "\n"; } else { echo $spacer . '<li class="file">' . "\n"; echo $spacer . "\t" . '<a href="' . $item->HREF . '" target="_blank"><img src="page.png" alt="" /><span class="txt" title="' . $item->name . '">' . shortname($item->name) . '</span></a>' . "\n"; echo $spacer . '</li>' . "\n"; } } } ?> </ul></li> </ul> <p>All: <?php echo $tt; ?> </p> </body> </html>
?> </div> <dl class='problem'> <?php echo $d['text']; ?> </dl> </div> <div class="tou"> <table class='table table-condensed table-bordered fiexd'> <tr><th colspan=5> <a href="../problem/comments.php?aid=<?php echo $aid; ?> ">关于 <b><?php echo shortname($d['title']); ?> </b> 的讨论</a> <?php if ($_SESSION['ID']) { ?> <a href="../problem/comment.php?aid=<?php echo $aid; ?> " class="pull-right btn btn-mini btn-danger">发表评论</a> <?php } ?> </th></tr> <?php $sql = "SELECT comments.*, userinfo.uid, userinfo.nickname, userinfo.realname, userinfo.email, userinfo.accepted, userinfo.submited, userinfo.grade, userinfo.memo FROM comments, userinfo WHERE userinfo.uid = comments.uid ";