Exemplo n.º 1
0
function get_exchange($imap_box)
{
    $emails = imap_search($imap_box, "FROM 'e-mail address'");
    //ищем письма от
    //$emails = imap_search($imap_box, "FROM 'e-mail address'");  //ищем письма от
    //echo "<br>";
    //if ($emails) echo "Найдено:" . sizeof($emails) . " писем.<br>";  // сколько нашли и какие их номера начиная с 0
    //else echo "Писем удовлетворяющих условию не найдено.";
    $result = false;
    if ($emails) {
        /* put the newest emails on top */
        rsort($emails);
        /* for every email... */
        foreach ($emails as $email_number) {
            $message = get_msg($imap_box, $email_number, "PLAIN");
            //  PLAIN or  HTML  or ...
            $message = preg_replace('/\\r\\n|\\r|\\n/u', '', $message);
            // удаляем символы перевода строки
            preg_match("/Курс виписки рахунків- \\d\\d\\,\\d\\dГотівковий- \\d\\d\\,\\d\\d/", $message, $output_array);
            //ищем паттерн
            if ($output_array[0]) {
                // Если нашли паттерн
                if (!$result) {
                    preg_match_all('/\\d\\d\\,\\d\\d/', $output_array[0], $result);
                }
                //нашли свежак и сохраняем его
                imap_delete($imap_box, $email_number);
                //помечаем письмо на удаление
            }
        }
    }
    imap_expunge($imap_box);
    return $result[0];
}
 /**
  * Set the User geolocation and page
  */
 function init($link = null, $id = null, $online_time = USER_ONLINE_TIME)
 {
     $file = basename($_SERVER['SCRIPT_FILENAME']);
     $url = $_SERVER['REQUEST_URI'];
     $user_localization = isset($_SESSION['user_localization']) ? $_SESSION['user_localization'] : null;
     $sid = session_id();
     $browser = BROWSER . " " . BROWSER_VERSION;
     $os = BROWSER_OS;
     $ip = IP;
     if (!$user_localization) {
         $time = TIME - HOUR;
         DB::query("DELETE FROM " . DB_PREFIX . "user_localization WHERE time < " . HOUR);
     }
     $user_localization_id = $user_localization ? $_SESSION['user_localization']['user_localization_id'] : DB::get_field("SELECT user_localization_id FROM " . DB_PREFIX . "user_localization WHERE sid='{$sid}'");
     if ($user_id = User::get_user_id()) {
         $guest_id = 0;
         $name = User::get_user_field("name");
     } else {
         $guest_id = isset($user_localization['guest_id']) ? $user_localization['guest_id'] : 1 + DB::get_field("SELECT guest_id FROM " . DB_PREFIX . "user_localization ORDER BY guest_id DESC LIMIT 1;");
         $name = get_msg('guest') . " " . $guest_id;
     }
     if ($user_localization_id) {
         DB::query("UPDATE " . DB_PREFIX . "user_localization SET ip='{$ip}', user_id='{$user_id}', name='{$name}', url='{$url}', id='{$id}', file='{$file}', time='" . TIME . "', sid='{$sid}' WHERE user_localization_id='{$user_localization_id}'");
     } else {
         if (!($location = ip_to_location($ip, $assoc = true))) {
             $location = array('CountryCode' => null, 'CountryName' => null, 'RegionCode' => null, 'RegionName' => null, 'City' => null, 'ZipPostalCode' => null, 'Latitude' => null, 'Longitude' => null, 'TimezoneName' => null, 'Gmtoffset' => null);
         }
         //replace_sql_injection( $location );
         DB::query("INSERT INTO " . DB_PREFIX . "user_localization\r\n                        (ip,sid,user_id,guest_id,name,url,id,file,os,browser,time,time_first_click,country_code,country_name,region_code,region_name,city_name,zip,latitude,longitude,timezone_name,gmt_offset)\r\n                        VALUES\r\n                        ('{$ip}','{$sid}','{$user_id}','{$guest_id}','{$name}','{$url}','{$id}','{$file}','{$os}','{$browser}', " . TIME . ", " . TIME . ", '{$location['CountryCode']}', '{$location['CountryName']}', '{$location['RegionCode']}', '{$location['RegionName']}','{$location['City']}', '{$location['ZipPostalCode']}', '{$location['Latitude']}', '{$location['Longitude']}', '{$location['TimezoneName']}', '{$location['Gmtoffset']}')");
         $user_localization_id = DB::get_last_id();
     }
     $_SESSION['user_localization'] = array('user_localization_id' => $user_localization_id, 'id' => $id, 'guest_id' => $guest_id, 'name' => $name, 'time' => TIME, 'file' => $file, 'user_id' => $user_id, 'os' => $os, 'browser' => $browser);
 }
Exemplo n.º 3
0
 /**
  * 格式化日期 e.g. 3 days ago, or 5 minutes ago to a maximum of a week ago
  *
  * @param int $time unix timestamp
  * @param string format of time (use the constant fdate_format or ftime_format)
  */
 function time_elapsed($time = null, $format)
 {
     $diff = TIME - $time;
     if ($diff < MINUTE) {
         return $diff . " " . get_msg('seconds_ago');
     } elseif ($diff < HOUR) {
         return ceil($diff / 60) . " " . get_msg('minutes_ago');
     } elseif ($diff < 12 * HOUR) {
         return ceil($diff / 3600) . " " . get_msg('hours_ago');
     } elseif ($diff < DAY) {
         return get_msg('today') . " " . strftime(TIME_FORMAT, $time);
     } elseif ($diff < DAY * 2) {
         return get_msg('yesterday') . " " . strftime(TIME_FORMAT, $time);
     } elseif ($diff < WEEK) {
         return ceil($diff / DAY) . " " . get_msg('days_ago') . " " . strftime(TIME_FORMAT, $time);
     } else {
         return strftime($format, $time);
     }
 }
