示例#1
0
 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');
 }
示例#2
0
 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'));
     }
 }
示例#3
0
 /**
  * 修改公告
  */
 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');
     }
 }
示例#4
0
 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');
 }
示例#5
0
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();
}
示例#6
0
 /**
  * 批量修改
  */
 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;
                 }
                 $category[$catid] = $r;
             }
             $str = "<option value='\$catid' \$selected>\$spacer \$catname</option>";
             $tree->init($category);
             $string .= $tree->get_tree(0, $str);
             include $this->admin_tpl('category_batch_select');
         }
     }
 }
示例#7
0
 /**
  * 信息修改
  */
 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');
     }
 }
示例#8
0
 /**
  * 导入模型
  */
 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');
     }
 }
 /**
  * 编辑站点
  */
 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('站点不存在!');
     }
 }
示例#10
0
	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);
		}
	}
示例#11
0
 /**
  * 投票模块配置
  */
 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');
     }
 }
示例#12
0
 /**
  * 导入模型
  */
 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');
     }
 }
示例#13
0
 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();
示例#14
0
 /**
  * 批量修改
  */
 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);
             include $this->view('category_batch_select');
         }
     }
 }
示例#15
0
 /**
  * 修改公告
  */
 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');
     }
 }
示例#16
0
 private function render_nav($nav)
 {
     global $system_routes;
     $menu = array();
     $n = 0;
     if (true) {
         $menu['divider' . $n] = array('text' => '', 'class' => 'divider-vertical');
     }
     foreach ($system_routes as $module) {
         foreach ($module as $path => $item) {
             if (array_key_exists('nav', $item) && array_search($nav, $item['nav']) !== false) {
                 $display = true;
                 if (array_key_exists('menu_callback', $item)) {
                     $display = call_user_func_array($item['menu_callback'], array($path));
                 }
                 if ($display) {
                     if ($item['menu_title']) {
                         $title = $item['menu_title'];
                     } else {
                         $title = $path;
                     }
                     $icon = '';
                     if (isset($item['menu_icon'])) {
                         $icon = '<i class="' . $item['menu_icon'] . ' icon-white"></i> ';
                     }
                     if ($nav == 'phone') {
                         $title = '<i class="' . $item['menu_icon'] . ' icon-white"></i> ';
                     } else {
                         $title = $icon . $title;
                     }
                     $t = l($title, '/' . $path, '', false, $item['menu_title']);
                     $menu[$path] = array('text' => $t);
                     if ($nav == 'phone') {
                         $n++;
                         $menu['divider' . $n] = array('text' => '', 'class' => 'divider-vertical');
                     }
                 }
             }
         }
     }
     return template_list($menu, 'nav');
 }
示例#17
0
 /**
  * 编辑表单向导
  */
 public function edit()
 {
     if (!isset($_GET['formid']) || empty($_GET['formid'])) {
         showmessage(L('illegal_operation'), HTTP_REFERER);
     }
     $formid = intval($_GET['formid']);
     if (isset($_POST['dosubmit'])) {
         if ($_POST['setting']['starttime']) {
             $_POST['setting']['starttime'] = strtotime($_POST['setting']['starttime']);
         }
         if ($_POST['setting']['endtime']) {
             $_POST['setting']['endtime'] = strtotime($_POST['setting']['endtime']);
         }
         $_POST['info'] = $this->check_info($_POST['info'], $formid);
         $_POST['info']['setting'] = array2string($_POST['setting']);
         $_POST['info']['js_template'] = $_POST['info']['show_js_template'];
         unset($_POST['info']['show_js_template']);
         $this->db->where(array('modelid' => $formid))->update($_POST['info']);
         showmessage(L('update_success'), U('formguide/formguide/edit', array('formid' => $formid)), '', 'edit');
     } else {
         $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]);
         }
         $data = $this->db->getby_modelid($formid);
         $data['setting'] = string2array($data['setting']);
         $show_header = $show_validator = $show_scroll = 1;
         include $this->view('formguide_edit');
     }
 }
示例#18
0
 /**
  * 专题修改
  */
 public function edit()
 {
     if (!isset($_GET['specialid']) || empty($_GET['specialid'])) {
         showmessage(L('illegal_action'), HTTP_REFERER);
     }
     $_GET['specialid'] = intval($_GET['specialid']);
     if (isset($_POST['dosubmit']) && !empty($_POST['dosubmit'])) {
         $special = $this->check($_POST['special'], 'edit');
         if ($special['ishtml'] && $special['filename']) {
             $special['url'] = SITE_URL . substr(C('system', 'html_root'), 1) . '/special/' . $special['filename'] . '/';
         } elseif ($special['ishtml'] == '0') {
             $special['url'] = SITE_URL . 'index.php?app=special&controller=index&specialid=' . $_GET['specialid'];
         }
         $this->db->update($special, array('id' => $_GET['specialid']));
         $this->special_api->_update_type($_GET['specialid'], $_POST['type'], 'edit');
         // 调用生成静态类
         if ($special['ishtml']) {
             $html = Loader::lib('special:html');
             $html->_index($_GET['specialid'], 20, 5);
         }
         // 更新附件状态
         if (C('attachment', 'stat')) {
             $this->attachment_db = Loader::model('attachment_model');
             $this->attachment_db->api_update(array($special['thumb'], $special['banner']), 'special-' . $_GET['specialid'], 1);
         }
         $this->special_cache();
         showmessage(L('edit_special_success'), HTTP_REFERER);
     } else {
         $info = $this->db->getby_id(intval($_GET['specialid']));
         $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]);
         }
         if ($info['pics']) {
             $pics = explode('|', $info['pics']);
         }
         if ($info['voteid']) {
             $vote_info = explode('|', $info['voteid']);
         }
         $type_db = Loader::model('type_model');
         $types = $type_db->where(array('application' => 'special', 'parentid' => $_GET['specialid']))->field('typeid, name, listorder,typedir')->order('listorder ASC, typeid ASC')->select();
         include $this->view('special_edit');
     }
 }
