コード例 #1
0
 /**
  * 封装curl的调用接口,post的请求方式
  * @return array()
  */
 protected function doCurlPostRequest($privatePara, $isDES, $timeout = 15, $url = "", $isCache = true)
 {
     $url = self::$url;
     $requestString = $this->getApiHeaderPara();
     $requestString = $requestString . $privatePara;
     if ($url == "" || $requestString == "" || $timeout <= 0) {
         return false;
     }
     $isCache = $isCache && $this->cacheTimeLength() > 0;
     if ($isCache) {
         $mc = MC();
         $mk_d = self::$act . "_" . md5($privatePara);
         $mk_t = $mk_d . "_lasttime2";
         if ($mc->get($mk_t)) {
             $data = $mc->get($mk_d);
             if ($data) {
                 return $data;
             }
         } else {
             $mc->set2($mk_t, "1", $this->cacheTimeLength());
         }
     }
     $data = $this->post($url, $requestString);
     if ($isDES) {
         $data = MyDes::share()->decode($data, self::$key);
     }
     if ($isCache) {
         //数据最长保存一小时(实际缓存时间为$mk_t的缓存时间)
         $mc->set($mk_d, $data, 60 * 60);
     }
     return $data;
 }
コード例 #2
0
ファイル: Main.class.php プロジェクト: evilgeny/bob
 public function __construct()
 {
     if (!MC('User')->checkAccessToEditGpc(me())) {
         goU('main');
     }
     $this->_action_list = array('rename' => L('wizard.gpc_rename_attribute_action'), 'edit' => L('wizard.gpc_edit_attribute_action'), 'add' => L('wizard.gpc_add_attribute_action'), 'delete' => L('wizard.gpc_delete_attribute_action'));
 }
コード例 #3
0
ファイル: Panel.class.php プロジェクト: evilgeny/bob
 public function init(RM_List_Object $list)
 {
     $this->_list = $list;
     $this->addItem(array('img' => '/img/report_settings.gif', 'alt' => L('menu.main.user_sort', array('menu_name' => L($list->menuCaption()))), 'url' => '#', 'extra' => ' onclick="getSortUser(\'' . $list->id() . '\');" '));
     $this->addSeparator();
     if ($this->_list->excelAvailable() && MC('List')->canLoadToExcel($list->id())) {
         $url = @$_SERVER['SERVER_PORT'] == 443 ? U('report.https_excel') : U('report.excel');
         $url .= '?' . $_SERVER['QUERY_STRING'];
         $this->addItem(array('url' => $url, 'img' => '/img/toexcel.gif', 'alt' => L('report.toexcel')));
         if (!$list->mailingAvailable()) {
             $this->addSeparator();
         }
     }
     if ($list->mailingAvailable()) {
         $q['mailing'] = 1;
         $url = url($q, 'abs');
         $this->addItem(array('url' => $url, 'img' => '/img/plan.gif', 'alt' => L('report.mailing')));
         $this->addSeparator();
     }
     $this->addButtonNoFilter(array('alt' => L('report.reset_filter'), 'extra' => 'onclick="clearForm(\'filterForm\'); return false;"'));
     $this->addButtonFilter(array('alt' => L('report.filter'), 'extra' => 'onclick="startSearch();  return false;"'));
     if ($this->_list->edit_script) {
         if (count($this->_toHtml) > 4) {
             $this->addSeparator();
         }
         $this->addItem(array('img' => '/img/save.gif', 'alt' => L('common.save'), 'extra' => 'class="edit_script"'));
     }
 }
コード例 #4
0
ファイル: List.class.php プロジェクト: evilgeny/bob
 /**
  *	Description...
  *
  *	@return void
  **/
 public function decorator($reportId)
 {
     if (!$this->_decorator) {
         $libName = M('List')->decoratorName($reportId);
         $this->_decorator = $libName ? MC($libName) : MC('Report_Blank');
     }
     return $this->_decorator;
 }
