Ejemplo n.º 1
0
 function addonlineapplication()
 {
     $config['upload_path'] = "uploads/onlineapplicants/";
     $config['allowed_types'] = "gif|jpg|jpeg|png";
     $config['max_size'] = "5000";
     $config['max_width'] = "1907";
     $config['max_height'] = "1280";
     $this->load->library('upload', $config);
     //$this->upload->initialize($config);
     if (!$this->upload->do_upload('photo')) {
         echo $this->upload->display_errors();
     } else {
         $data = $this->upload->data();
         $this->records = array('namebangla' => $this->input->post('namebangla', true), 'nameenglish' => $this->input->post('nameenglish', true), 'fathernamebangla' => $this->input->post('fathernamebangla', true), 'fathernameenglish' => $this->input->post('fathernameenglish', true), 'mothernamebangla' => $this->input->post('mothernamebangla', true), 'mothernameenglish' => $this->input->post('mothernameenglish', true), 'birthdate' => $this->input->post('birthdate', true), 'mobileno' => $this->input->post('mobileno', true), 'permanentaddress' => $this->input->post('permanentaddress', true), 'presentaddress' => $this->input->post('presentaddress', true), 'othersgurdian' => $this->input->post('othersgurdian', true), 'relation' => $this->input->post('relation', true), 'othersgurdianpermanentaddress' => $this->input->post('othersgurdianpermanentaddress', true), 'othersgurdianpresentaddress' => $this->input->post('othersgurdianpresentaddress', true), 'gurdianmobileno' => $this->input->post('gurdianmobileno', true), 'nationality' => $this->input->post('nationality', true), 'gender' => $this->input->post('gender', true), 'religion' => $this->input->post('religion', true), 'stdgroup' => $this->input->post('stdgroup', true), 'class' => $this->input->post('class', true), 'section' => $this->input->post('section', true), 'photo' => $data['file_name'], 'isActive' => 1);
         $this->results = $this->common_model->insertRecords($this->common_model->_applicants, $this->records);
         if ($this->results) {
             //$x = "Test Success";
             $this->status['status'] = 1;
             $this->status['msg'] = "Applicant";
         } else {
             //$x = "Test Fail";
             $this->status['status'] = 0;
             $this->status['msg'] = "Something went wrong when saving the file, please try again.";
         }
         echo jsonEncode($this->status);
         //echo jsonEncode(array('success' => $x));
     }
 }
Ejemplo n.º 2
0
 public function Set()
 {
     $path = get('path', 'txt');
     $data = get('data');
             $data = (strlen($data) <= 5) ? (($data == 'true') ? true : (($data == 'false') ? false : $data)) : $data;
             exit(jsonEncode(ini($path, $data)));
 }
Ejemplo n.º 3
0
function jsonEncode($obj)
{
    switch (true) {
        case is_array($obj):
            if (is_associative($obj)) {
                $arr_out = array();
                foreach ($obj as $key => $val) {
                    $arr_out[] = '"' . $key . '" : ' . jsonEncode($val);
                }
                return "{\n  " . implode(",\n  ", $arr_out) . "\n}";
            }
            $arr_out = array();
            $ct = count($obj);
            for ($j = 0; $j < $ct; $j++) {
                $arr_out[] = jsonEncode($obj[$j]);
            }
            return '[' . implode(',', $arr_out) . ']';
        case is_int($obj):
            return $obj;
        case is_bool($obj):
            return $obj ? 'true' : 'false';
        default:
            $str_out = stripslashes(trim($obj));
            $str_out = str_replace(array('"', '', '/', "\r", "\n"), array('\\"', "\\", '/', '', '\\n'), $str_out);
            return '"' . $str_out . '"';
    }
}
Ejemplo n.º 4
0
 function Ajax()
 {
     $fid = get('fid', 'txt');
     $wd = get('wd', 'txt');
     $result = logic('isearcher')->Search($fid, $wd);
     exit(jsonEncode($result));
 }
 function getVehicleModelByID($id, $session)
 {
     if (isLogin($session)) {
         $jsonObj = new stdClass();
         $jsonObj->ID = 1001;
         $data['encoded_data'] = jsonEncode($jsonObj);
         $this->load->view('json', $data);
     }
 }
