function actionModify()
 {
     $id = (int) $this->_context->get('id');
     $rs = Account::find('user_id = ?', $id)->getOne();
     if (!$rs->id()) {
         return $this->msg($tip = '参数错误', url('manage::account'));
     }
     $form = Form_Common::createForm('', 'manage/profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $is_locked = $post['is_locked'] ? '1' : '0';
         #dump($post);
         if ($user_pass) {
             $user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
             $rs->user_pass;
         }
         $rs->user_mail = $user_mail;
         $rs->is_locked = $is_locked;
         $rs->save();
         return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
     }
     $form->import($rs->toArray());
     $form->element('user_pass')->value = '';
     $form->element('is_locked')->checked = $rs->is_locked;
     #dump($form->element('is_locked'));
     $this->_view['form'] = $form;
     $this->_view['rs'] = $rs;
     $order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
     $this->_view['order'] = $order;
     $this->_view['_UDI'] = 'manage::account/index';
 }
 protected function _after_destroy()
 {
     $dir = rtrim(Q::ini('appini/teapics/upload_dir'), '/\\') . DS;
     if ($this->ico->value != null) {
         @unlink($dir . $this->ico);
     }
 }
 /**
  * 实现接口
  *
  */
 function render()
 {
     //得到子菜单的标题
     $menu_title = $this->_extract('menu');
     //的到子菜单的属性
     $sub_menu = Q::ini('appini/admin_sub_menus/' . $menu_title);
     //是否存在
     if (!is_array($sub_menu)) {
         $sub_menu = array();
     }
     //得到当前的属性
     $currentmenu = $this->_extract('current');
     //输出子菜单 如果是当前的加上css
     $out = "<ul>\n";
     foreach ($sub_menu as $menu) {
         //是否是当前菜单
         if ($menu['title'] == $currentmenu) {
             $out .= "<li class=\"current\">";
         } else {
             $out .= "<li>";
         }
         $out .= '<a href="' . url($menu['udi']) . '"> <span>';
         $out .= h($menu['title']) . '</span>';
         $out .= "</a></li>\n";
     }
     $out .= "</ul>\n";
     return $out;
 }
Exemple #4
0
 /**
  * 载入缓存的 YAML 解析结果,如果缓存失效,则重新解析并生成缓存
  *
  * 用法:
  * @code php
  * $arr = Helper_YAML::loadCached($filename);
  * @endcode
  *
  * $replace 参数的用法参考 load() 方法。
  *
  * @param string $filename 要解析的 yaml 文件名
  * @param array $replace 对于 YAML 内容要进行自动替换的字符串对
  * @param string $cache_backend 要使用的缓存后端
  *
  * @return array 解析结果
  * @throw Q_FileNotFoundException
  */
 static function loadCached($filename, array $replace = null, $cache_backend = null)
 {
     static $cache_obj = null;
     if (!is_file($filename)) {
         throw new Q_FileNotFoundException($filename);
     }
     $policy = array('lifetime' => 86400, 'serialize' => true);
     $mtime = filemtime($filename);
     $id = 'yaml_cache_' . md5($filename);
     if (is_null($cache_backend)) {
         if (is_null($cache_obj)) {
             $cache_obj = Q::singleton(Q::ini('runtime_cache_backend'));
         }
         $cache = $cache_obj;
     } else {
         $cache = Q::singleton($cache_backend);
     }
     /* @var $cache QCache_File */
     $data = $cache->get($id, $policy);
     if (!isset($data['yaml']) || empty($data['mtime']) || $data['mtime'] < $mtime) {
         // 缓存失效
         $data = array('mtime' => $mtime, 'yaml' => self::load($filename, $replace));
         $cache->set($id, $data, $policy);
     }
     return $data['yaml'];
 }
