public function test_delete() { $pageService = new PageService(666); $page = $pageService->save(true, ['en_US' => new PageLangDTO('Name US', 'Content US', 'SEO Title US', 'SEO Description US', 'handle-us')]); $this->DELETE("/666/pages/{$page->id}"); $page = Page::find($page->id); $this->assertNotNull($page->deleted_at); }
public function test_get() { $pageService = new PageService(666); $page = $pageService->save(true, ['en_US' => new PageLangDTO('Name US', 'Content US', 'SEO Title US', 'SEO Description US', 'handle-us')]); $response = $this->GET("/666/pages/{$page->id}"); $this->assertEquals($page->id, $response->id); $this->assertEquals(666, $response->store_id); $this->assertTrue($response->published); $this->assertNotNull($response->created_at); $this->assertNotNull($response->updated_at); $this->assertEquals('Name US', $response->name->en_US); $this->assertEquals('Content US', $response->content->en_US); $this->assertEquals('SEO Title US', $response->seo_title->en_US); $this->assertEquals('SEO Description US', $response->seo_description->en_US); $this->assertEquals('handle-us', $response->handle->en_US); }
public static function insertDiscuss($disObj) { $mysql = new MySQL(); $res = $mysql->insert("page_discs", $disObj); $mysql->closeCon(); PageService::updateDisNum($disObj['pageid']); return $res; }
/** * PUT /pages/id */ public function put_page($storeId, $id) { // TODO: Better validations // Validations $errors = $this->validate(['published' => 'boolean|required']); if ($errors != null) { return $errors; } $data = Input::all(); $pageLangs = $this->createPageLangs($data); $pageService = new PageService($storeId); $published = $this->boolValue($data['published']); $page = Page::find($id); $page->publish = $published; $pageService->update($page, $pageLangs); return Response::json($this->adapter->format($page)); }
function imgQuery($req) { $pageid = intval($req['pageid']); $res = PageService::getImg($pageid); $imgs = array(); $imgs['status'] = 1; $imgs['msg'] = ""; $imgs['title'] = ""; $imgs['id'] = $pageid; $imgs['start'] = 0; foreach ($res as $img) { $nimg['name'] = $img['img']; $nimg['pid'] = intval($img['id']); $nimg['src'] = STATICROOT2 . "/" . $img['img']; $nimg['thumb'] = ""; $nimg['area'] = array(800, 800); $imgs['data'][] = $nimg; } echo stripslashes(json_encode($imgs, true)); }
<?php session_start(); require_once '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'Config.php'; require_once ROOT . PATH . 'includes' . PATH . 'service' . PATH . 'PageService.php'; $pageid = empty($_GET['p']) ? 0 : $_GET['p']; if ($pageid <= 0) { exit; } $page = PageService::getPage($pageid); if (empty($page)) { echo "惭愧,页面已经不存在了,可能回火星去了。"; exit; } $imgnum = count($page); $page_title = $page[0]['title']; $cusername = $page[0]['cusername']; $udate = $page[0]['udate']; $udate = floor($udate / 1000); $nowTime = time(); $dateStr = date('Y-m-d H:i', $udate); if ($nowTime - $udate < 24 * 3600) { $dateStr = date('H:i', $udate); } elseif ($nowTime - $udate < 24 * 3600 * 365) { $dateStr = date('m-d H:i', $udate); } include ROOT . "/web/views/top-a.html"; include ROOT . "/web/views/view.html"; include ROOT . "/web/views/footer-a.html";
public function getNavigation() { return $this->pageService->getPages(); }
<?php session_start(); header("Content-type: text/html; charset=utf-8"); require_once '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'Config.php'; require_once ROOT . PATH . 'includes' . PATH . 'service' . PATH . 'PageService.php'; $active = 'active'; $menu_color = 'menu_active'; $key = empty($_GET['k']) ? "" : $_GET['k']; $pnum = empty($_GET['p']) ? 1 : $_GET['p']; $size = 15; $start = ($pnum - 1) * $size; $total = 0; $page_title = "三国志"; $pages = PageService::find($key, $start, 15); $total = PageService::getTotal($key); //分页使用 $tt = ceil($total / 15 * 8); $ee = ceil($pnum / 8); $lastpg = ceil($total / 15); $dd = 8 * $ee; if ($dd > $lastpg) { $dd = $lastpg; } $ss = 8 * ($ee - 1) + 1; $pre_url = 'meizi.php?p=' . ($pnum - 1); if (!empty($key)) { $pre_url = 'meizi.php?k=' . $key . '&p=' . ($pnum - 1); } $next_url = 'meizi.php?p=' . ($pnum + 1); if (!empty($key)) {
<?php session_start(); require_once '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'Config.php'; require_once SERVCIEROOT . 'PageService.php'; require_once HELPERROOT . 'StrHelper.php'; $page_title = "首页"; //unset($_SESSION['user']); //var_dump($_SESSION['user']);exit; $pages = PageService::findShowIndex(0, 20); include ROOT . "/web/views/top-a.html"; include ROOT . "/web/views/index.html"; include ROOT . "/web/views/footer-a.html";