当前位置: 首页>>代码示例>>PHP>>正文


PHP template_list函数代码示例

本文整理汇总了PHP中template_list函数的典型用法代码示例。如果您正苦于以下问题:PHP template_list函数的具体用法?PHP template_list怎么用?PHP template_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了template_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     Loader::helper('admin:global');
     $list = template_list(1);
     $big_menu = big_menu('?app=template&controller=style&action=import', 'import', L('import_style'), 500, 250);
     include $this->view('style_list');
 }
开发者ID:hubs,项目名称:yuncms,代码行数:7,代码来源:StyleController.php

示例2: edit

 public function edit()
 {
     $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : $this->error(L('illegal_parameters'));
     if ($site = $this->db->where(array('id' => $siteid))->find()) {
         if (IS_POST) {
             $this->checkToken();
             $data = $_POST['info'];
             $data['setting'] = array2string($_POST['setting']);
             if ($this->db->where(array('id' => $siteid))->save($data) !== false) {
                 $this->db->set_cache();
                 $this->success(L('setting_succ'));
             } else {
                 $this->error(L('operation_failure'));
             }
         } else {
             $template_list = template_list();
             $setting = string2array($site['setting']);
             $setting['watermark_img'] = str_replace('statics/images/water/', '', $setting['watermark_img']);
             $this->assign('template_list', $template_list);
             $this->assign('setting', $setting);
             $this->assign('data', $site);
             $this->display();
         }
     } else {
         $this->error(L('notfound'));
     }
 }
开发者ID:lxp521125,项目名称:TP-Admin,代码行数:27,代码来源:SiteAction.class.php

示例3: edit

 /**
  * 修改公告
  */
 public function edit()
 {
     $_GET['aid'] = intval($_GET['aid']);
     if (!$_GET['aid']) {
         showmessage(L('illegal_operation'));
     }
     if (isset($_POST['dosubmit'])) {
         $_POST['announce'] = $this->check($_POST['announce'], 'edit');
         if ($this->db->update($_POST['announce'], array('aid' => $_GET['aid']))) {
             showmessage(L('announced_a'), HTTP_REFERER, '', 'edit');
         }
     } else {
         $where = array('aid' => $_GET['aid']);
         $an_info = $this->db->get_one($where);
         pc_base::load_sys_class('form', '', 0);
         //获取站点模板信息
         pc_base::load_app_func('global', 'admin');
         $template_list = template_list($this->siteid, 0);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         $show_header = $show_validator = $show_scroll = 1;
         include $this->admin_tpl('announce_edit');
     }
 }
开发者ID:zhouzhouxs,项目名称:Progect,代码行数:29,代码来源:admin_announce.php

示例4: init

 public function init()
 {
     pc_base::load_app_func('global', 'admin');
     $list = template_list('', 1);
     $big_menu = array('javascript:window.top.art.dialog({id:\'import\',iframe:\'?m=template&c=style&a=import\', title:\'' . L('import_style') . '\', width:\'500\', height:\'250\', lock:true}, function(){var d = window.top.art.dialog({id:\'import\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'import\'}).close()});void(0);', L('import_style'));
     include $this->admin_tpl('style_list');
 }
开发者ID:ahmatjan,项目名称:huluphp,代码行数:7,代码来源:style.php

示例5: pages_homepage

function pages_homepage()
{
    $page = new Template();
    $page->c('<h1 class="ten columns">' . 'Welcome to FreshNetworks Reporting' . '</h1>');
    $page->c('<p>' . 'Click on the client name below to run queries on the correct database.');
    $sites = exec_hook('register_sites');
    foreach ($sites as &$site) {
        $site = l($site['name'], '/' . $site['path']);
    }
    $page->c(template_list($sites));
    return $page->render();
}
开发者ID:nodefortytwo,项目名称:engagement,代码行数:12,代码来源:pages.php