Exemple #5
0
 function UserAclRoles($user_id = '')
 {
     $show_box['title'] = '获取用户全部角色';
     $return_value = '';
     $roles_idname = array();
     $roles_id = array();
     $sp_roles = Q::ini('appini/sp_role');
     // 第一步:直接从中间表获得用户的全部角色ID
     $user_roles = UsersHaveRoles::find('user_id = ?', intval($user_id))->asArray()->getAll();
     //dump($user_roles);
     // 取出有用的ID,去除deny的ID
     foreach ($user_roles as $value) {
         if ($value['is_include']) {
             $roles_id[] = $value['role_id'];
         }
     }
     //dump ( $roles_id);
     $roles_arr = Roles::find('role_id in (?)', Q::normalize($roles_id, ","))->asArray()->getAll();
     foreach ($roles_arr as $value) {
         $roles_idname[$value['role_id']] = $value['rolename'];
     }
     //dump($roles_idname);
     if (in_array($sp_roles['REPEAL'], $roles_idname)) {
         $return_value = array($value['role_id'] => $sp_roles['REPEAL']);
         return $return_value;
     } elseif (in_array($sp_roles['FREEZE'], $roles_idname)) {
         $return_value = array($value['role_id'] => $sp_roles['FREEZE']);
         return $return_value;
     } elseif (in_array($sp_roles['UNCHECKED'], $roles_idname)) {
         $return_value = array($value['role_id'] => $sp_roles['UNCHECKED']);
         return $return_value;
     } else {
         return $roles_idname;
     }
 }
 function __construct()
 {
     $dsn = Q::ini('db_dsn_pool/default');
     if (empty($dsn)) {
         Q::changeIni('db_dsn_pool/default', Q::ini('db_dsn_mysql'));
     }
     parent::__construct();
 }
Exemple #7
0
 protected function _before_execute()
 {
     parent::_before_execute();
     $this->_user = Account::find('user_id = ?', $this->_user_id)->getOne();
     if (!in_array($this->_user->user_mail, Q::ini('appini/managers'))) {
         return $this->msg('请先登陆', url('default::default/signin'));
     }
 }
Exemple #8
0
 /**
  * 构造函数
  *
  * @param 默认的缓存策略 $default_policy
  */
 function __construct(array $default_policy = null)
 {
     if (!is_null($default_policy)) {
         $this->_default_policy = array_merge($this->_default_policy, $default_policy);
     }
     if (empty($this->_default_policy['cache_dir'])) {
         $this->_default_policy['cache_dir'] = Q::ini('runtime_cache_dir');
     }
 }
Exemple #9
0
 protected function setUp()
 {
     $dsn = Q::ini('db_dsn_pool/default');
     if (empty($dsn)) {
         Q::changeIni('db_dsn_pool/default', Q::ini('db_dsn_mysql'));
     }
     $conn = QDB::getConn();
     $params = array('name' => 'posts', 'pk' => 'post_id', 'conn' => $conn);
     $this->table = new QDB_Table($params);
 }
Exemple #10
0
 /**
  * 测试清除设置
  */
 function testCleanIni()
 {
     $path = 'node/single-value';
     Q::cleanIni($path);
     $test = Q::ini($path);
     $this->assertTrue(empty($test), "Q::ini('{$path}') == empty");
     $path = 'node';
     Q::cleanIni($path);
     $test = Q::ini($path);
     $this->assertTrue(empty($test), "Q::ini('{$path}') == empty");
 }
 static function createForm($id, $action)
 {
     $form = new Form_Admin_Links($id, $action);
     $form->add(QForm::ELEMENT, 'name', array('_ui' => 'textbox', '_label' => '友情链接名称', '_req' => true, '_tips' => '友情链接的网站名'))->add(QForm::ELEMENT, 'url', array('_ui' => 'textbox', '_label' => '网站地址', '_req' => true, '_tips' => '友情链接网站的网址'))->add(QForm::ELEMENT, 'link_id', array('_ui' => 'hidden'))->add(QForm::ELEMENT, 'img', array('_ui' => 'admin_picpreview', '_label' => '已上传图片', 'attr' => array('dir' => 'links')))->add(QForm::ELEMENT, 'ico', array('_ui' => 'upload', '_label' => '上传图标', '_tips' => ''))->add(QForm::ELEMENT, 'order_num', array('_ui' => 'textbox', '_label' => '排序', 'value' => 0));
     $form->addValidations(Links::meta());
     //上传图片的限制
     $types = Q::normalize(Q::ini('appini/teapics/upload_allowed_types'));
     $size = intval(Q::ini('appini/teapics/upload_allowed_size') * 1024);
     $dim = Q::ini('appini/teapics/img_pic_width') . 'x' . Q::ini('appini/teapics/img_pic_height');
     $form['ico']->_tips = sprintf($form['ico']->_tips, implode('/', $types), $size / 1024, $dim);
     $form->selectUploadElement('ico')->uploadAllowedSize($size)->uploadAllowedTypes($types)->enableSkipUpload();
     //表单验证规则
     return $form;
 }