Ejemplo n.º 6
0
function errorOccurred($num, $str, $file, $line)
{
    $err = array('yError' => "{$str}. \n File: {$file} \n Line: {$line}");
    if (function_exists('jsonEncode')) {
        echo jsonEncode($err);
    } else {
        echo $err['yError'];
    }
    exit;
}
 public function doLogin()
 {
     if ($this->username == "admin" && $this->password == "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918") {
         $session_id = $this->setSession($this->username);
         $jsonReq = array("session" => $session_id, "prkey" => time());
         echo jsonEncode($jsonReq);
     } else {
         echo '{"session":"@@@"}';
     }
 }
Ejemplo n.º 8
0
 public function Get()
 {
     $path = get('path', 'txt');
             list($search, $field) = explode('/', $path);
     list($sWhere, $sTable) = explode('@', $search);
     list($sField, $sValue) = explode(':', $sWhere);
     $sql = 'SELECT `'.$field.'` FROM '.table($sTable).' WHERE '.$sField.'='.(is_numeric($sValue) ? $sValue : '"'.$sValue.'"');
     $result = dbc()->Query($sql)->GetRow();
     exit(jsonEncode($result[$field]));
 }
Ejemplo n.º 9
0
 /**
  * rmp营销网首页提醒
  */
 function notice()
 {
     $return = array('status' => 0, 'msg' => '');
     if ($this->user['userRole'] != 1) {
         echo jsonEncode($return);
         exit;
     }
     //查询条件
     $where = array('isDel' => 0, 'status' => 1);
     //年份
     $year = $this->config->item('nowYear');
     $year && ($where['year'] = $year);
     //时段
     //$timeUnit = (int)$this->input->get('timeUnit');
     //查询项目数据
     $this->load->model('projectModel');
     $proList = $this->projectModel->getNewList($where, NULL, NULL, '', 'proId desc');
     //查询专营店项目数据
     $this->load->model('storeProModel');
     $storeProList = $this->storeProModel->getProListKeyProId($this->user['userId']);
     //筛选出各审核状态的数据
     $list1 = array();
     $list2 = array();
     $list3 = array();
     foreach ($proList as $v) {
         $v['proId'] = (int) $v['proId'];
         if (isset($storeProList[$v['proId']])) {
             $storeProData = $storeProList[$v['proId']];
             if ($storeProData['auditRs'] == -1) {
                 //未提交
                 $list1[] = $v;
             } else {
                 if ($storeProData['auditRs'] == 0) {
                     //待审核
                     $v['storeData'] = $storeProData;
                     $list2[] = $v;
                 } else {
                     //已审核
                     $v['storeData'] = $storeProData;
                     $list3[] = $v;
                 }
             }
         } else {
             $list1[] = $v;
         }
     }
     if ($list1) {
         $return['status'] = 1;
         $return['msg'] = 'RMP端执行反馈系统有新的反馈内容需要填写';
         echo jsonEncode($return);
         exit;
     }
     echo jsonEncode($return);
     exit;
 }
Ejemplo n.º 10
0
 /**
  * 载入报表类型json数据
  */
 function loadReportList()
 {
     $fundType = (int) $this->input->post('fundType');
     require_once APPPATH . 'libraries/JSON.php';
     $list = array();
     $list[] = array('key' => '', 'value' => '请选择');
     if (isset($this->reportList[$fundType])) {
         foreach ($this->reportList[$fundType] as $k => $v) {
             $list[] = array('key' => $k, 'value' => $v);
         }
     }
     echo jsonEncode($list);
     exit;
 }