示例6: batch_edit

 /**
  * 批量修改
  */
 public function batch_edit()
 {
     $categorys = getcache('category_content_' . $this->siteid, 'commons');
     if (isset($_POST['dosubmit'])) {
         pc_base::load_sys_func('iconv');
         $catid = intval($_POST['catid']);
         $post_setting = $_POST['setting'];
         //栏目生成静态配置
         $infos = $info = array();
         $infos = $_POST['info'];
         if (empty($infos)) {
             showmessage(L('operation_success'));
         }
         $this->attachment_db = pc_base::load_model('attachment_model');
         foreach ($infos as $catid => $info) {
             $setting = string2array($categorys[$catid]['setting']);
             if ($_POST['type'] != 2) {
                 if ($post_setting[$catid]['ishtml']) {
                     $setting['category_ruleid'] = $_POST['category_html_ruleid'][$catid];
                 } else {
                     $setting['category_ruleid'] = $_POST['category_php_ruleid'][$catid];
                     $info['url'] = '';
                 }
             }
             foreach ($post_setting[$catid] as $_k => $_setting) {
                 $setting[$_k] = $_setting;
             }
             //内容生成静态配置
             if ($post_setting[$catid]['content_ishtml']) {
                 $setting['show_ruleid'] = $_POST['show_html_ruleid'][$catid];
             } else {
                 $setting['show_ruleid'] = $_POST['show_php_ruleid'][$catid];
             }
             if ($setting['repeatchargedays'] < 1) {
                 $setting['repeatchargedays'] = 1;
             }
             $info['sethtml'] = $post_setting[$catid]['create_to_html_root'];
             $info['setting'] = array2string($setting);
             $info['module'] = 'content';
             $catname = CHARSET == 'gbk' ? $info['catname'] : iconv('utf-8', 'gbk', $info['catname']);
             $letters = gbk_to_pinyin($catname);
             $info['letter'] = strtolower(implode('', $letters));
             $this->db->update($info, array('catid' => $catid, 'siteid' => $this->siteid));
             //更新附件状态
             if ($info['image'] && pc_base::load_config('system', 'attachment_stat')) {
                 $this->attachment_db->api_update($info['image'], 'catid-' . $catid, 1);
             }
         }
         $this->public_cache();
         showmessage(L('operation_success'), '?m=admin&c=category&a=init&module=admin&menuid=43');
     } else {
         if (isset($_POST['catids'])) {
             //获取站点模板信息
             pc_base::load_app_func('global');
             $template_list = template_list($this->siteid, 0);
             foreach ($template_list as $k => $v) {
                 $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
                 unset($template_list[$k]);
             }
             $show_validator = $show_header = '';
             $catid = intval($_GET['catid']);
             $type = $_POST['type'] ? intval($_POST['type']) : 0;
             pc_base::load_sys_class('form', '', 0);
             if (empty($_POST['catids'])) {
                 showmessage(L('illegal_parameters'));
             }
             $batch_array = $workflows = array();
             foreach ($categorys as $catid => $cat) {
                 if ($cat['type'] == $type && in_array($catid, $_POST['catids'])) {
                     $batch_array[$catid] = $cat;
                 }
             }
             if (empty($batch_array)) {
                 showmessage(L('please_select_category'));
             }
             $workflows = getcache('workflow_' . $this->siteid, 'commons');
             if ($workflows) {
                 $workflows_datas = array();
                 foreach ($workflows as $_k => $_v) {
                     $workflows_datas[$_v['workflowid']] = $_v['workname'];
                 }
             }
             if ($type == 1) {
                 include $this->admin_tpl('category_batch_edit_page');
             } else {
                 include $this->admin_tpl('category_batch_edit');
             }
         } else {
             $type = isset($_GET['select_type']) ? intval($_GET['select_type']) : 0;
             $tree = pc_base::load_sys_class('tree');
             $tree->icon = array('&nbsp;&nbsp;│ ', '&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;└─ ');
             $tree->nbsp = '&nbsp;&nbsp;';
             $category = array();
             foreach ($categorys as $catid => $r) {
                 if ($this->siteid != $r['siteid'] || $r['type'] == 2 && $r['child'] == 0) {
                     continue;
                 }
//.........这里部分代码省略.........
开发者ID:baowzh,项目名称:fulianweb,代码行数:101,代码来源:category.php

示例7: edit

 /**
  * 信息修改
  */
 public function edit()
 {
     $_GET['specialid'] = intval($_GET['specialid']);
     $_GET['id'] = intval($_GET['id']);
     if (!$_GET['specialid'] || !$_GET['id']) {
         showmessage(L('illegal_action'), HTTP_REFERER);
     }
     if (isset($_POST['dosubmit']) || isset($_POST['dosubmit_continue'])) {
         $info = $this->check($_POST['info'], 'info', 'edit', $_POST['data']['content']);
         //验证数据的合法性
         //处理外部链接更换情况
         $r = $this->db->get_one(array('id' => $_GET['id'], 'specialid' => $_GET['specialid']));
         if ($r['islink'] != $info['islink']) {
             //当外部链接和原来差别时进行操作
             // 向数据统计表添加数据
             $count = pc_base::load_model('hits_model');
             $hitsid = 'special-c-' . $_GET['specialid'] . '-' . $_GET['id'];
             $count->delete(array('hitsid' => $hitsid));
             $this->data_db->delete(array('id' => $_GET['id']));
             if ($info['islink']) {
                 $info['url'] = $_POST['linkurl'];
                 $info['isdata'] = 0;
             } else {
                 $data = $this->check($_POST['data'], 'data');
                 $data['id'] = $_GET['id'];
                 $this->data_db->insert($data);
                 $count->insert(array('hitsid' => $hitsid));
             }
         }
         //处理外部链接情况
         if ($info['islink']) {
             $info['url'] = $_POST['linkurl'];
             $info['isdata'] = 0;
         } else {
             $info['isdata'] = 1;
         }
         $html = pc_base::load_app_class('html', 'special');
         if ($info['isdata']) {
             $data = $this->check($_POST['data'], 'data');
             $this->data_db->update($data, array('id' => $_GET['id']));
             $url = $html->_create_content($_GET['id']);
             if ($url[0]) {
                 $info['url'] = $url[0];
                 $searchid = $this->search_api($_GET['id'], $data, $info['title'], 'update', $info['inputtime']);
                 $this->db->update(array('url' => $url[0], 'searchid' => $searchid), array('id' => $_GET['id'], 'specialid' => $_GET['specialid']));
             }
         } else {
             $this->db->update(array('url' => $info['url']), array('id' => $_GET['id'], 'specialid' => $_GET['specialid']));
         }
         $this->db->update($info, array('id' => $_GET['id'], 'specialid' => $_GET['specialid']));
         //更新附件状态
         if (pc_base::load_config('system', 'attachment_stat')) {
             $this->attachment_db = pc_base::load_model('attachment_model');
             if ($info['thumb']) {
                 $this->attachment_db->api_update($info['thumb'], 'special-c-' . $_GET['id'], 1);
             }
             $this->attachment_db->api_update(stripslashes($data['content']), 'special-c-' . $_GET['id']);
         }
         $html->_index($_GET['specialid'], 20, 5);
         $html->_list($info['typeid'], 20, 5);
         showmessage(L('content_edit_success'), HTTP_REFERER, '', '', 'setTimeout("window.close()", 2000)');
     } else {
         $info = $this->db->get_one(array('id' => $_GET['id'], 'specialid' => $_GET['specialid']));
         if ($info['isdata']) {
             $data = $this->data_db->get_one(array('id' => $_GET['id']));
         }
         $rs = $this->type_db->select(array('parentid' => $_GET['specialid'], 'siteid' => $this->get_siteid()), 'typeid, name');
         $types = array();
         foreach ($rs as $r) {
             $types[$r['typeid']] = $r['name'];
         }
         //获取站点模板信息
         pc_base::load_app_func('global', 'admin');
         $template_list = template_list($this->siteid, 0);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         $special_db = pc_base::load_model('special_model');
         $s_info = $special_db->get_one(array('id' => $_GET['specialid']));
         @extract($s_info);
         include $this->admin_tpl('content_edit');
     }
 }
开发者ID:ahmatjan,项目名称:huluphp,代码行数:87,代码来源:content.php

示例8: import

 /**
  * 导入模型
  */
 function import()
 {
     if (isset($_POST['dosubmit'])) {
         $info = array();
         $info['name'] = $_POST['info']['modelname'];
         //主表表名
         $basic_table = $info['tablename'] = $_POST['info']['tablename'];
         //从表表名
         $table_data = $basic_table . '_data';
         $info['description'] = $_POST['info']['description'];
         $info['type'] = 0;
         $info['siteid'] = $this->siteid;
         $info['default_style'] = $_POST['default_style'];
         $info['category_template'] = $_POST['setting']['category_template'];
         $info['list_template'] = $_POST['setting']['list_template'];
         $info['show_template'] = $_POST['setting']['show_template'];
         if (!empty($_FILES['model_import']['tmp_name'])) {
             $model_import = @file_get_contents($_FILES['model_import']['tmp_name']);
             if (!empty($model_import)) {
                 $model_import_data = string2array($model_import);
             }
         }
         $is_exists = $this->db->table_exists($basic_table);
         if ($is_exists) {
             showmessage(L('operation_failure'), '?m=content&c=sitemodel&a=init');
         }
         $modelid = $this->db->insert($info, 1);
         if ($modelid) {
             $tablepre = $this->db->db_tablepre;
             //建立数据表
             $model_sql = file_get_contents(MODEL_PATH . 'model.sql');
             $model_sql = str_replace('$basic_table', $tablepre . $basic_table, $model_sql);
             $model_sql = str_replace('$table_data', $tablepre . $table_data, $model_sql);
             $model_sql = str_replace('$table_model_field', $tablepre . 'model_field', $model_sql);
             $model_sql = str_replace('$modelid', $modelid, $model_sql);
             $model_sql = str_replace('$siteid', $this->siteid, $model_sql);
             $this->db->sql_execute($model_sql);
             if (!empty($model_import_data)) {
                 $this->sitemodel_field_db = pc_base::load_model('sitemodel_field_model');
                 $system_field = array('title', 'style', 'catid', 'url', 'listorder', 'status', 'userid', 'username', 'inputtime', 'updatetime', 'pages', 'readpoint', 'template', 'groupids_view', 'posids', 'content', 'keywords', 'description', 'thumb', 'typeid', 'relation', 'islink', 'allow_comment');
                 foreach ($model_import_data as $v) {
                     $field = $v['field'];
                     if (in_array($field, $system_field)) {
                         $v['siteid'] = $this->siteid;
                         unset($v['fieldid'], $v['modelid'], $v['field']);
                         $v = new_addslashes($v);
                         $v['setting'] = array2string($v['setting']);
                         $this->sitemodel_field_db->update($v, array('modelid' => $modelid, 'field' => $field));
                     } else {
                         $tablename = $v['issystem'] ? $tablepre . $basic_table : $tablepre . $table_data;
                         //重组模型表字段属性
                         $minlength = $v['minlength'] ? $v['minlength'] : 0;
                         $maxlength = $v['maxlength'] ? $v['maxlength'] : 0;
                         $field_type = $v['formtype'];
                         require MODEL_PATH . $field_type . DIRECTORY_SEPARATOR . 'config.inc.php';
                         if (isset($v['setting']['fieldtype'])) {
                             $field_type = $v['setting']['fieldtype'];
                         }
                         require MODEL_PATH . 'add.sql.php';
                         $v['tips'] = addslashes($v['tips']);
                         $v['setting'] = array2string($v['setting']);
                         $v['modelid'] = $modelid;
                         $v['siteid'] = $this->siteid;
                         unset($v['fieldid']);
                         $this->sitemodel_field_db->insert($v);
                     }
                 }
             }
             $this->public_cache();
             showmessage(L('operation_success'), '?m=content&c=sitemodel&a=init');
         }
     } else {
         pc_base::load_sys_class('form', '', 0);
         $show_validator = '';
         $style_list = template_list($this->siteid, 0);
         foreach ($style_list as $k => $v) {
             $style_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($style_list[$k]);
         }
         $big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=content&c=sitemodel&a=add\', title:\'' . L('add_model') . '\', width:\'580\', height:\'400\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_model'));
         include $this->admin_tpl('sitemodel_import');
     }
 }
开发者ID:baowzh,项目名称:renfang,代码行数:86,代码来源:sitemodel.php

示例9: edit

 /**
  * 编辑站点
  */
 public function edit()
 {
     $siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : $this->error('参数异常');
     if ($site = $this->db->where(array('id' => $siteid))->find()) {
         if (IS_POST) {
             $this->checkToken();
             $data = $_POST['info'];
             $data['setting'] = array2string($_POST['setting']);
             if ($this->db->where(array('id' => $siteid))->save($data) !== false) {
                 logic('site')->setCache();
                 $this->success('操作成功');
             } else {
                 $this->error('操作失败');
             }
         } else {
             $template_list = template_list();
             $setting = string2array($site['setting']);
             $setting['watermark_img'] = str_replace('statics/images/water/', '', $setting['watermark_img']);
             $this->assign('template_list', $template_list);
             $this->assign('setting', $setting);
             $this->assign('data', $site);
             $this->display();
         }
     } else {
         $this->error('站点不存在!');
     }
 }
开发者ID:WALES7CH,项目名称:TP-Admin,代码行数:30,代码来源:SiteController.class.php

示例10: edit

	public function edit() {
		$siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
		if ($data = $this->db->get_one(array('siteid'=>$siteid))) {
			if (isset($_POST['dosubmit'])) {
				$name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('site_name').L('empty'));
				$dirname = isset($_POST['dirname']) && trim($_POST['dirname']) ? strtolower(trim($_POST['dirname'])) : ($siteid == 1 ? '' :showmessage(L('site_dirname').L('empty')));
				$domain = isset($_POST['domain']) && trim($_POST['domain']) ? trim($_POST['domain']) : '';
				$site_title = isset($_POST['site_title']) && trim($_POST['site_title']) ? trim($_POST['site_title']) : '';
				$keywords = isset($_POST['keywords']) && trim($_POST['keywords']) ? trim($_POST['keywords']) : '';
				$description = isset($_POST['description']) && trim($_POST['description']) ? trim($_POST['description']) : '';
				$release_point = isset($_POST['release_point']) ? $_POST['release_point'] : '';
				$template = isset($_POST['template']) && !empty($_POST['template']) ? $_POST['template'] : showmessage(L('please_select_a_style'));
				$default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style'));
				if ($data['name'] != $name && $this->db->get_one(array('name'=>$name), 'siteid')) {
					showmessage(L('site_name').L('exists'));
				}
				if ($siteid != 1) {
					if (!preg_match('/^\\w+$/i', $dirname)) {
						showmessage(L('site_dirname').L('site_dirname_err_msg'));
					}
					if ($data['dirname'] != $dirname && $this->db->get_one(array('dirname'=>$dirname), 'siteid')) {
						showmessage(L('site_dirname').L('exists'));
					}
				}

				if (!empty($domain) && !preg_match('/http:\/\/(.+)\/$/i', $domain)) {
					showmessage(L('site_domain').L('site_domain_ex2'));
				}
				if (!empty($domain) && $data['domain'] != $domain && $this->db->get_one(array('domain'=>$domain), 'siteid')) {
					showmessage(L('site_domain').L('exists'));
				}
				if (!empty($release_point) && is_array($release_point)) {
					if (count($release_point) > 4) {
						showmessage(L('release_point_configuration').L('most_choose_four'));
					}
					$s = '';
					foreach ($release_point as $key=>$val) {
						if($val) $s.= $s ? ",$val" : $val;
					}
					$release_point = $s;
					unset($s);
				} else {
					$release_point = '';
				}
				if (!empty($template) && is_array($template)) {
					$template = implode(',', $template);
				} else {
					$template = '';
				}
				$_POST['setting']['watermark_img'] = 'statics/images/water/'.$_POST['setting']['watermark_img'];
				$setting = trim(array2string($_POST['setting']));
				$sql = array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'release_point'=>$release_point, 'template'=>$template, 'setting'=>$setting, 'default_style'=>$default_style);
				if ($siteid == 1) unset($sql['dirname']);
				if ($this->db->update($sql, array('siteid'=>$siteid))) {
					$class_site = pc_base::load_app_class('sites');
					$class_site->set_cache();
					showmessage(L('operation_success'), '', '', 'edit');
				} else {
					showmessage(L('operation_failure'));
				}
			} else {
				$show_validator = true;
				$show_header = true;
				$show_scroll = true;
				$template_list = template_list();
				$setting = string2array($data['setting']);
				$setting['watermark_img'] = str_replace('statics/images/water/','',$setting['watermark_img']);
				$release_point_db = pc_base::load_model('release_point_model');
				$release_point_list = $release_point_db->select('', 'id, name');
				include $this->admin_tpl('site_edit');
			}
		} else {
			showmessage(L('notfound'), HTTP_REFERER);
		}
	}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:75,代码来源:site.php

