Ejemplo n.º 1
0
/**
 * 
 * @param string $where
 * @return array 返回数据库查询后的数组:
 */
function pagination($where, $conn, $tbl_name)
{
    require_once 'class/Config_commodity.php';
    require_once 'class/DBpagination.php';
    require_once 'class/DBcount.php';
    require_once 'class/Info_user.php';
    require_once 'class/Config_user.php';
    require_once 'Include_picture.php';
    //2.向数据库查询符合条件数,以计算显示分页数目
    $dbcount = new DBcount($tbl_name, $where);
    $retval = $dbcount->excute($conn);
    $row = mysqli_fetch_array($retval, MYSQLI_NUM);
    $count = 1 + (int) (($row ? $row[0] : 0) / SIZE_EACH_PAGE);
    //3.计算当前页码;
    $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    $page = $page > $count ? $count : $page;
    //4. 查询当前页的数据
    $choosed_fields = array(Config_commodity::table_name . '.' . Config_commodity::description, Config_commodity::table_name . '.' . Config_commodity::id, Config_commodity::table_name . '.' . Config_commodity::publisher, Config_commodity::table_name . '.' . Config_commodity::title, Config_commodity::table_name . '.' . Config_commodity::price, Config_commodity::table_name . '.' . Config_commodity::release_date, Config_commodity::table_name . '.' . Config_commodity::praise, Config_commodity::table_name . '.' . Config_commodity::leave_message_time, Config_commodity::table_name . '.' . Config_commodity::id);
    $DBpagination = new DBpagination($tbl_name, $where, $page, SIZE_EACH_PAGE, $choosed_fields);
    $reval = $DBpagination->excute($conn);
    //逐个配置 array 三级关联数组  供界面使用
    $array = array();
    while (($temp_database_row_array = mysqli_fetch_array($reval, MYSQLI_ASSOC)) != null) {
        $userinfo = Info_user::get_user_info_by_id($conn, $temp_database_row_array[Config_commodity::publisher]);
        $array[] = array('imgs' => get_commodity_pic($conn, $temp_database_row_array[Config_commodity::id]), 'description' => $temp_database_row_array[Config_commodity::description], 'title' => $temp_database_row_array[Config_commodity::title], 'price' => $temp_database_row_array[Config_commodity::price], 'url' => 'upload/default.jpg', 'name' => $userinfo[Config_user::log_name], 'time' => get_time($temp_database_row_array[Config_commodity::release_date]), 'star_numbers' => $temp_database_row_array[Config_commodity::praise], 'message_numbers' => $temp_database_row_array[Config_commodity::leave_message_time], 'id' => $temp_database_row_array[Config_commodity::id]);
    }
    //5.释放资源
    mysqli_free_result($reval);
    return array('page' => $page, 'array' => $array);
}
Ejemplo n.º 2
0
 public static function check_access_ip()
 {
     $blocked_time = db::scalar(self::Q_GET_IP, array('%ip' => ip2long(get_ip())));
     if ($blocked_time > get_time()) {
         throw new Exception_wx(4030003, get_ip());
     }
 }
Ejemplo n.º 3
0
function record($start_date, $end_date)
{
    global $useradmin;
    $start = new DateTime($start_date);
    $end = new DateTime($end_date);
    $end = $end->modify('+1 day');
    $interval = new DateInterval('P1D');
    $period = new DatePeriod($start, $interval, $end);
    //var_dump($period);
    foreach ($period as $date) {
        $index_date = $date->format('Y-m-d');
        //echo $index_date;
        $unique_visitors = get_unique_visits($index_date);
        $visits = get_visits($index_date);
        $time = get_time($index_date);
        echo "<br/><br/>" . $index_date . "<br/><br/>";
        echo "unique visitors:" . $unique_visitors . "<br/>";
        echo "visits:" . $visits . "<br/>";
        echo "total time:" . $time . "<br/>";
        $selectSQL = "SELECT * FROM visitor_daily_report WHERE report_date='" . $index_date . "'";
        if ($row_record = mysql_fetch_assoc(mysql_query_or_die($selectSQL, $useradmin))) {
            echo "<br/>record already in database!<br/>";
        } else {
            echo "<br/>inserting new record into database!<br/>";
            $insertSQL = sprintf("INSERT INTO visitor_daily_report (report_date, visits, unique_visitors, total_time) VALUES(%s, %s, %s, %s)", GetSQLValueString($index_date, "date"), GetSQLValueString($visits, "int"), GetSQLValueString($unique_visitors, "int"), GetSQLValueString($time, "int"));
            $result = mysql_query_or_die($insertSQL, $useradmin);
        }
    }
}
Ejemplo n.º 4
0
/**
 *	generate Purchase
 *
 * @param	int		purchase_id
 * @return	int		count of Incomings generated
 */
function JKY_generate_purchase($the_id)
{
    $db = Zend_Registry::get('db');
    $sql = 'SELECT *' . '  FROM Purchases' . ' WHERE id = ' . $the_id;
    $my_purchase = $db->fetchRow($sql);
    $sql = 'SELECT *' . '  FROM PurchaseLines' . ' WHERE parent_id = ' . $the_id;
    $my_rows = $db->fetchAll($sql);
    $my_count = 0;
    foreach ($my_rows as $my_row) {
        $my_incoming_id = get_next_id('Incomings');
        $sql = 'INSERT Incomings' . '   SET         id = ' . $my_incoming_id . ',      updated_by = ' . get_session('user_id') . ',      updated_at ="' . get_time() . '"' . ', incoming_number = ' . $my_incoming_id . ',     supplier_id = ' . $my_purchase['supplier_id'] . ',    invoice_date ="' . $my_row['expected_date'] . '"' . ',  invoice_weight = ' . $my_row['expected_weight'];
        log_sql('Incomings', 'INSERT', $sql);
        $db->query($sql);
        insert_changes($db, 'Incomings', $my_incoming_id);
        $my_batchin_id = get_next_id('Batches');
        $sql = 'INSERT Batches' . '   SET          id = ' . $my_batchin_id . ',       updated_by = ' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',      incoming_id = ' . $my_incoming_id . ',        thread_id = ' . $my_row['thread_id'] . ', purchase_line_id = ' . $my_row['id'];
        log_sql('Batches', 'INSERT', $sql);
        $db->query($sql);
        insert_changes($db, 'Batches', $my_batchin_id);
        $sql = 'UPDATE PurchaseLines' . '   SET batch_id =  ' . $my_batchin_id . ' WHERE id = ' . $my_row['id'];
        log_sql('PurchaseLines', 'UPDATE', $sql);
        $db->query($sql);
        insert_changes($db, 'PurchaseLines', $my_row['id']);
        $my_count++;
    }
    $sql = 'UPDATE Purchases' . '   SET status = "Active"' . ' WHERE id = ' . $the_id;
    log_sql('Purchases', 'UPDATE', $sql);
    $db->query($sql);
    insert_changes($db, 'Purchases', $the_id);
    return $my_count;
}
Ejemplo n.º 5
0
/**
 *	return Piece from Pieces Return
 * 
 *	$.ajax({ method:'return', table:'Pieces', barcode:9...9, ...};
 *
 * @return	string	''
 */