Exemplo n.º 4
0
 function drop()
 {
     if (!IS_POST) {
         $this->display('goods.batch.html');
     } else {
         $id = isset($_POST['id']) ? trim($_POST['id']) : '';
         if (!$id) {
             $this->show_warning('Hacking Attempt');
             return;
         }
         $ids = explode(',', $id);
         // notify store owner
         $ms =& ms();
         $goods_list = $this->_goods_mod->find(array("conditions" => $ids, "fields" => "goods_name, store_id"));
         foreach ($goods_list as $goods) {
             //$content = sprintf(LANG::get('toseller_goods_droped_notify'), );
             $content = get_msg('toseller_goods_droped_notify', array('reason' => trim($_POST['drop_reason']), 'goods_name' => addslashes($goods['goods_name'])));
             $ms->pm->send(MSG_SYSTEM, $goods['store_id'], '', $content);
         }
         // drop
         $this->_goods_mod->drop_data($ids);
         $this->_goods_mod->drop($ids);
         $ret_page = isset($_GET['ret_page']) ? intval($_GET['ret_page']) : 1;
         $this->show_message('drop_ok', 'back_list', 'index.php?app=goods&page=' . $ret_page);
     }
 }
Exemplo n.º 5
0
 function cancel()
 {
     $id = empty($_GET['id']) ? 0 : $_GET['id'];
     if (!$id) {
         $this->show_warning('no_such_groupbuy');
         return false;
     }
     if (!$this->_ican($id, ACT)) {
         $this->show_warning('Hacking Attempt');
         return;
     }
     /* 团购信息 */
     $group = $this->_groupbuy_mod->get(array('conditions' => 'group_id=' . $id, 'fields' => 'group_desc,group_name,owner_name', 'join' => 'belong_store'));
     if (!IS_POST) {
         /* 当前位置 */
         $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('groupbuy_manage'), 'index.php?app=seller_groupbuy', LANG::get('cancel_groupbuy'));
         /* 当前用户中心菜单 */
         $this->_curitem('groupbuy_manage');
         /* 当前所处子菜单 */
         $this->_curmenu('cancel_groupbuy');
         $this->assign('group', $group);
         $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('desc_groupbuy'));
         $this->display('seller_groupbuy.cancel.html');
     } else {
         if (!$this->_groupbuy_mod->edit($id, array('state' => GROUP_CANCELED))) {
             $this->show_warning($this->_groupbuy_mod->get_error());
             return;
         }
         $content = get_msg('tobuyer_groupbuy_cancel_notify', array('reason' => $_POST['reason'], 'url' => SITE_URL . '/' . url("app=groupbuy&id={$id}")));
         $this->_groupbuy_mod->sys_notice($id, array('admin', 'buyer'), '', $content, array('msg'));
         $this->show_message('cancel_ok', 'back_list', 'index.php?app=seller_groupbuy');
     }
 }
Exemplo n.º 6
0
    switch ($status) {
        case 'Open':
            echo "<h1>Open Orders</h1>";
            myOrders('Open', $custID);
            break;
        case 'Closed':
            echo "<h1>Past Orders</h1>";
            myOrders('Closed', $custID);
            break;
    }
}
if (isset($_GET['orderID']) && !isset($_GET['noOrders'])) {
    $orderID = $_GET['orderID'];
    $db->runQuery("select CL.id, CL.date,L.description, L.status, L.type, E.first_name as 'employee_first_name',\r                        E.last_name as 'employee_last_name',E.email as 'employee_email' from customer_leads CL, leads L, employees E\r                        where CL.id = {$orderID} and\r                        CL.employee_id = E.id and L.id = CL.id;");
    $rows = $db->result->fetch_object();
    $pdata = json_encode($rows);
}
if (isset($_GET['noOrders'])) {
    echo "<h2>You donot have any orders yet.</h2>";
}
?>

 
 <div id="profileBox"></div>
