Example #1
0
 function codemirror($attrs)
 {
     $url = zotop::module('codemirror', 'url');
     $options = new stdClass();
     $options->path = $url . '/codemirror/js/';
     $options->parserfile = array('parsexml.js');
     $options->stylesheet = array($url . '/codemirror/css/xmlcolors.css');
     $options->height = is_numeric($attrs['height']) ? $attrs['height'] . 'px' : $attrs['height'];
     $options->width = is_numeric($attrs['width']) ? $width . 'px' : $attrs['width'];
     $options->continuousScanning = 500;
     $options->autoMatchParens = true;
     if ($attrs['linenumbers'] !== false) {
         $options->lineNumbers = true;
         $options->textWrapping = false;
     }
     if ($attrs['tabmode'] == '') {
         $options->tabMode = 'shift';
     }
     $html = array();
     $html[] = html::script($url . '/codemirror/js/codemirror.js');
     $html[] = html::stylesheet($url . '/codemirror/css/codemirror.css');
     $html[] = '	' . field::textarea($attrs);
     $html[] = '<script type="text/javascript">';
     $html[] = '	var editor = CodeMirror.fromTextArea("' . $attrs['name'] . '", ' . json_encode($options) . ');';
     $html[] = '$(function(){';
     $html[] = '	$("form").submit(function(){';
     $html[] = '		$("textarea[name=+' . $attrs['name'] . '+]").val(editor.getCode());';
     $html[] = '	});';
     $html[] = '})';
     $html[] = '</script>';
     return implode("\n", $html);
 }
Example #2
0
 public function __construct()
 {
     if (!zotop::user()) {
         zotop::redirect('zotop/login');
     }
     $this->__init();
 }
Example #3
0
function msg_useraction()
{
    ?>
	<span id="msg">
		<a href="<?php 
    echo zotop::url('msg/list');
    ?>
" target="mainIframe">短消息</a>
		<span id="msg-unread">
			<a href="<?php 
    echo zotop::url('msg/list/unread');
    ?>
" target="mainIframe"><span id="msg-unread-num">0</span>条未读</a>
		</span>
		<b>|</b>
	</span>
	<script>
	//获取未读消息数目
	function getUnreadMsg(){
		var url = "<?php 
    echo zotop::url('msg/list/unread');
    ?>
";
		$.get(url,'',function(msg){
			msg.num = parseInt(msg.num);			
			$('#msg-unread-num').html(msg.num);
		},'json');
	};
	//定时获取未读短消息数目
	(function(){		
		setInterval(getUnreadMsg,10000);
	})();
	</script>
	<?php 
}
Example #4
0
 public function onDefault()
 {
     if (form::isPostBack()) {
         msg::error('开发中', '数据保存开发中,请稍后……');
     }
     $header['title'] = '系统设置';
     page::header($header);
     page::top();
     page::navbar($this->navbar(), 'main');
     form::header();
     block::header('网站基本信息');
     form::field(array('type' => 'text', 'label' => zotop::t('网站名称'), 'name' => 'zotop.site.title', 'value' => zotop::config('zotop.site.title'), 'description' => zotop::t('网站名称,将显示在标题和导航中')));
     form::field(array('type' => 'text', 'label' => zotop::t('网站域名'), 'name' => 'zotop.site.domain', 'value' => zotop::config('zotop.site.domain'), 'description' => zotop::t('网站域名地址,不包含http://,如:www.zotop.com')));
     form::field(array('type' => 'text', 'label' => zotop::t('备案信息'), 'name' => 'zotop.site.icp', 'value' => zotop::config('zotop.site.icp'), 'description' => zotop::t('页面底部可以显示 ICP 备案信息,如果网站已备案,在此输入您的授权码,它将显示在页面底部,如果没有请留空')));
     form::field(array('type' => 'select', 'options' => array('0' => '不显示', '1' => '显示'), 'label' => zotop::t('授权信息'), 'name' => 'zotop.site.license', 'value' => zotop::config('zotop.site.license'), 'description' => zotop::t('页脚部位显示程序官方网站链接')));
     form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => zotop::config('zotop.site.about')));
     block::footer();
     block::header('联系信息设置');
     form::field(array('type' => 'text', 'label' => zotop::t('公司名称'), 'name' => 'zotop.site.title', 'value' => '', 'description' => zotop::t('网站隶属的公司或者组织名称')));
     form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => ''));
     block::footer();
     form::buttons(array('type' => 'submit'), array('type' => 'back'));
     form::footer();
     page::bottom();
     page::footer();
 }
