Пример #1
0
 public function default_value($list)
 {
     global $_M;
     if ($list['id']) {
         $product = $this->get_product($list['id']);
         $list['plist'] = jsonencode($this->get_plist($list['id']));
         $list['paralist'] = $product['paralist'];
         $list['logistic'] = $product['logistic'];
         $list['price'] = $product['price'];
         $list['stock'] = $product['stock'];
         $list['original'] = $product['original'] > 0 ? $product['original'] : '';
         $list['freight_mould'] = $product['freight_mould'];
         $list['freight'] = $product['freight'];
         $list['purchase'] = $product['purchase'];
         $list['lnvoice'] = $product['lnvoice'];
         $list['message'] = $product['message'];
         $list['user_discount'] = $product['user_discount'];
         $list['freight_type'] = 2;
         if (!$list['logistic']) {
             $list['freight_type'] = 0;
         }
         if ($list['freight_mould']) {
             $list['freight_type'] = 1;
         }
     } else {
         $list['freight'] = '0.00';
         $list['freight_type'] = 2;
         $list['purchase'] = 0;
         $list['user_discount'] = 1;
         $list['lnvoice'] = 0;
     }
     return $list;
 }
Пример #2
0
 public function dogetfile()
 {
     global $_M;
     $filearray = traversal(PATH_WEB . '/upload/', 'jpg|png|gif|jpeg|bmp', '((\\/upload\\/[0-9]{6}\\/thumb)|(\\/upload\\/[0-9]{6}\\/thumb_dis)|(\\/upload\\/[0-9]{6}\\/watermark)|(\\/upload\\/thumb_src)|(\\/upload\\/files)|(\\/upload\\/images)|(\\/upload\\/_thumb))');
     //_thumbs
     foreach ($filearray as $val) {
         $img_info = getimagesize(PATH_WEB . $val);
         $img_name = pathinfo(PATH_WEB . $val);
         $info['name'] = $img_name['basename'];
         $info['path'] = $val;
         $info['value'] = '..' . $val;
         $info['x'] = $img_info[0];
         $info['y'] = $img_info[1];
         $info['time'] = filemtime(PATH_WEB . $val);
         $array[] = $info;
     }
     $arrays = arr_sort($array, 'time', SORT_DESC);
     echo jsonencode($arrays);
 }
