/** * 配合 masonry 这个 widget * widget('masonry' , array( 'tag'=>'#masonry', 'scroll'=>true )); */ function next() { $count = $this->result->rowCount; $size = $this->pageSize; $page = (int) $_GET['page'] ?: 1; $next = $page + 1; $pages = ceil($count / $size); if ($page <= $pages) { $params = array('page' => $next); if ($_GET) { $params = array_merge($_GET, $params); } $url = url_action(null, $params); echo "<div class='pagination' style='display:none;'><a href='" . $url . "'></a></div>"; } else { throw new \Exception('exception'); } }
<?php include "../../include.php"; if ($posting) { langTranslatePost('title'); $id = db_save('organizations'); url_drop('id'); } elseif (url_action('delete') && url_id('delete_id')) { db_delete('organizations', $_GET['delete_id']); url_drop('delete_id,action'); } echo drawTop(); if (url_id()) { //form $f = new form('organizations', @$_GET['id']); $f->set_field(array('type' => 'text', 'name' => 'title' . langExt(), 'label' => getString('title'))); langUnsetFields($f, 'title'); langTranslateCheckbox($f); echo $f->draw(); } else { //modules list $t = new table('organizations', drawHeader()); $t->set_column('draggy', 'd', ' '); $t->set_column('title', 'l', getString('title')); $t->set_column('delete', 'd', ' '); $result = db_table('SELECT id, title' . langExt() . ' title FROM organizations WHERE is_active = 1 ORDER BY precedence'); foreach ($result as &$r) { $r['draggy'] = draw_img('/images/icons/move.png'); $r['title'] = draw_link('organizations.php?id=' . $r['id'], $r['title']); $r['delete'] = drawColumnDelete($r['id']); }
<?php include '../include.php'; url_query_require(); if (url_action('delete')) { db_delete('press_clips', $_GET['delete_id']); url_change('/press-clips/'); } echo drawTop(); echo drawTableStart(); echo drawHeaderRow($page['breadcrumbs'] . $page['title'], 2, getString('edit'), 'edit/?id=' . $_GET['id'], getString('delete'), drawDeleteLink()); $r = db_grab('SELECT c.title' . langExt() . ' title, c.url, c.pub_date, c.publication' . langExtT() . ' publication, c.type_id, c.description' . langExt() . ' description, t.title' . langExt() . ' type FROM press_clips c JOIN press_clips_types t ON c.type_id = t.id WHERE c.id = ' . $_GET['id']); ?> <tr> <td class="left"><?php echo getString('title'); ?> </td> <td class='title'><?php echo $r['title']; ?> </td> </tr> <tr> <td class="left"><?php echo getString('category'); ?> </td> <td><?php echo draw_link('categories.php?id=' . $r['type_id'], $r['type']); ?>
<?php include "../include.php"; if (url_action("delete")) { if (!isset($_GET["staffID"]) && isset($_GET["id"])) { $_GET["staffID"] = $_GET["id"]; } $r = db_grab("SELECT firstname, lastname, endDate FROM intranet_users WHERE userID = " . $_GET["staffID"]); if ($r["endDate"]) { db_query("UPDATE intranet_users SET isActive = 0, deletedBy = {$user["id"]}, deletedOn = GETDATE() WHERE userID = " . $_GET["staffID"]); } else { db_query("UPDATE intranet_users SET isActive = 0, deletedBy = {$user["id"]}, deletedOn = GETDATE(), endDate = GETDATE() WHERE userID = " . $_GET["staffID"]); } if ($locale == "/_seedco/") { email("jreisner@seedco.org,pchoi@seedco.org", "<a href='http://intranet.seedco.org/staff/view.php?id=" . $_GET["staffID"] . "'>" . $r["firstname"] . " " . $r["lastname"] . "</a> was just deactivated on the Intranet.", "Intranet: Staff Deleted"); } url_query_drop("action,staffID"); } function drawJumpToStaff($selectedID = false) { global $isAdmin; $nullable = $selectedID === false; $return = ' <table class="message"> <tr> <td class="gray">Jump to ' . drawSelectUser("", $selectedID, $nullable, 0, true, true, "Staff Member:") . '</td> </tr> </table>'; if ($isAdmin) { if ($r = db_grab("SELECT COUNT(*) FROM users_requests")) { $return = drawServerMessage("There are pending <a href='requests.php'>account requests</a> for you to review.") . $return;
<?php include "include.php"; if (url_action("deletereq")) { db_query("DELETE FROM users_requests WHERE id = " . $_GET["id"]); url_query_drop("action,id"); } elseif (url_action("invite")) { $result = db_query('SELECT id FROM users WHERE lastlogin IS NULL AND is_active = 1'); while ($r = db_fetch($result)) { emailInvite($r['id']); } url_query_drop("action"); } echo drawTop(); echo drawJumpToStaff(); echo drawTableStart(); echo drawHeaderRow("", 3); $result = db_query("SELECT id, lastname, firstname, created_date FROM users_requests WHERE is_active = 1 ORDER BY created_date DESC"); if (db_found($result)) { ?> <tr> <th width="70%">Name</th> <th width="30%" class="r">Invited On</th> <th></th> </tr> <?php while ($r = db_fetch($result)) { ?> <tr> <td><a href="add_edit.php?requestID=<?php echo $r["id"];
<?php include "../../include.php"; if (url_id() && url_action('delete')) { db_delete('web_news_blurbs', $_GET['delete_id']); url_drop('action,delete_id'); } echo drawTop(); $blurbs = db_table("SELECT b.id, b.title, b.publish_date FROM web_news_blurbs b WHERE b.is_active = 1 ORDER BY b.publish_date DESC"); $t = new table("web_news_blurbs"); $t->set_column("title"); $t->set_column("publish_date", "r"); $t->set_column('delete', 'c', ' '); $t->set_title(drawHeader(array("add new" => "edit/"))); foreach ($blurbs as &$b) { $b["title"] = draw_link("edit/?id=" . $b["id"], $b["title"]); $b["publish_date"] = format_date($b["publish_date"]); $b['delete'] = draw_img('/images/icons/delete.gif', url_query_add(array('action' => 'delete', 'id' => $b['id']), false)); } echo $t->draw($blurbs); echo drawBottom();
<style> [banner-id] { cursor:pointer; } .of-row img { max-width:100%; } </style> <script> $(function(){ $('[banner-id] .content').click(function(){ var id = $(this).parent().attr('banner-id'); location.href='<?php echo url_action(); ?> &do=philgo-banner&what=upload&id='+id; }); $('.delete-banner').click(function(e){ e.preventDefault(); var re = confirm('정말 삭제하시겠습니까?'); if ( re ) { var id = $(this).parent().attr('banner-id'); var url = "<?php echo ajax_endpoint(); ?> &do=philgo_banner&what=delete&id="+id; console.log(url); $.get(url, function(re){ if ( re['code'] ) return alert( re['message'] ); var id = re['data']['id'];
db_query('UPDATE spotlight SET precedence = ' . $counter . ' WHERE id = ' . $link_id); $counter++; } die(drawSpotlight()); } else { $id = db_enter('spotlight', 'title url precedence'); if ($uploading && file_ext($_FILES["userfile"]['name']) == 'jpg') { define('DIRECTORY_ROOT', $_SERVER['DOCUMENT_ROOT']); define('DIRECTORY_WRITE', '/uploads'); $image = format_image($_FILES["userfile"]["tmp_name"], 'jpg'); $image = format_image_resize($image, 320, 320); file_put('/uploads/spotlight/' . $id . '.jpg', $image); } url_change(); } } elseif (!empty($_GET['id']) && url_action('delete')) { db_query('DELETE FROM spotlight WHERE id = ' . $_GET['id']); url_query_drop('action,id'); } drawTop(); ?> <table cellspacing="1" class="left draggable spotlight"> <thead> <?php echo drawHeaderRow(false, 5, "new", "#bottom"); ?> <tr> <th class="reorder"></th> <th>Image</th> <th>Link</th> <th>Address</th>
$func(); } echo "<table width='100%'>"; echo "<tr><th>Name</th><th>status</th><th>Action</th></tr>"; foreach (sys()->getModels() as $name) { $path = DIR_OVERFRAME . "/model/{$name}/install.php"; $status = '-'; $action = '-'; if (file_exists($path)) { include_once $path; $is_installed = "hook_{$name}_is_installed"; $install = "hook_{$name}_install"; $uninstall = "hook_{$name}_uninstall"; if (function_exists($is_installed)) { $re = $is_installed(); $url = url_action(); if ($re) { $status = 'installed'; $action = "<a href='{$url}&do=uninstall&name={$name}' onclick='return confirm(\"Are you sure you want to delete {$name} entity and its records?\");'>Un-Install</a>"; } else { $status = 'not installed'; $action = "<a href='{$url}&do=install&name={$name}'>Install</a>"; } } } echo "<tr>"; echo "<td>{$name}</td>"; echo "<td>{$status}</td>"; echo "<td><b>{$action}</b></td>"; echo "</tr>"; }
<?php include 'include.php'; if (url_action('delete_skill')) { db_query('UPDATE skills SET isActive = 0, updatedOn = GETDATE(), updatedBy = ' . $user['id'] . ' WHERE id = ' . $_GET['id']); url_query_drop('action,id'); } echo drawTop(); echo drawTableStart(); if ($isAdmin) { echo drawHeaderRow('', 3, 'Add New', 'skill_add_edit.php'); $colspan = 3; } else { echo drawHeaderRow('', 2); $colspan = 2; } $lastGroup = ''; $skills = db_table('SELECT s.id, s.title, s.group, (SELECT COUNT(*) FROM users_to_skills u2s JOIN intranet_users u ON u2s.user_id = u.userID WHERE u2s.skill_id = s.id AND u.isActive = 1) as count FROM skills s WHERE s.isActive = 1 ORDER BY s.group, s.title');
<?php $pageIsPublic = true; include "include.php"; $redirect = false; if (url_action("logout")) { error_debug("<b>index.php</b> Logging Out", __FILE__, __LINE__); cookie("last_login"); $_SESSION["user_id"] = false; $redirect = "/"; } elseif (login(@$_COOKIE["last_login"], "", true)) { //log in with last login error_debug("<b>index.php</b> Cookie Found (good)", __FILE__, __LINE__); $redirect = empty($_GET["goto"]) ? $_SESSION["homepage"] : $_GET["goto"]; } elseif ($posting) { //logging in error_debug("<b>index.php</b> Posting", __FILE__, __LINE__); if (login($_POST["email"], $_POST["password"])) { error_debug("<b>index.php</b> Login successful", __FILE__, __LINE__); $redirect = empty($_POST["goto"]) ? $_SESSION["homepage"] : $_POST["goto"]; } else { error_debug("<b>index.php</b> Login unsuccessful", __FILE__, __LINE__); $redirect = "/"; } } if ($redirect) { url_change($redirect); } url_header_utf8(); ?> <html>
/** * image pagination * * Example * * <code> * $arr = Pagination::img($post->img , $size); * $models = $arr['models']; * $pages = $arr['pages']; * $count = $arr['count']; * </code> */ static function img($arr, $per = 2, $img = false, $class = 'pagination') { $current = (int) $_GET['page'] ?: 1; $top = $current_page - 1 > 0 ?: 1; $next = $current_page + 1; $num = count($arr); $page = ceil($num / $per); if ($current >= $page) { $current = $page; } $k = $i = ($current - 1) * $per; $j = $i + $per; if ($j >= $num) { $j = $num; } foreach ($arr as $k => $v) { $n[] = $v; } for ($i; $i < $j; $i++) { $post[] = $n[$i]; } $p = "<div class='" . $class . "'><ul>"; for ($i = 1; $i <= $page; $i++) { unset($cls); $params = array('page' => $i); if ($_GET) { $params = array_merge($_GET, $params); } $url = url_action(null, $params); if ($i == $current) { $cls = "class='active'"; } if ($img == true) { $p .= "<li {$cls}><a href='" . $url . "' data-content=\"<img src='" . image($n[($i - 1) * $per], array(400, 300)) . "'/>\" >" . $i . "</a></li>"; } else { $p .= "<li {$cls}><a href='" . $url . "' {$cls} >" . $i . "</a></li>"; } } $p .= "</ul></div>"; return array('models' => $post, 'pages' => $p, 'count' => $num); }
<?php if (true === $create) { ?> <p><a href="<?php echo url_action('create'); ?> " class='label label-info'><?php echo __('create'); ?> </a></p> <?php } ?> <table class="table table-hover table-bordered"> <thead> <tr> <?php foreach ($fields as $f) { ?> <th><?php echo __($f); ?> </th> <?php } ?> <?php if ($delete || $update) { ?>