<script type="text/javascript">
showMsg('<?php 
get_msg();
?>
');
var pdata = <?php 
echo $pdata;
Exemplo n.º 7
0
/**
 * Convert seconds to string, eg. "2 minutes", "1 hour", "16 seconds"
 */
function sec_to_string($sec)
{
    $str = null;
    if ($hours = intval(intval($sec) / 3600)) {
        $str .= $hours > 1 ? $hours . " " . get_msg('hours') : $hours . " " . get_msg('hour');
    }
    if ($minutes = intval($sec / 60 % 60)) {
        $str .= $minutes > 1 ? $minutes . " " . get_msg('minutes') : $minutes . " " . get_msg('minute');
    }
    if ($seconds = intval($sec % 60)) {
        $str .= $seconds > 1 ? $seconds . " " . get_msg('seconds') : $seconds . " " . get_msg('second');
    }
    return $str;
}
Exemplo n.º 8
0
 function get_user($user_id = null)
 {
     if ($user_id) {
         $user = DB::get_row("SELECT * FROM " . DB_PREFIX . "user WHERE user_id = '{$user_id}'");
         $user['level'] = get_msg(strtolower($GLOBALS['user_level'][$user['status']]));
         return $user;
     } else {
         return isset(self::$user) ? self::$user : null;
     }
 }
Exemplo n.º 9
0
 function ld_msg($msg_code = 'err_000', $param = '')
 {
     static $_language_item = array();
     if (!isset($_language_item[$msg_code])) {
         $msg =& get_msg();
         if (!isset($msg[$msg_code])) {
             show_error("Your language file does not appear to be formatted correctly.");
         }
         $_language_item[$msg_code] = $msg[$msg_code];
     }
     return str_replace('{%s}', $param, $_language_item[$msg_code]);
 }
Exemplo n.º 10
0
 /**
  * Page was not found
  * 
  * @param string $msg, message for the page not found
  */
 protected function _draw_page_not_found($msg = "page_not_found")
 {
     header("HTTP/1.0 404 Not Found");
     $this->page_layout = $this->not_found_layout;
     $this->assign("message", get_msg($msg));
     $this->draw();
     die;
 }
Exemplo n.º 11
0
}
switch ($tela) {
    case 'gerenciar':
        ?>
		<div class="twelve columns">
			<script type="text/javascript">
				$(function(){
					$('.deletareg').click(function(){
						if(confirm("Deseja Realmente excluir este registro?\nEsta Operação não poderá ser desfeita!"))return true; else return false;
					});
				});
			</script>
			<?php 
        echo breadcrumb();
        get_msg('msgok');
        get_msg('msgerro');
        $modo = $this->uri->segment(3);
        if ($modo == 'all') {
            $limit = 0;
        } else {
            $limit = 50;
            echo '<p>Mostrando os últimos 50 registros, para ver todo o histórico ' . anchor('auditoria/gerenciar/all', 'Clique aqui') . ' </p>';
        }
        ?>
			
			<table class="twelve data-table">
				<thead>
					<tr>
						<th>Usuário</th>
						<th>Data e Hora</th>
						<th>Operação</th>
Exemplo n.º 12
0
}
switch ($tela) {
    case 'cadastrar':
        echo bt_row(array(form_open_multipart('midia/cadastrar'), form_fieldset(), bt_col(12, array(get_msg('msgok'), get_msg('msgerro'), erros_validacao())), bt_col(12, bt_input('Titulo midia', 'nome', 4)), bt_col(12, bt_input('Descrição', 'descricao', 2)), bt_col(12, bt_input('Alt', 'alt', 2)), bt_col(12, bt_form(12, array(form_label('Arquivo'), form_upload(array('name' => 'arquivo'), set_value('arquivo'))))), bt_col(12, array(anchor('midia/gerenciar', 'Canselar', array('class' => 'btn btn-danger espaco')), bt_submit('Salvar', 'cadastrar', 4, 3))), form_fieldset_close(), form_close()));
        break;
    case 'editar':
        $id = $this->uri->segment(3);
        if ($id == NULL) {
            set_msg('msgerro', 'Não foi informado uma midia valido.', 'aviso');
            redirect('midia/gerenciar');
        }
        $query = $this->midia->get_byid($id)->row();
        echo bt_row(array(form_open(current_url()), form_fieldset(), bt_col(12, array(get_msg('msgok'), get_msg('msgerro'), erros_validacao())), bt_col(6, array(bt_col(12, bt_input_cont('Titulo midia', 'nome', 12, $query->nome)), bt_col(12, bt_input_cont('Descrição', 'descricao', 12, $query->descricao)), bt_col(12, bt_input_cont('Alt', 'alt', 12, $query->alt)), bt_col(12, array(anchor('midia/gerenciar', 'Canselar', array('class' => 'btn btn-danger espaco')), bt_submit('Salvar', 'cadastrar', 4, 3))))), bt_col(6, trumb($query->arquivo, 300, 250, TRUE, $query->alt)), form_hidden('id', $id), form_fieldset_close(), form_close()));
        break;
    case 'gerenciar':
        bt_row(bt_col(12, array(get_msg('msgok'), get_msg('msgerro'))));
        ?>
       
         <div class="table-responsive">
            <table class="table table-hover table-striped data-table">
                <thead>
                    <tr>

                       <th>Nome<i class="fa"></i></th>
                       <th>Link<i class="fa"></i></th>
                       <th>Miniaturar<i class="fa"></i></th>
                       <th class="text-center">Ação<i class="fa"></i></th>
                    </tr>
                </thead>
                <?php 
        $query = $this->midia->get_all()->result();
Exemplo n.º 13
0
 function _update_store_state()
 {
     $store_mod =& m('store');
     $stores = $store_mod->find(array('conditions' => "state = '" . STORE_OPEN . "' AND end_time > 0 AND end_time < '" . gmtime() . "'", 'join' => 'belongs_to_user', 'fields' => 'store_id, user_id, user_name, email'));
     foreach ($stores as $store) {
         $subject = Lang::get('close_store_notice');
         $content = get_msg('toseller_store_closed_notify', array('reason' => Lang::get('close_reason')));
         /* 连接用户系统 */
         $ms =& ms();
         $ms->pm->send(MSG_SYSTEM, $store['user_id'], '', $content);
         $this->_mailto($store['email'], $subject, $content);
         $store_mod->edit($store['store_id'], array('state' => STORE_CLOSED, 'close_reason' => Lang::get('close_reason')));
     }
 }
Exemplo n.º 14
0
 function index()
 {
     $id = empty($_GET['id']) ? 0 : intval($_GET['id']);
     if (!$id) {
         $this->show_warning('no_such_groupbuy');
         return false;
     }
     // 团购信息
     $group = $this->_groupbuy_mod->get(array('conditions' => 'group_id=' . $id . ' AND gb.state<>' . GROUP_PENDING, 'join' => 'belong_store', 'fields' => 'gb.*,s.owner_name'));
     if (empty($group)) {
         $this->show_warning('no_such_groupbuy');
         return;
     }
     // 团购商品信息
     $goods = $this->_query_goods_info($group['goods_id']);
     if ($goods['closed'] == 1) {
         $this->show_warning('groupbuy_goods_closed');
         return;
     }
     if (!IS_POST) {
         $data['views'] = $group['views'] + 1;
         // 浏览数
         if ($group['end_time'] < gmtime() && $group['state'] == GROUP_ON) {
             $group['state'] = GROUP_END;
             // 结束团购
             /* 通知卖家 */
             $content = get_msg('toseller_groupbuy_end_notify', array('cancel_days' => GROUP_CANCEL_INTERVAL));
             $this->_groupbuy_mod->sys_notice($id, array('seller'), '', $content, array('msg'));
         } else {
             if ($group['end_time'] + GROUP_CANCEL_INTERVAL * 3600 * 24 < gmtime() && $group['state'] == GROUP_END) {
                 $group['state'] = GROUP_CANCELED;
                 // 取消团购
                 /* 通知买家和站长 */
                 $content = get_msg('tobuyer_group_auto_cancel_notify', array('cancel_days' => GROUP_CANCEL_INTERVAL, 'url' => SITE_URL . '/' . url("app=groupbuy&id={$id}")));
                 $this->_groupbuy_mod->sys_notice($id, array('admin', 'buyer'), '', $content, array('msg'));
             }
         }
         $data['state'] = $group['state'];
         $this->_groupbuy_mod->edit($id, $data);
         // 订购数
         $group['quantity'] = $this->_groupbuy_mod->get_join_quantity($id);
         // 进度
         $group['left_quantity'] = $group['min_quantity'] - $group['quantity'];
         $group['left_per'] = 100 - intval(100 * $group['quantity'] / $group['min_quantity']);
         $group['left_per'] < 0 && ($group['left_per'] = 0);
         // 状态描述
         $group['state_desc'] = $this->_get_state_desc($group['state'], $group['end_time']);
         // 团购规格价格
         $group['spec_price'] = unserialize($group['spec_price']);
         // 可执行操作
         $group['ican'] = $this->_ican($group['group_id'], $group['state'], $group['store_id']);
         // 参团记录
         $join_list = $this->_groupbuy_mod->get_join_list($id);
         foreach ($goods['_specs'] as $key => $spec) {
             if (empty($group['spec_price'][$spec['spec_id']])) {
                 unset($goods['_specs'][$key]);
             } else {
                 $goods['_specs'][$key]['group_price'] = $group['spec_price'][$spec['spec_id']]['price'];
                 if (isset($join_list[$this->_visitor['user_id']])) {
                     $goods['_specs'][$key]['my_qty'] = $join_list[$this->_visitor['user_id']]['spec_quantity'][$spec['spec_id']]['qty'];
                 }
             }
         }
         // 店铺信息
         $this->set_store($goods['store_id']);
         $store = $this->get_store_data();
         // 当前位置
         $this->_curlocal(array(array('text' => Lang::get('groupbuy'), 'url' => url('app=search&act=groupbuy')), array('text' => $group['group_name'])));
         // 团购咨询数据
         $data = $this->_get_groupbuy_qa($id);
         if (Conf::get('captcha_status.goodsqa')) {
             $this->assign('captcha', 1);
         }
         $this->assign('email', $data['email']);
         $this->assign('page_info', $data['page_info']);
         $this->assign('qa_info', $data['qa_info']);
         /* 页面标题 */
         $this->_config_seo('title', $group['group_name'] . ' - ' . Lang::get('groupbuy') . ' - ' . Conf::get('site_title'));
         $this->_import_resource();
         $this->assign('store', $store);
         $this->assign('goods', $goods);
         $this->assign('group', $group);
         $this->assign('guest_comment_enable', Conf::get('guest_comment'));
         $this->assign('join_list', $join_list);
         $this->display('groupbuy.index.html');
     } else {
         if (isset($_POST['join'])) {
             $quantity = 0;
             $spec_quantity = array();
             foreach ($_POST['quantity'] as $key => $val) {
                 if ($_POST['quantity'][$key] > 0) {
                     $spec_quantity[$_POST['spec_id'][$key]] = array('spec' => $_POST['spec'][$key], 'qty' => $_POST['quantity'][$key]);
                     $quantity += $_POST['quantity'][$key];
                 } elseif ($_POST['quantity'][$key] != '') {
                     $this->show_warning('invalid_quantity');
                     return;
                 }
             }
             if ($quantity == 0) {
                 $this->show_warning('fill_quantity');
                 return;
             }
             if ($group['max_per_user'] > 0 && $quantity > $group['max_per_user']) {
                 $this->show_warning(sprintf(Lang::get('error_max_per_user'), $group['max_per_user']));
                 return;
             }
             $link_man = trim($_POST['link_man']);
             $tel = trim($_POST['tel']);
             if (!$link_man || !$tel) {
                 $this->show_warning('fill_join_user_info');
                 return;
             }
             $data[$group['group_id']] = array('user_name' => $this->_visitor['user_name'], 'quantity' => $quantity, 'spec_quantity' => serialize($spec_quantity), 'linkman' => $link_man, 'tel' => $tel, 'order_id' => 0, 'add_time' => gmtime());
             $member_mod =& m('member');
             $member_mod->createRelation('join_groupbuy', $this->_visitor['user_id'], $data);
             $this->show_message('join_groupbuy_successed');
             $groupbuy_url = SITE_URL . '/' . url('app=groupbuy&id=' . $group['group_id']);
             $groupbuy_name = $group['group_name'];
             $this->send_feed('groupbuy_joined', array('user_id' => $this->visitor->get('user_id'), 'user_name' => $this->visitor->get('user_name'), 'groupbuy_url' => $groupbuy_url, 'groupbuy_name' => $groupbuy_name, 'images' => array(array('url' => SITE_URL . '/' . $goods['default_image'], 'link' => $groupbuy_url))));
             return;
         } elseif (isset($_POST['qa'])) {
             /* 不允许游客评论 */
             if (!Conf::get('guest_comment') && !$this->visitor->has_login) {
                 $this->show_warning('guest_comment_disabled');
                 return;
             }
             //团购咨询
             $content = isset($_POST['content']) ? trim($_POST['content']) : '';
             $email = isset($_POST['email']) ? trim($_POST['email']) : '';
             $hide_name = isset($_POST['hide_name']) ? trim($_POST['hide_name']) : '';
             if (empty($content)) {
                 $this->show_warning('content_not_null');
                 return;
             }
             $qa_mod =& m('goodsqa');
             //对验证码和邮件进行判断
             if (Conf::get('captcha_status.goodsqa')) {
                 if (base64_decode($_SESSION['captcha']) != strtolower($_POST['captcha'])) {
                     $this->show_warning('captcha_failed');
                     return;
                 }
             }
             if (!empty($email) && !is_email($email)) {
                 $this->show_warning('email_not_correct');
                 return;
             }
             // 匿名发布
             $user_id = empty($hide_name) ? $_SESSION['user_info']['user_id'] : 0;
             $conditions = 'group_id =' . $id;
             $groupbuy_mod =& m('groupbuy');
             $ids = $groupbuy_mod->get(array('fields' => 'store_id,group_name', 'conditions' => $conditions));
             extract($ids);
             $data = array('question_content' => $content, 'type' => 'groupbuy', 'item_id' => $id, 'item_name' => $group_name, 'store_id' => $store_id, 'email' => $email, 'user_id' => $user_id, 'time_post' => gmtime());
             if ($qa_mod->add($data)) {
                 $this->show_message('question_successful');
                 return;
             } else {
                 $this->show_warning('post_fail');
                 exit;
             }
         } else {
             if (isset($_POST['exit'])) {
                 $member_mod =& m('member');
                 $member_mod->unlinkRelation('join_groupbuy', $this->_visitor['user_id'], $group['group_id']);
                 $this->show_message('exit_groupbuy_successed');
                 return;
             }
         }
     }
 }
Exemplo n.º 15
0
<div class="row">
<?php 
echo '<div class="small-4 small-centered large-4 columns large-centered">';
echo form_open('usuarios/login', array('class' => 'custom login-form'));
echo form_fieldset('Identifique-se');
erros_validacao();
get_msg('logoffok');
get_msg('errologin');
echo form_label('Usuário');
echo form_input(array('name' => 'usuario'), set_value('usuario'), 'autofocus');
echo form_label('Senha');
echo form_password(array('name' => 'senha'), set_value('senha'));
echo form_hidden('redirect', $this->session->userdata('redir_para'));
echo form_submit(array('name' => 'logar', 'class' => 'button radius right'), 'Login');
echo "<p>" . anchor('usuarios/nova_senha', 'Esqueci  minha senha') . '<p>';
echo form_fieldset_close();
echo form_close();
echo "</div>";
?>
 </div>
Exemplo n.º 16
0
    $img->set_width($pic_width);
    //決定縮圖大小,大圖大小
    $img->set_savepath("../images/" . date("Y-m-d"));
    //設定儲存路徑
    $pic2 = $img->save();
} else {
    $pic2 = $_POST['pic2'];
}
if ($check == 'upd') {
    $unit->table = $pro_class_table;
    $unit->get_vars();
    $unit->pic = $pic;
    $unit->pic2 = $pic2;
    $buff = array();
    $unit->get_history($unit->upid, $buff);
    $unit->upd();
    $tool->show(get_msg("upd_success"), $_SERVER['HTTP_REFERER']);
    exit;
}
if (isset($_POST['del'])) {
    $id = $_POST['id'];
    for ($i = 0; $i < count($id); $i++) {
        del_child($id[$i]);
    }
    if (count($id) > 0) {
        $tool->show(get_msg("del_success"), $_SERVER['HTTP_REFERER']);
    } else {
        $tool->error(get_msg("del_fail"));
    }
    exit;
}
Exemplo n.º 17
0
 protected function init_variable()
 {
     $this->THEMEVARS = array();
     $this->THEMEVARS['is_home'] = $this->is_home;
     $this->THEMEVARS['base_url'] = _URL;
     $this->THEMEVARS['theme_url'] = $this->theme_url;
     $this->THEMEVARS['logo_url'] = $this->meta->logo();
     $this->THEMEVARS['config'] = (array) $this->meta->sys_config;
     $this->THEMEVARS['meta'] = $this->meta->get_meta();
     $this->THEMEVARS['breadcrumb'] = $this->meta->breadcrumb_trail;
     $this->THEMEVARS['copyright'] = str_replace("[year]", date('Y'), $this->meta->sys_config->copyright);
     $this->THEMEVARS['notification'] = get_msg(true);
     $this->init_blocks();
     if (isset($_GET['_d_x_'])) {
         pr($this->THEMEVARS);
         die;
     }
 }