syntaxmodels($rowsarray, $numberofwords, $category, $funcion, $case, $wordorder, $addedword);
//6. We check the syntax models
typeassignation($numberofwords, $type, $subtype);
//7. We assign gender to variable type
typeverb($numberofwords, $type, $subtype, $prefix);
//8. We clasified verbs
capitalizedsubstantives($numberofwords, $category, $word, $message);
errordetection($numberofwords, $word, $case, $type, $cword);
//9. We check declination concordances on articles
genderconrcondances($numberofwords, $category, $genero, $case, $type, $neworder, $wordorder, $spanish, $word, $cword, $message);
//10. Translate genders to the target language
reordersyntaxtargetlanguage($numberofwords, $neworder, $addedword, $spanish);
//11. We reorder the sentences by the syntax order for the target language
conjugationconcordances($numberofwords, $category, $word, $person);
//12. We check conjugation concordances
jsonencode($message);
//13. Function to send results
erasememorycloseconnection($numberofwords, $result);
//14. Erase memory and close connection
function countwords(&$numberofwords, &$array)
{
    //3. The number of words are counted and the values are saved in a variable.
    $numberofwords = count($array);
    //We count the number of words
    if ($numberofwords >= 10) {
        $numberofwords = 10;
        // We establish a limit of 10 words
        // }else { $message[3]="number of words is $numberofwords";
    }
}
function openandselectdatabase($username, $password, $db)
//5. We check every word in the database
syntaxmodels($rowsarray, $numberofwords, $category, $funcion, $case, $wordorder, $addedword);
//6. We check the syntax models
typeassignation($numberofwords, $type, $subtype);
//7. We assign gender to variable type
typeverb($numberofwords, $type, $subtype, $prefix);
//8. We clasified verbs
errordetection($numberofwords, $word, $case, $type, $cword);
//9. We check declination concordances on articles
genderconrcondances($numberofwords, $category, $genero, $case, $type, $type2, $neworder, $wordorder, $spanish);
//10. Translate genders to the target language
reordersyntaxtargetlanguage($numberofwords, $neworder, $addedword, $spanish);
//11. We reorder the sentences by the syntax order for the target language
conjugationconcordances($numberofwords, $category, $word, $person);
//12. We check conjugation concordances
jsonencode($spanish);
//13. Function to send results
erasememorycloseconnection($numberofwords, $result);
//14. Erase memory and close connection
function countwords(&$numberofwords, &$array)
{
    //3. The number of words are counted and the values are saved in a variable.
    $numberofwords = count($array);
    //We count the number of words
    if ($numberofwords >= 10) {
        $numberofwords = 10;
    }
    // We establish a limit of 10 words
}
function openandselectdatabase($username, $password, $db)
{
Пример #5
0
 function column_json($module, $type)
 {
     $array = $this->column(3, $module);
     $metinfo = array();
     $i = 0;
     if ($type) {
         $metinfo['citylist'][$i]['p']['name'] = '选择栏目';
         $metinfo['citylist'][$i]['p']['value'] = '';
     } else {
         $metinfo['citylist'][$i]['p'] = '所有栏目';
     }
     foreach ($array['class1'] as $key => $val) {
         //一级级栏目
         if ($val['module'] == $module) {
             $i++;
             $metinfo['citylist'][$i]['p']['name'] = $val[name];
             $metinfo['citylist'][$i]['p']['value'] = $val[id];
             if (count($array['class2'][$val[id]])) {
                 //二级栏目
                 $metinfo['citylist'][$i]['c'][0]['n']['name'] = '二级栏目';
                 $metinfo['citylist'][$i]['c'][0]['n']['value'] = ' ';
                 $k = 1;
                 foreach ($array['class2'][$val[id]] as $key => $val2) {
                     $metinfo['citylist'][$i]['c'][$k]['n']['name'] = $val2[name];
                     $metinfo['citylist'][$i]['c'][$k]['n']['value'] = $val2[id];
                     if (count($array['class3'][$val2[id]])) {
                         //三级栏目
                         $metinfo['citylist'][$i]['c'][$k]['a'][0]['s']['name'] = '三级栏目';
                         $metinfo['citylist'][$i]['c'][$k]['a'][0]['s']['value'] = ' ';
                         $j = 1;
                         foreach ($array['class3'][$val2[id]] as $key => $val3) {
                             $metinfo['citylist'][$i]['c'][$k]['a'][$j]['s']['name'] = $val3[name];
                             $metinfo['citylist'][$i]['c'][$k]['a'][$j]['s']['value'] = $val3[id];
                             $j++;
                         }
                     }
                     $k++;
                 }
             }
         }
     }
     echo jsonencode($metinfo);
 }
Пример #6
0
 public function dopos()
 {
     global $_M;
     $metinfo['citylist'][0]['p']['name'] = '全局';
     $metinfo['citylist'][0]['p']['value'] = 0;
     $metinfo['citylist'][0]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][0]['c'][0]['n']['value'] = 0;
     $metinfo['citylist'][1]['p']['name'] = '首页';
     $metinfo['citylist'][1]['p']['value'] = 1;
     $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND pos = '0' ORDER BY no_order DESC,id DESC ";
     $max_order = DB::get_one($query);
     $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
     $metinfo['citylist'][1]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][1]['c'][0]['n']['value'] = $max_order['id'];
     $metinfo['citylist'][2]['p']['name'] = '列表页';
     $metinfo['citylist'][2]['p']['value'] = 2;
     $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1') ORDER BY no_order DESC,id DESC ";
     $max_order = DB::get_one($query);
     $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
     $metinfo['citylist'][2]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][2]['c'][0]['n']['value'] = $max_order['id'];
     $metinfo['citylist'][3]['p']['name'] = '详细页';
     $metinfo['citylist'][3]['p']['value'] = 3;
     $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1' OR pos='2') ORDER BY no_order DESC,id DESC ";
     $max_order = DB::get_one($query);
     $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0;
     $metinfo['citylist'][3]['c'][0]['n']['name'] = '首项';
     $metinfo['citylist'][3]['c'][0]['n']['value'] = $max_order['id'];
     $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id";
     $tems = DB::get_all($query);
     foreach ($tems as $key => $val) {
         $val['pos'] = $val['pos'];
         $tem = array();
         $tem['n']['name'] = $val['valueinfo'];
         $tem['n']['value'] = $val['id'];
         $metinfo['citylist'][$val['pos']]['c'][] = $tem;
     }
     echo jsonencode($metinfo);
 }