示例#19
0
 //Admin?
 echo '<html><head></head><body><pre>';
 install_header();
 if ($userdata['user_level'] != ADMIN) {
     failure("\nYou need admin rights to be allowed to uninstall gwBBCode.");
     die;
 }
 echo "\nUnhooking phpBB...\n";
 sub_from_file($step++, "// Remove our padding from the string..\n\t\$text = substr(\$text, 1);", "include_once('gwbbcode/functions_gw.php');", GWBBCODE_ROOT . '/../includes/bbcode.php');
 sub_from_file($step++, "'T_SPAN_CLASS3' => \$theme['span_class3'],", "   'GWBBCODE_HEAD' => file_get_contents('gwbbcode/overall_header.tpl'),", GWBBCODE_ROOT . '/../includes/page_header.php');
 sub_from_file($step++, "'T_SPAN_CLASS3' => \$theme['span_class3'],", "   'GWBBCODE_BODY' => include('gwbbcode/body.php'),", GWBBCODE_ROOT . '/../includes/page_header.php');
 //TODO merge in one line?
 sub_from_file($step++, "'T_SPAN_CLASS3' => \$theme['span_class3'],", "   'GWBBCODE_HEAD' => include('gwbbcode/header.php'),", GWBBCODE_ROOT . '/../includes/page_header.php');
 sub_from_file($step++, "// Remove our padding from the string..\n\t\$text = substr(\$text, 1);", "include('gwbbcode/gwbbcode.php');", GWBBCODE_ROOT . '/../includes/bbcode.php');
 //Clean all templates
 $templates = template_list('templates');
 foreach ($templates as $template) {
     echo "\nProcessing template " . basename($template) . "...\n";
     sub_from_file($step++, '@<body[^>]*>@Uis', '{GWBBCODE_BODY}', $template . '/overall_header.tpl', true);
     sub_from_file($step++, '@<head[^>]*>@i', '{GWBBCODE_HEAD}', $template . '/overall_header.tpl', true);
     sub_from_file($step++, '</title>', '{GWBBCODE_HEAD}', $template . '/overall_header.tpl');
 }
 //Remove the sql skill table
 if (GWBBCODE_SQL) {
     echo "\n\nMySQL skill table status: ";
     if (mysql_query('DROP TABLE IF EXISTS skills;')) {
         success('removed');
     } else {
         failure('couldn\'t be removed');
     }
 }
示例#20
0
 /**
  * 投票模块配置
  */
 public function setting()
 {
     //读取配置文件
     $data = array();
     $siteid = $this->get_siteid();
     //当前站点
     //更新模型数据库,重设setting 数据.
     $m_db = pc_base::load_model('module_model');
     $data = $m_db->select(array('module' => 'vote'));
     $setting = string2array($data[0]['setting']);
     $now_seting = $setting[$siteid];
     if (isset($_POST['dosubmit'])) {
         //多站点存储配置文件
         $siteid = $this->get_siteid();
         //当前站点
         $setting[$siteid] = $_POST['setting'];
         setcache('vote', $setting, 'commons');
         //更新模型数据库,重设setting 数据.
         $set = array2string($setting);
         $m_db->update(array('setting' => $set), array('module' => ROUTE_M));
         showmessage(L('setting_updates_successful'), '?m=vote&c=vote&a=init');
     } else {
         @extract($now_seting);
         pc_base::load_sys_class('form', '', 0);
         //模版
         pc_base::load_app_func('global', 'admin');
         $siteid = $this->get_siteid();
         $template_list = template_list($siteid, 0);
         $site = pc_base::load_app_class('sites', 'admin');
         $info = $site->get_by_id($siteid);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         include $this->admin_tpl('setting');
     }
 }