Exemple #12
0
 /**
  * 生成指定名称的模型
  *
  * @param string $model_name
  * @param string $table_name
  * @param QDB_Adapter_Abstract $dbo
  *
  * @return QGenerator_Model
  */
 function generate($model_name, $table_name, $dbo)
 {
     $class_name = $this->_normalizeClassName($model_name);
     $dir = rtrim($this->_module->moduleDir(), '/\\') . '/model';
     $path = $this->_classFilePath($dir, $class_name);
     $this->_logClean();
     if (file_exists($path)) {
         throw new Q_ClassFileExistsException($class_name, $path);
     }
     // 确定数据表名称
     $arr = explode('.', $table_name);
     if (isset($arr[1])) {
         $table_name = $arr[1];
         $schema = $arr[0] . '.';
     } else {
         $table_name = $arr[0];
         $schema = '';
     }
     if (is_null($dbo)) {
         $dsn = Q::ini('db_dsn_pool/default');
         $dbtype = $dsn['driver'];
         $objid = "dbo_{$dbtype}_" . md5(serialize($dsn));
         $dbo_class_name = 'QDB_Adapter_' . ucfirst($dbtype);
         $dbo = new $dbo_class_name($dsn, $objid);
     }
     $prefix = $dbo->getTablePrefix();
     if ($prefix && substr($table_name, 0, strlen($prefix)) == $prefix) {
         $table_name = substr($table_name, strlen($prefix));
     }
     $table_name = "{$schema}{$table_name}";
     $config = array('name' => $table_name, 'conn' => $dbo);
     $table = new QDB_Table($config);
     $meta = $table->columns();
     $pk = array();
     foreach ($meta as $field) {
         if ($field['pk']) {
             $pk[] = $field['name'];
         }
     }
     $data = array('class_name' => $class_name, 'table_name' => $table_name, 'meta' => $meta, 'pk' => $pk);
     $content = $this->_parseTemplate('model', $data);
     $this->_createFile($path, $content);
     return $this;
 }
Exemple #13
0
 /**
  * 从配置文件中创建表单
  * @param string $action     表单的url	
  * @param string $configName  配置文件的名字
  * @return Form_Tea $form
  */
 protected static function _createFormConfig($action, $configName)
 {
     $form = new Form_Admin_Tea('tea_form', $action);
     $filename = rtrim(dirname(__FILE__), '/\\') . DS . $configName;
     $form->loadFromConfig(Helper_YAML::load($filename));
     $form->addValidations(Tea::meta());
     //图片的路径
     $form['thumb_filename']->dir = Q::ini('appini/teapics/img_dir');
     //上传图片的限制
     $types = Q::normalize(Q::ini('appini/teapics/upload_allowed_types'));
     $size = intval(Q::ini('appini/teapics/upload_allowed_size') * 1024);
     $dim = Q::ini('appini/teapics/img_pic_width') . 'x' . Q::ini('appini/teapics/img_pic_height');
     $form['postfile']->_tips = sprintf($form['postfile']->_tips, implode('/', $types), $size / 1024, $dim);
     //        茶叶类别
     //       $teatype = new TeaType();
     //       $form['type_id']->items=$teatype->list;
     $form->selectUploadElement('postfile')->uploadAllowedSize($size)->uploadAllowedTypes($types)->enableSkipUpload();
     return $form;
 }