Пример #7
0
 public function dohome()
 {
     global $_M;
     /*获取统计数据*/
     function statime($ymd, $day = '')
     {
         $day = $day == '' ? time() : strtotime($day);
         $time = strtotime(date($ymd, $day));
         return $time;
     }
     $stat = array();
     for ($i = 1; $i <= 5; $i++) {
         $stats = $i == 1 ? statime("Y-m-d") : statime("Y-m-d", 0 - $i + 1 . " day");
         $query = "select * from {$_M[table][visit_summary]} WHERE stattime ='{$stats}'";
         $stat[$i] = DB::get_one($query);
         if (!$stat[$i]) {
             $stat[$i]['pv'] = 0;
             $stat[$i]['alone'] = 0;
             $stat[$i]['ip'] = 0;
         }
         $stat[$i]['day'] = date('Y-m-d', $stats);
         if ($i == 1) {
             $stat[$i]['day'] = $_M['word']['today'];
         }
         if ($i == 2) {
             $stat[$i]['day'] = $_M['word']['yesterday'];
         }
     }
     /*图表数据*/
     $dm = date('H', time());
     $dt = $dm - 8;
     $dt = $dt < 0 ? $dt + 24 : $dt;
     for ($i = 0; $i <= 23; $i++) {
         if ($i <= $dm && $i >= $dt) {
             $d = $i < 10 ? '0' . $i : $i;
             $chartdata['labels'][] = "{$d}:59";
         }
     }
     $chartcolor[0] = "#23b7e5";
     $chartcolor[1] = "#7266ba";
     $chartcolor[2] = "#23ad44";
     foreach ($chartcolor as $key => $val) {
         $chartdata['datasets'][$key]['fillColor'] = $val;
         $chartdata['datasets'][$key]['strokeColor'] = $val;
         $chartdata['datasets'][$key]['pointColor'] = $val;
         $chartdata['datasets'][$key]['pointStrokeColor'] = '#fff';
     }
     $nowcrt = explode("|", $stat[1]['parttime']);
     $i = 0;
     foreach ($nowcrt as $val) {
         if ($i <= $dm && $i >= $dt) {
             $aowcrt = '';
             if ($val) {
                 $aowcrt = explode("-", $val);
                 $val = array();
                 $val[0] = $aowcrt[0];
                 $val[1] = $aowcrt[1];
                 $val[2] = $aowcrt[2];
             } else {
                 $val[0] = 0;
                 $val[1] = 0;
                 $val[2] = 0;
             }
             $chartdata['datasets'][0]['data'][] = $val[0];
             $chartdata['datasets'][1]['data'][] = $val[1];
             $chartdata['datasets'][2]['data'][] = $val[2];
         }
         $i++;
     }
     $chartdata = jsonencode($chartdata);
     /*我的应用*/
     $query = "select * from {$_M['table']['admin_column']} where bigclass='44'";
     $app_in = DB::get_all($query);
     $privilege = background_privilege();
     require $this->template('tem/home');
 }
Пример #8
0
function jsoncallback($back, $callback = 'callback')
{
    global $_M;
    header('Content-type: application/x-javascript');
    $callback = $_M['form'][$callback];
    if ($callback) {
        echo $callback . '(' . jsonencode($back) . ')';
    } else {
        echo jsonencode($back);
    }
}
Пример #9
0
<?php

echo jsonencode($_POST['calculo'] * 3);
Пример #10
0
 /**
  * 上传文件
  * @return json   		 					返回成功或失败信息,成功有路径,失败有错误信息,不过要通过json解析
  */
 public function doupimg()
 {
     global $_M;
     $infoarray = array('formname', 'savepath', 'format', 'maxsize', 'is_rename', 'is_overwrite');
     $info = copykey($_M['form'], $infoarray);
     $back = $this->upimg($info);
     $imgpath = explode('../', $back['path']);
     $img_info = getimagesize(PATH_WEB . $imgpath[1]);
     $img_name = pathinfo(PATH_WEB . $imgpath[1]);
     $back['name'] = $img_name['basename'];
     $back['path'] = $imgpath[1];
     $back['x'] = $img_info[0];
     $back['y'] = $img_info[1];
     echo jsonencode($back);
 }
Пример #11
0
 /**
  * 获取语言参数,存放在$_M['word'],网站设置数组
  * @param string $lang    需要获取语言参数的语言
  * @param int    $site    获取语言参数位置,1:后台语言,2:前台语言
  */
 protected function load_word($lang, $site)
 {
     global $_M;
     $query = "SELECT * FROM {$_M['table']['language']} WHERE lang='{$lang}' AND site='{$site}'";
     $result = DB::query($query);
     while ($listlang = DB::fetch_array($result)) {
         $_M['word'][$listlang['name']] = trim($listlang['value']);
     }
     $langtype = $site ? 'admin_' : '';
     $json_cache = PATH_CACHE . 'lang_json_' . $langtype . $lang . '.php';
     file_put_contents($json_cache, jsonencode($_M['word']));
 }