コード例 #5
0
ファイル: Main.class.php プロジェクト: evilgeny/bob
 public function getFlavoursForSelectedBrick(RM_Wizard_Result_Object $obResult, $flavour_type)
 {
     $obBrick = MC('Gpc_Wizard_Flavour_Main')->getSelectedBrick($obResult);
     $arr = array();
     foreach ($obBrick->getFlavours($flavour_type) as $obFlavour) {
         $arr[$obFlavour->id()] = $obFlavour->getName();
     }
     return $arr;
 }
コード例 #6
0
 static function getLoginUser()
 {
     $str = get_cookie(getC('LOGIN_KEY'));
     $arr = explode("###", $str);
     $mc = MC();
     $mk = getC('LOGIN_KEY') . "_" . $arr[0];
     $obj = $mc->get($mk);
     if ($str && $obj->SIMULATION_LOGIN_STR == $str) {
         return $obj;
     }
     return null;
 }
コード例 #7
0
ファイル: Item.class.php プロジェクト: evilgeny/bob
 public function countAgain()
 {
     $barcode = MC('AveragePrice')->getBarcodeValue();
     $obQuery = MC('AveragePrice')->getQuery($barcode);
     if ($this->getSigma() > $this->max) {
         $obQuery->where('p.price/p.quantity < ?', $this->getSigma(1));
     }
     if ($this->getSigma() < $this->min) {
         $obQuery->where('p.price/p.quantity > ?', $this->getSigma(-1));
     }
     $obQuery->where('b.product_qty = ? AND b.product_measure = ? ', $this->qty, $this->measure);
     return iterFirst($obQuery->execute());
 }
コード例 #8
0
ファイル: Coding.class.php プロジェクト: evilgeny/bob
 /**
  *	Returns additional params (query object, column etc.) for report
  *
  *	@param		array		args
  *	@return		array
  **/
 public function getAdditionalParams($args)
 {
     $args['query'] = M('Barcode')->report()->barcodeListQuery(TRUE);
     if (!MC('User')->canDeleteBarcode(me())) {
         $args['no_visible'][] = 'delete';
     }
     if (!MC('User')->canSetIsFood(me())) {
         $args['no_visible'][] = 'is_food';
     }
     if (!MC('User')->canSendBarcodeToRefresh(me())) {
         $args['no_visible'][] = 'to_refresh';
     }
     return $args;
 }
コード例 #9
0
ファイル: BarcodeRecover.class.php プロジェクト: evilgeny/bob
 public function approveQueue(RM_Barcode_Queue $obQueue, $name_new)
 {
     $obQueue->moderated = 1;
     $obQueue->name_new = $name_new;
     $obQueue->user_id_moderator = me()->id();
     if (isNull($obBarcode = M('Barcode')->loadBarcodeByValue($obQueue->barcode_value))) {
         $obBarcode = M('Barcode')->createBarcode(array('value' => $obQueue->barcode_value, 'attribute_1' => $name_new, 'complete' => 0));
     } else {
         $obBarcode->value = $obQueue->barcode_value;
         $obBarcode->attribute_1 = $name_new;
     }
     $error = '';
     if (!MC('Barcode')->save($obBarcode, $error)) {
         error(L($error));
     } else {
         $obQueue->save();
     }
 }