Exemple #14
0
 static function send($subject, $body, $user_mail, $user_nick = '客户')
 {
     $cfg = Q::ini('appini/email_config');
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->SMTPDebug = false;
     $mail->SMTPAuth = $cfg['smtpauth'];
     $mail->SMTPSecure = $cfg['smtpsecure'];
     $mail->Host = $cfg['host'];
     $mail->Port = $cfg['port'];
     $mail->Username = $cfg['username'];
     $mail->Password = $cfg['password'];
     $mail->SetFrom($cfg['from_email'], $cfg['from_nick']);
     $mail->Subject = $subject;
     $mail->MsgHTML($body);
     $mail->AddAddress($user_mail, $user_nick);
     if (!$mail->Send()) {
         return $mail->ErrorInfo;
     } else {
         return true;
     }
 }
 function actionIndex()
 {
     $account = QDB::getConn()->getOne($sql = "SELECT count(`groupname`) as total FROM radusergroup WHERE groupname =  'NOR'");
     $this->_view['account'] = $account;
     if (15 - $account < 1) {
         $this->_view['_MSG'] = '目前产品已经卖光了,请填写您有效的邮箱,以便接收到货通知。';
     }
     $rs = $this->_user;
     $form = Form_Common::createForm('', 'profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $msg = null;
         if ($user_pass) {
             if ($user_pass != $post['user_pass_checked']) {
                 $msg = '两次密码输入不一致;';
             }
         }
         if ($msg === null) {
             if (!Q::ini('isDemo')) {
                 $rs->user_pass = sha1(md5('sike' . $user_pass . Q::ini('appini/secret_key')));
                 $rs->save();
                 return $this->msg('修改成功。', url('default::account/index'));
             }
             $msg = '演示用户禁止修改密码';
         }
         $this->_view['_MSG'] = $msg;
     }
     #$form->add(QForm::ELEMENT, $prop, array('_ui' => 'dropdownlist','_label'=>$label_text . ':', 'class' => 'slt toggle_input'));
     #$elem = $form->element($prop);
     $this->_view['_META_TITLE'] = '我的账户';
     $form->element('user_mail')->value = $rs->user_mail;
     $form->element('user_mail')->disabled = 'disabled';
     $this->_view['form'] = $form;
 }
Exemple #16
0
<?php 
$this->_endblock();
?>

<?php 
$this->_block('contents');
?>

    <div class="search">
        
        <form id="search_form" action="<?php 
echo url("{$_ctx->namespace}::{$_ctx->controller_name}/{$_ctx->action_name}");
?>
">
        <p><?php 
