コード例 #1
0
ファイル: cached.php プロジェクト: a195474368/ejw
 public static function form($appid, $list)
 {
     global $_G;
     $sql = "SELECT * FROM `mod:form_form` WHERE appid='" . $appid . "' ";
     //读取表单信息
     $list && ($sql .= " and id in(" . $list . ")");
     //创建子文件夹
     $folder = create_dir(self::direct($appid));
     $result = System::$db->getAll($sql);
     foreach ($result as $form) {
         $file = $folder . "/form." . $form['id'] . ".php";
         $part = array('form' => array(), 'group' => array(), 'option' => array());
         //表单主体
         foreach ($form as $key => $val) {
             if ($key == 'config') {
                 $form[$key] = fix_json($val);
             }
         }
         $part['form'] = $form;
         ////////////////
         //选项组
         $sql = "SELECT * FROM `mod:form_group` WHERE fid=" . $form['id'] . " and `state`>0 order BY sort ASC,id ASC";
         $res = System::$db->getAll($sql, 'id');
         foreach ($res as $gid => $group) {
             foreach ($group as $key => $val) {
                 if ($key == 'config') {
                     $group[$key] = fix_json($val);
                 }
                 if ($key == 'selected') {
                     $group[$key] = explode(',', $val);
                 }
             }
             $part['group'][$gid] = $group;
         }
         ////////////////
         //子选项
         $sql = "SELECT * FROM `mod:form_option` WHERE fid=" . $form['id'] . " and `state`>0 order BY sort ASC,id ASC";
         $res = System::$db->getAll($sql, 'id');
         foreach ($res as $oid => $option) {
             foreach ($option as $key => $val) {
                 if ($key == 'config') {
                     $option[$key] = fix_json($val);
                 }
             }
             $part['option'][$option['gid']][$oid] = $option;
         }
         ////////////////
         //写入缓存
         create_file($file, '<?php /*' . date("Y-m-d H:i:s") . '*/ $_CACHE[\'' . $appid . '\'] = ' . var_export($part, true) . ';');
     }
 }
コード例 #2
0
ファイル: output.php プロジェクト: a195474368/ejw
 public static function convert($dataset, $datatype, $option)
 {
     global $_G;
     //解码
     $option['jsonde'] = $option['jsonde'] ? $option['jsonde'] : array();
     //使用逗号分隔
     $option['split'] = $option['split'] ? $option['split'] : array();
     //使用空隔分隔
     $option['space'] = $option['space'] ? $option['space'] : array();
     //反序列化
     $option['serialize'] = $option['serialize'] ? $option['serialize'] : array();
     //HTML实体
     $option['entity'] = $option['entity'] ? $option['entity'] : array();
     //移除数字零
     $option['zeroed'] = $option['zeroed'] ? $option['zeroed'] : array();
     //Unicode
     $option['unicode'] = $option['unicode'] ? $option['unicode'] : array();
     //修正地址
     $option['attach'] = $option['attach'] ? $option['attach'] : array();
     //修正地址
     $option['nl2br'] = $option['nl2br'] ? $option['nl2br'] : array();
     //修正地址
     $option['cdata'] = $option['cdata'] ? $option['cdata'] : array();
     //字段别名
     $option['alias'] = $option['alias'] ? $option['alias'] : array();
     ///////////////////////////////
     foreach ($dataset as &$row) {
         foreach ($row as $key => &$text) {
             //JSON解码
             if (in_array($key, $option['jsonde'])) {
                 $text = fix_json($text);
             }
             //替换换行
             if (in_array($key, $option['nl2br'])) {
                 $text = preg_replace("(\r\n|\r|\n)", '<br />', $text);
             }
             //处理图片
             if (in_array($key, $option['attach'])) {
                 $text = fix_attach($text);
             }
         }
     }
     unset($row, $text);
     //修正分页参数
     if ($option['pagination'] > $option['pagecount']) {
         $option['pagination'] = $option['pagecount'];
     } elseif (!$option['pagination'] || $option['pagination'] < -1) {
         $option['pagination'] = 1;
     }
     ///////////////////////////////
     switch ($datatype) {
         case "xml":
             $content .= '<?xml version="1.0" encoding="' . self::$charset . '"?>';
             $content .= '<data pagesize="' . $option['pagesize'] . '" rowscount="' . $option['rowscount'] . '" pagecount="' . $option['pagecount'] . '" pagination="' . $option['pagination'] . '" domain="' . self::$domain . '" charset="' . self::$charset . '">';
             //$content.='<option>'.fix_json($option).'</option>';
             foreach ($dataset as $row) {
                 $n = 1;
                 $content .= '<item ';
                 foreach ($row as $key => $text) {
                     if (!in_array($key, $option['cdata'])) {
                         //$text = dhtmlspecialchars(str_replace('$','\$',addslashes($text)));
                         $content .= '' . $key . '=' . '"' . $text . '" ';
                     }
                     $n++;
                 }
                 $content .= '>';
                 foreach ($row as $key => $text) {
                     if (in_array($key, $option['cdata'])) {
                         $content .= '<' . $key . '><![CDATA[' . $text . ']]></' . $key . '>';
                     }
                     $n++;
                 }
                 $content .= '</item>';
             }
             $content .= '</data>';
             break;
         case "json":
             $content = '{"pagesize":"' . $option['pagesize'] . '", "rowscount":"' . $option['rowscount'] . '", "pagecount":"' . $option['pagecount'] . '", "pagination":"' . $option['pagination'] . '", "domain":"' . self::$domain . '", "charset":"' . self::$charset . '", "data" : [';
             $numrows = count($dataset);
             $x = 1;
             foreach ($dataset as $row) {
                 $n = 1;
                 $content .= '{';
                 foreach ($row as $key => $text) {
                     $content .= '"' . $key . '" : ' . '"' . addslashes($text) . '"' . ($n != count($row) ? ',' : '');
                     $n++;
                 }
                 $content .= '}' . ($x != $numrows ? ',' : '');
                 $x++;
             }
             $content .= ']}';
             break;
         case 'csv':
             //取第一条数据
             $newest = array_shift($dataset);
             //获取所有字段名
             $fields = array_keys($newest);
             $content .= '';
             foreach ($fields as $key) {
                 $content .= ($option['alias'][$key] ? $option['alias'][$key] : $key) . '	';
             }
             $content .= chr(13);
             foreach ($dataset as $row) {
                 $content .= '';
                 foreach ($row as $key => $text) {
                     $content .= '="' . $text . '"	';
                 }
                 $content .= chr(13);
                 //$report.= $row['account'].'	="'.$row["qq"].'"	="'.$row["phone"].'"	'.$row["email"].'	'.$row["blog"].chr(13);
             }
             break;
     }
     return $content;
 }