Ejemplo n.º 11
0
 public function editprofileajax()
 {
     $this->id = $this->input->post('id', true);
     $this->where = array('id' => $this->id);
     $this->records = array('password' => $this->input->post('password', true));
     $this->results = $this->common_model->updateRecords($this->common_model->_usersTable, $this->records, $this->where);
     if ($this->results == 1) {
         $this->status['status'] = 1;
         $this->status['msg'] = "Password";
     } else {
         $this->status['status'] = 0;
         $this->status['msg'] = "Something went wrong when saving the file, please try again.";
     }
     echo jsonEncode($this->status);
 }
Ejemplo n.º 12
0
 public function Get()
 {
     $path = get('path', 'txt');
             list($search, $lgName) = explode('@', $path);
     list($sParm, $lgFunc) = explode('~', $search);
     $logic = logic($lgName);
     if (method_exists($logic, $lgFunc))
     {
         $r = $logic->$lgFunc('get', $sParm);
     }
     else
     {
         $r = false;
     }
     exit(jsonEncode($r));
 }
Ejemplo n.º 13
0
	function Main()
	{
		$class = get('class')=='mail'?'mail':'sms';
				$runx = 13;
		$pause = 60;
		$MT = ini('service.push.mthread');
		if ($MT || $class == 'sms')
		{
			$runx = 30;
			$pause = 10;
		}
		logic('push')->run($runx, $class);
		echo jsonEncode(array(
			'extend' => ($class=='sms'?'mail':'sms'),
			'interval' => $pause
		));
				$this->extend();

		exit;
	}
Ejemplo n.º 14
0
function jsonEncode($var)
{
    if (function_exists('json_encode')) {
        return json_encode($var);
    } else {
        switch (gettype($var)) {
            case 'boolean':
                return $var ? 'true' : 'false';
                // Lowercase necessary!
            // Lowercase necessary!
            case 'integer':
            case 'double':
                return $var;
            case 'resource':
            case 'string':
                return '"' . str_replace(array("\r", "\n", "<", ">", "&"), array('\\r', '\\n', '\\x3c', '\\x3e', '\\x26'), addslashes($var)) . '"';
            case 'array':
                // Arrays in JSON can't be associative. If the array is empty or if it
                // has sequential whole number keys starting with 0, it's not associative
                // so we can go ahead and convert it as an array.
                if (empty($var) || array_keys($var) === range(0, sizeof($var) - 1)) {
                    $output = array();
                    foreach ($var as $v) {
                        $output[] = jsonEncode($v);
                    }
                    return '[ ' . implode(', ', $output) . ' ]';
                }
                // Otherwise, fall through to convert the array as an object.
            // Otherwise, fall through to convert the array as an object.
            case 'object':
                $output = array();
                foreach ($var as $k => $v) {
                    $output[] = jsonEncode(strval($k)) . ': ' . jsonEncode($v);
                }
                return '{ ' . implode(', ', $output) . ' }';
            default:
                return 'null';
        }
    }
}
Ejemplo n.º 15
0
 function contactajax()
 {
     error_reporting(0);
     $data['settings'] = $this->settings_model->getSettings();
     $ad = $data['settings'][0];
     $instituteemail = $ad['instituteemail'];
     $fullname = $this->input->post('fullname', true);
     $mobileno = $this->input->post('mobileno', true);
     $email = $this->input->post('email', true);
     $subject = $this->input->post('subject', true);
     $message = $this->input->post('message', true);
     $msg = "Name:" . $fullname . "\n" . "Contact Number:" . $mobileno . "\n" . "Message:" . $message;
     //$receiverEmail = "*****@*****.**";
     //$to = "*****@*****.**";
     $to = $instituteemail;
     //$subject = "Test mail";
     if ($subject) {
         $subject = $subject;
     } else {
         $subject = "Contact Form";
     }
     //$message = "Hello! This is a simple email message.";
     $message = $msg;
     //$from = "*****@*****.**";
     $from = $email;
     $headers = "From:" . $from;
     $send = @mail($to, $subject, $message, $headers);
     if ($send) {
         $this->status['status'] = 1;
         $this->status['msg'] = "আমাদের সাথে যোগাযোগ করার জন্য আপনাকে ধন্যবাদ";
     } else {
         $this->status['status'] = 0;
         $this->status['msg'] = "Something went wrong sending contact information.";
     }
     echo jsonEncode($this->status);
 }
