/** * This will call the parentxontent controller to populate the view, while sending throught he type of content that it is * as well as the paper_id, which will be used to autocomplete the paper combo box withg the correct result. * @see Content_Controller::add() */ public function add($paper_id = NULL) { $paper = orm::factory('paper', $paper_id); // load the paper so that we can get all the details required to populate the breadrumbs if ($paper->loaded) { $this->breadcrumbs->add()->url('products/papers/edit/' . url::encode($paper->name))->title(url::decode($paper->name)); $this->breadcrumbs->add()->url('products/papers/technicals/index/' . $paper->id)->title('Technicals'); $this->breadcrumbs->add()->url(false)->title('Add'); } parent::add('technical', $paper->id); }
/** * This page will display a page much like the page for the paper products. * * the expcetion will be it will have multiple images and missing some of the relationships that * the papers have. * * * @param unknown_type $name */ public function view($name) { // clean the input, remove and opf the escape characters $name = url::encode($name); $industrial = orm::factory('industrial')->where('name', $name)->find_all(); //if ($industrial->loaded) //{ $view = new view(url::location()); $view->industrial = $industrial[0]; $this->template->title = ucwords($name); $this->template->content = $view; //} //else //{ // unable to find the industrial item //} }
public function actionLicense($path) { $module = zotop::model('zotop.module'); $modules = $module->getUnInstalled(); if (empty($path) || !dir::exists($path)) { msg::error(array('content' => zotop::t('模块不存在,请确认是否已经上传该模块?'), 'description' => zotop::t("路径:{$path}"))); } $licenseFile = $path . DS . 'license.txt'; if (!file::exists($licenseFile)) { zotop::redirect('zotop/module/install', array('path' => url::encode($path))); exit; } $license = file::read($licenseFile); $page = new dialog(); $page->set('title', '许可协议'); $page->set('license', html::decode($license)); $page->set('next', zotop::url('zotop/module/install', array('path' => url::encode($path)))); $page->display(); }
public function actionUpload($globalid, $field, $image = '') { $file = zotop::model('zotop.image'); if (form::isPostBack()) { $file->globalid = $globalid; $file->field = $field; $file->description = request::post('description'); $files = $file->upload(); if (!$file->error() && isset($files[0]['path'])) { msg::success('图片上传成功', zotop::url('zotop/image/preview', array('globalid' => $globalid, 'field' => $field, 'image' => url::encode($files[0]['path'])))); } msg::error($file->msg()); } $page = new dialog(); $page->set('title', '本地上传'); $page->set('navbar', $this->navbar($globalid, $field, $image)); $page->set('alowexts', $file->upload->alowexts); $page->set('maxsize', $file->upload->maxsize); $page->display(); }
public function actionImageFromLocal($globalid, $field, $image) { $upload = zotop::model('zotop.upload'); $upload->alowexts = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); if (form::isPostBack()) { $upload->bind('globalid', request::post('globalid')); $upload->bind('field', request::post('field')); $upload->bind('description', request::post('description')); $files = $upload->save(); $image = $files[0]; if ($upload->error() == 0 && $image) { msg::success($upload->msg(), zotop::url('zotop/upload/imagePreview', array('globalid' => $globalid, 'field' => $field, 'image' => url::encode($image['path'])))); } msg::error($upload->msg()); } $page = new dialog(); $page->set('title', '本地上传'); $page->set('navbar', $this->navbar($globalid, $field, $image)); $page->set('alowexts', $upload->alowexts); $page->set('maxsize', $upload->maxsize); $page->display(); }
?> </strong><br/> <i><?php echo $paper->style->name; ?> </i> </td> <td class="align-center"><?php echo $paper->status == 'approved' ? '<span class="icon-approved">✔</span>' : '<span class="icon-pending">✘</span>'; ?> </td> <td><a href="<?php echo url::routes_area(); ?> edit/<?php echo url::encode($paper->name); ?> " title="Edit <?php echo $paper->name; ?> " class="text-edit"><span>Edit</span></a> <a href="<?php echo url::routes_area() . 'delete/' . $paper->id; ?> " class="text-delete" title="Delete <?php echo $paper->name; ?> " onclick="return confirm('Do you really want to delete the paper item <?php echo $paper->name; ?> ?');"><span>Delete</span></a></td> </tr>
"><span>Overview</span></a> </li> <li> <a href="javascript:void(null);" class="current"><span>Sheets</span></a> </li> <li> <a href="products/papers/technicals/index/<?php echo $paper->id; ?> " ><span>Technical</span></a> </li> </ul><!--/sub-navigation --> <div class="navigation"> <a href="<?php echo url::routes_area() . 'add/' . url::encode($paper->name); ?> " class="button"><span>Add New Sheet</span></a> </div> </div> <?php if (count($paper->collections)) { ?> <?php foreach ($paper->collections as $collection) { ?> <?php foreach ($collection->pigments as $pigment) { ?> <?php
}); </script> <div id="header"> <h2 style="text-align:left;"><?php echo $title; ?> </h2> <h3> <a href="<?php echo zotop::config('site.index'); ?> ">网站首页</a> <b>|</b> <a href="javascript:void(0);" class="addFavorite">加入收藏夹</a> <b>|</b> <a href="<?php echo zotop::url('zotop/login/shortcut', array('title' => url::encode($title . ' ' . zotop::config('site.name')), 'url' => url::encode(url::location()))); ?> ">设为桌面图标</a> </h3> </div> <?php block::header(array('title' => $title, 'icon' => 'user', 'action' => '')); form::header(array('title' => '', 'description' => ' 请输入您的帐户和密码登录', 'class' => 'small')); form::field(array('type' => 'text', 'label' => zotop::t('帐 户(U)'), 'name' => 'username', 'value' => zotop::cookie('admin.username'), 'valid' => 'required:true')); form::field(array('type' => 'password', 'label' => zotop::t('密 码(P)'), 'name' => 'password', 'value' => '', 'valid' => 'required:true')); form::buttons(array('type' => 'submit', 'value' => '登录'), array('type' => 'button', 'name' => 'options', 'value' => '选项')); form::footer(); block::footer(); $this->footer();
?> "><?php echo html::image($img['path']); ?> <span class="zotop-icon zotop-icon-ok"></span></div> <div class="title"> <a href="<?php echo zotop::url('zotop/image/preview', array('globalid' => $globalid, 'field' => $field, 'image' => url::encode($img['path']))); ?> ">预览</a> <a href="<?php echo zotop::url('zotop/image/edit', array('image' => url::encode($img['path']))); ?> " class="dialog">编辑</a> <a href="<?php echo zotop::url('zotop/image/delete', array('image' => url::encode($img['path']), 'referer' => url::encode(url::location()))); ?> " class="confirm">删除</a> </div> </li> <?php } ?> </ul> </div> <div class="clearfix"><?php echo $pagination; ?> </div> <div class="buttons"> <?php
$('button[name=options]').click(function(){ location.href = "<?php echo zotop::url('site://'); ?> "; }); }); </script> <div id="topbar"> <a href="<?php echo zotop::url('site://'); ?> ">网站首页</a> <b>|</b> <a href="javascript:void(0);" class="addFavorite">加入收藏夹</a> <b>|</b> <a href="<?php echo zotop::url('zotop/login/shortcut', array('title' => url::encode($title), 'url' => url::encode(url::location()))); ?> ">设为桌面图标</a> </div> <?php box::header(array('title' => $title, 'icon' => 'user', 'action' => '')); form::header(array('title' => '', 'description' => '请输入您的帐户和密码登录', 'class' => 'small')); form::field(array('type' => 'text', 'label' => zotop::t('帐 户'), 'name' => 'username', 'value' => zotop::cookie('username'), 'valid' => 'required:true')); form::field(array('type' => 'password', 'label' => zotop::t('密 码'), 'name' => 'password', 'value' => '', 'valid' => 'required:true')); form::buttons(array('type' => 'submit', 'value' => '登录'), array('type' => 'button', 'name' => 'options', 'value' => '取消')); form::footer(); box::footer(); $this->footer();
//图片预览 $(function(){ $('#image-preview').zoomImage(500,300,true); }); </script> <?php $this->navbar(); ?> <div style="text-align:right;padding:3px;"> <span class="zotop-icon zotop-icon-delete"></span><a href="<?php echo zotop::url('zotop/image/delete', array('image' => url::encode($image['path']), 'referer' => url::encode(url::location()))); ?> " class="confirm">删除图片</a> <span class="zotop-icon zotop-icon-edit"></span><a href="<?php echo zotop::url('zotop/image/edit', array('image' => url::encode($image['path']))); ?> " class="dialog">编辑图片</a> </div> <div id="image-preview" style="margin:10px;text-align:center;height:300px;overflow:hidden;"> <?php echo html::image($image['path'], array('width' => '100%')); ?> </div> <div style="text-align:center;padding:3px;"> <span>名称:<?php echo $image['name']; ?> 大小:<?php echo format::byte($image['size']);
public function update() { if ($this->access->allowed('papers', 'update')) { // check the inputs $input = Validation::factory($this->input->post())->pre_filter('trim')->add_rules('name', 'required')->add_rules('id', 'required'); if ($input->validate()) { $paper = ORM::factory('paper')->find($this->input->post('id')); if ($paper->loaded) { if ($this->input->post('name') != $paper->name) { // check to make sure that the paper they are adding is unique $existing = ORM::factory('paper')->where('name', $this->input->post('name'))->find(); if ($existing->loaded) { $this->notification->add($this->i18n['system.paper.exists'], $this->input->post('name')); url::redirect(url::area() . 'edit/' . $paper->name); // redirect back to the edit page } } $paper->colors = $this->input->post('colors') ? $this->input->post('colors') : array(); $paper->applications = $this->input->post('applications') ? $this->input->post('applications') : array(); $paper->characteristics = $this->input->post('characteristics') ? $this->input->post('characteristics') : array(); $paper->environmentals = $this->input->post('environmentals') ? $this->input->post('environmentals') : array(); $paper->status = $this->input->post('status'); $paper->name = $this->input->post('name'); $paper->description = $this->input->post('description'); $paper->brief = $this->input->post('brief'); $paper->availablity_id = $this->input->post('availablity_id'); $paper->price_site = $this->input->post('price_site'); $paper->price_style = $this->input->post('price_style'); $paper->type = $this->input->post('type'); $paper->popular = $this->input->post('popular') == 'true' ? true : false; $paper->style_id = $this->input->post('style_id'); $ids = array(); if (is_array($this->input->post('features'))) { // loop thorugh each of the features which were added and add them to the paper foreach ($this->input->post('features') as $feature_name) { $feature = orm::factory('feature'); $feature = $feature->set($feature_name); $ids[] = $feature->id; } } $ids = array_unique($ids); // delete all the entreis for that paper/feature, then readd them. ORM::factory('features_paper')->where('paper_id', $paper->id)->delete_all(); foreach ($ids as $key => $feature_id) { $features_paper = ORM::factory('features_paper'); $features_paper->feature_id = $feature_id; $features_paper->paper_id = $paper->id; $features_paper->order = $key; $features_paper->save(); } $ids = array(); if (is_array($this->input->post('tips'))) { // loop thorugh each of the features which were added and add them to the paper foreach ($this->input->post('tips') as $tip_name) { $tip = orm::factory('tip'); $tip = $tip->set($tip_name); $ids[] = $tip->id; } } $ids = array_unique($ids); // delete all the entreis for that paper/feature, then readd them. ORM::factory('papers_tip')->where('paper_id', $paper->id)->delete_all(); foreach ($ids as $key => $tip_id) { $papers_tip = ORM::factory('papers_tip'); $papers_tip->tip_id = $tip_id; $papers_tip->paper_id = $paper->id; $papers_tip->order = $key; $papers_tip->save(); } $images = $this->input->post('images'); // check to see if we need to update the images (any of them) if (count($images)) { // make sure that the file location exists, if not create it $cms = DOCROOT . 'application/' . SITE . '/media/cms/products/papers/' . $paper->id; if (file::tree($cms)) { foreach ($images as $type => $location) { $paper->{$type} = $location; if (file_exists(DOCROOT . 'upload/' . $location)) { //@todo change this so that the uploads folder is not part of the info sent in if (rename(DOCROOT . 'upload/' . $location, $cms . '/' . $location)) { $this->notification->add($this->i18n['cms.image.success'], $type); } else { $this->notification->add($this->i18n['cms.image.error'], $type); } } else { $this->notification->add($this->i18n['cms.image.error'], $type); } } } else { $this->notification->add($this->i18n['cms.folder.error']); } } if ($paper->save()) { $this->notification->add($this->i18n['system.paper.success'], $paper->name); } else { $this->notification->add($this->i18n['system.paper.error'], $paper->name); } url::redirect(url::area() . 'edit/' . url::encode($paper->name)); } else { $this->notification->add($this->i18n['system.paper.error'], $this->input->post('name')); } } else { foreach ($input->errors() as $key => $value) { $this->notification->add($this->i18n['filter.' . $key . '.' . $value]); } } } else { url::failed(); } url::redirect(url::area()); }
public function delete($id = NULL) { if ($this->access->allowed('sheets', 'delete')) { if ($id) { $sheet = ORM::factory('sheet')->find($id); $paper_name = $sheet->pigment->collection->paper->name; if ($sheet->loaded) { if ($sheet->delete()) { $this->notification->add($this->i18n['system.sheet.success']); } else { $this->notification->add($this->i18n['system.sheet.error']); } } else { $this->notification->add($this->i18n['system.sheet.failed']); } } else { $this->notification->add($this->i18n['system.sheet.failed']); } } else { url::failed(); } if (!request::is_ajax()) { url::redirect(url::routes_area() . 'index/' . url::encode($paper_name)); } }
"><?php echo date('j F Y', $lightbox->created); ?> </div> </td> <td width="20%"><?php echo count($lightbox->papers); ?> item<?php echo count($lightbox->papers) == 1 ? '' : 's'; ?> </td> <td width="30%"> <a href="#todo" class="button style-account"><span>Email</span></a> <a href="<?php echo url::routes_area() . 'view/' . $lightbox->creator->email . '/' . url::encode($lightbox->name); ?> " class="button style-account"><span>Permalink</span></a> </td> <td width="20%" class="align-right"><a href="<?php echo url::routes_area() . 'view/' . $lightbox->creator->email . '/' . rawurlencode($lightbox->name); ?> " class="button button-account"><span>Edit</span></a> <a href="<?php echo url::routes_area() . 'delete/' . $lightbox->id; ?> " class="button button-account icon-remove" onclick="return confirm('Do you really want to delete this lightbox?');"><span>Delete</span></a></td> </tr> <?php } ?> <?php
<?php echo html::msg(zotop::t('<h2>如何安装新模块?</h2><div>1,安装模块前,请确认将该模块文件夹上传至服务器上的模块目录下面目录下面({$modules})</div><div>2,上传完成后,<a class="zotop-reload" href="javascript:location.reload();">刷新本页面</a>,模块将会出现在下面的待安装模块列表中,点击模块后面的 <a>安装</a>,根据系统提示完成模块安装</div>', array('modules' => ZOTOP_URL_MODULES))); block::header('待安装模块'); if (empty($modules)) { echo '<div class="zotop-empty"><span>暂时没有待安装模块</span></div>'; } else { $column = array(); $column['logo w40 center'] = '标识'; $column['name'] = '名称'; $column['version w50 center'] = '版本号'; $column['manage edit'] = '安装'; $column['manage delete'] = '删除'; table::header('list', $column); foreach ($modules as $module) { $column = array(); $column['logo center'] = html::image(empty($module['icon']) ? '$theme/image/skin/none.png' : $module['icon'], array('width' => '32px')); $column['name'] = '<a><b>' . $module['name'] . ' ( ' . $module['id'] . ' )</b></a><h5>' . $module['description'] . '</h5>'; $column['version center'] = $module['version']; $column['manage edit'] = html::a(zotop::url('zotop/module/uninstalled', array('path' => url::encode($module['path']))), '安装', array('class' => 'dialog')); $column['manage delete'] = html::a(zotop::url('zotop/module/delete', array('path' => url::encode($module['path']))), '删除', array('class' => 'confirm')); table::row($column); } table::footer(); } block::footer(); ?> <?php $this->bottom(); $this->footer();
<div> <div class="header"> <?php if (isset($foreign->name)) { ?> <ul class="sub-navigation"> <li> <a href="products/papers/edit/<?php echo url::encode($foreign->name); ?> " ><span>Overview</span></a> </li> <li> <a href="products/papers/sheets/index/<?php echo url::encode($foreign->name); ?> "><span>Sheets</span></a> </li> <li> <a href="products/papers/technicals/index/<?php echo $foreign->id; ?> " class="current"><span>Technical</span></a> </li> </ul><!--/#sub-navigation --> <?php } ?> <div class="navigation"> <?php
<input id="sheet-grain-none" name="grain" type="radio" value="" disabled="disabled"/> <label for="sheet-grain-none">None</label> </li> </ul> </div> </li> <li> <label for="gsms" class="column x3 first">Grammage</label> <div class="column x9 last"> <input type="text" name="gsms" value="<?php echo isset($post['gsms']) ? $post['gsms'] : ''; ?> " class="text x-long"/> <div class="help">Separate each GSM value with a comma, e.g. <em>80, 120, 180, 210</em></div> </div> </li> </ul> </fieldset> <div class="button-group"> <button class="" name="post-action" value="index" type="submit"><span>Save</span></button> <a href="<?php echo url::routes_area() . 'index/' . url::encode($paper_name); ?> " class="button"><span>Cancel</span></a> </div> </form>
foreach ($populars as $popular) { ?> <li class="article column x3 <?php echo text::hive_alt('first', 'last'); ?> " > <a href="/products/papers/view/<?php echo url::encode($popular->name); ?> " class="thumbnail"><img src="media/cms/products/papers/<?php echo $popular->id; ?> /icon.jpg" /></a> <div class="content"> <h5><a href="/products/papers/view/<?php echo url::encode($popular->name); ?> "><?php echo $popular->name; ?> </a></h5> <p><?php echo $popular->brief; ?> </p> </div> </li> <?php } ?> </ul><!-- /.section -->
$column['title'] .= '</h5>'; $column['categoryid w50'] = '<div class="w60 textflow" title="' . $categorys[$blog['categoryid']]['title'] . '">' . $categorys[$blog['categoryid']]['title'] . '</div>'; $column['comment w30 center'] = empty($blog['comment']) ? '0' : '<b class="red">' . $blog['comment'] . '</b>'; $column['atime w120'] = '' . time::format($blog['updatetime']) . ''; table::row($column); } table::footer(); form::buttons(array('type' => 'select', 'name' => 'operation', 'id' => 'operation', 'class' => 'short', 'options' => array('status100' => $blogstatus['100'], 'status0' => $blogstatus['0'], 'status-1' => $blogstatus['-1'], 'status-50' => $blogstatus['-50'], 'order' => '权重->', 'move' => '移动->', 'delete' => '永久删除')), array('type' => 'text', 'name' => 'order', 'id' => 'order', 'value' => '50', 'title' => '权重参数,必须是数字', 'style' => 'width:30px;padding:4px;display:none;'), array('type' => 'select', 'options' => arr::hashmap($categorys, 'id', 'title'), 'name' => 'categoryid', 'id' => 'categoryid', 'value' => $categoryid, 'class' => 'short', 'style' => 'display:none;'), array('type' => 'submit', 'value' => '执行操作')); form::footer($pagination); $this->bottom(); $this->mainFooter(); $this->sideHeader(); ?> <?php block::header(array('title' => '日志分类', 'action' => '<a href="' . zotop::url('blog/category/index') . '" class="dialog">管理</a><a href="' . zotop::url('blog/category/add', array('referer' => url::encode(url::location()))) . '" class="dialog">添加</a>')); ?> <div class="navbarlist"> <ul> <li<?php echo empty($categoryid) ? ' class="selected"' : ''; ?> ><a href="<?php echo zotop::url('blog/index/index'); ?> "><span class="zotop-icon zotop-icon-category"></span>全部日志</a></li> <?php foreach ($categorys as $c) { ?> <li<?php echo $categoryid == $c['id'] ? ' class="selected"' : '';
$column['name'] = '<a href="' . zotop::url('webftp/index/index', array('dir' => rawurlencode($dir . '/' . $folder))) . '"><b>' . $folder . '</b></a>'; $column['name'] .= '<h5>'; $column['name'] .= '<a href="' . zotop::url('webftp/folder/rename', array('dir' => rawurlencode($dir), 'file' => $file)) . '" class="dialog">重命名</a>'; $column['name'] .= ' <a href="' . zotop::url('webftp/folder/delete', array('dir' => rawurlencode($dir), 'file' => $file)) . '" class="dialog">删除</a>'; $column['name'] .= '</h5>'; $column['type w60'] = '文件夹'; $column['encoding w60'] = ''; $column['size w60'] = '--'; $column['atime w120'] = time::format(@fileatime($path . DS . $folder)); $column['mtime w120'] = time::format(@filemtime($path . DS . $folder)); table::row($column); } foreach ($files as $file) { $column = array(); $column['center'] = '<div class="zotop-icon zotop-icon-file ' . file::ext($file) . '"></div>'; $column['name'] = '<div><b>' . $file . '</b></div>'; $column['name'] .= '<h5>'; $column['name'] .= '<a href="' . zotop::url('webftp/file/edit', array('file' => url::encode($dir . '/' . $file))) . '" class="dialog">编辑</a>'; $column['name'] .= ' <a href="' . zotop::url('webftp/file/rename', array('file' => url::encode($dir . '/' . $file))) . '" class="dialog">重命名</a>'; $column['name'] .= ' <a href="' . zotop::url('webftp/file/delete', array('file' => url::encode($dir . '/' . $file))) . '" class="dialog">删除</a>'; $column['name'] .= '</h5>'; $column['type w60'] = '文件'; $column['encoding w60'] = file::isUTF8($path . DS . $file) ? 'UTF8' : ''; $column['size w60'] = format::byte(@filesize($path . DS . $file)); $column['atime w120'] = time::format(@fileatime($path . DS . $file)); $column['mtime w120'] = time::format(@filemtime($path . DS . $file)); table::row($column); } table::footer(); $this->bottom(); $this->footer();
public function info_list($params = array()) { global $config; //传入的是数组 $ret = array(); //返回的数据 $ret['list'] = array(); $ret['pagecode'] = ''; $ret['total'] = ''; $table = ''; $params['cate_id'] = isset($params['cate_id']) ? $params['cate_id'] : 0; $bak_cate_id = $params['cate_id']; $params['model'] = isset($params['model']) ? $params['model'] : ''; if ($params['cate_id'] == 0 && $params['model'] == '') { return; } if ($params['cate_id']) { $true_cate_id = explode(',', $params['cate_id']); $table = $this->categorys[$true_cate_id[0]]['model_table_name']; //如果有 cate_id 的形式为 3,4,5,9 ,则表采用 第一个 3的模型表 } if ($params['model']) { $table = $params['model']; } $params['pagesize'] = isset($params['pagesize']) ? intval($params['pagesize']) : 10; $params['ordersql'] = isset($params['ordersql']) ? $params['ordersql'] : ''; $params['andwhere'] = isset($params['andwhere']) ? $params['andwhere'] : ''; $params['joinsql'] = isset($params['joinsql']) ? $params['joinsql'] : ''; $params['selectsql'] = isset($params['selectsql']) ? $params['selectsql'] : ' l.* '; $params['recommend_id'] = isset($params['recommend_id']) ? intval($params['recommend_id']) : 0; $params['pageshowtype'] = isset($params['pageshowtype']) ? $params['pageshowtype'] : 1; //处理 $params['andwhere'] = ' where l.last_cate_id>0 and l.audit=1 ' . $params['andwhere']; if ($params['recommend_id']) { $params['andwhere'] .= ' and l.info_id in(' . $this->get_recommend_inid($params['recommend_id']) . ')'; } if ($params['model'] == '') { if (is_numeric($params['cate_id'])) { //如果传入的是 'cate_id'=>6 这种形式 //拼装where id in() $gidarr = array(); //获取子栏目 $gidarr = $this->cate_son_arr($params['cate_id']); //加上自己 $gidarr[] = $bak_cate_id; //同时获取指定栏目的内容 $gids = array(); foreach ($gidarr as $a) { if ($this->categorys[$a]['getcateids']) { $gids[] = $this->categorys[$a]['getcateids']; } } $params['cate_id'] = implode(',', $gidarr); if (count($gids)) { $params['cate_id'] .= ',' . implode(',', $gids); } } else { //如果是 'cate_id'=>'2,5,7'这种形式 //拼装where id in() $gidarr = explode(',', $params['cate_id']); $newgidarr2 = array(); $newgidarr = array(); foreach ($gidarr as $a) { $newgidarr = $this->cate_son_arr($a); $newgidarr2 = array_merge($newgidarr2, $newgidarr); } //print_r($newgidarr); //同时获取指定栏目的内容 $gids = array(); foreach ($gidarr as $a) { if ($this->categorys[$a]['getcateids']) { $gids[] = $this->categorys[$a]['getcateids']; } } $params['cate_id'] .= ',' . implode(',', $newgidarr2); if (count($gids)) { $params['cate_id'] .= ',' . implode(',', $gids); } if (preg_match('~,$~', $params['cate_id'])) { $params['cate_id'] = substr($params['cate_id'], 0, strlen($params['cate_id']) - 1); } } } if ($params['cate_id']) { $params['andwhere'] .= " and (l.last_cate_id in(" . $params['cate_id'] . ")) "; } //强制设置 where 语句 if (isset($params['setwhere'])) { $params['andwhere'] = $params['setwhere']; } $params['ordersql'] = $params['ordersql'] ? $params['ordersql'] : " order by l.info_order,l.create_time desc "; if ($params['ordersql'] == 'no') { $params['ordersql'] = ''; } $count = 0; $suffix = ''; //设置分页大小和页码默认值 if (!isset($params['pagesize']) || !is_numeric($params['pagesize'])) { $params['pagesize'] = 10; } //默认分页大小 if (!isset($params['p']) || !is_numeric($params['p'])) { $params['p'] = 1; } else { $count = 1; } //默认页码,如果传入了该值,则会进行分页统计 //拼接 order by 和 limit 语句 $suffix .= " limit " . ($params['p'] - 1) * $params['pagesize'] . "," . $params['pagesize']; $sql = "select " . $params['selectsql'] . ",(select count(1) from comment_list b where b.fromid=concat('{$table}','-',l.info_id)) as comments_total from " . $table . " l " . $params['joinsql'] . " " . $params['andwhere'] . " " . $params['ordersql'] . " {$suffix} "; $count_sql = "select count(1) as total from " . $table . " l " . $params['joinsql'] . " " . $params['andwhere'] . ""; if (isset($params['debug'])) { echo $sql; } $rsarrs = $this->dbm->query($sql); if ($count == 1) { $cr = $this->dbm->query($count_sql); $rsarrs['total'] = $cr['list'][0]['total']; } foreach ($rsarrs['list'] as $a) { $a['cate'] = $this->categorys[$a['last_cate_id']]; $a['url'] = $this->set_info_url($a); $a['title'] = $a['info_title']; $a['thumb'] = simg($a['info_img']); $a['extern_array'] = helper::json_decode_cn($a['info_extern'], 1); $ret['list'][] = $a; } if ($count == 1) { $pageurl = ''; if (url::$rewrite == 1 && is_numeric($bak_cate_id)) { //这里很可能要变更 $page_rule = $this->categorys[$bak_cate_id]['csetting']['list_rewrites']['rewrite_page_rule']; url::$url_config['info_list']['page_rule'] = $page_rule; //echo $page_rule; $host = ''; if ($this->categorys[$bak_cate_id]['cate_host']) { $host = $this->categorys[$bak_cate_id]['cate_host']; } else { $host = $config['basic']['siteurl']; } $pageurl = url::encode('info_list', array('host' => $host, 'cate_id' => $this->categorys[$bak_cate_id]['cate_id'], 'cname_py' => $this->categorys[$bak_cate_id]['cname_py']), 'page_rule'); //echo $pageurl;die(); } if (isset($params['pageurl'])) { $pageurl = $params['pageurl']; } $pagearr = helper::pagehtml(array('total' => $rsarrs['total'], "pagesize" => $params['pagesize'], 'list_str' => $pageurl, 'show' => $params['pageshowtype'])); $ret['pagecode'] = $pagearr['pagecode']; $ret['total'] = $pagearr['total']; } return $ret; }