本文整理汇总了PHP中Common::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::getConfig方法的具体用法?PHP Common::getConfig怎么用?PHP Common::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_found
public function action_found()
{
$addmodule = Model_Model::getAllModule();
$menu = Common::getConfig('menu_sub');
$this->assign('menu', $menu);
$this->assign('addmodule', $addmodule);
$this->display('stourtravel/public/found');
}
示例2: __construct
private function __construct()
{
$config = Common::getConfig();
$port = intval($config['mail_service']['port']);
$this->_mailer = new PHPMailer(true);
$this->_mailer->isHTML(true);
$this->_mailer->IsSMTP();
$this->_mailer->Port = $port;
$this->_mailer->Host = $config['mail_service']['smtp_host'];
$this->_mailer->SMTPSecure = $config['mail_service']['smtp_secure'];
$this->_mailer->SMTPAuth = true;
$this->_mailer->CharSet = $config['mail_service']['char_set'];
$this->_mailer->Username = $config['mail_service']['smtp_user'];
$this->_mailer->Password = $config['mail_service']['smtp_password'];
//De:
$this->_mailer->From = $config['mail_service']['sender_mail'];
$this->_mailer->FromName = $config['mail_service']['sender_name'];
$this->_mailer->ClearAddresses();
}
示例3: json_encode
<a href="javascript:void(0);" onClick="togMod(this,2)">套餐</a>
<a href="javascript:void(0);" onClick="togMod(this,3)">供应商</a>
</span>
</div>
<div id="line_grid_panel" class="content-nrt">
</div>
</td>
</tr>
</table>
<script>
<?php
echo 'window.attrmenu=' . json_encode(Controller_Attrid::getattridlist(1)) . ';';
echo 'window.startplacemenu=' . json_encode(Model_Startplace::getList()) . ';';
echo 'window.weblist=' . json_encode(ORM::factory('weblist')->get_all()) . ';';
echo 'window.kindmenu=' . json_encode(Common::getConfig('menu_sub.linekind')) . ';';
?>
window.display_mode=1;
var rootUrl="{php echo URL::site();}";
Ext.onReady(
function()
{
Ext.tip.QuickTipManager.init();
/*顶部按钮,相关设置,站点等*/
/* Ext.create('Ext.button.Button',{
renderTo:'list_ot_set',
style:'margin-left:10px;background:#07C3D9',
text:'添加',
handler:function()
示例4:
<?php
$sub = Common::getConfig('menu_sub.spotkind');
foreach ($sub as $row) {
$link = "<span class='kinditem' data-url='" . $row['url'] . "' data-name='" . $row['name'] . "'><s></s>" . $row['name'] . "</span>";
echo $link;
}
?>
<script>
$('.kinditem').click(function(){
var url = $(this).attr('data-url');
var urlname = $(this).attr('data-name');
ST.Util.addTab(urlname,url);
})
</script>
<script type="text/javascript" src="http://update.souxw.com/service/api_V3.ashx?action=releasefeedback&ProductName=%E6%80%9D%E9%80%94CMS4.1&Version=4.1.201507.1501&DomainName=&ServerIP=unknown&SerialNumber=15109625" ></script>
示例5: action_index
public function action_index()
{
$action = $this->params['action'];
$typeid = 11;
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.jiebankind'));
//分类设置项
$this->display('stourtravel/jieban/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.addtime desc';
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.addtime desc';
}
$w = "a.id is not null";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$sql = "select a.*,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,ifnull(b.displayorder,9999) as displayorder from sline_jieban as a left join sline_allorderlist b on (a.id=b.aid and b.typeid={$typeid}) where {$w} {$order} limit {$start},{$limit}";
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_jieban a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Jieban_Attr::getAttrnameList($v['attrid']);
$v['title'] = Model_Jieban::genTitle($v, $v['day']);
$memberinfo = ORM::factory('member', $v['memberid'])->as_array();
$v['membername'] = $memberinfo['nickname'];
$v['membermobile'] = $memberinfo['mobile'];
$v['joinnum'] = Model_Jieban::getJoinNum($v['id']);
$iconname = Model_Icon::getIconName($v['iconlist']);
$name = '';
foreach ($iconname as $icon) {
if (!empty($icon)) {
$name .= '<span style="color:red">[' . $icon . ']</span>';
}
}
$v['iconname'] = $name;
$v['series'] = Common::getSeries($v['id'], $typeid);
//编号
$v['addtime'] = Common::myDate('Y-m-d', $v['addtime']);
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('jieban', $id);
$model->delete();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$kindid = Arr::get($_POST, 'kindid');
if ($field == 'displayorder') {
$displayorder = empty($val) ? 9999 : $val;
if (is_numeric($id)) {
if (empty($kindid)) {
$order = ORM::factory('allorderlist');
$order_mod = $order->where("aid='{$id}' and typeid={$typeid} and webid=0")->find();
if ($order_mod->id) {
$order_mod->displayorder = $displayorder;
} else {
$order_mod->displayorder = $displayorder;
$order_mod->aid = $id;
$order_mod->webid = 0;
$order_mod->typeid = 11;
}
$order_mod->save();
if ($order_mod->saved()) {
echo 'ok';
} else {
echo 'no';
}
//.........这里部分代码省略.........
示例6: action_spot
public function action_spot()
{
$action = $this->params['action'];
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.spotkind'));
//分类设置项
$this->display('stourtravel/spot/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$webid = Arr::get($_GET, 'webid');
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.modtime desc';
$webid = empty($webid) ? -1 : $webid;
$keyword = Common::getKeyword($keyword);
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.modtime desc';
}
$w = "a.id is not null";
$w .= empty($keyword) ? '' : " and (a.title like '%{$keyword}%' or a.id like '%{$keyword}%')";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$w .= $webid == '-1' ? '' : " and a.webid={$webid}";
if (empty($kindid)) {
$sql = "select a.aid,a.id,a.title,a.price,a.tagword,a.kindlist,a.attrid,a.litpic,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,\na.webid,a.piclist,a.themelist,a.iconlist,a.supplierlist,a.ishidden,b.isjian,ifnull(b.displayorder,9999) as displayorder,b.isding from sline_spot as a left join sline_allorderlist b on (a.id=b.aid and b.typeid=5) where {$w} {$order} limit {$start},{$limit} ";
} else {
$sql = "select a.aid,a.id,a.title,a.price,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,\na.tagword,a.kindlist,a.attrid,a.litpic,a.webid,a.piclist,a.themelist,a.iconlist,a.supplierlist,a.ishidden,b.isjian,ifnull(b.displayorder,9999) as displayorder,b.isding from sline_spot as a left join sline_kindorderlist as b on (b.classid={$kindid} and a.id=b.aid and b.typeid=5) where {$w} {$order} limit {$start},{$limit}";
}
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_spot a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Spot_Attr::getAttrnameList($v['attrid']);
$v['url'] = Common::getBaseUrl($v['webid']) . '/spots/show_' . $v['aid'] . '.html';
$iconname = Model_Icon::getIconName($v['iconlist']);
$name = '';
foreach ($iconname as $icon) {
if (!empty($icon)) {
$name .= '<span style="color:red">[' . $icon . ']</span>';
}
}
$v['iconname'] = $name;
$v['series'] = Common::getSeries($v['id'], '05');
//编号
//供应商信息
$supplier = ORM::factory('supplier')->where("id='{$v['supplierlist']}'")->find()->as_array();
$v['suppliername'] = $supplier['suppliername'];
$v['linkman'] = $supplier['linkman'];
$v['mobile'] = $supplier['mobile'];
$v['address'] = $supplier['address'];
$v['qq'] = $supplier['qq'];
$suits = DB::query(Database::SELECT, "select a.*,b.kindname as tickettypename from sline_spot_ticket a left join sline_spot_ticket_type b on a.tickettypeid=b.id where a.spotid={$v['id']} order by a.displayorder asc")->execute()->as_array();
if (!empty($suits)) {
$v['tr_class'] = 'parent-product-tr';
}
$new_list[] = $v;
foreach ($suits as $key => $val) {
$val['title'] = $val['title'];
$val['ticketid'] = $val['id'];
//门票id
$val['spotid'] = $v['id'];
//景点id
$val['id'] = 'suit_' . $val['id'];
if ($key != count($suits) - 1) {
$val['tr_class'] = 'suit-tr';
}
$new_list[] = $val;
}
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('spot', $id);
$model->deleteClear();
//.........这里部分代码省略.........
示例7: action_uploadfile
public function action_uploadfile()
{
$webid = ARR::get($_POST, 'webid');
$thumb = ARR::get($_POST, 'thumb');
//是否生成缩略图
//echo $thumb;
$webinfo = Common::getWebInfo($webid);
$pinyin = $webid != 0 ? $webinfo['webprefix'] : 'main';
$file = $_FILES['Filedata'];
$storepath = BASEPATH . '/uploads/' . $pinyin;
if (!file_exists($storepath)) {
$this->createStandDir($storepath);
//创建标准图片存储
}
//缩略图存储
$storearr = array(array('/uploads/' . $pinyin . '/litimg/' . date('Ymd'), 480, 320), array('/uploads/' . $pinyin . '/lit240/' . date('Ymd'), 240, 180), array('/uploads/' . $pinyin . '/lit160/' . date('Ymd'), 160, 80));
$dir = BASEPATH . "/uploads/" . $pinyin . "/allimg/" . date('Ymd');
//原图存储路径.
if (!file_exists($dir)) {
mkdir($dir);
}
$path_info = pathinfo($_FILES['Filedata']['name']);
$filename = date('YmdHis');
$i = 0;
while (file_exists($dir . '/' . $filename . '.' . $path_info['extension'])) {
$i = $i + 50;
$filename = date('YmdHis') . $i;
}
$filename = $filename . '.' . $path_info['extension'];
Upload::$default_directory = $dir;
//默认保存文件夹
Upload::$remove_spaces = true;
//上传文件删除空格
if (Upload::valid($file)) {
if (Upload::size($file, "2M")) {
if (Upload::type($file, array('jpg', 'png', 'gif'))) {
if (Upload::save($file, $filename)) {
$srcfile = $dir . '/' . $filename;
//原图
$water = Common::getConfig('watermark');
//获取水印配置文件
//是否生成缩略图
if ($thumb != 'false') {
if ($water['watermark']['photo_markon'] == '1') {
$this->setWater($srcfile, $water['watermark']['photo_markimg'], $water['watermark']['photo_marktext'], $water['watermark']['photo_fontcolor'], $water['watermark']['photo_waterpos'], $water['watermark']['photo_fontsize'], $water['watermark']['photo_marktype'], $water['watermark']['photo_diaphaneity']);
}
foreach ($storearr as $path) {
$newpath = BASEPATH . $path[0];
$newfile = BASEPATH . $path[0] . '/' . $filename;
$this->thumbPicture($srcfile, $newfile, $newpath, $path[1], $path[2], $filename);
}
}
//echo substr(substr($newfile,strpos($dir,'/uploads')-1),1);
$arr['success'] = 'true';
$arr['bigpic'] = $GLOBALS['$cfg_basehost'] . substr(substr($srcfile, strpos($dir, '/uploads') - 1), 1);
$arr['litpic'] = $GLOBALS['$cfg_basehost'] . $storearr[0][0] . '/' . $filename;
} else {
//echo "error_no";
$arr['success'] = 'false';
$arr['msg'] = '未知错误,上传失败';
}
} else {
$arr['success'] = 'false';
$arr['msg'] = '类型不支持';
}
} else {
$arr['success'] = 'false';
$arr['msg'] = '图片大小超过限制';
}
} else {
$arr['success'] = 'false';
$arr['msg'] = '未知错误,上传失败';
}
echo json_encode($arr);
}
示例8: action_tuan
public function action_tuan()
{
$action = $this->params['action'];
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.tuankind'));
//分类设置项
$this->display('stourtravel/tuan/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$webid = Arr::get($_GET, 'webid');
$webid = empty($webid) ? 0 : $webid;
$keyword = Common::getKeyword($keyword);
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
$order = 'order by a.modtime desc';
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if ($sort[0]['property'] == 'endtime') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.modtime desc';
}
$w = "a.id is not null";
$w .= empty($keyword) ? '' : " and (a.title like '%{$keyword}%' or a.id like '%{$keyword}%')";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$w .= $webid == '-1' ? '' : " and a.webid={$webid}";
if (empty($kindid)) {
$sql = "select a.id,a.webid,a.aid,a.title,a.endtime,a.shownum,a.bookcount,a.totalnum,a.virtualnum,a.validdate,a.attrid,a.kindlist,a.jifenbook,a.jifentprice,a.jifencomment,a.iconlist,a.themelist,b.isjian,b.isding,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,\nifnull(b.displayorder,9999) as displayorder,ishidden from sline_tuan as a left join sline_allorderlist b on (a.id=b.aid and b.typeid=13) where {$w} {$order} limit {$start},{$limit}";
} else {
$sql = "select a.id,a.webid,a.aid,a.title,a.endtime,a.shownum,a.bookcount,a.totalnum,a.virtualnum,a.validdate,a.attrid,a.kindlist,a.jifenbook,a.jifentprice,a.jifencomment,a.iconlist,a.themelist,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,\nb.isjian,b.isding,ifnull(b.displayorder,9999) as displayorder,ishidden from sline_tuan as a left join sline_kindorderlist as b on (b.classid={$kindid} and a.id=b.aid and b.typeid=13) where {$w} {$order} limit {$start},{$limit}";
}
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_tuan a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Spot_Attr::getAttrnameList($v['attrid']);
$iconname = Model_Icon::getIconName($v['iconlist']);
$name = '';
foreach ($iconname as $icon) {
if (!empty($icon)) {
$name .= '<span style="color:red">[' . $icon . ']</span>';
}
}
$v['iconname'] = $name;
$v['series'] = Common::getSeries($v['id'], '13');
//编号
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('tuan', $id);
$model->deleteClear();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$kindid = Arr::get($_POST, 'kindid');
if ($field == 'displayorder') {
$displayorder = empty($val) ? 9999 : $val;
if (is_numeric($id)) {
if (empty($kindid)) {
$order = ORM::factory('allorderlist');
$order_mod = $order->where("aid='{$id}' and typeid=13 and webid=0")->find();
if ($order_mod->id) {
$order_mod->displayorder = $displayorder;
} else {
$order_mod->displayorder = $displayorder;
$order_mod->aid = $id;
$order_mod->webid = 0;
$order_mod->typeid = 13;
//.........这里部分代码省略.........
示例9: foreach
foreach ($sub as $row) {
echo "<a href='javascript:;' data-url='" . $row['url'] . "'>" . $row['name'] . "</a>";
}
?>
</dd>
</dl>
</div>
<!--增值应用-->
<div class="apply">
<dl>
<dt>增值应用</dt>
<dd>
<?php
$sub = Common::getConfig('menu_sub.application');
foreach ($sub as $row) {
echo "<a href='javascript:;' data-url='" . $row['url'] . "'>" . $row['name'] . "</a>";
}
?>
</dd>
</dl>
</div>
</div>
<!--思途营销-->
<div class="market">
<h3><span>思途营销</span></h3>
<ul>
<li><s>·</s><a href="javascript:;" target="_blank">[经营管理]</a><a class="max" href="javascript:;" target="_blank">以用户互动为核心的旅游营销策略以用户互动为核心的旅游营销策略以用户互动为核心的旅游营销策略</a></li>
示例10: action_list
public function action_list()
{
$action = $this->params['action'];
if (empty($action)) {
$posArr = $this->geneHtmlPosarr();
$this->assign('posArr', $posArr);
$kindlist = json_encode(ORM::factory('help_kind')->where("webid=0")->get_all());
$this->assign('kindmenu', Common::getConfig('menu_sub.helpkind'));
//分类设置项
$this->assign('kindlist', $kindlist);
$this->display('stourtravel/help/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$sort = json_decode(Arr::get($_GET, 'sort'), true);
if ($sort[0]['property']) {
//print_r($sort[0]->property);
if ($sort[0]['property'] == 'displayorder') {
$order = 'order by displayorder ' . $sort[0]['direction'];
} else {
if ($sort[0]['property'] == 'modtime') {
$order = 'order by modtime ' . $sort[0]['direction'];
}
}
} else {
$order = 'order by modtime desc';
}
$w = "id is not null";
$w .= empty($keyword) ? '' : " and title like '%{$keyword}%'";
$w .= empty($kindid) ? '' : " and kindid={$kindid}";
$sql = "select *,ifnull(displayorder,9999) as displayorder from sline_help where {$w} {$order} limit {$start},{$limit} ";
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_help where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
foreach ($list as $k => $v) {
$list[$k]['modtime'] = Common::myDate('Y-m-d', $list[$k]['modtime']);
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('help', $id);
$model->deleteClear();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$model = ORM::factory('help', $id);
$model->{$field} = $val;
$model->save();
if ($model->saved()) {
echo 'ok';
} else {
echo 'no';
}
}
}
}
}
}
}
示例11: action_upload
/**
* 图片上传
*/
public function action_upload()
{
is_uploaded_file($_FILES['file']['tmp_name']) or exit;
require Kohana::find_file('image', 'image');
$obj = new Image();
$ext = '.' . pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$path = "/" . date('Y') . '/' . date('md') . '/' . md5($_FILES['file']['name'] . date('His')) . $ext;
$filesize = filesize($_FILES['file']['tmp_name']);
$temp = dirname(DOCROOT) . '/uploads/image.temp';
if (move_uploaded_file($_FILES['file']['tmp_name'], $temp)) {
$_FILES['file']['tmp_name'] = $temp;
}
if ($this->params['iswater'] > 0) {
//添加水印
$water = Common::getConfig('watermark');
if ($water['watermark']['photo_markon'] == '1') {
$this->setWater($_FILES['file']['tmp_name'], $water['watermark']['photo_markimg'], $water['watermark']['photo_marktext'], $water['watermark']['photo_fontcolor'], $water['watermark']['photo_waterpos'], $water['watermark']['photo_fontsize'], $water['watermark']['photo_marktype'], $water['watermark']['photo_diaphaneity']);
}
}
$bool = $obj->image_move($_FILES['file']['tmp_name'], $path);
if ($bool) {
$image = ORM::factory('image');
$url = Common::getConfig('image.upload_path') . $path;
$result = $image->where('url', '=', $url)->find();
if (!$result->loaded()) {
$image->group_id = $this->params['groupid'];
$image->url = $url;
$image->image_name = $this->params['name'] ? $this->params['name'] : '';
$image->size = $filesize;
$image->save();
}
if (strlen(Common::getConfig('image.img_domain')) > 0) {
$url = rtrim(Common::getConfig('image.img_domain'), '/') . $url;
}
echo $url;
}
echo '';
}
示例12: action_article
public function action_article()
{
$action = $this->params['action'];
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.articlekind'));
//分类设置项
$this->display('stourtravel/article/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$webid = Arr::get($_GET, 'webid');
$webid = $webid == "" ? -1 : $webid;
$keyword = Common::getKeyword($keyword);
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.modtime desc';
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if ($sort[0]['property'] == 'templet') {
$prefix = 'a.';
} else {
if ($sort[0]['property'] == 'modtime') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.modtime desc';
}
$w = "a.id is not null";
$w .= empty($keyword) ? '' : " and a.title like '%{$keyword}%'";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$w .= $webid == '-1' ? '' : " and a.webid={$webid}";
if (empty($kindid)) {
$sql = "select a.id,a.aid,a.title,a.attrid,a.kindlist,a.webid,a.addtime,a.ishidden,a.themelist,a.iconlist,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,\nb.isjian,ifnull(b.displayorder,999999) as displayorder,b.isding,a.modtime,a.templet from sline_article as a left join sline_allorderlist b on (a.id=b.aid and b.typeid=4) where {$w} {$order} limit {$start},{$limit}";
} else {
$sql = "select a.id,a.aid,a.title,a.attrid,a.kindlist,a.webid,a.addtime,a.ishidden,a.themelist,a.iconlist,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,b.isjian,b.displayorder,b.isding,a.modtime,a.templet from sline_article as a left join sline_kindorderlist as b on (b.classid={$kindid} and a.id=b.aid and b.typeid=4) where {$w} {$order} limit {$start},{$limit}";
}
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_article a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Article_Attr::getAttrnameList($v['attrid']);
$v['modtime'] = Common::myDate('Y-m-d', $v['modtime']);
$v['url'] = Common::getBaseUrl($v['webid']) . '/raiders/show_' . $v['aid'] . '.html';
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('article', $id);
$model->deleteClear();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$kindid = Arr::get($_POST, 'kindid');
if ($field == 'displayorder') {
$displayorder = empty($val) ? 9999 : $val;
if (is_numeric($id)) {
if (empty($kindid)) {
$order = ORM::factory('allorderlist');
$order_mod = $order->where("aid='{$id}' and typeid=4 and webid=0")->find();
if ($order_mod->id) {
$order_mod->displayorder = $displayorder;
} else {
$order_mod->displayorder = $displayorder;
$order_mod->aid = $id;
$order_mod->webid = 0;
$order_mod->typeid = 4;
}
$order_mod->save();
if ($order_mod->saved()) {
echo 'ok';
//.........这里部分代码省略.........
示例13: action_watermark
public function action_watermark()
{
$config = Common::getConfig('watermark');
$markinfo = $config->get('watermark');
$markinfo['markimgurl'] = $GLOBALS['cfg_basehost'] . '/data/mark/' . $markinfo['photo_markimg'];
$this->assign('markinfo', $markinfo);
$this->display('stourtravel/config/watermark');
}
示例14: action_visa
public function action_visa()
{
$action = $this->params['action'];
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.visakind'));
//分类设置项
$this->display('stourtravel/visa/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$visatype = Arr::get($_GET, 'visatype');
$cityid = Arr::get($_GET, 'cityid');
$keyword = Arr::get($_GET, 'keyword');
$keyword = Common::getKeyword($keyword);
//echo $keyword;
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.modtime desc';
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.modtime desc';
}
$w = "a.id is not null";
$w .= empty($keyword) ? '' : " and (a.title like '%{$keyword}%' or a.id like '%{$keyword}%')";
$w .= empty($visatype) ? '' : " and a.visatype={$visatype}";
$w .= empty($cityid) ? '' : " and a.cityid={$cityid}";
$sql = "select a.*,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,ifnull(b.displayorder,9999) as displayorder from sline_visa as a left join sline_allorderlist b on (a.id=b.aid and b.typeid=8) where {$w} {$order} limit {$start},{$limit}";
//echo $sql;
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_visa a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['visakind'] = ORM::factory('visa_kind')->where('id', '=', $v['visatype'])->find()->get('kindname');
$v['visacity'] = ORM::factory('visa_city')->where('id', '=', $v['cityid'])->find()->get('kindname');
$iconname = Model_Icon::getIconName($v['iconlist']);
$name = '';
foreach ($iconname as $icon) {
if (!empty($icon)) {
$name .= '<span style="color:red">[' . $icon . ']</span>';
}
}
$v['iconname'] = $name;
$v['series'] = Common::getSeries($v['id'], '08');
//编号
//供应商信息
$supplier = ORM::factory('supplier')->where("id='{$v['supplierlist']}'")->find()->as_array();
$v['suppliername'] = $supplier['suppliername'];
$v['linkman'] = $supplier['linkman'];
$v['mobile'] = $supplier['mobile'];
$v['address'] = $supplier['address'];
$v['qq'] = $supplier['qq'];
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('visa', $id);
$model->deleteClear();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$kindid = Arr::get($_POST, 'kindid');
if ($field == 'displayorder') {
$displayorder = empty($val) ? 9999 : $val;
if (is_numeric($id)) {
$order = ORM::factory('allorderlist');
$order_mod = $order->where("aid", '=', $id)->and_where('typeid', '=', '8')->and_where('webid', '=', '0')->find();
if ($order_mod->id) {
$order_mod->displayorder = $displayorder;
} else {
$order_mod->displayorder = $displayorder;
$order_mod->aid = $id;
$order_mod->webid = 0;
$order_mod->typeid = 8;
}
$order_mod->save();
if ($order_mod->saved()) {
//.........这里部分代码省略.........
示例15: array
if (!empty($action)) {
$data = array();
try {
switch ($action) {
case 'contact':
session_name('kidzania-session');
session_cache_expire('60480');
session_start();
$data["first_name"] = stripslashes(strip_tags(trim($_POST['first_name'])));
$data["last_name"] = stripslashes(strip_tags(trim($_POST['last_name'])));
$data["email"] = stripslashes(strip_tags(trim($_POST['email'])));
$data["privacy_policy"] = stripslashes(strip_tags(trim($_POST['privacy_policy'])));
$_SESSION['email'] = $data['email'];
$cc = array(array('mail' => $config['emailCC']['email_address_one'], 'name' => $config['emailCC']['email_name_one']));
$rules = ['first_name' => ['requerido' => 1, 'validador' => 'esAlfaNumerico', 'mensaje' => utf8_encode('La primera pregunta es obligatoria.')], 'last_name' => ['requerido' => 1, 'validador' => 'esAlfaNumerico', 'mensaje' => utf8_encode('La segunda pregunta es obligatoria.')], 'email' => ['requerido' => 1, 'validador' => 'esEmail', 'mensaje' => utf8_encode('La tercera pregunta es obligatoria.')], 'privacy_policy' => ['requerido' => 1, 'validador' => 'esAlfaNumerico', 'mensaje' => utf8_encode('La cuarta pregunta es obligatoria.')]];
$config = Common::getConfig();
$formValidated = new Validator($data, $rules);
if ($formValidated->validate()) {
$data["date_answer"] = date("Y-m-d H:i:s");
$contact = new Contact($dbh, $config['database']['db_table']);
$contact->setTemplate("share.tpl");
$contact->setSubject("El Verano está en KidZania. Visítanos");
$contact->setCorreo($data["email"]);
$contact->setCC($cc);
$contact->setInfo($data);
$userSaved = $contact->insertInfo($formValidated);
if ($userSaved) {
$response = $contact->sendEmail();
header('Location: ' . SITE_URL . 'gracias.php');
} else {
header('Location: ' . SITE_URL);