Ejemplo n.º 16
0
	KindEditor.ready(function(K) {
		var uploadbutton_<?php 
    echo $itemId;
    ?>
 = K.uploadbutton({
			button : K('#imgUpload<?php 
    echo $itemId;
    ?>
')[0],
			fieldName : 'imgFile',
			url : '<?php 
    echo $uploadUrl;
    ?>
',
			extraParams:<?php 
    echo $extraParams ? jsonEncode($extraParams) : jsonEncode(array());
    ?>
,
			afterUpload : function(data) {
				layer.closeAll('loading'); //关闭加载层
				if (data.error === 0) {
					if ($("#imgUpload<?php 
    echo $itemId;
    ?>
Download").length > 0) {
						var url = K.formatUrl(data.url, 'absolute');
						var html = '<a role="button" aria-label="Left Align" href="index.php?c=Upload&m=download&fileId='+data.fileId+'" class="btn btn-default" type="button"><span aria-hidden="true" class="glyphicon glyphicon-download-alt"></span>附件下载</a>';
						$("#imgUpload<?php 
    echo $itemId;
    ?>
Download").html(html);
Ejemplo n.º 17
0
 function Iframe()
 {
 	$field = get('field', 'txt');
     $result = logic('upload')->Save($field, false, false);
     if (isset($result['error']) && $result['error'])
     {
         $ops = array(
             'status' => 'fails',
             'msg' => $result['msg']
         );
     }
     else
     {
         $ops = array(
             'status' => 'ok',
             'file' => $result
         );
     }
     exit('<script type="text/javascript">window.parent.ups_Result('.jsonEncode($ops).');</script>');
 }
Ejemplo n.º 18
0
// ***********************
// SALLES
// ***********************
// !!!! Pas encore à jour avec la nouvelle version d'ADE !!!!
$json = json_decode(file_get_contents("../dictionaries/rooms.json"), TRUE);
$listeRooms = $json["rooms"];
foreach ($listeRooms as $ics) {
    $json = icsToArray("../../cache/ics/{$ics['nom']}.ics");
    $calendrier = array();
    if (isset($json)) {
        foreach ($json as $event) {
            if ($event["BEGIN"] == "VEVENT") {
                $dateEvent = date("z", strtotime($event["DTSTART"]));
                if ($dateEvent >= $aujourdhui && $dateEvent < $aujourdhui + 4) {
                    $enCours = array();
                    $enCours["DEBUT"] = strtotime($event["DTSTART"]);
                    $enCours["FIN"] = strtotime($event["DTEND"]);
                    $enCours["JOUR"] = date("z", strtotime($event["DTSTART"]));
                    $enCours["NOM"] = ucfirst($event["SUMMARY"]);
                    $enCours["SECTION"] = preg_replace("#Etudiant : ([A-Z0-9]+) .+#", '$1', $event["DESCRIPTION"]);
                    if (preg_match("#nEnseignants #", $enCours["SECTION"])) {
                        $enCours["SECTION"] = "";
                    }
                    $calendrier[] = $enCours;
                }
            }
        }
        usort($calendrier, "triDate");
        file_put_contents("../../cache/json/{$ics['nom']}.json", jsonEncode($calendrier));
    }
}
Ejemplo n.º 19
0
資料</span></h1>
 <div class="pidding_5">
  <table cellspacing="0" cellpadding="0" class="Admin_L">
    <tr>
      <th class="T_title" scope="col" width="150"><?php 
echo $classStr;
?>
資料</th>
      <th class="T_title" scope="col" colspan="7">&nbsp;</th>
    </tr>
	<?php 
include $_GET['type'] . '/' . $className . '.form.php';
?>
    <tr class="Ls2">
      <td class="N_title">&nbsp;</td>
      <td class="N_title" colspan="7"><input class="sub2" type="submit" value="送出表單"></td>
    </tr>
  </table>
  </div>
</form>
<?php 
if ($info) {
    ?>
<script>
editFun(<?php 
    echo jsonEncode($info);
    ?>
);
</script>
<?php 
}
Ejemplo n.º 20
0
 function prune($ids = false, $user_id = false)
 {
     if (is_array($ids)) {
         $sql = 'SELECT us_id AS US_ID, us_elements AS US_ELEMENTS ' . 'FROM user_slideshows ' . 'WHERE us_u_id = ' . intval($user_id) . ' ';
         $data = $this->dbh->query_all($sql);
         //loop through each slideshow
         foreach ($data as $k => $v) {
             $update = false;
             $elements = jsonDecode($v['US_ELEMENTS']);
             // loop through the elements array
             // if $v['photoId_int'] is in the ids array
             // then unset that element
             if (is_array($elements)) {
                 foreach ($elements as $k_element => $v_element) {
                     if (in_array($v_element['photoId_int'], $ids)) {
                         // delete this element from the data array
                         unset($elements[$k_element]);
                         $update = true;
                     }
                 }
             }
             if ($update === true) {
                 //rewrite this slideshow
                 $elements = jsonEncode($elements);
                 $sql = 'UPDATE user_slideshows ' . 'SET us_elements = ' . $this->dbh->sql_safe($elements) . ' ' . 'WHERE us_id = ' . intval($v['US_ID']) . ' ';
                 $this->dbh->execute($sql);
             }
         }
     } else {
         $sql = 'SELECT us_elements AS US_ELEMENTS ' . 'FROM user_slideshows ' . 'WHERE us_d_id = ' . intval($user_id) . ' ';
         $data = $this->dbh->query_all($sql);
         //loop through each slideshow
         foreach ($data as $k => $v) {
             $update = false;
             $elements = jsonDecode($v['US_ELEMENTS']);
             // loop through the elements array
             // if $v['photoId_int'] is in the ids array
             // then unset that element
             if (is_array($elements)) {
                 foreach ($elements as $k_element => $v_element) {
                     if ($v_element['photoId_int'] == $id) {
                         unset($elements[$k_element]);
                         $update = true;
                     }
                 }
             }
             if ($update === true) {
                 //rewrite this slideshow
                 $elements = jsonEncode($elements);
                 $sql = 'UPDATE user_slideshows ' . 'SET us_elements = ' . $this->dbh->sql_safe($elements) . ' ' . 'WHERE us_id = ' . intval($v['US_ID']) . ' ';
                 $this->dbh->execute($sql);
             }
         }
     }
 }
Ejemplo n.º 21
0
 public function sendnotification()
 {
     error_reporting(0);
     $absencenotify = $this->input->post('absencenotify', true);
     $message = $this->input->post('message', true);
     foreach ($absencenotify as $absencenot) {
         $absencesep = explode("_", $absencenot);
         $stdid = $absencesep[0];
         $contact = $absencesep[1];
         if ($absencesep) {
             $s[] = array('studentabid' => $stdid, 'absencedate' => now());
             sendSms($message, $contact);
         }
     }
     $res = $this->common_model->insertBatch($this->common_model->_absence, $s);
     if ($res) {
         $this->status['status'] = 1;
         $this->status['msg'] = "Absence Notifyer Worked Fine";
     } else {
         $this->status['status'] = 0;
         $this->status['msg'] = "There is no student in this group. Please add student in this group.";
     }
     echo jsonEncode($this->status);
 }
Ejemplo n.º 22
0
         $_REQUEST['filter'] = delFilterTerm($_REQUEST['filter'], $_REQUEST['line']);
     }
 } elseif (canEdit('Events')) {
     if (!empty($_REQUEST['execute'])) {
         $tempFilterName = "_TempFilter" . time();
     }
     if (isset($tempFilterName)) {
         $filterName = $tempFilterName;
     } elseif (!empty($_REQUEST['newFilterName'])) {
         $filterName = $_REQUEST['newFilterName'];
     }
     if (!empty($filterName)) {
         $_REQUEST['filter']['sort_field'] = validStr($_REQUEST['sort_field']);
         $_REQUEST['filter']['sort_asc'] = validStr($_REQUEST['sort_asc']);
         $_REQUEST['filter']['limit'] = validInt($_REQUEST['limit']);
         $sql = "replace into Filters set Name = " . dbEscape($filterName) . ", Query = " . dbEscape(jsonEncode($_REQUEST['filter']));
         if (!empty($_REQUEST['autoArchive'])) {
             $sql .= ", AutoArchive = " . dbEscape($_REQUEST['autoArchive']);
         }
         if (!empty($_REQUEST['autoVideo'])) {
             $sql .= ", AutoVideo = " . dbEscape($_REQUEST['autoVideo']);
         }
         if (!empty($_REQUEST['autoUpload'])) {
             $sql .= ", AutoUpload = " . dbEscape($_REQUEST['autoUpload']);
         }
         if (!empty($_REQUEST['autoEmail'])) {
             $sql .= ", AutoEmail = " . dbEscape($_REQUEST['autoEmail']);
         }
         if (!empty($_REQUEST['autoMessage'])) {
             $sql .= ", AutoMessage = " . dbEscape($_REQUEST['autoMessage']);
         }
Ejemplo n.º 23
0
 public function deletegalleryajax()
 {
     $this->id = $this->uri->segment(2);
     //var_dump($this->id);
     if ($this->id) {
         $this->where = array('galleryid' => $this->id);
         $this->isDelete = $this->common_model->deleteRecords($this->common_model->_galleries, $this->where);
         //var_dump($this->isDelete);exit;
         if ($this->isDelete) {
             $this->status['status'] = 1;
             $this->status['msg'] = "Gallery is deleted.";
         } else {
             $this->status['status'] = 0;
             $this->status['msg'] = "An error occur, try again later.";
         }
     } else {
         /* Return msg error */
         $this->status['status'] = 0;
         $this->status['msg'] = "An error occur, try again later.";
     }
     /* ajax response */
     echo jsonEncode($this->status);
 }
Ejemplo n.º 24
0
	function Event_msg()
	{
		$this->CheckAdminPrivs('notifyevent','ajax');
		$hook = get('hook', 'txt');
		list($event, $flag) = explode('.msg.', $hook);
		$struct = ini('notify.event.'.$event.'.struct');
		$msg = ini('notify.event.'.$event.'.msg.'.$flag);
		$ops = array(
			'status' => 'ok',
			'name' => ini('notify.event.'.$event.'.name'),
			'msg' => $msg,
			'al2user' => ini('notify.event.'.$event.'.cfg.'.$flag.'.al2user') ? true : false,
			'cc2admin' => ini('notify.event.'.$event.'.cfg.'.$flag.'.cc2admin') ? true : false,
			'tags' => $this->ETS_Parser($event, $struct)
		);
		exit(jsonEncode($ops));
	}
Ejemplo n.º 25
0
 /**
  * 上传文件浏览
  */
 function uploadManager()
 {
     header('Content-type:application/json;charset=UTF-8');
     $where = array();
     $where['userId'] = $this->user['userId'];
     //浏览类别
     $dir = $this->input->get('dir');
     if (!in_array($dir, array('', 'image', 'flash', 'media', 'file'))) {
         echo "Invalid Directory name.";
     }
     $where['dir'] = $dir;
     //排序形式,name or size or type
     $order = strtolower($this->input->get('order'));
     $orderStr = '';
     switch ($order) {
         case 'name':
             $orderStr = 'fileName desc';
             break;
         case 'size':
             $orderStr = 'fileSize desc';
             break;
         case '':
             $orderStr = 'fileType desc';
             break;
     }
     $this->load->model('fileModel');
     $findList = $this->fileModel->getList($where, null, null, '', $orderStr);
     $fileList = array();
     foreach ($findList as $v) {
         $file_ext = strtolower(pathinfo($v['fullPath'], PATHINFO_EXTENSION));
         $fileList[] = array('is_dir' => false, 'has_file' => false, 'filesize' => $v['fileSize'], 'dir_path' => '', 'is_photo' => $v['dir'] == 'image' ? true : false, 'filetype' => $file_ext, 'filename' => $v['viewPath'], 'datetime' => date('Y-m-d H:i:s', $v['createTime']));
     }
     $result = array();
     //相对于根目录的上一级目录
     $result['moveup_dir_path'] = '';
     //相对于根目录的当前目录
     $result['current_dir_path'] = '';
     //当前目录的URL
     $result['current_url'] = '';
     //文件数
     $result['total_count'] = count($fileList);
     //文件列表数组
     $result['file_list'] = $fileList;
     echo jsonEncode($result);
 }
Ejemplo n.º 26
0
        if (empty($value)) {
            ajax_info(-1);
        } else {
            $value = stripslashes($value);
            load_cache('catalogs,cotypes');
            foreach ($catalogs as $k => $v) {
                $v['dirname'] == $value && ajax_info(1);
            }
            foreach ($cotypes as $k => $v) {
                $arr = read_cache('coclasses', $k);
                foreach ($arr as $x => $y) {
                    $y['dirname'] == $value && ajax_info(1);
                }
            }
            unset($arr);
        }
        ajax_info(0);
        break;
    case 'floor':
        $v = explode(':', $querydata);
        preg_match('/^m?(?:comment|reply)s$/', $v[0]) && preg_match('/^\\w+(,\\w+)*$/', $v[1]) && preg_match('/^\\d+(,\\d+)*$/', $v[2]) || exit;
        preg_match('/\\bcid\\b/', $v[1]) || ($v[1] .= ',cid');
        $querydata = array($v[0] => array());
        $point =& $querydata[$v[0]];
        $query = $db->query("SELECT {$v['1']} FROM {$tblprefix}{$v['0']} WHERE cid IN ({$v['2']})");
        while ($row = $db->fetch_array($query)) {
            $point[$row['cid']] = $row;
            unset($point[$row['cid']]['cid']);
        }
        echo empty($callback) ? jsonEncode($querydata, 1) : $callback . '(' . jsonEncode($querydata, 1) . ')';
}
Ejemplo n.º 27
0
/**
 * 页面跳转方法,基本方法,涵盖异步请求的判断
 * @param number $status
 * @param string $message
 * @param number $waitSecond
 * @param string $jumpUrl
 */
function dispatchJump($status = 1, $message = '', $jumpUrl = '', $waitSecond = 1, $paramData = array())
{
    $CI =& get_instance();
    $waitSecond || ($waitSecond = 1);
    //默认跳转等待时间为1秒
    $msgTitle = '';
    if ($status == 1) {
        $msgTitle = '操作成功';
        $jumpUrl || ($jumpUrl = $_SERVER['HTTP_REFERER']);
    } elseif ($status == 2) {
        $msgTitle = '操作失败';
        $jumpUrl || ($jumpUrl = $_SERVER['HTTP_REFERER']);
    } elseif ($status == 3) {
        $msgTitle = '信息提示';
        $jumpUrl || ($jumpUrl = $_SERVER['HTTP_REFERER']);
    }
    $paramData['jumpUrl'] = $jumpUrl;
    $message || ($message = $msgTitle);
    if (isAjax()) {
        //判断是否为异步请求
        $originData = array('waitSecond' => $waitSecond, 'jumpUrl' => $jumpUrl);
        echo jsonEncode(ajaxFormat($status, $message, array_merge($originData, $paramData)));
        exit;
    } else {
        $data = array('status' => $status, 'msgTitle' => $msgTitle, 'message' => $message, 'waitSecond' => $waitSecond, 'jumpUrl' => $jumpUrl);
        echo $CI->load->view('common/dispatchJump', $data, true);
        exit;
    }
}
Ejemplo n.º 28
0
<?php

require_once '../libraries/common.php';
include 'ajax_common.php';
const MAX_CHECK_COUNT = 20;
$userId = \sessions\getCurrentUserId();
if (is_null($userId)) {
    notAuthErrorResponse();
    return;
}
$lwTime = intval(getIfExists($_GET, 'lw_time'));
$lwParsedOrderId = getParsedOrderId($_GET, 'lw_order_id');
$lwCustomerId = $lwParsedOrderId ? $lwParsedOrderId['customer_id'] : 0;
$lwOrderId = $lwParsedOrderId ? $lwParsedOrderId['order_id'] : 0;
$orders = \cache\getWaitingOrders($userId, $lwTime, $lwCustomerId, $lwOrderId, 0, 0, 0, MAX_CHECK_COUNT + 1);
if (is_null($orders)) {
    internalErrorResponse();
    return;
}
$newOrdersCount = min(MAX_CHECK_COUNT, sizeof($orders));
$newOrdersHasMore = sizeof($orders) > MAX_CHECK_COUNT;
$log = \cache\getDoneOrCanceledLog($userId, $lwTime);
if (is_null($log)) {
    internalErrorResponse();
    return;
}
$presentableLog = array_map(function ($order) {
    return getCompositeOrderId($order);
}, $log);
echo jsonEncode(['new_orders_count' => $newOrdersCount, 'new_orders_has_more' => $newOrdersHasMore, 'done_or_canceled' => $presentableLog]);
Ejemplo n.º 29
0
<?php

include '../../init_constants.php';
include PATH_INCLUDE . '/functions.php';
include PATH_HOMEROOT . '/init.php';
include_once PATH_DOCROOT . '/init_database.php';
include_once PATH_CLASS . '/CSession.php';
include_once PATH_DOCROOT . '/init_session.php';
include PATH_CLASS . '/CToolbox.php';
include PATH_CLASS . '/CFlixManage.php';
include PATH_CLASS . '/CFotobox.php';
$tb =& CToolbox::getInstance();
$flm =& CFlixManage::getInstance();
$fb =& CFotobox::getInstance();
$fotos = $tb->get($_USER_ID);
$params = array('MODE' => 'INSERT', 'USER_ID' => $_USER_ID, 'TAGS' => 'stuff', 'NAME' => date('h:i:s', time()), 'ELEMENTS' => array(), 'SETTINGS' => array());
$params['SETTINGS'] = array(array('instanceName_str' => 'someinstance', 'depth_int' => 0, 'swfPath_str' => '/path/to/swf'), array('instanceName_str' => 'someotherinstance', 'depth_int' => 0, 'swfPath_str' => '/path/to/swf', 'maskPath_str' => '/path/to/mask'));
foreach ($fotos as $k => $v) {
    $fotoData = $fb->fotoData($v['P_ID']);
    $params['ELEMENTS'][$k] = array('photoId_int' => $fotoData['P_ID'], 'photoPath_str' => $fotoData['P_ORIG_PATH'], 'thumbnailPath_str' => $fotoData['P_THUMB_PATH'], 'photoKey_str' => $fotoData['P_KEY']);
    if ($k % 2 == 0) {
        $params['ELEMENTS'][$k]['hotSpot_arr'] = array(array('note_str' => 'This is a note', 'fill_bool' => false, 'depth_int' => 1), array('note_str' => 'This is a note', 'fill_bool' => false, 'depth_int' => 1, 'draw_arr' => array(array('x_int' => 0, 'y_int' => 10), array('x_int' => 1, 'y_int' => 11), array('x_int' => 2, 'y_int' => 12))));
    }
}
//print_r($params);
echo jsonEncode($params);
$flm->flashInput($params);
Ejemplo n.º 30
0
 /**
  * 载入项目状态类型
  */
 function loadProStatusList()
 {
     $proStatusList = $this->config->item('proStatus');
     $list = array();
     $list[] = array('key' => '', 'value' => '请选择');
     foreach ($proStatusList as $k => $v) {
         $list[] = array('key' => $k, 'value' => $v);
     }
     echo jsonEncode($list);
     exit;
 }