示例11: setting

 /**
  * 投票模块配置
  */
 public function setting()
 {
     // 读取配置文件
     $data = array();
     // 更新模型数据库,重设setting 数据.
     $m_db = Loader::model('application_model');
     $now_seting = $m_db->get_setting('vote');
     if (isset($_POST['dosubmit'])) {
         S('common/vote', $_POST['setting']);
         $m_db->set_setting('vote', $_POST['setting']);
         showmessage(L('setting_updates_successful'), U('vote/vote/init'));
     } else {
         @extract($now_seting);
         // 模版
         $template_list = template_list(0);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         include $this->view('setting');
     }
 }
开发者ID:hubs,项目名称:yuncms,代码行数:25,代码来源:VoteController.php

示例12: import

 /**
  * 导入模型
  */
 public function import()
 {
     if (isset($_POST['dosubmit'])) {
         $info = array();
         $info['name'] = $_POST['info']['modelname'];
         // 主表表名
         $basic_table = $info['tablename'] = $_POST['info']['tablename'];
         // 从表表名
         $table_data = $basic_table . '_data';
         $info['description'] = $_POST['info']['description'];
         $info['type'] = 0;
         $info['default_style'] = $_POST['default_style'];
         $info['category_template'] = $_POST['setting']['category_template'];
         $info['list_template'] = $_POST['setting']['list_template'];
         $info['show_template'] = $_POST['setting']['show_template'];
         if (!empty($_FILES['model_import']['tmp_name'])) {
             $model_import = @file_get_contents($_FILES['model_import']['tmp_name']);
             if (!empty($model_import)) {
                 $model_import_data = string2array($model_import);
             }
         }
         $is_exists = $this->db->table_exists($basic_table);
         if ($is_exists) {
             showmessage(L('operation_failure'), U('content/model/init'));
         }
         $modelid = $this->db->add($info, 1);
         if ($modelid) {
             $tablepre = $this->db->get_prefix();
             // 建立数据表
             $model_sql = file_get_contents(MODEL_PATH . 'model.sql');
             $model_sql = str_replace('$basic_table', $tablepre . $basic_table, $model_sql);
             $model_sql = str_replace('$table_data', $tablepre . $table_data, $model_sql);
             $model_sql = str_replace('$table_model_field', $tablepre . 'model_field', $model_sql);
             $model_sql = str_replace('$modelid', $modelid, $model_sql);
             $this->db->sql_execute($model_sql);
             if (!empty($model_import_data)) {
                 $this->model_field_db = Loader::model('model_field_model');
                 $system_field = array('title', 'style', 'catid', 'url', 'listorder', 'status', 'userid', 'username', 'inputtime', 'updatetime', 'pages', 'readpoint', 'template', 'groupids_view', 'posids', 'content', 'keywords', 'description', 'thumb', 'typeid', 'relation', 'islink', 'allow_comment');
                 foreach ($model_import_data as $v) {
                     $field = $v['field'];
                     if (in_array($field, $system_field)) {
                         unset($v['fieldid'], $v['modelid'], $v['field']);
                         $v = String::addslashes($v);
                         $v['setting'] = serialize($v['setting']);
                         $this->model_field_db->where(array('modelid' => $modelid, 'field' => $field))->update($v);
                     } else {
                         $tablename = $v['issystem'] ? $tablepre . $basic_table : $tablepre . $table_data;
                         // 重组模型表字段属性
                         $minlength = $v['minlength'] ? $v['minlength'] : 0;
                         $maxlength = $v['maxlength'] ? $v['maxlength'] : 0;
                         $field_type = $v['formtype'];
                         require MODEL_PATH . $field_type . DIRECTORY_SEPARATOR . 'config.inc.php';
                         if (isset($v['setting']['fieldtype'])) {
                             $field_type = $v['setting']['fieldtype'];
                         }
                         require MODEL_PATH . 'add.sql.php';
                         $v['tips'] = addslashes($v['tips']);
                         $v['setting'] = serialize($v['setting']);
                         $v['modelid'] = $modelid;
                         unset($v['fieldid']);
                         $this->model_field_db->insert($v);
                     }
                 }
             }
             $this->public_cache();
             showmessage(L('operation_success'), U('content/model/init'));
         }
     } else {
         $show_validator = '';
         $style_list = template_list(0);
         foreach ($style_list as $k => $v) {
             $style_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($style_list[$k]);
         }
         $big_menu = big_menu(U('content/model/add'), 'add', L('add_model'), 580, 400);
         include $this->view('model_import');
     }
 }