Example #5
0
 public function onSide()
 {
     $header['title'] = '系统管理';
     $header['js'][] = url::module() . '/admin/js/side.js';
     $header['body']['class'] = 'side';
     page::header($header);
     block::header(array('title' => '系统工具', 'class' => 'show'));
     echo '<ul id="applications" class="list">';
     echo '	<li><a href="' . zotop::url('zotop/system/reboot') . '" target="mainIframe">系统关闭与重启</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/system/clearcahce') . '" target="mainIframe">缓存清理</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/setting') . '" target="mainIframe">系统设置</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/database') . '" target="mainIframe">数据库备份与还原</a></li>';
     echo '	<li><a href="' . zotop::url('database') . '" target="mainIframe">数据库管理</a></li>';
     echo '	<li><a href="' . zotop::url('filemanager') . '" target="mainIframe">文件管理</a></li>';
     echo '</ul>';
     block::footer();
     block::header(array('title' => '模块管理', 'class' => 'show'));
     echo '<ul class="list">';
     echo '	<li><a href="' . zotop::url('zotop/module') . '" target="mainIframe">模块管理</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/module/add') . '" target="mainIframe">模块添加</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/module/install') . '" target="mainIframe">模块安装</a></li>';
     echo '</ul>';
     block::footer();
     block::header(array('title' => '管理员设置', 'class' => 'show'));
     echo '<ul class="list">';
     echo '	<li><a href="' . zotop::url('zotop/user') . '" target="mainIframe">系统用户管理</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/usergroup') . '" target="mainIframe">系统用户组管理</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/role') . '" target="mainIframe">系统角色管理</a></li>';
     echo '</ul>';
     block::footer();
     //echo '<div style="height:600px;"></div>';
     page::footer();
 }
Example #6
0
 public function __construct($config = array())
 {
     if (!$this->test()) {
         zotop::error(zotop::t('The memcache extension is not available'));
     }
     $host = $config['host'];
     $host = empty($host) ? zotop::config('system.cache.memcache.host') : $host;
     $host = empty($host) ? '127.0.0.1' : $host;
     $post = $config['post'];
     $port = empty($port) ? zotop::config('system.cache.memcache.port') : $port;
     $port = empty($port) ? '11211' : $port;
     $timeout = isset($config['timeout']) ? (bool) $config['timeout'] : false;
     $persistent = isset($config['persistent']) ? (bool) $config['persistent'] : false;
     unset($config);
     //是否持久链接
     $connect = $persistent ? 'pconnect' : 'connect';
     $this->memcache =& new Memcache();
     if ($timeout === false) {
         $this->connected = @$this->memcache->{$connect}($host, $port);
     } else {
         $this->connected = @$this->memcache->{$connect}($host, $port, $timeout);
     }
     if (!$this->connected) {
         zotop::error(zotop::t('无法连接memcache服务器 “{$host}:{$port}”,请检查参数配置是否正确', array('host' => $host, 'port' => $port)));
     }
 }
Example #7
0
 public function editAction($tablename)
 {
     if (form::isPostBack()) {
         $tablename = request::post('tablename');
         $name = request::post('name');
         $comment = request::post('comment');
         $primary = request::post('primary');
         if (strtolower($tablename) !== strtolower($name)) {
             $rename = zotop::db()->table($tablename)->rename($name);
         }
         if ($comment !== NULL) {
             $comment = zotop::db()->table($name)->comment($comment);
         }
         if ($primary) {
             $primary = zotop::db()->table($name)->primary($primary);
         }
         $this->success('数据表设置成功,正在刷新页面,请稍后……', zotop::url('database/table'));
     }
     $db = zotop::db();
     $database = $db->config();
     $tables = $db->tables(true);
     $table = $tables[$tablename];
     if (!isset($table)) {
         $this->error(zotop::t('数据表{$tablename}不存在', array('tablename' => $tablename)));
     }
     $page = new dialog();
     $page->title = '数据库管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 编辑:' . $tablename;
     $page->set('database', $database);
     $page->set('table', $table);
     $page->display();
 }