コード例 #10
0
ファイル: Runtime.inc.php プロジェクト: lingPro/zj_web_demo
 static function load_class($class)
 {
     $cachetime = getC("AUTO_LOAD_CACHETIME");
     if ($cachetime > 0 && !in_array($class, array("MyCache"))) {
         $m = MC();
         $mk = md5(getC("APP_PATH")) . "_" . $class;
         $mget = $m->get($mk);
         if ($mget) {
             if (file_exists($mget)) {
                 require_once "{$mget}";
                 return;
             } else {
                 $m->delete($mk);
             }
         }
     }
     $arr = getC("AUTO_LOAD_PATH");
     $classFullPath = null;
     foreach ($arr as $path) {
         $file1 = $path . "/" . "{$class}.class.php";
         //my_log($file1);
         if (file_exists($file1)) {
             $classFullPath = $file1;
             break;
         }
         $file2 = $path . "/" . "class.{$class}.php";
         if (file_exists($file2)) {
             $classFullPath = $file2;
             break;
         }
     }
     if ($cachetime > 0 && $m && $classFullPath) {
         $m->set($mk, $classFullPath, $cachetime);
     }
     require_once "{$classFullPath}";
 }
コード例 #11
0
ファイル: master.php プロジェクト: evilgeny/bob
            if (!isset($_REQUEST['brick_id'])) {
                $error = 'please_specify_brick';
            } else {
                if (isNull($obBrick = M('Gpc')->loadBrickById($_REQUEST['brick_id']))) {
                    $error = 'no_such_brick';
                }
            }
        }
    }
    if (!@$error) {
        $root_params = array('object_type' => 'attribute') + $obAttribute->props();
        /*		$root_params = array(
        			'object_type'	=> 'attribute',
        			'slave_id'		=> $obAttribute->id(),
        		);*/
        // выбрать все `мастер` атрибуты данного атрибута с учетом брика
        $list = $obAttribute->getMasters($obBrick);
    }
}
$root_params['status'] = 'ok';
$root_params['list'] = 'master';
$root_params = array_merge($root_params, MC('Message')->setXmlMessage(@$error, @$message, 'gpc'));
// сформировать и вывести XML
$root = M('Ajax')->init('gpc', $root_params);
if (@$list) {
    $fields = M('Gpc')->fields('attribute');
    $map = array_keys($fields);
    $map = $map + qw2('master_value_id>master_value_id');
    $root->addNode('attribute', $list, $map);
}
M('Ajax')->xml();
コード例 #12
0
ファイル: Connection.php プロジェクト: qycloud/activerecord
 /**
  * Retrieves column meta data for the specified table.
  *
  * @param string $table Name of a table
  * @return array An array of {@link Column} objects.
  */
 public function columns($table)
 {
     /**
      * DIY 添加缓存
      */
     $cacheKey = "db:column:{$table}";
     $structs = \MC($cacheKey);
     if (empty($structs)) {
         $sth = $this->query_column_info($table);
         $structs = $sth->fetchAll();
         \MC($cacheKey, $structs, 600);
     }
     $columns = array();
     foreach ($structs as $row) {
         $c = $this->create_column($row);
         $columns[$c->name] = $c;
     }
     return $columns;
 }