foreach (Q::ini('appini/nav/left/fileSearch') as $key => $nav) {
    if ($_app->authorizedUDI($currentUser['roles'], $nav['udi'])) {
        ?>
            &nbsp;&nbsp;
            <?php 
        if ("type/{$type}" == (isset($nav['args']) ? $nav['args'] : '')) {
            ?>
                <b><?php 
            echo $nav['title'];
            ?>
</b>
            <?php 
        } else {
            ?>
                <a href="<?php 
            echo url($nav['udi'], (isset($nav['args']) ? $nav['args'] : '') . '/query/' . $query);
Exemple #17
0
?>

        <div class="w200 left">
            <div class="box">
                <div class="p10">
                    <h2 class="t3"><?php 
echo $pathway->getTitle();
?>
</h2>
                </div>
            </div>
            <div class="box mt10">
                <div class="p10">
                    <ul class="ul">
                        <?php 
foreach (Q::ini('appini/nav/top') as $nav) {
    if ($_app->authorizedUDI($currentUser['roles'], $nav['udi'])) {
        ?>
                            <li><a href="<?php 
        echo url($nav['udi']);
        ?>
"><?php 
        echo $nav['title'];
        ?>
</a></li>
                        <?php 
    }
}
?>
                    </ul>
                </div>
Exemple #18
0
 /**
  * 将缓存的日志信息写入实际存储,并清空缓存
  */
 function flush()
 {
     if (empty($this->_log)) {
         return;
     }
     // 更新日志记录优先级
     $keys = Q::normalize(Q::ini('log_priorities'));
     $arr = array();
     foreach ($keys as $key) {
         if (!isset($this->_priorities[$key])) {
             continue;
         }
         $arr[$key] = true;
     }
     $this->_priorities = $arr;
     // 确定日志写入目录
     $dir = realpath(Q::ini('log_writer_dir'));
     if ($dir === false || empty($dir)) {
         $dir = realpath(Q::ini('runtime_cache_dir'));
         if ($dir === false || empty($dir)) {
             // LC_MSG: 指定的日志文件保存目录不存在 "%s".
             if ($this->_destruct) {
                 return;
             } else {
                 throw new QLog_Exception(__('指定的日志文件保存目录不存在 "%s".', Q::ini('log_writer_dir')));
             }
         }
     }
     $filename = Q::ini('log_writer_filename');
     $this->_filename = rtrim($dir, '/\\') . DS . $filename;
     //if(is_file($this->_filename))
     //unlink($this->_filename);
     $chunk_size = intval(Q::ini('log_cache_chunk_size'));
     if ($chunk_size < 1) {
         $chunk_size = 64;
     }
     $this->_cache_chunk_size = $chunk_size * 1024;
     $this->_writeable = true;
     // 写入日志
     $string = '';
     foreach ($this->_log as $offset => $item) {
         list($time, $msg, $type) = $item;
         unset($this->_log[$offset]);
         // 过滤掉不需要的日志条目
         if (!isset($this->_priorities[$type])) {
             continue;
         }
         $string .= date('c', $time) . " {$type}: {$msg}\n";
     }
     if ($string) {
         $fp = fopen($this->_filename, 'a');
         if ($fp && flock($fp, LOCK_EX)) {
             fwrite($fp, $string);
             flock($fp, LOCK_UN);
             fclose($fp);
         }
     }
     //unset($this->_log);
     $this->_log = array();
     $this->_cached_size = 0;
 }
Exemple #19
0
 /**
  * 导入路由规则
  *
  * 如果指定了 $cache_id 参数,则首先尝试从缓存载入解析好的路由规则。
  *
  * @param array $rules
  * @param string $cache_id
  *
  * @return QRouter
  */
 function import(array $rules, $cache_id = null)
 {
     if ($cache_id) {
         $backend = Q::ini('runtime_cache_backend');
         $routes = Q::cache($cache_id, null, $backend);
     }
     if (!$cache_id || !$routes) {
         $routes = array();
         foreach ($rules as $route_name => $rule) {
             $routes[$route_name] = $this->prepareRoute($route_name, $rule);
         }
         if ($cache_id) {
             Q::writeCache($cache_id, $routes, array('life_time' => Q::ini('routes_cache_lifetime')), $backend);
         }
     }
     $this->_routes = array_merge($this->_routes, $routes);
     return $this;
 }
Exemple #20
0
 static function formattingByTexy($source)
 {
     static $texy;
     if (is_null($texy)) {
         if (!class_exists('Texy', false)) {
             $dir = Q::ini('vendor_dir');
             require_once "{$dir}/geshi/geshi.php";
             require_once "{$dir}/texy/texy.php";
         }
         Texy::$advertisingNotice = false;
         $texy = new Texy();
         $options = self::$_texy_options;
         foreach ($options as $module => $config) {
             foreach ($config as $key => $value) {
                 $m = $module . 'Module';
                 $texy->{$m}->{$key} = $value;
             }
         }
         $texy->addHandler('block', array(__CLASS__, 'texyBlockHandler'));
     }
     return $texy->process($source);
 }
      <td><?php 
    echo h($link->name);
    ?>
</td>
      <td><?php 
    echo $link->url;
    ?>
</td>
	  <td><?php 
    if (is_null($link->ico)) {
        ?>
NULL<?php 
    } else {
        ?>
<img border="0" src="<?php 
        echo $_BASE_DIR . Q::ini('appini/teapics/img_dir') . DS . $link->ico;
        ?>
" height="30"> <?php 
    }
    ?>
</td>
	  <td><input name="order_num[<?php 
    echo $link->link_id;
    ?>
]"  class="txt" type="text" size="6" maxlength="6" value="<?php 
    echo $link->order_num;
    ?>
"/></td>
	
      <td><a href="<?php 
    echo url('links/edit', array('link_id' => $link->link_id));
Exemple #22
0
 /**
  * 测试反向解析
  */
 function testReverseParse()
 {
     $context = QContext::instance();
     $router = new QRouter();
     $router->import(Q::ini('routes'));
     foreach ($this->_tests_args as $offset => $test) {
         $copy = $test;
         $path = $test['_path'];
         unset($test['_path']);
         $result = $router->url($test);
         list($route_name) = explode(':', $offset);
         if ($route_name != $router->lastReverseMatchedRouteName()) {
             dump('-----------------------------------');
             dump($path, 'test path');
             dump($test, $result);
             dump($router->lastReverseMatchedRouteName(), 'used route');
             dump($route_name, 'expected route');
             dump($router->get($route_name));
         }
         $this->assertEquals($route_name, $router->lastReverseMatchedRouteName(), "Expected route name is [{$route_name}].");
         $this->assertEquals($path, $result, "{$path} == {$result}\n" . print_r($copy, true) . "\n" . print_r($test, true));
     }
 }
Exemple #23
0
 static function getPreviewFileStream($id)
 {
     $file = Files::find()->getById($id);
     if ($file->isNewRecord()) {
         return;
     }
     $fileName = rtrim($file->path, '/\\') . DS . $file->name . '.' . $file->ext;
     if ($file->type == 1 || $file->type == 2) {
         $fileNamePreview = rtrim($file->path, '/\\') . DS . $file->name . '-preview.flv';
         $lock = $fileNamePreview . '.lock';
         while (true) {
             if (!file_exists($lock)) {
                 break;
             }
         }
         if (!file_exists($fileNamePreview) || !@filesize($fileNamePreview)) {
             $lock = $fileNamePreview . '.lock';
             if (!file_exists($lock)) {
                 @ignore_user_abort(1);
                 @set_time_limit(0);
                 @touch($lock);
                 $ffmpegPath = Q::ini('appini/catalog/ffmpegPath');
                 $ffmpegParameter = Q::ini('appini/catalog/ffmpegParameter');
                 //$command = "$ffmpegPath -i \"$fileName\" -y -ab 56 -ar 22050 -r 15 -b 500 -s 320x240 \"$fileNamePreview\"";
                 //$command = "$ffmpegPath -i \"$fileName\" -y -ab 56 -ar 22050 -r 15 -s 320x240 \"$fileNamePreview\"";
                 $command = "{$ffmpegPath} -i \"{$fileName}\" {$ffmpegParameter} \"{$fileNamePreview}\"";
                 //$command .= "&& $ffmpegPath -i \"$fileName\" -y -f image2 -ss 8 -t 0.011 -s 320x240 \"$fileNamePreview.jpg\"";
                 @exec($command);
                 @unlink($lock);
             }
         }
         $output = new QView_Output($file->title . '.' . $file->ext, 'video/x-flv');
         $output->addFile($fileNamePreview);
         return $output;
     } else {
         if ($file->type == 4) {
             if ($file->ext == 'txt') {
                 $handle = @fopen($fileName, 'r');
                 $data = @fread($handle, @filesize($fileName));
                 @fclose($handle);
                 return Helper_Util::encoding($data, 'utf-8');
             } else {
                 return '无法预览非文本文件(*.txt)格式';
             }
         } else {
             $output = new QView_Output($file->title);
             $output->addFile($fileName);
             if ($file->ext == 'jpg' || $file->ext == 'jpeg') {
                 $output->setMimeType('image/jpeg');
             }
             return $output;
         }
     }
 }
Exemple #24
0
 function testGetTablePrefix()
 {
     $prefix = $this->dbo->getTablePrefix();
     $this->assertEquals(Q::ini('db_dsn_pool/default/prefix'), $prefix);
 }
Exemple #25
0
            <?php 
} else {
    ?>
            <?php 
}
?>
            <div style="clear:both;"></div>

        </ul>
        <div style="clear:both;"></div>
    </div>
    <div class="main">
        <?php 
echo $_MSG ? '<div class="global_msg">' . $_MSG . '</div>' : '';
?>
        <?php 
$this->_block('contents');
$this->_endblock();
?>
    </div>
    <div class="copyright">&copy; 2012 <?php 
echo Q::ini('appini/meta/title');
?>
</div>
    <?php 
echo $_USER_ID == 1 ? '' : Q::ini('appini/analytics');
?>
</div>
</body>
</html>
 /**
  * 渲染指定的视图文件
  *
  * 渲染时,视图要使用的数据保存在控件的 $_view 属性中。
  *
  * @param string $filename
  * @param array $more_vars
  *
  * @return string
  */
 protected function _fetchView($filename, array $more_vars = null)
 {
     $vars = $this->_view;
     /**
      * TODO! 全局变量应该放到 控件抽象类 _before_render() 中
      */
     $vars['_ctx'] = $this->_context;
     $vars['_CTL_ID'] = $this->id();
     $vars['_BASE_DIR'] = $this->_context->baseDir();
     $vars['_BASE_URI'] = $this->_context->baseUri();
     $vars['_REQUEST_URI'] = $this->_context->requestUri();
     //
     if (is_array($more_vars)) {
         $vars = array_merge($vars, $more_vars);
     }
     if (strpos($filename, 'view:') === 0) {
         $filename = Q::ini('app_config/APP_DIR') . DS . 'view' . DS . ltrim(substr($filename, 5), '/\\');
     } elseif ($filename[0] != DS && strpos($filename, ':') === false) {
         $_class_name = strtolower(get_class($this));
         $_sep = explode('_', $_class_name);
         array_pop($_sep);
         $filename = Q::ini('app_config/APP_DIR') . DS . implode($_sep, DS) . DS . ltrim($filename, '/\\');
     }
     if (is_null($this->_render)) {
         $this->_render = new $this->_render_class(dirname($filename));
     } else {
         // TODO! 假如共享视图解析器实例,需在此做必要处理
     }
     $this->_render->assign($vars);
     $extname = pathinfo($filename, PATHINFO_EXTENSION);
     $pextname = $this->_render->extname();
     if (empty($extname) || $extname != $pextname && !empty($pextname)) {
         $filename .= '.' . ($pextname ? $pextname : 'php');
     }
     return $this->_render->parse($filename);
 }
Exemple #27
0
 /**
  * 获得指定控制器的 ACL
  *
  * @param string|array $udi
  *
  * @return array
  */
 function controllerACL($udi)
 {
     if (!is_array($udi)) {
         $udi = QContext::instance()->normalizeUDI($udi);
     }
     $path = 'acl_global';
     if ($udi[QContext::UDI_MODULE] && $udi[QContext::UDI_MODULE] != QContext::UDI_DEFAULT_MODULE) {
         $path .= '/' . $udi[QContext::UDI_MODULE];
     }
     if ($udi[QContext::UDI_NAMESPACE] && $udi[QContext::UDI_NAMESPACE] != QContext::UDI_DEFAULT_NAMESPACE) {
         $path .= '/' . $udi[QContext::UDI_NAMESPACE];
     }
     $acl = Q::ini($path);
     if (!is_array($acl)) {
         return Q::ini('acl_default');
     }
     $acl = array_change_key_case($acl, CASE_LOWER);
     if (isset($acl[$udi[QContext::UDI_CONTROLLER]])) {
         return (array) $acl[$udi[QContext::UDI_CONTROLLER]];
     }
     return isset($acl[QACL::ALL_CONTROLLERS]) ? (array) $acl[QACL::ALL_CONTROLLERS] : Q::ini('acl_default');
 }
Exemple #28
0
 /**
  * 构造函数
  */
 function __construct($app)
 {
     parent::__construct();
     $this->_app = $app;
     $this->_managed_app = new QReflection_Application(Q::ini('managed_app_config'));
 }
Exemple #29
0
 protected function _after_destroy()
 {
     $dir = rtrim(Q::ini('appini/teapics/upload_dir'), '/\\') . DS;
     @unlink($dir . $this->thumb_filename);
     @unlink($dir . $this->img_url);
 }
Exemple #30
0
<?php

$this->_extends('_layouts/default_layout');
?>

<?php 
$this->_block('contents');
?>
<div class="contents">
<h2>概述</h2>
<p>一、为可持续地向客户提供更优质、稳定的服务,同时为争议的解决提供依据,制定本“服务条款”<br />
二、购买<?php 
echo Q::ini('appini/meta/title');
?>
(以下为“本站”)服务或产品时(以下为“本产品”),必须同意本“服务条款”。已经购买本站服务或产品并完成支付的,视为同意本“服务条款”<br />
三、用户享有本“服务条款”所规定的相关权利,同时必须履行本“服务条款”所规定的相关义务。用户在本产品的过程中,与本产品发生的争议,依本“服务条款”解决</p>
<h2>用户权利</h2>
<p>四、用户在完成支付后,享有正常、持续以及稳定使用相关产品的权利<br />
五、用户在完成支付后,享自由支配相关产品的权利<br />

六、用户在完成支付后,本产品保证其所购买的服务或产品,在特性和相关技术参数上,与该服务或产品的说明页面一致</p>
<h2>用户义务</h2>
<p>七、用户在使用本产品的过程中,不得实施违反美国法律的行为或发布违反美国法律的内容<br />
八、用户在使用本产品的过程中,不得实施违反中国法律的行为或发布违反中国法律的内容</p>
<h2>禁止用途</h2>
<p>九、用户在使用本产品过程中:<br />
不得发布、传播淫秽色情等相关内容。<br />
不得放置任何形式的带有欺诈,欺骗性质的网站,包含但不仅限于仿牌、钓鱼等性质的网站。<br />
不得发布反动、与事实不符的政论等相关内容。<br />
不得发布违反中华人民共和国社会主义道德的相关内容。<br />
不得发布危害中华人民共和国国家安全与政治稳定的相关内容。<br />