function JKY_return_piece($the_data)
{
    $db = Zend_Registry::get('db');
    $my_barcode = get_data($the_data, 'barcode');
    $my_inspected_by = get_data($the_data, 'inspected_by');
    $my_weighed_by = get_data($the_data, 'weighed_by');
    $my_remarks = get_data($the_data, 'remarks');
    $my_checkin_weight = get_data($the_data, 'checkin_weight');
    $my_checkin_location = get_data($the_data, 'checkin_location');
    $sql = 'UPDATE Pieces' . '   SET ' . get_updated() . ',           status="Check In"' . ',     inspected_by=  ' . $my_inspected_by . ',       weighed_by=  ' . $my_weighed_by . ',          remarks=\'' . $my_remarks . '\'' . ',   checkin_weight=  ' . $my_checkin_weight . ', checkin_location=\'' . $my_checkin_location . '\'' . ',       checkin_at=\'' . get_time() . '\'' . ' WHERE id =' . $my_barcode;
    log_sql('Pieces', 'update', $sql);
    $db->query($sql);
    insert_changes($db, 'Pieces', $my_barcode);
    $my_order_id = get_table_value('Pieces', 'order_id', $my_barcode);
    $my_set = ', produced_at=\'' . get_time() . '\'' . ', produced_pieces = produced_pieces + 1';
    if ($my_remarks != 'boa') {
        $my_set = ', rejected_pieces = rejected_pieces + 1';
    }
    $my_field_name = $my_remarks == 'boa' ? 'produced_pieces' : 'rejected_pieces';
    $sql = 'UPDATE Orders' . '   SET ' . get_updated() . $my_set . ' WHERE id = ' . $my_order_id;
    log_sql('Orders', 'update', $sql);
    $db->query($sql);
    insert_changes($db, 'Orders', $my_order_id);
    return '';
}
Ejemplo n.º 6
0
 public function addRecord()
 {
     $M = M('backup');
     $M->backup_time = get_time();
     $M->path = $this->config['path'];
     $M->desc = session('username');
     $M->add();
     $this->success('备份成功', U('Database/index'));
 }
Ejemplo n.º 7
0
/**
 *	generate Order from OSAs
 *
 * @param	int		quotation_id
 * @return	int		count of Orders generated
 */
function JKY_generate_order($the_id)
{
    $db = Zend_Registry::get('db');
    $sql = 'SELECT *' . '  FROM OSAs' . ' WHERE id = ' . $the_id;
    $my_osa = $db->fetchRow($sql);
    $sql = 'SELECT *' . '  FROM OSA_Lines' . ' WHERE parent_id = ' . $the_id;
    $my_rows = $db->fetchAll($sql);
    $my_count = 0;
    foreach ($my_rows as $my_row) {
        $my_osa_line_id = $my_row['id'];
        $sql = 'SELECT *' . '  FROM OSA_Colors' . ' WHERE parent_id = ' . $my_osa_line_id;
        $my_colors = $db->fetchAll($sql);
        foreach ($my_colors as $my_color) {
            $my_order_id = get_next_id('Orders');
            $sql = 'INSERT Orders' . '   SET          id =' . $my_order_id . ',       updated_by =' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',     order_number =' . $my_order_id . ',      osa_line_id =' . $my_osa_line_id . ',       osa_number =' . $my_osa['osa_number'] . ',       ordered_at ="' . $my_osa['ordered_at'] . '"' . ',        needed_at ="' . $my_osa['needed_at'] . '"' . ',     quoted_units =' . $my_row['units'] . ',    quoted_pieces =' . $my_color['quoted_pieces'] . ',    quoted_weight =' . $my_color['quoted_weight'] . ',   ordered_pieces =' . $my_color['ordered_pieces'] . ',   ordered_weight =' . $my_color['ordered_weight'];
            if ($my_osa['customer_id']) {
                $sql .= ', customer_id=' . $my_osa['customer_id'];
            }
            if ($my_row['product_id']) {
                $sql .= ',  product_id=' . $my_row['product_id'];
            }
            if ($my_color['color_id']) {
                $sql .= ',    color_id=' . $my_color['color_id'];
            }
            if ($my_color['ftp_id']) {
                $sql .= ',      ftp_id=' . $my_color['ftp_id'];
            }
            if ($my_color['machine_id']) {
                $sql .= ',  machine_id=' . $my_color['machine_id'];
            }
            if ($my_color['partner_id']) {
                $sql .= ',  partner_id=' . $my_color['partner_id'];
            }
            log_sql('Orders', 'INSERT', $sql);
            $db->query($sql);
            insert_changes($db, 'Orders', $my_order_id);
            /*
            			$sql= 'UPDATE OSA_lines'
            				. '   SET status = "Active"'
            				. ' WHERE id = ' . $my_row['id']
            				;
            	log_sql('OSA_Lines', 'UPDATE', $sql);
            			$db->query($sql);
            			insert_changes($db, 'OSA_Lines', $my_row['id']);
            */
            $my_count++;
        }
    }
    $sql = 'UPDATE OSAs' . '   SET status = "Active"' . ' WHERE id = ' . $the_id;
    log_sql('OSAs', 'UPDATE', $sql);
    $db->query($sql);
    insert_changes($db, 'OSAs', $the_id);
    return $my_count;
}
Ejemplo n.º 8
0
 public function index()
 {
     if (session('?username') && session('userid')) {
         redirect(U('Index/index'));
         exit;
     }
     if ($this->isGet()) {
         if (session('errors') > 2) {
             $this->show_recaptcha();
         }
         //如果为get请求并且错误尝试次数大于3,显示验证码
         $this->display();
         exit;
     } else {
         if ($this->isPost()) {
             session('errors', 0);
             if (session('errors') < 3 || $this->recaptcha_valiaute()) {
                 //如果为post请求并且错误尝试次数小于4,则无需验证;否则需要对验证码进行验证
                 $username = htmlentities($this->_post('usernameoremail'));
                 $password = htmlentities($this->_post('password'));
                 $User = M('user');
                 $User->where("username='******' or email='%s' ", $username, $username)->find();
                 if (isset($User->password) && $User->password === md5Encrypt($password)) {
                     session('username', $username);
                     session('userid', $User->id);
                     $M = M('log');
                     $M->update_user = session('userid');
                     $M->update_time = get_time();
                     $M->operate = 'login';
                     $M->ip = get_client_ip();
                     $M->status = '0';
                     $M->add();
                     $this->msg = 'success!';
                     redirect(U('Index/index'));
                     exit;
                 } else {
                     if (session('errors') > 2) {
                         $this->recaptcha = recaptcha_get_html($this->publickey, $error);
                     }
                     $this->msg = "Wrong username or email and password combine.";
                 }
             }
             session('errors', session('errors') + 1);
             $this->errors = session('errors');
             $this->username = $username;
             $this->display();
         } else {
             if ($this->isAjax()) {
                 exit;
                 //Ajax cross domain attack
             }
         }
     }
 }