コード例 #13
0
ファイル: api.php プロジェクト: bizonix/sailvan
include "../../framework.php";
Core::getInstance();
//初始化缓存,memcache类
$memc_obj = new Cache(C('CACHEGROUP'));
$act = isset($_GET['action']) ? $_GET['action'] : "";
$v = isset($_GET['v']) ? $_GET['v'] : "1.0";
if (empty($act)) {
    json_return(10170);
}
if (preg_match("/^[a-z0-9_]*\$/i", $act) == 0) {
    json_return(10171, '', $act);
}
if (preg_match("/^[\\.0-9_]*\$/i", $v) == 0) {
    json_return(10175, '', $v);
}
$data = MC("SELECT * FROM " . C('DB_PREFIX') . "interface_version WHERE requestname='{$act}' AND version='{$v}' AND is_delete=0", 0);
if (!isset($data[0]['is_disable'])) {
    json_return(10173, '', $act, $v);
}
if ($data[0]['is_disable'] == 1) {
    json_return(10174, '', $act, $v);
}
//对接口请求内容进行验证或转换
$transform = !empty($data[0]['extend_transform']) ? $data[0]['extend_transform'] : 'Transform:commonTransform';
list($vclass, $vfun) = explode(':', $transform);
$vmethod = ucfirst($vclass . "Act");
$vfun = 'act_' . $vfun;
if (!class_exists($vmethod)) {
    json_return(10176);
}
if (!method_exists($vmethod, $vfun)) {
コード例 #14
0
ファイル: Leave.class.php プロジェクト: evilgeny/bob
 /**
  *	Description...
  *
  *	@return void
  **/
 public function getRowHighlight(RM_List_Row $row)
 {
     $obLeave = M('User')->loadLeaveById($row->id);
     return MC('Leave')->getHighlight($obLeave);
 }
コード例 #15
0
ファイル: payment.php プロジェクト: evilgeny/bob
<?php

require_once "../../init.php";
MC('Report_Payment')->generateReport();
コード例 #16
0
ファイル: edit_report.php プロジェクト: evilgeny/bob
<?php

if (!MC('User')->canEditReceipts(me())) {
    goU('receipts.list_real');
}
foreach ($_POST['data'] as $d) {
    if (!isNull($obReceipt = M('Purchase')->receipt()->loadRealById($d['id']))) {
        try {
            if (isset($d['delete'])) {
                $obReceipt->delete();
                continue;
            }
            $d['btime'] = (@$d['h'] ? $d['h'] : '') . ':' . (@$d['i'] ? $d['i'] : '') . ':00';
            $obReceipt->checked(@$d['bit_mask'] ? TRUE : FALSE);
            $map = qw2('h i bit_mask');
            foreach ($d as $name => $val) {
                if ((!empty($val) || empty($val) && $name == 'discount_real') && !in_array($name, $map)) {
                    $obReceipt->{$name} = $val;
                }
            }
            $obReceipt->save();
        } catch (RM_Validator_Exception $e) {
            $err = iterFirst($e->getResult()->getErrors());
            error(L('receipt.receipt') . ' ' . $obReceipt->number . ': ' . L('receipt.' . $err['code']) . ' ' . L('receipt.' . $err['place']));
        }
    }
}
コード例 #17
0
ファイル: question.php プロジェクト: evilgeny/bob
<?php

/*
	Show question
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
    goU('main');
}
if (isNull($obQuestion = M('Anketa')->loadQuestionById(p('qid')))) {
    error(L('anketa.no_such_question'));
    goU('anketa');
}
$obRespondent = $obQuestion->getAnketa()->loadRespondentById(p('rid'));
// check access to anketa
if (!MC('Anketa')->checkAccess($obRespondent)) {
    error(L('anketa.cannot_fill_for_other_user'));
    goU('main');
}
// create result, but don't save!
if (isNull($obResult = M('Anketa')->getResult($obQuestion->getAnketa(), $obRespondent))) {
    $obResult = M('Anketa')->createResult($obQuestion->getAnketa(), $obRespondent);
}
show("/anketa/question", array('obQuestion' => $obQuestion, 'obRespondent' => $obRespondent, 'obResult' => $obResult, 'admin' => 0));
コード例 #18
0
ファイル: index.php プロジェクト: evilgeny/bob
<?php

/**
 *	Show user family
 *
 * id	int		user identifier
 *
 */
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
    goU('main');
}
$user_id = p('user_id');
if (!$user_id || isNull($obUser = M('User')->loadUserById($user_id))) {
    goU('main');
}
if (!MC('User')->canAccessToViewProfile($obUser)) {
    goU('main');
}
show('user/person/index', array('action' => 'view', 'obUser' => $obUser, 'admin' => 1));
コード例 #19
0
ファイル: order_functions.php プロジェクト: bizonix/sailvan
/**
 * 根据SKU信息获取每日销售情况
 * @param string $sku
 * @return string
 * @author lzx
 */
function get_skudailystatus($sku)
{
    $dailystatus = MC("SELECT * FROM " . C('DB_PREFIX') . "sku_daily_status WHERE sku='{$sku}'", 900);
    return isset($dailystatus[0]) ? $dailystatus[0] : false;
}
コード例 #20
0
ファイル: edit.php プロジェクト: evilgeny/bob
<?php