Exemplo n.º 18
0
 function view()
 {
     $id = empty($_GET['id']) ? 0 : intval($_GET['id']);
     if (!IS_POST) {
         /* 是否存在 */
         $store = $this->_store_mod->get_info($id);
         if (!$store) {
             $this->show_warning('Hacking Attempt');
             return;
         }
         $sgrade_mod =& m('sgrade');
         $sgrades = $sgrade_mod->get_options();
         $store['sgrade'] = $sgrades[$store['sgrade']];
         $this->assign('store', $store);
         $scates = $this->_store_mod->getRelatedData('has_scategory', $id);
         $this->assign('scates', $scates);
         $this->display('store.view.html');
     } else {
         $ret_page = isset($_GET['ret_page']) ? intval($_GET['ret_page']) : 1;
         /* 批准 */
         if (isset($_POST['agree'])) {
             $this->_store_mod->edit($id, array('state' => STORE_OPEN, 'add_time' => gmtime(), 'sort_order' => 65535));
             $content = get_msg('toseller_store_passed_notify');
             $ms =& ms();
             $ms->pm->send(MSG_SYSTEM, $id, '', $content);
             $store_info = $this->_store_mod->get_info($id);
             $this->send_feed('store_created', array('user_id' => $store_info['store_id'], 'user_name' => $store_info['user_name'], 'store_url' => SITE_URL . '/' . url('app=store&id=' . $store_info['store_id']), 'seller_name' => $store_info['store_name']));
             $this->_hook('after_opening', array('user_id' => $id));
             $this->show_message('agree_ok', 'edit_the_store', 'index.php?app=store&amp;act=edit&amp;id=' . $id, 'back_list', 'index.php?app=store&wait_verify=1&page=' . $ret_page);
         } elseif (isset($_POST['reject'])) {
             $reject_reason = trim($_POST['reject_reason']);
             if (!$reject_reason) {
                 $this->show_warning('input_reason');
                 return;
             }
             $content = get_msg('toseller_store_refused_notify', array('reason' => $reject_reason));
             $ms =& ms();
             $ms->pm->send(MSG_SYSTEM, $id, '', $content);
             $this->_drop_store_image($id);
             // 注意这里要先删除图片,再删除店铺,因为删除图片时要查店铺信息
             $this->_store_mod->drop($id);
             $this->show_message('reject_ok', 'back_list', 'index.php?app=store&wait_verify=1&page=' . $ret_page);
         } else {
             $this->show_warning('Hacking Attempt');
             return;
         }
     }
 }