Example #8
0
 public function onDefault()
 {
     $header['title'] = '控制面板';
     $header['js'][] = url::module() . '/admin/js/side.js';
     $header['body']['class'] = 'side';
     page::header($header);
     block::header(array('title' => '应用列表', 'action' => '<a href="#" title="栏目管理">管理</a>'));
     echo '<ul id="applications" class="list">';
     echo '	<li><a href="' . zotop::url('zotop/main') . '" target="mainIframe">控制中心</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/test') . '" target="mainIframe">表单测试</a></li>';
     echo '	<li><a href="' . zotop::url('database') . '" target="mainIframe">数据库管理</a></li>';
     echo '	<li><a href="' . zotop::url('filemanager') . '" target="mainIframe">文件管理</a></li>';
     echo '</ul>';
     block::footer();
     block::header(array('title' => '内容管理', 'action' => '<a href="javascript:zotop.frame.side().location.reload();">刷新</a> <a href="#" title="栏目管理">管理</a>'));
     echo '<ul class="list">';
     echo '	<li><a href="' . zotop::url('zotop/main') . '" target="mainIframe">控制中心</a></li>';
     echo '	<li><a href="' . zotop::url('zotop/test') . '" target="mainIframe">表单测试</a></li>';
     echo '	<li><a href="' . zotop::url('database') . '" target="mainIframe">数据库管理</a></li>';
     echo '	<li><a href="' . zotop::url('filemanager') . '" target="mainIframe">文件管理</a></li>';
     echo '</ul>';
     block::footer();
     //echo '<div style="height:600px;"></div>';
     page::footer();
 }
Example #9
0
 public static function theme()
 {
     //系统默认返回的主题为system
     $theme = zotop::config('system.theme');
     $theme = empty($theme) ? 'system' : $theme;
     return $theme;
 }
Example #10
0
 public function actionDelete($tablename)
 {
     $delete = zotop::db()->table($tablename)->drop();
     if (!$delete) {
         msg::error(zotop::t('删除数据表{$tablename}失败', array('tablename' => $tablename)));
     }
     msg::success('删除成功', zotop::url('database/table'));
 }
Example #11
0
 public function __construct()
 {
     $this->db = zotop::db();
     //数据库
     if (!user::isLogin()) {
         //url::redirect('system/login');
     }
 }
Example #12
0
 public function actionDelete($id)
 {
     $file = zotop::model('zotop.file');
     $delete = $file->delete($id);
     if ($delete) {
         msg::success('删除成功', request::referer());
     }
 }
Example #13
0
 public static function hash()
 {
     $hash = zotop::config('system.safety.authkey');
     $hash = empty($hash) ? 'zotop form hash!' : $hash;
     $hash = substr(time(), 0, -7) . $hash;
     $hash = strtoupper(md5($hash));
     return $hash;
 }
Example #14
0
 public function onDefault()
 {
     $db = zotop::db();
     if ($db->connect()) {
         zotop::redirect('database/table');
     }
     msg::error('连接数据库失败', '请检查数据库配置是否正确');
 }
Example #15
0
 public function actionIndex()
 {
     $db = zotop::db();
     if ($db->connect()) {
         zotop::redirect(zotop::url('database/table'));
     }
     msg::error('连接数据库失败,请检查数据库配置是否正确');
 }
Example #16
0
 public function actionShortcut()
 {
     $title = zotop::get('title');
     $url = zotop::get('url');
     $shortcut = "[InternetShortcut]\nURL=" . $url . "\nIDList= [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2";
     header("Content-type: application/octet-stream");
     header("Content-Disposition: attachment; filename=" . $title . ".url;");
     echo $shortcut;
 }
Example #17
0
 /**
  * 表情转换,可以通过hook(zotop.smiles)扩展
  * 
  *
  */
 public static function smiles($str)
 {
     $smiles = array(':)' => url::theme() . '/image/smiles/smile.gif', ':-)' => url::theme() . '/image/smiles/cool.gif');
     $smiles = zotop::filter('zotop.smiles', $smiles);
     foreach ($smiles as $key => $val) {
         $str = str_replace($key, '<img src=' . $val . ' class="zotop-smile"/>', $str);
     }
     return $str;
 }
Example #18
0
 public function actionDetail($id)
 {
     $content = zotop::model('content.content');
     $content->read($id);
     $page = new page();
     $page->set('content', $content);
     $page->set('body', array('class' => 'detail'));
     $page->display($content->template);
 }
Example #19
0
 public function actionSide()
 {
     $category = zotop::model('content.category');
     $tree = $category->getTree(0, '<span class="zotop-icon zotop-icon-$icon"></span><a href="' . zotop::url('content/content/index/$id') . '" target="mainIframe">$title</a>');
     $page = new side();
     $page->set('title', zotop::t('文件管理'));
     $page->set('tree', $tree);
     $page->display();
 }
Example #20
0
 public function author($userid = '')
 {
     $userid = empty($userid) ? $this->userid : $userid;
     $author = empty($author) ? $this->author : $author;
     if (empty($author) && !empty($userid)) {
         $author = zotop::model('system.user')->getName($userid);
     }
     return empty($author) ? '' : $author;
 }