/**
 *	Edit price distribution
 */
if ($list->id() != 7) {
    throw Exception(__FILE__ . 'Wrong report = ' . $list->id() . ' to edit!');
}
try {
    MC('Report_PriceDistribution')->editData($_POST);
} catch (RM_Validator_Exception $e) {
    $err = iterFirst($e->getResult()->getErrors());
    error(L('purchase.' . $err['code']));
}
コード例 #21
0
ファイル: delete.php プロジェクト: evilgeny/bob
<?php

require $_SERVER['ROOT_DIR'] . '/init.php';
if (!me()->id()) {
    goU('main');
}
$user_id = p('user_id');
if (!$user_id || isNull($obUser = M('User')->loadUserById($user_id))) {
    goU('main');
}
if (!MC('User')->canAccessToEditProfile($obUser)) {
    goU('main');
}
MC('User_Family')->deletePet(@$_GET['id']);
goU('user.pets', array('user_id' => $obUser->id()));
コード例 #22
0
ファイル: filtered.php プロジェクト: evilgeny/bob
<?php

/**
 *	Show report list
 *
 * id report id
 *
 */
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
    goU('main');
}
if (isset($_GET['report_id'])) {
    if (!isNull($list = M('List')->initList($_GET['report_id'], MC('List')->getAdditionalParams($_GET['report_id'])))) {
        if ($list->edit_script && isset($_REQUEST['edit'])) {
            include_once ROOT_DIR . '/www/' . $list->edit_script . '.php';
        }
        if ($list->delete_script && isset($_REQUEST['delete'])) {
            include_once ROOT_DIR . '/www/' . $list->delete_script . '.php';
        }
        $pageSize = $list->page_size ? $list->page_size : 20;
        /* @var $list RM_List_Object */
        $params = array();
        foreach ($list->getAllColumns() as $column) {
            if (isset($_GET[$column->filterVariable()])) {
                $params['filter_' . $column->id()] = $_GET[$column->filterVariable()];
            }
        }
        $params = array_merge($_GET, $params);
        $filter = array();
        foreach ($params as $k => $v) {
コード例 #23
0
ファイル: functions.php プロジェクト: bizonix/sailvan
/**
 * 根据提示码获取提示信息
 * string get_promptmsg ( string $msgNum, mixed var [, mixed ...] )
 * @param int $msgNum 提示信息编号
 * @param string $var 替换变量
 * @param .... 多变量扩展
 * @global $dbConn 数据库对象全局变量
 * @global $memc_obj 缓存对象全局变量
 * @return string
 * @author lzx
 */
function get_promptmsg($msgNum)
{
    $msgNum = intval($msgNum);
    $numargs = func_num_args();
    if ($numargs === 0) {
        return get_promptmsg(10004);
    }
    if ($msgNum === 0) {
        return get_promptmsg(10015);
    }
    $arg_list = func_get_args();
    $data = MC("SELECT errormsg FROM " . C('DB_PREFIX') . "prompt_msg WHERE id={$msgNum}", 1800);
    if (!isset($data[0]['errormsg'])) {
        return get_promptmsg(10016, $msgNum);
    }
    $arg_list[0] = $data[0]['errormsg'];
    if ($msgNum === 200 && $numargs === 1) {
        return preg_replace('/\\[\\%s\\]/', '', $arg_list[0]);
    }
    return call_user_func_array('sprintf', $arg_list);
}
コード例 #24
0
ファイル: Panelist.class.php プロジェクト: evilgeny/bob
 public function canLoadToExcel()
 {
     return MC('User')->canLoadToExcelPanelist(me());
 }
コード例 #25
0
ファイル: index.php プロジェクト: evilgeny/bob
<?php

/*
	Main interface for diagram.
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id() || !isset($_GET['type'])) {
    goU('main');
}
$diagram = MC('Diagram_' . $_GET['type']);
show("/diagram/index", array('diagram' => $diagram));
コード例 #26
0
ファイル: edit.php プロジェクト: evilgeny/bob
<?php

if (!MC('User')->canEditReceipts(me())) {
    goU('report.purchase');
}
foreach ($_POST['data'] as $d) {
    if (!isNull($obPurchase = M('Purchase')->loadPurchaseById($d['id']))) {
        if ($obPurchase->is_deleted) {
            continue;
        }
        try {
            if (isset($d['barcode_change']) && $d['barcode_change']) {
                if (MC('Report_Purchase')->canChangeBarcode(me())) {
                    if ($d['barcode_change'] == 1) {
                        $d['barcode_value'] = M('Barcode')->getFakeBarcode()->value;
                    }
                    if ($d['barcode_change'] == 2 && ($obBarcode = $obPurchase->getBarcode(TRUE))) {
                        $obBarcodeSplited = M('Barcode')->splitBarcode($obBarcode, $d['corrected_name'], array($d['id']));
                        $d['barcode_value'] = $obBarcodeSplited->value;
                        list($purchaseQuery, $priceQuery) = M('Purchase')->move()->getQueriesForMovement($current['barcode_value'], $obBarcodeSplited, array($current['purchase_id']));
                        $purchaseQuery->execute();
                        $priceQuery->addToAsyncQueue();
                    }
                }
                unset($d['barcode_change']);
            }
            foreach ($d as $name => $val) {
                if (!empty($val)) {
                    $obPurchase->{$name} = $val;
                }
            }
コード例 #27
0
ファイル: index.php プロジェクト: evilgeny/bob
<?php

/*
	View user anketa by admin
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
    goU('main');
}
if (isNull($obUser = M('User')->loadUserById(p('user_id')))) {
    error(L('common.no_such_user'));
    goU('main');
}
// check access to anketa of this user
if (!MC('User')->checkAnketaAccess($obUser)) {
    goU('main');
}
show("/anketa/index", array('obUser' => $obUser, 'admin' => 1));
コード例 #28
0
ファイル: delete.php プロジェクト: evilgeny/bob
<?php

/*
	Delete barcode by id.

	@param		int			id			barcode id
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!MC('User')->checkAccessToCoding(me())) {
    goU('main');
}
if (MC('User')->canDeleteBarcode(me())) {
    if (isNull($obBarcode = M('Barcode')->loadBarcodeById(@$_GET['id']))) {
        error('barcode.no_such_barcode');
    } else {
        if ($obBarcode->delete()) {
            goU('report.barcode');
        } else {
            error(L('barcode.cannot_delete_barcode'));
        }
    }
}
goU('barcode', NULL, array('id' => @$_GET['id']));
コード例 #29
0
ファイル: all.php プロジェクト: evilgeny/bob
<?php

/*
	List of all reports.
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
    qoU('main');
}
if (!MC('User')->checkAccessReportList(me())) {
    goU('main');
}
show("/reports/all", array('page_size' => 20, 'page' => p('page')));
コード例 #30
0
ファイル: view.php プロジェクト: evilgeny/bob
<?php

/*
	View own anketa result
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
    goU('main');
}
if (isNull($obAnketa = M('Anketa')->loadAnketaById(p('aid')))) {
    error(L('anketa.no_such_anketa'));
    goU('anketa');
}
$obRespondent = $obAnketa->loadRespondentById(p('rid'));
// check access to anketa
if (!MC('Anketa')->checkAccess($obRespondent)) {
    error(L('anketa.not_your_family'));
    goU('anketa');
}
show("/anketa/view", array('obAnketa' => $obAnketa, 'obRespondent' => $obRespondent, 'obUser' => MC('Anketa')->getRealUser($obRespondent), 'admin' => 0));