Exemplo n.º 19
0
<?php

require 'db.php';
require 'chat.func.php';
$messages = get_msg();
foreach ($messages as $message) {
    echo '<strong>' . $message['sender'] . ' Sent:</strong><br />';
    echo $message['message'] . '<br /><br />';
}
Exemplo n.º 20
0
		$('.deletareg').click(function(){
			if(confirm("deseja realmente excluir esse registro?\nEsta operação não poderá ser desfeita!"))return true;else return false;
		});
		$('.link').on('click', function(){
			$(this).select();
		});
	})
</script>
<p class="breadcrumb"><?php 
echo breadcrumb();
?>
</p>
<div class="large-12 columns">		
	<?php 
get_msg('msgok');
get_msg('msgerror');
?>
	
	<table class="large-12 data-table">
		<thead>
			<tr>
				<th>Foto</th>
				<th>Nome</th>
				<th>categoria</th>				
				<th class="tex-center">Ações</th>
			</tr>
		</thead>
		<tbody>
			<?php 
foreach ($query as $data) {
    echo "<tr>";
Exemplo n.º 21
0
if ($_POST['submit']) {
    $unit = new product_class();
    $tool = new My_Tool();
    $sam = new guard();
    //檢查傳入值--------------------------
    $name = htmlspecialchars(trim($_POST['name']));
    if (empty($name)) {
        $tool->error(get_msg("name_error"));
    } else {
        $name = $sam->var_check($name);
    }
    $unit->table = $pro_class_table;
    $unit->get_vars();
    $buff = array();
    $unit->get_history($unit->upid, $buff);
    $unit->add();
    $tool->show(get_msg("add_success"), $_SERVER['HTTP_REFERER']);
    exit;
}
?>
			 
    <form method="post" action="">
	<input type="hidden" name="upid" value="<?php 
print $_GET['id'];
?>
" />
	類別名稱:<input type="text" name="name" size="20" />
	排序:   <input type="text" name="no" value="100" />
	<input type="submit" name="submit" value="新增類別" />
	</form>
Exemplo n.º 22
0
 function _message_to_user($users, $coupon)
 {
     $ms =& ms();
     foreach ($users as $key => $val) {
         $content = get_msg('touser_send_coupon', array('price' => $coupon['coupon_value'], 'start_time' => local_date('Y-m-d', $coupon['start_time']), 'end_time' => local_date("Y-m-d", $coupon['end_time']), 'coupon_sn' => $val['coupon']['coupon_sn'], 'min_amount' => $coupon['min_amount'], 'url' => SITE_URL . '/' . url('app=store&id=' . $coupon['store_id']), 'store_name' => $coupon['store_name']));
         $msg_id = $ms->pm->send(MSG_SYSTEM, $val['user_id'], '', $content);
     }
 }
Exemplo n.º 23
0
			</section>
			
			<section class="content">
				<div class="row">
				<div class="col-md-12">
					<div class="box box-primary">
						<div class="box-header">
							<h3 class="box-title">Informações</h3>
						</div>
						
						<div class="box-body">
							<?php 
        $query = $this->cursos->get_byid($id)->row();
        //erros de validação dos campos do formulário
        erros_validacao();
        get_msg('msgok');
        ?>
						   
							<?php 
        echo form_open(current_url());
        ?>
							<div class="form-group"> 
								<label>Descrição</label>
								<div class="input-group">
									<span class="input-group-addon"><i class="fa fa-text-height"></i></span>
									<?php 
        echo form_input(array('name' => 'descricao', 'class' => 'form-control'), set_value('descricao', $query->descricao), 'disabled');
        ?>
								</div>
							</div>
							
Exemplo n.º 24
0
 function refuse()
 {
     $id = $_GET['id'];
     if (empty($id)) {
         $this->show_warning('request_error');
         exit;
     }
     if (!IS_POST) {
         $this->import_resource(array('script' => 'jquery.plugins/jquery.validate.js'));
         $this->display('brand_refuse.html');
     } else {
         if (empty($_POST['content'])) {
             $this->show_warning('content_required');
             exit;
         }
         $ids = explode(',', trim($_GET['id']));
         $brands = $this->_brand_mod->find(db_create_in($ids, 'brand_id') . ' AND if_show = 0');
         $ms =& ms();
         $content = '';
         foreach ($brands as $brand) {
             $content = get_msg('toseller_brand_refused_notify', array('brand_name' => $brand['brand_name'], 'reason' => trim($_POST['content'])));
             $ms->pm->send(MSG_SYSTEM, $brand['store_id'], '', $content);
             if (is_file(ROOT_PATH . '/' . $brand['brand_logo']) && file_exists(ROOT_PATH . '/' . $brand['brand_logo'])) {
                 unlink(ROOT_PATH . '/' . $brand['brand_logo']);
             }
             $this->_brand_mod->drop($brand['brand_id']);
         }
         $this->show_message('brand_refused', 'back_list', 'index.php?app=brand&wait_verify=1');
     }
 }
Exemplo n.º 25
0
 function add_validation($name, $validation, $message = null)
 {
     if ($validation) {
         $val = explode(",", $validation);
         foreach ($val as $validation) {
             $array = explode("=", $validation);
             $validation = $array[0];
             $value = isset($array[1]) ? $array[1] : true;
             if (!in_array($validation, explode(',', 'required,remote,minlength,maxlength,rangelength,min,max,range,email,url,date,dateISO,dateDE,number,numberDE,digits,creditcard,accept,equalTo'))) {
                 echo "Validation method not found: {$validation}<br>";
             }
             $message = $message ? $message : str_replace('{$value}', $value, get_msg($validation));
             $message = "{$validation}: '{$message}'";
             $rule = "{$validation}: {$value}";
             if (!isset($this->validation[$name])) {
                 $this->validation[$name] = array('rules' => '', 'messages' => '');
             }
             $this->validation[$name]['rules'][] = $rule;
             $this->validation[$name]['messages'][] = $message;
             $message = null;
         }
     }
 }
Exemplo n.º 26
0
    <li>
    <div id="user">
      Hello, <?php 
        echo $user->get_name();
        ?>
!
    </div>
    </li>
 <?php 
    }
    ?>
  <?php 
}
?>
  
    		</ul>
	   </div>
	   
  <?php 