Ejemplo n.º 9
0
 public function update($id, array $data, $log = true)
 {
     $data['updated_at'] = get_time();
     if (is_session('user_id')) {
         $data['updated_by'] = get_session('user_id');
     }
     $where = $this->getAdapter()->quoteInto('id = ?', $id);
     parent::update($data, $where);
     if ($log) {
         log_sql($this->_name, $id, 'updated', $data);
         set_session('notice', 'current record saved');
     }
 }
Ejemplo n.º 10
0
 /**
  * 导入记录信息
  * 
  * @param string $pid        	
  * @param string $location        	
  * @param string $toplocation        	
  * @param string $cookies        	
  * @param unknown $data        	
  */
 public function __construct($pid = "", $location = "", $toplocation = "", $cookies = "", $data = array())
 {
     $this->pid = $pid;
     $this->location = $location;
     $this->toplocation = $toplocation;
     $this->cookies = $cookies;
     $this->data = is_array($data) ? $data : array();
     $this->dbh = $GLOBALS['pmx_dbh'];
     $this->ip = get_ip();
     $this->time = get_time();
     $this->HTTP_ACCEPT = isset($_SERVER["HTTP_ACCEPT"]) ? $_SERVER["HTTP_ACCEPT"] : "";
     $this->HTTP_REFERER = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "";
     $this->HTTP_USER_AGENT = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
 }
Ejemplo n.º 11
0
/**
 *	generate CheckOut from Planning Orders
 *
 * @param	int		order_id
 * @return	int		count of CheckOuts generated
 */