示例#21
0
	/**
	 * 编辑表单向导
	 */
	public function edit() {
		if (!isset($_GET['formid']) || empty($_GET['formid'])) {
			showmessage(L('illegal_operation'), HTTP_REFERER);
		}
		$formid = intval($_GET['formid']);
		if (isset($_POST['dosubmit'])) {
			if ($_POST['setting']['starttime']) {
				$_POST['setting']['starttime'] = strtotime($_POST['setting']['starttime']);
			}
			if ($_POST['setting']['endtime']) {
				$_POST['setting']['endtime'] = strtotime($_POST['setting']['endtime']);
			}
			$_POST['info'] = $this->check_info($_POST['info'], $formid);
			$_POST['info']['setting'] = array2string($_POST['setting']);
			$_POST['info']['js_template'] = $_POST['info']['show_js_template'];
			unset($_POST['info']['show_js_template']);
			$this->db->update($_POST['info'], array('modelid'=>$formid));
			showmessage(L('update_success'), '?m=formguide&c=formguide&a=init&formid='.$formid, '', 'edit');
		} else {
			$siteid = $this->get_siteid();
			$template_list = template_list($siteid, 0);
			$site = pc_base::load_app_class('sites','zl_admin');
			$info = $site->get_by_id($siteid);
			foreach ($template_list as $k=>$v) {
				$template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
				unset($template_list[$k]);
			}
			$data = $this->db->get_one(array('modelid'=>$formid));
			$data['setting'] = string2array($data['setting']);
			pc_base::load_sys_class('form', '', false);
			$show_header = $show_validator = $show_scroll = 1;
			include $this->admin_tpl('formguide_edit');
		}
	}
示例#22
0
function user_login_block()
{
    $user = new User();
    $links = array();
    $links['d0'] = array('text' => '', 'class' => 'divider-vertical');
    if ($user->uid) {
        $links['your-account'] = l('Your Account', '/user');
        $links['d1'] = array('text' => '', 'class' => 'divider-vertical');
        $links['logout'] = l('Logout', '/logout') . '</li>';
    } else {
        $links['login'] = l('Login', '/login', 'button');
        $links['register'] = l('Register', '/register', 'button');
    }
    return template_list($links, 'nav');
}
示例#23
0
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">关闭原因</label>
                <div class="col-sm-4">
                    <textarea name="form[close_reason]" class="form-control" cols="60" rows="3"><?php 
echo output($setting, 'close_reason');
?>
</textarea>

                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">默认模板</label>
                <div class="col-sm-4">
                    <?php 
echo WUZHI_form::select(template_list(), TPLID, 'name="form[default_template]" class="form-control"');
?>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <input class="btn btn-info" type="submit" name="submit" value="提交">
                </div>
            </div>
        </form>
    </div>
</section>
</div>
</div>
<!-- page end-->
示例#24
0
文件: special.php 项目: cfhb/MIS
 /**
  * 专题修改
  */
 public function edit()
 {
     if (!isset($_GET['specialid']) || empty($_GET['specialid'])) {
         showmessage(L('illegal_action'), HTTP_REFERER);
     }
     $_GET['specialid'] = intval($_GET['specialid']);
     if (isset($_POST['dosubmit']) && !empty($_POST['dosubmit'])) {
         $special = $this->check($_POST['special'], 'edit');
         $siteid = get_siteid();
         $site = pc_base::load_app_class('sites', 'admin');
         $site_info = $site->get_by_id($siteid);
         if ($special['ishtml'] && $special['filename']) {
             if ($siteid > 1) {
                 $special['url'] = $site_info['domain'] . 'special/' . $special['filename'] . '/';
             } else {
                 $special['url'] = APP_PATH . substr(pc_base::load_config('system', 'html_root'), 1) . '/special/' . $special['filename'] . '/';
             }
         } elseif ($special['ishtml'] == '0') {
             if ($siteid > 1) {
                 $special['url'] = $site_info['domain'] . 'index.php?m=special&c=index&specialid=' . $_GET['specialid'];
             } else {
                 $special['url'] = APP_PATH . 'index.php?m=special&c=index&specialid=' . $_GET['specialid'];
             }
         }
         $this->db->update($special, array('id' => $_GET['specialid'], 'siteid' => $this->get_siteid()));
         $this->special_api->_update_type($_GET['specialid'], $_POST['type'], 'edit');
         //调用生成静态类
         if ($special['ishtml']) {
             $html = pc_base::load_app_class('html', 'special');
             $html->_index($_GET['specialid'], 20, 5);
         }
         //更新附件状态
         if (pc_base::load_config('system', 'attachment_stat')) {
             $this->attachment_db = pc_base::load_model('attachment_model');
             $this->attachment_db->api_update(array($special['thumb'], $special['banner']), 'special-' . $_GET['specialid'], 1);
         }
         $this->special_cache();
         showmessage(L('edit_special_success'), HTTP_REFERER);
     } else {
         $info = $this->db->get_one(array('id' => $_GET['specialid'], 'siteid' => $this->get_siteid()));
         //获取站点模板信息
         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]);
         }
         if ($info['pics']) {
             $pics = explode('|', $info['pics']);
         }
         if ($info['voteid']) {
             $vote_info = explode('|', $info['voteid']);
         }
         $type_db = pc_base::load_model('type_model');
         $types = $type_db->select(array('module' => 'special', 'parentid' => $_GET['specialid'], 'siteid' => $this->get_siteid()), '`typeid`, `name`, `listorder`, `typedir`', '', '`listorder` ASC, `typeid` ASC');
         include $this->admin_tpl('special_edit');
     }
 }