开发者ID:hubs,项目名称:yuncms,代码行数:81,代码来源:ModelController.php

示例13: sub_from_file

 sub_from_file($step++, "// Remove our padding from the string..\n\t\$text = substr(\$text, 1);", "include_once('" . GWBB_ROOT . "gwbbcode/functions_gw.php');", INCL_ROOT . 'includes/bbcode.php');
 sub_from_file($step++, "'T_SPAN_CLASS3' => \$theme['span_class3'],", "   'GWBBCODE_HEAD' => file_get_contents('" . GWBB_ROOT . "gwbbcode/overall_header.tpl'),", INCL_ROOT . 'includes/page_header.php');
 if (file_exists(OLD_PICKUP_PATH)) {
     $pickup = eval('return ' . file_get_contents(OLD_PICKUP_PATH) . ';');
     if (save(PICKUP_PATH, $pickup)) {
         echo 'Transfering ' . OLD_PICKUP_PATH . ' to ' . PICKUP_PATH . ': ' . success('done', true);
         rm(OLD_PICKUP_PATH, false);
     }
 }
 //Installing
 echo "\nHooking phpBB2...\n";
 add_to_file($step++, "'T_SPAN_CLASS3' => \$theme['span_class3'],", "   'GWBBCODE_HEAD' => include('" . GWBB_ROOT . "gwbbcode/header.php'),", INCL_ROOT . 'includes/page_header.php');
 add_to_file($step++, "'T_SPAN_CLASS3' => \$theme['span_class3'],", "   'GWBBCODE_BODY' => include('" . GWBB_ROOT . "gwbbcode/body.php'),", INCL_ROOT . 'includes/page_header.php');
 add_to_file($step++, "// Remove our padding from the string..\n\t\$text = substr(\$text, 1);", "include('" . GWBB_ROOT . "gwbbcode/gwbbcode.php');", INCL_ROOT . 'includes/bbcode.php');
 //Hook all templates
 $templates = defined('IS_NUKE') ? template_list('../../themes') : template_list('templates');
 $templatepath = defined('IS_NUKE') ? '/forums' : '';
 foreach ($templates as $template) {
     if (in_array($template, $not_to_hook) || !is_dir($template . $templatepath)) {
         continue;
     }
     echo "\nProcessing template " . basename($template) . "...\n";
     sub_from_file($step++, '@<head[^>]*>@Uis', '{GWBBCODE_HEAD}', $template . $templatepath . '/overall_header.tpl', true);
     add_to_file($step++, '</title>', '{GWBBCODE_HEAD}', $template . $templatepath . '/overall_header.tpl');
     add_to_file($step++, '@<body[^>]*>@Uis', '{GWBBCODE_BODY}', $template . $templatepath . '/overall_header.tpl', true);
 }
 echo "\nIf you add templates, please rerun install.php to hook gwbbcode on them";
 //Recreate and fill the skills table
 if (GWBBCODE_SQL) {
     echo "\n\nPreparing the MySQL skill table...\n";
     add_skills_to_sql();
开发者ID:yusufchang,项目名称:app,代码行数:31,代码来源:install.php

示例14: batch_edit

 /**
  * 批量修改
  */
 public function batch_edit()
 {
     $categorys = S('common/category_content');
     if (isset($_POST['dosubmit'])) {
         $catid = intval($_POST['catid']);
         $post_setting = $_POST['setting'];
         // 栏目生成静态配置
         $infos = $info = array();
         $infos = $_POST['info'];
         if (empty($infos)) {
             showmessage(L('operation_success'));
         }
         $this->attachment_db = Loader::model('attachment_model');
         foreach ($infos as $catid => $info) {
             $setting = string2array($categorys[$catid]['setting']);
             if ($_POST['type'] != 2) {
                 if ($post_setting[$catid]['ishtml']) {
                     $setting['category_ruleid'] = $_POST['category_html_ruleid'][$catid];
                 } else {
                     $setting['category_ruleid'] = $_POST['category_php_ruleid'][$catid];
                     $info['url'] = '';
                 }
             }
             foreach ($post_setting[$catid] as $_k => $_setting) {
                 $setting[$_k] = $_setting;
             }
             // 内容生成静态配置
             if ($post_setting[$catid]['content_ishtml']) {
                 $setting['show_ruleid'] = $_POST['show_html_ruleid'][$catid];
             } else {
                 $setting['show_ruleid'] = $_POST['show_php_ruleid'][$catid];
             }
             if ($setting['repeatchargedays'] < 1) {
                 $setting['repeatchargedays'] = 1;
             }
             $info['sethtml'] = isset($post_setting[$catid]['create_to_html_root']) && !empty($post_setting[$catid]['create_to_html_root']) ? $post_setting[$catid]['create_to_html_root'] : 0;
             $info['setting'] = array2string($setting);
             $info['application'] = 'content';
             $info['letter'] = strtolower(string_to_pinyin($info['catname']));
             $this->db->where(array('catid' => $catid))->update($info);
             // 更新附件状态
             if ($info['image'] && C('attachment', 'stat')) {
                 $this->attachment_db->api_update($info['image'], 'catid-' . $catid, 1);
             }
         }
         $this->public_cache();
         showmessage(L('operation_success'), U('admin/category/init'));
     } else {
         if (isset($_POST['catids'])) {
             $template_list = template_list(0);
             foreach ($template_list as $k => $v) {
                 $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
                 unset($template_list[$k]);
             }
             $show_validator = '';
             $catid = intval($_GET['catid']);
             $type = isset($_POST['type']) ? intval($_POST['type']) : 0;
             if (empty($_POST['catids'])) {
                 showmessage(L('illegal_parameters'));
             }
             $batch_array = $workflows = array();
             foreach ($categorys as $catid => $cat) {
                 if ($cat['type'] == $type && in_array($catid, $_POST['catids'])) {
                     $batch_array[$catid] = $cat;
                 }
             }
             if (empty($batch_array)) {
                 showmessage(L('please_select_category'));
             }
             $workflows = S('common/workflow');
             if ($workflows) {
                 $workflows_datas = array();
                 foreach ($workflows as $_k => $_v) {
                     $workflows_datas[$_v['workflowid']] = $_v['workname'];
                 }
             }
             $show_header = true;
             if ($type == 1) {
                 include $this->view('category_batch_edit_page');
             } else {
                 include $this->view('category_batch_edit');
             }
         } else {
             $type = isset($_GET['select_type']) ? intval($_GET['select_type']) : 0;
             $tree = Loader::lib('Tree');
             $tree->icon = array('&nbsp;&nbsp;│ ', '&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;└─ ');
             $tree->nbsp = '&nbsp;&nbsp;';
             $category = array();
             foreach ($categorys as $catid => $r) {
                 if ($r['type'] == 2 && $r['child'] == 0) {
                     continue;
                 }
                 $category[$catid] = $r;
             }
             $str = "<option value='\$catid' \$selected>\$spacer \$catname</option>";
             $tree->init($category);
             $string .= $tree->get_tree(0, $str);
//.........这里部分代码省略.........
开发者ID:hubs,项目名称:yuncms,代码行数:101,代码来源:CategoryController.php

示例15: edit

 /**
  * 修改公告
  */
 public function edit()
 {
     $id = isset($_GET['id']) ? intval($_GET['id']) : showmessage(L('illegal_operation'));
     if (isset($_POST['dosubmit'])) {
         $info = $this->check($_POST['announce'], 'edit');
         if ($this->db->where(array('id' => $id))->update($info)) {
             showmessage(L('announced_a'), HTTP_REFERER, '', 'edit');
         } else {
             showmessage(L('operation_failure'), HTTP_REFERER, '', 'edit');
         }
     } else {
         $where = array('id' => $id);
         $an_info = $this->db->where($where)->find();
         Loader::helper('admin:global');
         // 获取站点模板信息
         $template_list = template_list(0);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         $show_header = $show_validator = $show_scroll = 1;
         include $this->view('announce_edit');
     }
 }
开发者ID:hubs,项目名称:yuncms,代码行数:27,代码来源:Admin_announceController.php


注:本文中的template_list函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。