コード例 #3
0
ファイル: group.edit.php プロジェクト: a195474368/ejw
        System::$db->execute($sql);
        //缓存系统用户组
        Cached::table('system', 'sys:group', array('jsonde' => array('config'), 'serialize' => array('module', 'widget')));
        //写入日志
        System::insert_event($func, time(), time(), "修改用户组:" . $name);
        //重载权限
        $_SESSION["GroupLife"] = 0;
        //$_G['project']['message']="<b>消息:</b> 成功修改用户!";
        System::redirect("group.list.php", "成功修改用户组!");
        break;
    case "edit":
        $sql = "SELECT * FROM `sys:group` WHERE id=" . $gid;
        $row = System::$db->getOne($sql);
        if ($row) {
            //权限配置
            $config = fix_json($row['config']);
            //快捷方式
            $module = unserialize($row['module']);
            //小工具
            $widget = unserialize($row['widget']);
        }
        //$CFG = $_CACHE['system']['group'][]
        //var_dump($config);
        break;
}
/////////////////////////
//关闭数据库
System::connect();
?>
    
    <script type="text/javascript">
コード例 #4
0
ファイル: admin.edit.php プロジェクト: a195474368/ejw
            $sql = "UPDATE `sys:admin` SET gid='" . $gid . "' WHERE id=" . $id;
            System::$db->execute($sql);
            //写入日志
            System::insert_event($func, time(), time(), "变更用户组:" . $_CACHE['system']['admin'][$id]["name"]);
        }
        $_G['manager']['id'] == $id && System::admin_update('avatar', $avatar);
        //写入日志
        System::insert_event($func, time(), time(), "修改用户资料:" . $_CACHE['system']['admin'][$id]["name"]);
        //缓存系统用户
        Cached::table('system', 'sys:admin', array('jsonde' => array('config', 'extra')));
        System::redirect($jump ? $jump : "?id=" . $id . "&action=edit", "成功修改用户信息!");
        break;
    case "edit":
        $sql = "SELECT * FROM `sys:admin` WHERE id=" . $id;
        $row = System::$db->getOne($sql);
        $extra = fix_json($row['extra']);
        break;
}
//关闭数据库
System::connect();
/*
安全问题
<select name="question" onchange="showcustomquest(this.value)" style="width:124px">
	<option value="0">无安全问题</option>
	<option value="1">我爸爸的出生地</option>
	<option value="2">我妈妈的出生地</option>
	<option value="3">我的小学校名</option>
	<option value="4">我的中学校名</option>
	<option value="5">我最喜欢的运动</option>
	<option value="6">我最喜欢的歌曲</option>
	<option value="7">我最喜欢的电影</option>
コード例 #5
0
ファイル: system.php プロジェクト: a195474368/ejw
 public static function examine_update($id, $state, $remark = '')
 {
     global $_G;
     global $_CACHE;
     //查询记录
     $sql = "SELECT * FROM `sys:examine` WHERE state = -1 and id=" . $id;
     $row = self::$db->getOne($sql);
     if ($row) {
         $row['summary'] = fix_json($row['summary']);
         $row['original'] = fix_json($row['original']);
         /*
         	
         			//执行查询
         			self :: $db -> execute( $row['execute'] );
         //如果是新插入数据
         			if( preg_match("/INSERT INTO/i", $row['execute'] ) ){
         	//读取插入ID
         				$newid = self :: $db -> getInsertId();
         				
         				//记录新ID
         				$row['summary']['id'] = $newid;
         			}
         */
         //更新数据
         $sql = "UPDATE `sys:examine` SET remark='" . $remark . "',state='" . $state . "',auditor='" . $_SESSION['manager']['account'] . "' WHERE id = " . $id;
         self::$db->execute($sql);
         self::examine_execute($row['appid'], $row['execute'], $row['summary'], $row['original']);
         /*
         						
         			//加载模块
         			Module :: loader( $row['appid'] );
         //调用模块接口
         			call_user_func_array( array( $row['appid'], 'examine'), array( $row['summary'], $row['original'] ) );
         */
         //审核处理完邮件提醒
         $email = $_CACHE['system']['admin'][$row['aid']]['email'];
         if ($email) {
             self::sendmail('审核处理完毕……', $email, '', '$content');
         }
     }
 }