function JKY_generate_checkout($the_id)
{
    $db = Zend_Registry::get('db');
    $sql = 'SELECT *' . '  FROM Orders' . ' WHERE id = ' . $the_id;
    $my_order = $db->fetchRow($sql);
    $sql = 'SELECT *' . '  FROM OrdThreads' . ' WHERE parent_id = ' . $the_id;
    $my_rows = $db->fetchAll($sql);
    /*
    	$my_needed_at = $my_order['needed_at'];
    	if ($my_needed_at == null) {
    		$my_needed_at = get_time();
    	}
    */
    $my_checkout_id = get_next_id('CheckOuts');
    $sql = 'INSERT CheckOuts' . '   SET          id =' . $my_checkout_id . ',       updated_by =' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',           number =' . $my_checkout_id . ',     requested_at ="' . get_time() . '"' . ', requested_weight =' . $my_order['ordered_weight'];
    if ($my_order['machine_id']) {
        $sql .= ', machine_id=' . $my_order['machine_id'];
    }
    if ($my_order['partner_id']) {
        $sql .= ', partner_id=' . $my_order['partner_id'];
    }
    log_sql('CheckOuts', 'INSERT', $sql);
    $db->query($sql);
    insert_changes($db, 'CheckOuts', $my_checkout_id);
    $my_count = 0;
    foreach ($my_rows as $my_row) {
        $my_ord_thread_id = $my_row['id'];
        $my_batch = db_get_row('Batches', 'id=' . $my_row['batchin_id']);
        $my_ordered_weight = $my_row['ordered_weight'];
        $my_ordered_boxes = ceil((double) $my_ordered_weight / (double) $my_batch['average_weight']);
        $my_batchout_id = get_next_id('BatchOuts');
        $sql = 'INSERT BatchOuts' . '   SET          id =' . $my_batchout_id . ',       updated_by =' . get_session('user_id') . ',       updated_at ="' . get_time() . '"' . ',      checkout_id =' . $my_checkout_id . ',        thread_id =' . $my_row['thread_id'] . ',       batchin_id =' . $my_row['batchin_id'] . ',  order_thread_id =' . $my_ord_thread_id . ',            batch ="' . $my_batch['batch'] . '"' . ',       unit_price =' . $my_batch['unit_price'] . ',   average_weight =' . $my_batch['average_weight'] . ', requested_weight =' . $my_ordered_weight . ',  requested_boxes =' . $my_ordered_boxes;
        log_sql('BatchOuts', 'INSERT', $sql);
        $db->query($sql);
        insert_changes($db, 'BatchOuts', $my_batchout_id);
        $sql = 'UPDATE OrdThreads' . '   SET batchout_id = ' . $my_batchout_id . ' WHERE id = ' . $my_ord_thread_id;
        log_sql('OrdThreads', 'UPDATE', $sql);
        $db->query($sql);
        insert_changes($db, 'OrdThreads', $my_ord_thread_id);
        $my_count++;
    }
    $sql = 'UPDATE Orders' . '   SET status = "Active"' . ' WHERE id = ' . $the_id;
    log_sql('Orders', 'UPDATE', $sql);
    $db->query($sql);
    insert_changes($db, 'Orders', $the_id);
    return $my_count;
}
Ejemplo n.º 12
0
function show_recette($r)
{
    global $PANIER;
    ?>
<a id="recette-<?php 
    echo $r['id'];
    ?>
" class="recette-el" href="recette-<?php 
    echo $r['id'] . '-' . txt2url($r['titre']);
    ?>
.html" style="background: url(images/<?php 
    echo $r['id'];
    ?>
.jpg) no-repeat center center; background-size: 100%;">
			<div class="infos">
				<div class="details fltr"><?php 
    echo '<img src="style/time11.png" alt="" /> ' . get_time($r['duree']) . ' &nbsp; <img src="style/pers11.png" alt="Pour " /> ' . $r['personnes'];
    ?>
</div>
				<div class="stars"><div class="stars_full" style="width: <?php 
    echo $r['note'] / 2 * 12;
    ?>
px"></div></div>
				<div class="titre"><?php 
    echo $r['titre'];
    ?>
</div>
			</div>
			<div class="cart"><?php 
    if (isset($PANIER[$r['id']])) {
        for ($i = 1; $i <= $PANIER[$r['id']]; $i++) {
            ?>
<img src="style/ok25.png" alt="ok"  onclick="return rem(<?php 
            echo $r['id'];
            ?>
,this)" /><?php 
        }
    }
    ?>
				<img class="cart-add" src="style/add25.png" alt="+" onclick="return add(<?php 
    echo $r['id'];
    ?>
)" />
			</div>
			<img src="style/transp.png" class="transp" />
		</a><?php 
}
Ejemplo n.º 13
0
function get_leave_message($commodity_id, $conn)
{
    require_once 'class/Config_leave_message.php';
    require_once 'class/DBpagination.php';
    require_once 'class/Info_user.php';
    require_once 'class/Config_user.php';
    $page = isset($_REQUEST['page']) ? (int) $_GET['id'] : 1;
    $dbtraerser = new DBpagination(Config_leave_message::tbl_name, ' where ' . Config_leave_message::commodity_id . ' = ' . "'" . $commodity_id . "'", $page, MESSAGE_EACH_PAGE, array(Config_leave_message::content, Config_leave_message::time, Config_leave_message::talker));
    $retval = $dbtraerser->excute($conn);
    $array_message = array();
    while (($temp_database_row_array = mysqli_fetch_array($retval, MYSQLI_ASSOC)) != null) {
        $temp_user = Info_user::get_user_avatar_and_logname($conn, $temp_database_row_array[Config_leave_message::talker]);
        $array_message[] = array('description' => $temp_database_row_array[Config_leave_message::content], 'time' => get_time($temp_database_row_array[Config_leave_message::time]), 'nickname' => $temp_user[Config_user::log_name], 'img' => 'upload/avatar.png');
    }
    mysqli_free_result($retval);
    return $array_message;
}
Ejemplo n.º 14
0
function show_buy_html($commodity_id, $conn)
{
    require_once 'class/Config_commodity.php';
    require_once 'class/DBtraverser.php';
    $where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
    $DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
    $result = $DBtraverser->excute($conn);
    $array_commofity_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
    if ($array_commofity_info) {
        require_once 'Include_picture.php';
        require_once 'class/Info_user.php';
        require_once 'class/Config_user.php';
        $acceptor_info_array = Info_user::get_user_info_by_id($conn, $_SESSION['CURRENT_LOGIN_ID']);
        $publisher_info_array = Info_user::get_user_info_by_id($conn, $array_commofity_info[Config_commodity::publisher]);
        $commodity_array_for_display = array('nickname' => $acceptor_info_array[Config_user::log_name], 'acceptor_phone' => $acceptor_info_array[Config_user::phone_number], 'publisher_name' => $publisher_info_array[Config_user::log_name], 'publisher_phone' => $array_commofity_info[Config_commodity::communication_number], 'title' => $array_commofity_info[Config_commodity::title], 'time' => get_time($array_commofity_info[Config_commodity::release_date]), 'price' => $array_commofity_info[Config_commodity::price], 'description' => $array_commofity_info[Config_commodity::description], 'description_img' => get_one_commodity_pic($conn, $array_commofity_info[Config_commodity::id]), 'img' => 'upload/avatar.png', 'id' => $commodity_id);
        return $commodity_array_for_display;
    }
}
Ejemplo n.º 15
0
function show_welcome($nick)
{
    $location = get_location($nick);
    if ($location === False) {
        return;
    }
    $time = get_time($location);
    if ($time == "") {
        return;
    }
    $arr = convert_google_location_time($time);
    $data = process_weather($location, $nick, True);
    if ($data === False) {
        return;
    }
    if ($data["tempC"] === False or $data["tempF"] === False) {
        return;
    }
    privmsg("welcome {$nick}: " . trim($arr["location"]) . ", " . $data["tempC"] . "/" . $data["tempF"] . ", " . date("g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . ", " . date("l, j F Y", $arr["timestamp"]));
}
Ejemplo n.º 16
0
 public static function set($key, $content, $time, $position = 'pages')
 {
     switch ($position) {
         case 'pages':
             $cache_file = APPPATH . "cache/{$key}.cch";
             break;
         case 'styles':
             $cache_file = FCPATH . "modules/styles/cache/{$key}.css";
             break;
         case 'scripts':
             $cache_file = FCPATH . "modules/scripts/cache/{$key}.js";
             break;
         default:
             return NULL;
     }
     $h = fopen($cache_file, 'w');
     fwrite($h, $content);
     fclose($h);
     touch($cache_file, get_time() + $time);
     return TRUE;
 }
Ejemplo n.º 17
0
 public function regenerate_secret_key()
 {
     $id = $this->_user->get_id();
     if (!$id or $this->_user->is_visitor()) {
         return FALSE;
     }
     $sc =& $this->_special_chars;
     $salt0 = uniqid('wx__');
     $salt1 = $sc[array_rand($sc)];
     $salt2 = $sc[array_rand($sc)];
     $salt3 = $sc[array_rand($sc)];
     $session_id = Session::get_sid();
     $lifetime = get_time() + config('session', 'lifetime_secret_key');
     $raw_data = array($salt0, $id, time(), $session_id, $lifetime, $salt1, $salt2 . $salt1, $salt2 . $salt1 . $salt3);
     shuffle($raw_data);
     $non_format_key = md5(implode(uniqid(), $raw_data));
     //Заменяем повторяющиеся символы в коде на спец символы
     $length = strlen($non_format_key);
     for ($i = 0; $i < $length; $i++) {
         $test_char = $non_format_key[$i];
         for ($j = 0; $j < $length; $j++) {
             if ($i == $j) {
                 continue;
             }
             if ($test_char == $non_format_key[$j]) {
                 if (!is_numeric($non_format_key[$j]) and mt_rand(0, 100) >= 50) {
                     $non_format_key[$j] = ucfirst($non_format_key[$j]);
                     continue;
                 }
                 $key = array_rand($sc);
                 $non_format_key[$j] = $sc[$key];
             }
         }
     }
     $secret_key = $non_format_key;
     $secret_data = array('secret_key' => $secret_key);
     Session::set_server_data($secret_data);
     db::simple_query(self::Q_UPDATE_USER_KEY, array('%user_id' => $id, '%secret_key' => $secret_key));
     return $secret_data['secret_key'];
 }
Ejemplo n.º 18
0
function uploaded_file_info()
{
    if (isset($_SESSION['url'])) {
        //Is it a URL?
        if (filter_var($_SESSION['url'], FILTER_VALIDATE_URL) == TRUE) {
            //Note this should have already been sanitised, so this is an additional (uneccesary?) check
            $testing_file_name = htmlentities($_SESSION['url']);
        }
    } elseif (isset($_SESSION['uploadedfilepath'])) {
        //Has it been either uploaded or pasted
        if (strstr($_SESSION['uploadedfilepath'], "paste")) {
            //Pasted code is saved with the filename like pasted.time()
            $testing_file_name = "Pasted code";
        } else {
            //Filename of type basename_time().xml
            $testing_file_name = basename($_SESSION['uploadedfilepath']);
            $extension = explode(".", $testing_file_name);
            $extension = end($extension);
            $testing_file_name = explode("_", $testing_file_name);
            array_pop($testing_file_name);
            $testing_file_name = implode("_", $testing_file_name) . "." . $extension;
        }
    }
    //Finally only display the HTML if we have a file
    if (isset($_SESSION['uploadedfilepath'])) {
        $day_time = get_time(basename($_SESSION['uploadedfilepath']));
        $day = $day_time[1];
        $time = $day_time[0];
        $today = date("z");
        if ($today == $day) {
            $day = "Today";
        } elseif ($today - $day == 1) {
            $day = "Yesterday";
        } else {
            $day = $today - $day . " days ago";
        }
        return '<div class="alert alert-info"><strong>Testing:</strong> ' . $testing_file_name . '<br/><strong>Uploaded:</strong> ' . $day . ' at ' . $time . ' GMT</div>';
    }
}
Ejemplo n.º 19
0
 /**
  * Session Constructor
  *
  * The constructor runs the session routines automatically
  * whenever the class is instantiated.
  */
 function __construct()
 {
     // Set all the session preferences, which can either be set
     // manually via the $params array above or via the config file
     foreach (array('sess_encrypt_cookie', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key) {
         $this->{$key} = isset($params[$key]) ? $params[$key] : config_item($key);
     }
     if ($this->encryption_key == '') {
         show_error(ld_msg('session_msg_001'));
     }
     // Do we need encryption? If so, load the encryption class
     if ($this->sess_encrypt_cookie == TRUE) {
         $this->ENC =& load_class('Encryption');
     }
     // Set the "now" time.  Can either be GMT or server time, based on the
     // config prefs.  We use this to set the "last activity" time
     $this->now = get_time();
     // Set the session length. If the session expiration is
     // set to zero we'll set the expiration two years from now.
     if ($this->sess_expiration == 0) {
         $this->sess_expiration = 60 * 60 * 24 * 365 * 2;
     }
     // Set the cookie name
     $this->sess_cookie_name = $this->cookie_prefix . $this->sess_cookie_name;
     // Run the Session routine. If a session doesn't exist we'll
     // create a new one.  If it does, we'll update it.
     if (!$this->sess_read()) {
         $this->sess_create();
     } else {
         $this->sess_update();
     }
     // Delete 'old' flashdata (from last request)
     $this->_flashdata_sweep();
     // Mark all new flashdata as old (data will be deleted before next request)
     $this->_flashdata_mark();
     // Delete expired sessions if necessary
     $this->_sess_gc();
 }
Ejemplo n.º 20
0
 /**
  * 根据时间统计各应用系统短信发送量
  *
  * @param string $appId 应用系统ID
  * @param int $year 年份
  * @param int $month 月份
  * @param int $day 日期
  *
  * ~~
  * 默认为当前前一天或者前一小时的时间
  * ~~
  *
  * @return array $daily
  */
 public function statistics($appId = '', $year = 0, $month = 0, $day = 0)
 {
     $conditions = [];
     // 获取前一天的年月日
     list($years, $months, $days) = get_time(2);
     // 根据条件构造查询条件
     if (!empty($appId)) {
         $conditions['app_id'] = strval($appId);
     }
     if ($year == 0) {
         $year = $years;
     }
     $conditions['year'] = $year;
     if ($month == 0) {
         $month = $months;
     }
     $conditions['month'] = $month;
     if ($day == 0) {
         $day = $days;
     }
     $conditions['day'] = $day;
     $daily = self::find()->select(['app_id', 'SUM(total) total', 'year', 'month', 'day'])->where($conditions)->groupBy(['app_id'])->asArray()->all();
     return $daily;
 }
    /**
     * Show the edit match form
     */
    function loadEditMatchForm()
    {
        global $db, $_pre;
        if (!isset($_GET['m_id'])) {
            system_messages(0, 'No match given');
            return;
        }
        if ($_GET['m_id'] == 'none') {
            system_messages(0, 'Please select a match to edit');
            return;
        }
        $match_id = $_GET['m_id'];
        settype($match_id, 'integer');
        $query = "SELECT * FROM {$_pre}matches WHERE id={$match_id} ORDER BY start_time DESC";
        $db->setQuery($query);
        if ($db->foundRows == 0) {
            system_messages(0, 'No such match!');
            return;
        }
        $row = $db->fetch_assoc();
        ?>
		<span class="dark10">Editing CodeZone match <?php 
        echo "{$match_id} .::. {$row['title']}";
        ?>
</span><br />
		<form class='admin-panel-form' name='global-conf' method='POST' action='index.php?a=su&amp;a1=edit-match-details'>
		<table class='admin-panel-forms-table' cellpadding="2" cellspacing="2" border="0">
				<tr><td class='form-field-label'><span class='form-field-label-text'>Match Name</span></td>
				<td><input type="text" name="edm-title" class="admin-panel-text-input" value="<?php 
        echo $row['title'];
        ?>
"/></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Match duration (sec)</span></td><td><input type="text" name="edm-duration" class="admin-panel-text-input" value="<?php 
        echo $row['duration'];
        ?>
"/></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Start date (yyyy-mm-dd)</span></td><td><input type="text" name="edm-start_date" class="admin-panel-text-input" value="<?php 
        echo get_date($row['start_time']);
        ?>
"/></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Start time (hh:mm:ss)</span></td><td><input type="text" name="edm-start_time" class="admin-panel-text-input" value="<?php 
        echo get_time($row['start_time']);
        ?>
"/></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Difficulty</span></td><td><input type="text" name="edm-difficulty" class="admin-panel-text-input" value="<?php 
        echo $row['difficulty'];
        ?>
"/></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Match points</span></td><td><input type="text" name="edm-match_points" class="admin-panel-text-input" value="<?php 
        echo $row['match_points'];
        ?>
"/></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Ranked match</span></td><td>Yes&nbsp;<input type="radio" name="edm-ranked_match" value="1" <?php 
        if ($row['match_ranked'] == 1) {
            echo "checked='true'";
        }
        ?>
 />&nbsp;&nbsp;No&nbsp;<input type="radio" name="edm-ranked_match" value="0" <?php 
        if ($row['match_ranked'] == 0) {
            echo "checked='true'";
        }
        ?>
 /></td></tr>
				<tr><td class='form-field-label'><span class='form-field-label-text'>Analysis <i>(Allowed tags are: &lt;p&gt;,&lt;a&gt;,&lt;strong&gt;,&lt;i&gt;,&lt;br&gt;. To highlight code blocks enclose the code in a div tag with class code_block e.g &lt;div class=&quot;code_block&quot;&gt;&lt;pre&gt;echo CONSTANT;&lt;/pre&gt;&lt;/div&gt;</i></span></td><td><textarea name="edm-analysis" class="admin-panel-textarea" style="width:400px;" rows="15" cols="45"><?php 
        echo stripslashes($row['analysis']);
        ?>
</textarea></td></tr>
				<tr><td><input type="hidden" name="adm" value="<?php 
        echo base64_encode('su');
        ?>
" /><input type="hidden" name="f" value="<?php 
        echo base64_encode('edit_match');
        ?>
" /><input type="hidden" name="m_id" value="<?php 
        echo base64_encode($match_id);
        ?>
" /></td><td><input type="submit" name="save" class="admin-panel-submit-button" value="save" />&nbsp;&nbsp;<input type="submit" name='delete_match' class="admin-panel-submit-button" value='Delete this match?' class="admin-panel-submit-button" onclick="return confirm('WARNING: Are you sure you want to delete this match? this action cannot be reversed!!');" /></td></tr>
		</table>
		</form>
		<br />
		<br />
		<?php 
        $query = "SELECT COUNT(*) FROM {$_pre}{$row['match_table_name']} WHERE 1";
        $db->setQuery($query);
        $tmp_row = $db->fetch_assoc();
        $st_total_registered = $tmp_row['COUNT(*)'];
        //Total users registered for the match
        $query = "SELECT * FROM {$_pre}user_match_log WHERE match_id={$row['id']} AND participated=1";
        $db->setQuery($query);
        $st_total_participated = $db->foundRows;
        $query = "SELECT SUM(downloads_count) FROM {$_pre}{$row['match_table_name']} WHERE 1";
        $db->setQuery($query);
        $tmp_row = $db->fetch_assoc();
        $st_downloads = $tmp_row['SUM(downloads_count)'];
        $query = "SELECT SUM(submissions) FROM {$_pre}{$row['match_table_name']} WHERE 1";
        $db->setQuery($query);
        $tmp_row = $db->fetch_assoc();
        $st_submissions = $tmp_row['SUM(submissions)'];
        ?>
		<span class="navy10">Match Statistics</span>
		<ul>
		<li><span class="form-field-label-text">Total Registered Users for this match: </span><span class="green10"><?php 
        echo $st_total_registered;
        ?>
</span></li>
		<li><span class="form-field-label-text">Total Registered Users who participated: </span><span class="green10"><?php 
        echo $st_total_participated;
        ?>
</span></li>
		<li><span class="form-field-label-text">Total Registered Users who did not participate: </span><span class="green10"><?php 
        echo $st_total_registered - $st_total_participated < 0 ? 0 : $st_total_registered - $st_total_participated;
        ?>
</span></li>
		<li><span class="form-field-label-text">Total Input file downloads: </span><span class="green10"><?php 
        echo $st_downloads;
        ?>
</span></li>
		<li><span class="form-field-label-text">Total Submissions: </span><span class="green10"><?php 
        echo $st_submissions;
        ?>
</span></li>
		</ul>
		
		<button id="show_problem_st" class="admin-panel-button" value="hidden" onclick="showProblemToggle('<?php 
        echo $row['match_table_name'];
        ?>
','<?php 
        echo $row['problem_sheet'];
        ?>
');">Show/Hide problem sheet</button>&nbsp;&nbsp;
		<button class="admin-panel-button" onclick="downloadSheet('<?php 
        echo $row['match_table_name'];
        ?>
','<?php 
        echo $row['input_sheet'];
        ?>
','input');">Download input sheet</button>&nbsp;&nbsp;
		<button class="admin-panel-button" onclick="downloadSheet('<?php 
        echo $row['match_table_name'];
        ?>
','<?php 
        echo $row['answer_sheet'];
        ?>
','answer');">Download answer sheet</button>
		<div id="problem_statement_view"></div><!--render problem statement here-->
		<iframe id="sheet_download" src="" style="display: none;" /><!--Frame whose src is changed by JS to trigger download-->
		<?php 
    }
Ejemplo n.º 22
0
        {
            return zbx_date2str(DATE_TIME_FORMAT, $t);
        }
        function format_time2($t)
        {
            return format_time($t);
        }
        break;
}
$table->setHeader($header);
$intervals = array();
for ($t = $from; $t <= $to; $t++) {
    if (($start = get_time($t)) > time()) {
        break;
    }
    if (($end = get_time($t + 1)) > time()) {
        $end = time();
    }
    $intervals[] = array('from' => $start, 'to' => $end);
}
$sla = API::Service()->getSla(array('serviceids' => $service['serviceid'], 'intervals' => $intervals));
$sla = reset($sla);
foreach ($sla['sla'] as $intervalSla) {
    $ok = new CSpan(sprintf('%dd %dh %dm', $intervalSla['okTime'] / SEC_PER_DAY, $intervalSla['okTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['okTime'] % SEC_PER_HOUR / SEC_PER_MIN), 'off');
    $problems = new CSpan(sprintf('%dd %dh %dm', $intervalSla['problemTime'] / SEC_PER_DAY, $intervalSla['problemTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['problemTime'] % SEC_PER_HOUR / SEC_PER_MIN), 'on');
    $downtime = sprintf('%dd %dh %dm', $intervalSla['downtimeTime'] / SEC_PER_DAY, $intervalSla['downtimeTime'] % SEC_PER_DAY / SEC_PER_HOUR, $intervalSla['downtimeTime'] % SEC_PER_HOUR / SEC_PER_MIN);
    $percentage = new CSpan(sprintf('%2.4f', $intervalSla['sla']), $intervalSla['sla'] >= $service['goodsla'] ? 'off' : 'on');
    $table->addRow(array(format_time($intervalSla['from']), format_time2($intervalSla['to']), $ok, $problems, $downtime, $service['showsla'] ? $percentage : '-', $service['showsla'] ? new CSpan($service['goodsla']) : '-'));
}
$table->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Ejemplo n.º 23
0
 private function _orderStatusCache($msg)
 {
     $table_name = "paynow";
     $condition = array('reference' => $msg["reference"]);
     $data = array('status' => $msg["status"], 'pollurl' => $msg["pollurl"], 'paynowreference' => $msg["paynowreference"], 'amount' => $msg["amount"], 'date_of_payment' => get_time());
     $this->app_model->update($table_name, $data, $condition);
     //$this->_notifyCustomerViaEmail($this->session->userdata('transaction'));
     //$this->cart->destroy();
     //--$this->session->userdata('transaction') = "";
     //$this->session->unset_userdata('transaction');
     //$this->load->view('paynow/thankyou');
 }
Ejemplo n.º 24
0
    $installVarList = array();
    foreach ($languageVarList as $var) {
        $installVarList[$var] = $var;
    }
    // generate english file
    // - get vars from english install lang file
    // - merge the two
    // - generate new language file
    $_lang = array();
    $englishLangFile = get_path('rootSys') . 'claroline/lang/english/install.lang.php';
    if (file_exists($englishLangFile)) {
        include $englishLangFile;
    }
    $completeInstallVarList = array_merge($installVarList, $_lang);
    $output = '<?php' . "\n";
    foreach ($completeInstallVarList as $key => $value) {
        $output .= build_translation_line_file($key, $value);
    }
    $output .= '?>';
    // write to file
    file_put_contents($englishLangFile, $output);
    echo "<p>Total variables: " . $total_var_count . "</p>";
    // end time
    $endtime = get_time();
    $totaltime = $endtime - $starttime;
    echo "<p><em>Execution time: {$totaltime}</em></p>\n";
} else {
    echo '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=generate">' . 'Generate it, it will overwrite previous /lang/english/install.lang.php file' . '</a>';
}
// display footer
include get_path('incRepositorySys') . '/claro_init_footer.inc.php';
Ejemplo n.º 25
0
    $result_mode = "connect";
    $mistakes = intval($_POST['num_of_mistakes']);
    $pairs = intval($_POST['num_of_pairs']);
    $score = (1 - round($mistakes / $pairs, 2)) * 100;
    $set_id = intval($_POST['set_id']);
    $time = get_time(intval($_POST['time']));
} elseif (isset($_POST['num_of_tries']) && $_POST['time'] && $_POST['set_id']) {
    $result_mode = "outline";
    $num_of_tries = intval($_POST['num_of_tries']);
    $tries = "";
    if ($num_of_tries == 1) {
        $tries = "try";
    } else {
        $tries = "tries";
    }
    $time = get_time(intval($_POST['time']));
    $set_id = intval($_POST['set_id']);
} else {
    header('Location: index.php');
}
?>
<!DOCTYPE html>
<html>
<head>
    <title>Learn - home</title>
    <?php 
require 'includes/head.php';
?>
</head>
<body id="learn">
    <nav>
<?php

include __DIR__ . '/../lib/IronWorkerWrapper.php';
$num_emails = $_REQUEST['num_emails'];
$name = "emailWorker.php";
$start = get_time();
queue_worker($iw, $name, $num_emails);
$worker_time = get_time() - $start;
$details = array("worker" => $worker_time);
echo json_encode($details);
function get_time()
{
    return (double) array_sum(explode(' ', microtime()));
}
function queue_worker($iw, $name, $num_emails)
{
    ob_start();
    $tmpdir = $_SERVER['TMP_DIR'];
    if (empty($tmpdir)) {
        $tmpdir = dirname(__FILE__);
    }
    $zipName = $tmpdir . "/{$name}.zip";
    $file = IronWorker::zipDirectory(dirname(__FILE__) . "/../workers", $zipName, true);
    $res = $iw->postCode('emailWorker.php', $zipName, $name);
    $tasks = array();
    for ($i = 1; $i <= $num_emails / 10; $i++) {
        $payload = array('num_emails' => 10);
        $task_id = $iw->postTask($name, $payload);
    }
    do {
        $details = $iw->getTaskDetails($task_id);
Ejemplo n.º 27
0
 /**
  * 批量统计每天各应用系统的邮件发送量
  */
 public function actionEmailBatchDaily()
 {
     $time = time();
     $date = date('Ymd', $time);
     // 年月日
     list($year, $month, $day) = get_time(2);
     $rows = [];
     $appIds = '';
     try {
         $serviceBinding = new ServiceBinding();
         $hourStat = new EmailStatHour();
         $dayStat = new EmailStatDay();
         // 获取所有的AppID
         $appIdAll = $serviceBinding->getAllAppId(self::SERVICEID);
         // 各应用系统每日邮件发送总量统计
         $daily = $hourStat->statistics();
         if (empty($appIdAll) && arr_null($daily)) {
             $this->stdout("不存在绑定服务的第三方应用系统!!!", Console::FG_RED);
             $this->_fileLogger->writeOne("不存在绑定服务的第三方应用系统!!!", Logger::LEVEL_INFO, 'console\\controllers\\EmailController::email-batch-daily');
             // 目标数据不存在
             exit(6);
         }
         if (!arr_null($daily)) {
             // 构造params
             foreach ($daily as $k => $val) {
                 $appIda[] = $val['app_id'];
                 $appIds .= $val['app_id'] . ",";
                 $rows[] = [$val['app_id'] . '' . $date, $val['app_id'], intval($val['year']), intval($val['month']), intval($val['day']), intval($val['total']), $time, $time];
             }
             // 存在appIdAll不存在$appIda($daily)中的appId
             $appDiffs = array_diff($appIdAll, $appIda);
             if (!empty($appDiff)) {
                 foreach ($appDiffs as $appDiff) {
                     $appIds .= $appDiff . ',';
                     $rows[] = [$appDiff . "" . $date, $appDiff, $year, $month, $day, 0, $time, $time];
                 }
             }
             $appIds = rtrim($appIds, ',');
         } else {
             foreach ($appIdAll as $appId) {
                 $appIds .= $appId . ',';
                 $rows[] = [$appId . "" . $date, $appId, $year, $month, $day, 0, $time, $time];
             }
             $appIds = rtrim($appIds, ',');
         }
         $result = $dayStat->batchInsertStat($rows);
         if (!$result) {
             $this->stdout("应用ID为{$appIds},时间为{$year}年{$month}月{$day}日,统计失败!!!\r\n", Console::FG_RED);
             $this->_fileLogger->writeOne("应用ID为{$appIds},时间为{$year}年{$month}月{$day}日,统计失败!!!", Logger::LEVEL_INFO, 'console\\controllers\\EmailController::email-batch-daily');
             // 数据库操作失败
             exit(3);
         }
         // TODO:: 是否能删除
         $this->stdout("应用ID为{$appIds},时间为{$year}年{$month}月{$day},统计成功!!!\r\n", Console::FG_GREEN);
         $this->_fileLogger->writeOne("应用ID为{$appIds},时间为{$year}年{$month}月{$day}日,统计成功!!!", Logger::LEVEL_INFO, 'console\\controllers\\EmailController::email-batch-daily');
         exit(0);
     } catch (\Exception $ex) {
         $code = $ex->getCode();
         if ($code == 23000) {
             $this->stdout("应用中存在已经被备份(主键重复)~~\r\n", Console::FG_GREEN);
         } else {
             $this->stdout("系统出错,请稍后重试~~\r\n", Console::FG_GREEN);
         }
         $this->_fileLogger->writeOne($ex->getMessage(), Logger::LEVEL_ERROR, 'console\\controllers\\EmailController::email-batch-daily');
         // 1表示异常退出
         exit(1);
     }
 }
Ejemplo n.º 28
0
function affecte_cb($cb, $id_resa = 0)
{
    global $dbh;
    global $pmb_utiliser_calendrier, $pmb_location_reservation, $pmb_transferts_actif, $transferts_choix_lieu_opac, $deflt_docs_location;
    // chercher s'il s'agit d'une notice ou d'un bulletin
    $rqt = "SELECT expl_notice, expl_bulletin FROM exemplaires WHERE expl_cb='" . $cb . "' ";
    $res = pmb_mysql_query($rqt, $dbh);
    $nb = pmb_mysql_num_rows($res);
    if (!$nb) {
        return 0;
    }
    $obj = pmb_mysql_fetch_object($res);
    if ($id_resa == 0) {
        if ($pmb_transferts_actif == "1") {
            switch ($transferts_choix_lieu_opac) {
                case "1":
                    //retrait de la resa sur lieu choisi par le lecteur
                    $where = " AND resa_loc_retrait=" . $deflt_docs_location;
                    break;
                case "2":
                    //retrait de la resa sur lieu fixé
                    $where = " AND resa_loc_retrait=" . $deflt_docs_location;
                    break;
                case "3":
                    //retrait de la resa sur lieu exemplaire
                    if (!$pmb_location_reservation) {
                        $from = " ,exemplaires ";
                        $where = " AND expl_cb='{$cb}' and expl_location=" . $deflt_docs_location;
                    } else {
                        $where = " and expl_location=" . $deflt_docs_location;
                    }
                    break;
                default:
                    //retrait de la resa sur lieu lecteur
                    if (!$pmb_location_reservation) {
                        $from = " ,empr ";
                    }
                    $where = " AND resa_idempr=id_empr and empr_location=" . $deflt_docs_location;
                    break;
            }
            //switch $transferts_choix_lieu_opac
        }
        if ($pmb_location_reservation) {
            $from_loc_resa = " ,empr, resa_loc, exemplaires ";
            $sql_loc_resa = " and resa_idempr=id_empr and empr_location=resa_emprloc and resa_loc='{$deflt_docs_location}' ";
            $sql_loc_resa .= " and expl_location=resa_loc AND expl_cb='{$cb}' ";
        }
        // chercher le premier (par ordre de rang, donc de date de début de résa, non validé
        $rqt = "SELECT id_resa, resa_idempr, resa_loc_retrait, resa_date_fin, resa_planning_id_resa\n\t\t\t\t\t\tFROM resa {$from} {$from_loc_resa}\n\t\t\t\tWHERE resa_idnotice='" . $obj->expl_notice . "'\n\t\t\t\t\tAND resa_idbulletin='" . $obj->expl_bulletin . "'\n\t\t\t\t\tAND resa_cb=''\n\t\t\t\t\t{$where}\n\t\t\t\t\t{$sql_loc_resa}\n\t\t\t\tORDER BY resa_date ";
    } else {
        //on sait de quelle resa on parle ...
        $rqt = "SELECT id_resa, resa_idempr,resa_loc_retrait, resa_date_fin, resa_planning_id_resa FROM resa WHERE id_resa='" . $id_resa . "'";
    }
    $res = pmb_mysql_query($rqt, $dbh);
    if (!pmb_mysql_num_rows($res)) {
        return 0;
    }
    $obj_resa = pmb_mysql_fetch_object($res);
    /*
    	$rqt_loc_retrait="";
    	if($pmb_transferts_actif) {
    $rqt = "SELECT empr_location FROM resa INNER JOIN empr ON resa_idempr = id_empr WHERE id_resa=".$obj_resa->id_resa;
    $res = pmb_mysql_query($rqt);
    $empr_location = pmb_mysql_result($res,0) ;
    if($obj_resa->resa_loc_retrait==$deflt_docs_location || $empr_location==$deflt_docs_location) {
    	$rqt_loc_retrait.= ", resa_loc_retrait='$deflt2docs_location' " ;
    } else return 0 ;
    	}
    */
    if ($obj_resa->resa_date_fin == '0000-00-00' || $obj_resa->resa_planning_id_resa == 0) {
        $nb_days = get_time($obj_resa->resa_idempr, $obj->expl_notice, $obj->expl_bulletin);
        $rqt_date = "select date_add(sysdate(), INTERVAL '{$nb_days}' DAY) as date_fin ";
        $resultatdate = pmb_mysql_query($rqt_date);
        $res = pmb_mysql_fetch_object($resultatdate);
        $date_fin = $res->date_fin;
    } else {
        $date_fin = $obj_resa->resa_date_fin;
    }
    if ($pmb_utiliser_calendrier) {
        $rqt_date = "select date_ouverture from ouvertures where ouvert=1 and num_location={$deflt_docs_location} and to_days(date_ouverture)>=to_days('{$date_fin}') order by date_ouverture ";
        $resultatdate = pmb_mysql_query($rqt_date);
        $res = @pmb_mysql_fetch_object($resultatdate);
        if ($res->date_ouverture) {
            $date_fin = $res->date_ouverture;
        }
    }
    // mettre resa_cb à jour pour cette resa
    $rqt = "update resa set resa_cb='" . $cb . "' ";
    $rqt .= ", resa_date_debut=sysdate() ";
    $rqt .= ", resa_date_fin='{$date_fin}', resa_loc_retrait='{$deflt_docs_location}' ";
    $rqt .= " where id_resa='" . $obj_resa->id_resa . "' ";
    $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . " <br />{$rqt}");
    $rqt = "delete from resa_ranger where resa_cb='" . $cb . "' ";
    $res = pmb_mysql_query($rqt, $dbh);
    return $obj_resa->id_resa;
}
Ejemplo n.º 29
0
        $bcc .= $content["bcc"][$i];
    }
    if ($bcc != '') {
        echo '<tr><td valign="top"><b>Bcc:</b>&nbsp;</td><td>';
        echo htmlspecialchars($bcc);
        echo '</td></tr>';
    }
}
?>
<tr>
<td><b><?php 
echo $strDate;
?>
:&nbsp;</b></td>
<td><?php 
echo date($_SESSION['GO_SESSION']['date_format'] . ' ' . $_SESSION['GO_SESSION']['time_format'], get_time($content['udate']));
?>
</td>
</tr>
<?php 
if ($account['type'] == "imap" && !$print) {
    echo '<tr><td nowrap><b>' . $ml_folder . ':&nbsp;</b></td><td>';
    if ($email->get_all_folders($account['id'], true) > 0) {
        $dropbox = new dropbox();
        $dropbox->add_value('INBOX', $ml_inbox);
        while ($email->next_record()) {
            if (!($email->f('attributes') & LATT_NOSELECT)) {
                $dropbox->add_value($email->f('name'), str_replace('INBOX' . $email->f('delimiter'), '', $email->f('name')));
            }
        }
        $dropbox->print_dropbox('move_to_mailbox', $mailbox, 'onchange="javascript:move_mail()"');
Ejemplo n.º 30
0
}
$graph_url = "https://graph.facebook.com/{$fbid}/";
$execution_time['totalstart'] = get_time();
$execution_time['start'] = get_time();
$param->fbid = $fbid;
$param->token = $token;
$param->graph_url = $graph_url;
$param->limit = 25;
$param->offset = 0;
//me/statuses
echo 'processing fb statuses...';
$param->connection = 'statuses';
$param->table_name = 'statuses_raw_data';
get_statuses($param);
echo "done<br/>";
$execution_time['end'] = get_time();
$totaltime = $execution_time['end'] - $execution_time['start'];
echo "<br/>totaltime : {$totaltime}";
logme("Facebook ID:{$fbid}");
logme("Total Execution Time: {$totaltime}");
logme("============================================================================");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//MY STATUS UPDATES
function get_graphapi_data($graph_url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $graph_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $data = @json_decode(curl_exec($ch));
    return $data;