Example #21
0
 /**
  * 显示成功消息
  *
  */
 public static function success($content = '', $url = '', $life = 2)
 {
     $msg = array('type' => 'success', 'title' => zotop::t('success'), 'content' => '', 'detail' => '', 'url' => $url, 'life' => $life, 'action' => '');
     if (is_array($content)) {
         $msg = array_merge($msg, $content, array('type' => 'success'));
     } else {
         $msg['content'] = $content;
     }
     msg::show($msg);
 }
Example #22
0
 public function cache()
 {
     $data = array();
     $rows = $this->getAll();
     foreach ($rows as $row) {
         $data[$row['id']] = $row;
     }
     zotop::data('usergroup', $data);
     return $data;
 }
Example #23
0
 public function add($data = array())
 {
     $this->bind($data);
     if ((int) $this->id <= 0) {
         $this->error(zotop::t('编号不能为空'));
         return false;
     }
     $this->insert();
     return $this->error() ? false : true;
 }
Example #24
0
 public function actionDelete($id)
 {
     $category = zotop::model('blog.category');
     $category->id = $id;
     $category->delete();
     if (!$category->error()) {
         msg::success('删除成功', zotop::url('blog/category/index'));
     }
     msg::error($category->msg());
 }
Example #25
0
 public static function referer($url = '')
 {
     static $referer;
     if (empty($url)) {
         $url = zotop::post('_REFERER');
         return $url;
     }
     $referer = $url;
     return $referer;
 }
Example #26
0
 public function reload()
 {
     $data = $this->getAll(array('select' => '*', 'where' => array('status', '>', 0), 'orderby' => 'order desc,updatetime desc'));
     if (is_array($data)) {
         foreach ($data as $module) {
             $modules[$module['id']] = $module;
         }
         zotop::data('zotop.config.module', $modules);
     }
     return true;
 }
Example #27
0
 function site_keywords($attrs)
 {
     //$html[] = html::script('$common/js/zotop.keywords.js');
     $html[] = '<div class="field-wrapper clearfix">';
     $html[] = '	' . field::text($attrs);
     $html[] = '	<span class="field-handle">';
     $html[] = '		&nbsp;<a class="setkeywords" style="display:inline-block;" valueto="' . $attrs['name'] . '" title="' . zotop::t('常用关键词') . '"><span class="zotop-icon zotop-icon-keywords"></span></a>';
     $html[] = '	</span>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
Example #28
0
 public function onBing()
 {
     $header['title'] = 'Bing搜索';
     dialog::header($header);
     dialog::navbar($this->navbar(), 'bing');
     form::header(array('title' => '', 'description' => '<span class="zotop-tip">请先搜索图片,然后插入</span>'));
     dialog::add(html::iframe('images', 'about:blank', array('width' => '100%', 'style' => 'width:100%;height:200px;')));
     form::buttons(array('id' => 'UploadImages', 'type' => 'submit', 'value' => '插入图片'), array('type' => 'button', 'value' => zotop::t('取消'), 'class' => 'zotop-dialog-close'));
     form::footer();
     dialog::footer();
 }
Example #29
0
 public function onSend()
 {
     $header['title'] = '发送短消息';
     dialog::header($header);
     form::header(array('title' => '', 'description' => '请输入收信人的账户并输入短消息内容', 'class' => 'small'));
     form::field(array('type' => 'text', 'label' => zotop::t('收信人'), 'name' => 'sendto', 'value' => '', 'description' => '请输入收信人的账户名称,多个账户之间请用’逗号‘隔开'));
     form::field(array('type' => 'textarea', 'label' => zotop::t('内 容'), 'name' => 'content', 'value' => ''));
     form::buttons(array('type' => 'submit', 'value' => '发 送'), array('type' => 'button', 'name' => 'close', 'value' => '取消', 'class' => 'zotop-dialog-close'));
     form::footer();
     dialog::footer();
 }
Example #30
0
 public function read($value, $key = '')
 {
     if (empty($key)) {
         $key = $this->getPrimaryKey();
     }
     /**/
     $sql = array('select' => '*', 'from' => $this->getTableName(), 'where' => array($key, '=', $value), 'limit' => 1);
     //$sql = "SELECT * FROM {$this->getTableName()} WHERE {$key}= '{$value}'";
     $read = $this->db->getRow($sql);
     zotop::dump($this->db->lastSql());
     return $read;
 }