Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * FecShop file. * * @link http://www.fecshop.com/ * @copyright Copyright (c)..
Decoded Output download
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appadmin\modules\Catalog\block\urlrewrite;
use fec\helpers\CUrl;
use fecshop\app\appadmin\interfaces\base\AppadminbaseBlockInterface;
use fecshop\app\appadmin\modules\AppadminbaseBlock;
use Yii;
/**
* @author Terry Zhao <[email protected]>
* @since 1.0
*/
class Index extends AppadminbaseBlock implements AppadminbaseBlockInterface
{
/**
* init param function ,execute in construct.
*/
public function init()
{
/*
* edit data url
*/
$this->_editUrl = CUrl::getUrl('catalog/urlrewrite/manageredit');
/*
* delete data url
*/
$this->_deleteUrl = CUrl::getUrl('catalog/urlrewrite/managerdelete');
/*
* service component, data provider
*/
$this->_service = Yii::$service->url->rewrite;
parent::init();
}
public function getLastData()
{
// hidden section ,that storage page info
$pagerForm = $this->getPagerForm();
// search section
$searchBar = $this->getSearchBar();
// edit button, delete button,
$editBar = $this->getEditBar();
// table head
$thead = $this->getTableThead();
// table body
$tbody = $this->getTableTbody();
// paging section
$toolBar = $this->getToolBar($this->_param['numCount'], $this->_param['pageNum'], $this->_param['numPerPage']);
return [
'pagerForm' => $pagerForm,
'searchBar' => $searchBar,
'editBar' => $editBar,
'thead' => $thead,
'tbody' => $tbody,
'toolBar' => $toolBar,
];
}
/**
* get search bar Arr config.
*/
public function getSearchArr()
{
$data = [
[ //
'type' => 'inputtext',
'title' => Yii::$service->page->translate->__('Origin Url'),
'name' => 'origin_url',
'columns_type' => 'string',
],
[ //
'type' => 'inputtext',
'title' => Yii::$service->page->translate->__('Custom Url'),
'name' => 'custom_url_key',
'columns_type' => 'string',
],
];
return $data;
}
/**
* config function ,return table columns config.
*/
public function getTableFieldArr()
{
$table_th_bar = [
[
'orderField' => $this->_primaryKey,
'label' => Yii::$service->page->translate->__('Id'),
'width' => '50',
'align' => 'center',
],
[
'orderField' => 'type',
'label' => Yii::$service->page->translate->__('Type'),
'width' => '50',
'align' => 'left',
],
[
'orderField' => 'custom_url_key',
'label' => Yii::$service->page->translate->__('Custom Url'),
'width' => '110',
'align' => 'left',
],
[
'orderField' => 'origin_url',
'label' => Yii::$service->page->translate->__('Origin Url'),
'width' => '110',
'align' => 'left',
],
];
return $table_th_bar;
}
/**
* rewrite parent getTableTbodyHtml($data).
*/
public function getTableTbodyHtml($data)
{
$fileds = $this->getTableFieldArr();
$str .= '';
$csrfString = \fec\helpers\CRequest::getCsrfString();
$user_ids = [];
foreach ($data as $one) {
$user_ids[] = $one['created_user_id'];
}
$users = Yii::$service->adminUser->getIdAndNameArrByIds($user_ids);
foreach ($data as $one) {
$str .= '<tr target="sid_user" rel="'.$one[$this->_primaryKey].'">';
$str .= '<td><input name="'.$this->_primaryKey.'s" value="'.$one[$this->_primaryKey].'" type="checkbox"></td>';
foreach ($fileds as $field) {
$orderField = $field['orderField'];
$display = $field['display'];
$val = $one[$orderField];
if ($orderField == 'created_user_id') {
$val = isset($users[$val]) ? $users[$val] : $val;
$str .= '<td>'.$val.'</td>';
continue;
}
if ($val) {
if (isset($field['display']) && !empty($field['display'])) {
$display = $field['display'];
$val = $display[$val] ? $display[$val] : $val;
}
if (isset($field['convert']) && !empty($field['convert'])) {
$convert = $field['convert'];
foreach ($convert as $origin =>$to) {
if (strstr($origin, 'mongodate')) {
if (isset($val->sec)) {
$timestramp = $val->sec;
if ($to == 'date') {
$val = date('Y-m-d', $timestramp);
} elseif ($to == 'datetime') {
$val = date('Y-m-d H:i:s', $timestramp);
} elseif ($to == 'int') {
$val = $timestramp;
}
}
} elseif (strstr($origin, 'date')) {
if ($to == 'date') {
$val = date('Y-m-d', strtotime($val));
} elseif ($to == 'datetime') {
$val = date('Y-m-d H:i:s', strtotime($val));
} elseif ($to == 'int') {
$val = strtotime($val);
}
} elseif ($origin == 'int') {
if ($to == 'date') {
$val = date('Y-m-d', $val);
} elseif ($to == 'datetime') {
$val = date('Y-m-d H:i:s', $val);
} elseif ($to == 'int') {
$val = $val;
}
} elseif ($origin == 'string') {
if ($to == 'img') {
$t_width = isset($field['img_width']) ? $field['img_width'] : '100';
$t_height = isset($field['img_height']) ? $field['img_height'] : '100';
$val = '<img style="width:'.$t_width.'px;height:'.$t_height.'px" src="'.$val.'" />';
}
}
}
}
if (isset($field['lang']) && !empty($field['lang'])) {
//var_dump($val);
//var_dump($orderField);
$val = Yii::$service->fecshoplang->getDefaultLangAttrVal($val, $orderField);
}
}
$str .= '<td>'.$val.'</td>';
}
$str .= '</tr>';
}
return $str;
}
public function getTableTheadHtml($table_th_bar)
{
$table_th_bar = $this->getTableTheadArrInit($table_th_bar);
$this->_param['orderField'] = $this->_param['orderField'] ? $this->_param['orderField'] : $this->_primaryKey;
$this->_param['orderDirection'] = $this->_param['orderDirection'];
foreach ($table_th_bar as $k => $field) {
if ($field['orderField'] == $this->_param['orderField']) {
$table_th_bar[$k]['class'] = $this->_param['orderDirection'];
}
}
$str = '<thead><tr>';
$str .= '<th width="22"><input type="checkbox" group="'.$this->_primaryKey.'s" class="checkboxCtrl"></th>';
foreach ($table_th_bar as $b) {
$width = $b['width'];
$label = $b['label'];
$orderField = $b['orderField'];
$class = isset($b['class']) ? $b['class'] : '';
$align = isset($b['align']) ? 'align="'.$b['align'].'"' : '';
$str .= '<th width="'.$width.'" '.$align.' orderField="'.$orderField.'" class="'.$class.'">'.$label.'</th>';
}
$str .= '</tr></thead>';
return $str;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace fecshop\app\appadmin\modules\Catalog\block\urlrewrite;
use fec\helpers\CUrl;
use fecshop\app\appadmin\interfaces\base\AppadminbaseBlockInterface;
use fecshop\app\appadmin\modules\AppadminbaseBlock;
use Yii;
/**
* @author Terry Zhao <[email protected]>
* @since 1.0
*/
class Index extends AppadminbaseBlock implements AppadminbaseBlockInterface
{
/**
* init param function ,execute in construct.
*/
public function init()
{
/*
* edit data url
*/
$this->_editUrl = CUrl::getUrl('catalog/urlrewrite/manageredit');
/*
* delete data url
*/
$this->_deleteUrl = CUrl::getUrl('catalog/urlrewrite/managerdelete');
/*
* service component, data provider
*/
$this->_service = Yii::$service->url->rewrite;
parent::init();
}
public function getLastData()
{
// hidden section ,that storage page info
$pagerForm = $this->getPagerForm();
// search section
$searchBar = $this->getSearchBar();
// edit button, delete button,
$editBar = $this->getEditBar();
// table head
$thead = $this->getTableThead();
// table body
$tbody = $this->getTableTbody();
// paging section
$toolBar = $this->getToolBar($this->_param['numCount'], $this->_param['pageNum'], $this->_param['numPerPage']);
return [
'pagerForm' => $pagerForm,
'searchBar' => $searchBar,
'editBar' => $editBar,
'thead' => $thead,
'tbody' => $tbody,
'toolBar' => $toolBar,
];
}
/**
* get search bar Arr config.
*/
public function getSearchArr()
{
$data = [
[ //
'type' => 'inputtext',
'title' => Yii::$service->page->translate->__('Origin Url'),
'name' => 'origin_url',
'columns_type' => 'string',
],
[ //
'type' => 'inputtext',
'title' => Yii::$service->page->translate->__('Custom Url'),
'name' => 'custom_url_key',
'columns_type' => 'string',
],
];
return $data;
}
/**
* config function ,return table columns config.
*/
public function getTableFieldArr()
{
$table_th_bar = [
[
'orderField' => $this->_primaryKey,
'label' => Yii::$service->page->translate->__('Id'),
'width' => '50',
'align' => 'center',
],
[
'orderField' => 'type',
'label' => Yii::$service->page->translate->__('Type'),
'width' => '50',
'align' => 'left',
],
[
'orderField' => 'custom_url_key',
'label' => Yii::$service->page->translate->__('Custom Url'),
'width' => '110',
'align' => 'left',
],
[
'orderField' => 'origin_url',
'label' => Yii::$service->page->translate->__('Origin Url'),
'width' => '110',
'align' => 'left',
],
];
return $table_th_bar;
}
/**
* rewrite parent getTableTbodyHtml($data).
*/
public function getTableTbodyHtml($data)
{
$fileds = $this->getTableFieldArr();
$str .= '';
$csrfString = \fec\helpers\CRequest::getCsrfString();
$user_ids = [];
foreach ($data as $one) {
$user_ids[] = $one['created_user_id'];
}
$users = Yii::$service->adminUser->getIdAndNameArrByIds($user_ids);
foreach ($data as $one) {
$str .= '<tr target="sid_user" rel="'.$one[$this->_primaryKey].'">';
$str .= '<td><input name="'.$this->_primaryKey.'s" value="'.$one[$this->_primaryKey].'" type="checkbox"></td>';
foreach ($fileds as $field) {
$orderField = $field['orderField'];
$display = $field['display'];
$val = $one[$orderField];
if ($orderField == 'created_user_id') {
$val = isset($users[$val]) ? $users[$val] : $val;
$str .= '<td>'.$val.'</td>';
continue;
}
if ($val) {
if (isset($field['display']) && !empty($field['display'])) {
$display = $field['display'];
$val = $display[$val] ? $display[$val] : $val;
}
if (isset($field['convert']) && !empty($field['convert'])) {
$convert = $field['convert'];
foreach ($convert as $origin =>$to) {
if (strstr($origin, 'mongodate')) {
if (isset($val->sec)) {
$timestramp = $val->sec;
if ($to == 'date') {
$val = date('Y-m-d', $timestramp);
} elseif ($to == 'datetime') {
$val = date('Y-m-d H:i:s', $timestramp);
} elseif ($to == 'int') {
$val = $timestramp;
}
}
} elseif (strstr($origin, 'date')) {
if ($to == 'date') {
$val = date('Y-m-d', strtotime($val));
} elseif ($to == 'datetime') {
$val = date('Y-m-d H:i:s', strtotime($val));
} elseif ($to == 'int') {
$val = strtotime($val);
}
} elseif ($origin == 'int') {
if ($to == 'date') {
$val = date('Y-m-d', $val);
} elseif ($to == 'datetime') {
$val = date('Y-m-d H:i:s', $val);
} elseif ($to == 'int') {
$val = $val;
}
} elseif ($origin == 'string') {
if ($to == 'img') {
$t_width = isset($field['img_width']) ? $field['img_width'] : '100';
$t_height = isset($field['img_height']) ? $field['img_height'] : '100';
$val = '<img style="width:'.$t_width.'px;height:'.$t_height.'px" src="'.$val.'" />';
}
}
}
}
if (isset($field['lang']) && !empty($field['lang'])) {
//var_dump($val);
//var_dump($orderField);
$val = Yii::$service->fecshoplang->getDefaultLangAttrVal($val, $orderField);
}
}
$str .= '<td>'.$val.'</td>';
}
$str .= '</tr>';
}
return $str;
}
public function getTableTheadHtml($table_th_bar)
{
$table_th_bar = $this->getTableTheadArrInit($table_th_bar);
$this->_param['orderField'] = $this->_param['orderField'] ? $this->_param['orderField'] : $this->_primaryKey;
$this->_param['orderDirection'] = $this->_param['orderDirection'];
foreach ($table_th_bar as $k => $field) {
if ($field['orderField'] == $this->_param['orderField']) {
$table_th_bar[$k]['class'] = $this->_param['orderDirection'];
}
}
$str = '<thead><tr>';
$str .= '<th width="22"><input type="checkbox" group="'.$this->_primaryKey.'s" class="checkboxCtrl"></th>';
foreach ($table_th_bar as $b) {
$width = $b['width'];
$label = $b['label'];
$orderField = $b['orderField'];
$class = isset($b['class']) ? $b['class'] : '';
$align = isset($b['align']) ? 'align="'.$b['align'].'"' : '';
$str .= '<th width="'.$width.'" '.$align.' orderField="'.$orderField.'" class="'.$class.'">'.$label.'</th>';
}
$str .= '</tr></thead>';
return $str;
}
}
Function Calls
None |
Stats
MD5 | fb18fdd26a9e0b43ab135cedb6409171 |
Eval Count | 0 |
Decode Time | 128 ms |