if (has_msg()) {
    ?>
<div id="message-box" class="message"><?php 
    echo get_msg();
    ?>
</div>
  <?php 
}
?>
  
  
Exemplo n.º 27
0
}
// get user id if specified
if (isset($_POST['uid'])) {
    $uid = $_POST['uid'];
} elseif (isset($_GET['uid'])) {
    $uid = $_GET['uid'];
}
// get paid / spent if specified
if (isset($_POST['xtype'])) {
    $xtype = $_POST['xtype'];
} elseif (isset($_GET['xtype'])) {
    $xtype = $_GET['xtype'];
}
// get message
if (isset($_GET['msg'])) {
    $message = get_msg($_GET['msg']);
}
switch ($mode) {
    case "showexpenses":
        $showexpenses = true;
        break;
}
// Start HTML output
print_header();
// array structure: $bararray['title'], $bararray['leftnav'][$i][name|url], $bararray['rightnav'][$i][name|url]
$topbar['title'] = $groupdetails['name'];
// $topbar['leftnav'][0]['name'] = "Group";
// $topbar['leftnav'][0]['url'] =  "http://" . $_SERVER['HTTP_HOST'] . DIR . "group_detail.php?groupid=" . $groupdetails['group_id'];
/*if ( !strpos($_SESSION['back'],"expenses.php") && !strpos($_SESSION['back'],"expense_detail.php")) {
  $_SESSION['eshow_back'] = $_SESSION['back'];
       $backurl = $_SESSION['eshow_back'];
Exemplo n.º 28
0
    $result = mysql_query($sql, $con);
    return mysql_num_rows($result);
    mysql_close($con);
}
// get message
$last_msg = get_msg();
// start the loop
while (true) {
    // get current time
    $current_time = time();
    // check if we are timed out
    if ($current_time - $start_time > $timeout) {
        break;
    }
    // get latest message
    $current_msg = get_msg();
    if ($last_msg != $current_msg) {
        $length = $current_msg - $last_msg;
        $con = mysql_connect("localhost", "root", "qwe123");
        if (!$con) {
            die('Could not connect: ' . mysql_error());
        }
        $db_selected = mysql_select_db("web", $con);
        $sql = "SELECT * FROM talk order by id desc limit {$length}";
        $get = mysql_query($sql);
        while ($row = mysql_fetch_array($get)) {
            echo $row["name"];
            echo ",";
            echo $row['text'];
            echo ",";
            echo $row['img'];
Exemplo n.º 29
0
            set_msg('msgerro', 'Não foi informado um usuario valido.', 'aviso');
            redirect('usuarios/gerenciar');
        }
        if (is_admin() || $iduser == $this->session->userdata('user_id')) {
            $query = $this->usuarios->get_byid($iduser)->row();
            echo bt_row(array(form_open(current_url(), array('role' => 'form')), form_fieldset(), bt_col(12, array(get_msg('msgok'), get_msg('msgerro'), erros_validacao())), bt_col(12, bt_input_disabled('Nome', 'nome', 4, $query->nome)), bt_col(12, array(bt_input_disabled('Login', 'loginoff', 2, $query->login), form_hidden('login', $query->login))), bt_col(12, bt_input_disabled('E-Mail', 'email', 4, $query->email)), bt_col(12, bt_password('Senha', 'senha', 2)), bt_col(12, bt_password('Repita Senha', 'senha2', 2)), bt_col(12, array(anchor('usuarios/gerenciar', 'Canselar', array('class' => 'btn btn-danger espaco')), bt_submit('Salvar', 'alterarsenha', 4, 3))), form_hidden('idusuario', $iduser), form_fieldset_close(), form_close()));
        } else {
            set_msg('msgerro', 'Não tem permição para alterar a senha.', 'aviso');
            redirect('usuarios/gerenciar');
        }
        break;
    case 'editar':
        $iduser = $this->uri->segment(3);
        if ($iduser == NULL) {
            set_msg('msgerro', 'Não foi informado um usuario valido.', 'aviso');
            redirect('usuarios/gerenciar');
        }
        if (is_admin() || $iduser == $this->session->userdata('user_id')) {
            $query = $this->usuarios->get_byid($iduser)->row();
            echo bt_row(array(form_open(current_url(), array('role' => 'form')), form_fieldset(), bt_col(12, array(get_msg('msgok'), get_msg('msgerro'), erros_validacao())), bt_col(12, bt_input_cont('Nome', 'nome', 4, $query->nome)), bt_col(12, array(bt_input_disabled('Login', 'loginoff', 2, $query->login), form_hidden('login', $query->login))), bt_col(12, bt_input_disabled('E-Mail', 'email', 4, $query->email)), $iduser == 1 ? '<div class=col-md-12><br/> </div>' : bt_col(12, bt_form(6, array(bt_checkbox('ativo', '1', 'Ativa um usuario', $query->ativo == 1 ? TRUE : FALSE), is_admin() ? bt_checkbox('adm', '1', 'Dar porder de ADM', $query->adm == 1 ? TRUE : FALSE) : ''))), bt_col(12, array(anchor('usuarios/gerenciar', 'Canselar', array('class' => 'btn btn-danger espaco')), bt_submit('Salvar', 'alterarsenha', 4, 3))), form_hidden('idusuario', $iduser), form_fieldset_close(), form_close()));
        } else {
            set_msg('msgerro', 'Não tem permição para alterar este usuario.', 'aviso');
            redirect('usuarios/gerenciar');
        }
        break;
    default:
        echo '<div class="alert alert-warning">
                    <strong>Warning!</strong> A tela solicitada não foi encontrada!!
                </div>';
        break;
}
Exemplo n.º 30
0
 function _group_auto_cancel()
 {
     /* 自动取消团购的天数 */
     $interval = GROUP_CANCEL_INTERVAL * 3600 * 24;
     $groupbuy_mod =& m('groupbuy');
     $groups = $groupbuy_mod->findAll(array('conditions' => "gb.state = '" . GROUP_END . "' AND gb.end_time > 0 AND gb.end_time + {$interval} < '" . gmtime() . "'", 'join' => 'belong_store', 'include' => array('be_join')));
     // 短信通知
     $ms =& ms();
     $userpriv_mod =& m('userpriv');
     foreach ($groups as $group) {
         // 管理员
         $admin_id = $userpriv_mod->get_admin_id();
         $to_id = array_keys($admin_id);
         $group_ids[] = $group['group_id'];
         // 参与团购的用户
         if (!empty($group['member'])) {
             foreach ($group['member'] as $join_user) {
                 $to_id[] = $join_user['user_id'];
             }
             $to_id = array_unique($to_id);
         }
         $content = get_msg('tobuyer_group_auto_cancel_notify', array('cancel_days' => GROUP_CANCEL_INTERVAL, 'url' => SITE_URL . '/' . url("app=groupbuy&id=" . $group['group_id'])));
         $ms->pm->send(MSG_SYSTEM, $to_id, '', $content);
     }
     // 取消团购活动
     empty($group_ids) || $groupbuy_mod->edit($group_ids, array('state' => GROUP_CANCELED));
 }