Esempio n. 1
0
function process_code($code)
{
    $url = null;
    if (empty($code)) {
        return -1;
    }
    $url = get_url($code);
    if (empty($url)) {
        return -1;
    }
    $response = verify_url($url);
    if ($response != null) {
        if ($response == 404) {
            return 2;
        }
    } else {
        return -1;
    }
    if (lookup_url_is_spam($url)) {
        return 1;
    }
    if (check4spam($url)) {
        add_bad_url_to_db($url);
        return 1;
    }
    return 0;
}
 function process_postback($vars)
 {
     global $db;
     $this->log_debug($vars);
     $vars1 = $vars;
     $vars1['tipo'] = 'CP';
     $vars1['Comando'] = 'validar';
     $vars1['Token'] = $this->config['token'];
     $vars1['email_cobranca'] = $this->config['merchant_email'];
     foreach ($vars1 as $kk => $vv) {
         $v = urlencode($vv);
         $k = urlencode($kk);
         $vars2[] = "{$k}={$v}";
     }
     $vars2 = join('&', $vars2);
     $res = get_url("https://pagseguro.uol.com.br/Security/NPI/Default.aspx", $vars2);
     if ($res != "VERIFICADO") {
         $this->postback_error($res, $vars1);
         return false;
     }
     // process payment
     if (strtoupper($vars['StatusTransacao']) == 'APROVADO') {
         $err = $db->finish_waiting_payment($vars['ProdID_1'], "pagseguro", $vars['TransacaoID'], str_replace('.', '', $vars['ProdValor_1']), $vars);
         if ($err) {
             $this->postback_error("finish_waiting_payment error: {$err}", $vars);
         }
     }
 }
Esempio n. 3
0
 /**
  * Saves the settings.
  */
 private final function _save()
 {
     $data = $_POST['setting'];
     // CSRF checks
     if (isset($_POST['csrf_token'])) {
         $csrf_token = $_POST['csrf_token'];
         if (!SecureToken::validateToken($csrf_token, BASE_URL . 'setting')) {
             Flash::set('error', __('Invalid CSRF token found!'));
             Observer::notify('csrf_token_invalid', AuthUser::getUserName());
             redirect(get_url('setting'));
         }
     } else {
         Flash::set('error', __('No CSRF token found!'));
         Observer::notify('csrf_token_not_found', AuthUser::getUserName());
         redirect(get_url('setting'));
     }
     if (!isset($data['allow_html_title'])) {
         $data['allow_html_title'] = 'off';
     }
     use_helper('Kses');
     $allowed = array('img' => array('src' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
     $data['admin_title'] = kses(trim($data['admin_title']), $allowed);
     Setting::saveFromData($data);
     Flash::set('success', __('Settings have been saved!'));
     redirect(get_url('setting'));
 }
Esempio n. 4
0
 /**
  * Render the widget in frontend
  *
  * @param array $args
  * @param array $instance
  * @return string
  */
 function get_widget($args, $instance)
 {
     extract(wp_parse_args($instance, array('align' => '', 'animation' => '', 'class' => '', 'style' => '', 'size' => '')));
     if (is_admin()) {
         return "<center><i class='icon-picture  icon-4x'></i></center>";
     }
     if (!empty($image['url'])) {
         if ($animation != "no-animation") {
             $class = "image animated_image animate_when_visible " . $animation;
         }
         $link = get_url($link);
         if ($image['id'] > 0 && $size != '') {
             $img = wp_get_attachment_image_src($image['id'], $size);
             $use_image = " src='{$img[0]}' width='{$img[1]}' height='{$img[2]}' ";
         } else {
             $img = $image['url'];
             $use_image = " src='{$img}' ";
         }
         if ($link) {
             $output = "<a href='" . $link . "' ><img class='img-responsive {$align} {$class} {$style}'  data-animation='" . esc_attr($animation) . "' {$use_image} alt='' /></a>";
         } else {
             $output = "<img class='img-responsive {$align} {$class} {$style}' ' data-animation='" . esc_attr($animation) . "' alt='' {$use_image} />";
         }
     }
     return $output;
 }
Esempio n. 5
0
function get_markers()
{
    global $vbulletin, $cfg;
    $rows = mysql_query("\nSELECT\n  `c`.`id`                     AS `id`,\n  `a`.`id`                     AS `ad_id`,\n  `c`.`companyname`            AS `name`,\n  `c`.`department`             AS `department`,\n  `c`.`pri_address`            AS `street`,\n  `c`.`pri_address_city`       AS `city`,\n  `c`.`pri_address_state`      AS `state`,\n  `c`.`pri_address_zip`        AS `zip`,\n  `countries`.`printable_name` AS `country_name`,\n  `c`.`tel_work`               AS `tel1`,\n  `c`.`tel_other`              AS `tel2`,\n  `c`.`pri_address_lat`        AS `lat`,\n  `c`.`pri_address_long`       AS `lng`,\n  `c`.`pri_address_mapurl`     AS `mapurl`,\n  `c`.`webpage`                AS `url`,\n  `a`.`ad_copy`                AS `ad_copy`,\n  FIND_IN_SET('sponsor',`c`.`nb_tags`) AS `sponsor`,\n  FIND_IN_SET('premium',`c`.`nb_tags`) AS `premium`,\n  FIND_IN_SET('premium',`c`.`nb_tags`) > 0 AS `premium_first`\nFROM (`contacts` `c`\n   LEFT JOIN `countries`\n     ON ((`countries`.`iso` = `c`.`pri_address_country`))\n   LEFT JOIN `nb_ads` `a`\n     ON ((`a`.`contact_id` = `c`.`id`)))\nWHERE (((FIND_IN_SET('hospital',`c`.`nb_tags`) || FIND_IN_SET('other_company',nb_tags)))\n       && FIND_IN_SET('publish',`c`.`nb_tags`) && pri_address_lat <> 0)\n    ") or die("Failed Query");
    $markers = array();
    $is_admin = $vbulletin->userinfo['permissions']['adminpermissions'];
    while ($row = mysql_fetch_assoc($rows)) {
        $url = get_url($row);
        $html = '';
        if ($is_sponsor = $row['sponsor'] && $row['ad_id']) {
            $img_file = $cfg['dir.forum'] . 'ads/' . $row['ad_id'] . '.png';
            list($width, $height, $type, $attr) = getimagesize($img_file);
            $html .= "<img src=\"{$img_file}\" width={$width} height={$height} /><br />";
        }
        if ($is_admin || in_array($vbulletin->userinfo['userid'], array(1, 0, 5650))) {
            $html .= '<a href="' . $cfg['dir.xchg'] . '/contacts/' . $row['id'] . '/edit">*</a> ';
        }
        /*
        if ($is_sponsor){
            $html    .= '<a href="' . $cfg['dir.home'] . 'our_sponsors/">Sponsor</a> ';
        }
        */
        $html .= '<a href="' . $url . '">' . htmlspecialchars($row['name']) . '</a>';
        $html .= '<br />' . htmlspecialchars(trim($row['city'] . ' ' . $row['state'] . ' ' . $row['country_name']));
        $html .= '<br />' . htmlspecialchars($row['tel1']);
        $markers[] = array('lat' => $row['lat'], 'lng' => $row['lng'], 'html' => $html);
    }
    return $markers;
}
 function index()
 {
     $this->title("客户在线留言 - " . $GLOBALS['LANG']['site_name']);
     $this->meta("title", "客户在线留言");
     $type = "default";
     $rt = $this->Cache->read(3600);
     if (is_null($rt)) {
         //获取当前位置
         $rt['hear'] = array();
         $rt['hear'][] = '<a href="' . SITE_URL . '">首页</a>&nbsp;&gt;&nbsp;';
         $rt['hear'][] = '<a href="feedback.php">客户留言</a>';
         //所有分类
         $rt['all_cate'] = $this->action('category', 'get_cate_tree', 0, 'default');
         //当前文章的分类的所有文章
         $order = "ORDER BY tb1.vieworder ASC, tb1.article_id DESC";
         $sql = "SELECT tb1.article_title,tb1.cat_id, tb1.article_id,tb2.cat_name FROM `{$this->App->prefix()}article` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
         $sql .= " ON tb1.cat_id = tb2.cat_id";
         $sql .= " WHERE tb2.type='{$type}'  {$order}";
         $article_list = $this->App->find($sql);
         $rt['article_list'] = array();
         if (!empty($article_list)) {
             foreach ($article_list as $k => $row) {
                 $rt['article_list'][$row['cat_id']][$k] = $row;
                 $rt['article_list'][$row['cat_id']][$k]['url'] = get_url($row['article_title'], $row['article_id'], $type . '.php?id=' . $row['article_id'], 'article', array($type, 'article', $row['article_id']));
             }
             unset($article_list);
         }
         //商品分类列表
         $rt['menu'] = $this->action('catalog', 'get_goods_cate_tree');
         $this->Cache->write($rt);
     }
     $this->set('rt', $rt);
     $this->template('feedback');
 }
 public function update_event()
 {
     if (!isset($_POST['save'])) {
         Flash::set('error', __('Could not update this event!'));
     } else {
         use_helper('Kses');
         /* Prepare the data */
         $data = $_POST['event'];
         if (isset($data['id'])) {
             $data['id'] = kses(trim($data['id']), array());
         }
         $event = new CalendarEvent();
         if (isset($data['id'])) {
             $event->id = $data['id'];
             $event->created_by_id = $data['created_by_id'];
         }
         $event->title = $data['title'];
         $event->date_from = $data['date_from'];
         $event->date_to = $data['date_to'];
         $event->description = $data['description'];
         /* Check data and, if correct, save to DB */
         if ($event->checkData() && $event->save()) {
             if (isset($data['id'])) {
                 Flash::set('success', __('The event has been updated.'));
             } else {
                 Flash::set('success', __('A new event has been created.'));
             }
             redirect(get_url('plugin/calendar/events'));
         } else {
             Flash::setNow('error', __('There are errors in the form.'));
             $this->display(CALENDAR_VIEWS . '/update', array('event' => $event));
         }
     }
 }
Esempio n. 8
0
function wiki_replace_link_callback($matches)
{
    if (count($matches) < 2) {
        return null;
    }
    if ($matches[1] == 'wiki') {
        $rev = Revisions::instance()->getTableName(true);
        $page = Wiki::instance()->getTableName(true);
        $where1 = 'WHERE page_id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId();
        $where2 = 'WHERE id = ' . $matches[2] . ' AND project_id = ' . active_project()->getId();
        $sql = "SELECT page_id, name FROM {$rev} {$where1} ";
        $sql .= "AND revision = ( select revision from {$page} {$where2} )";
        //echo $sql;
        $row = DB::executeOne($sql);
        if (!count($row)) {
            return null;
        }
        $url = get_url($matches[1], 'view', array('id' => $matches[2]));
        $url = str_replace('&amp;', '&', $url);
        return '"' . $row['name'] . '(' . $row['page_id'] . ')":' . $url;
    }
    $user = Users::instance()->getTableName(true);
    $where1 = 'WHERE id = ' . $matches[2];
    $sql = "SELECT id, display_name FROM {$user} {$where1} ";
    echo $sql;
    $row = DB::executeOne($sql);
    if (!count($row)) {
        return null;
    }
    $url = get_url($matches[1], 'card', array('id' => $matches[2]));
    $url = str_replace('&amp;', '&', $url);
    return '"' . $row['display_name'] . '(' . $row['id'] . ')":' . $url;
}
Esempio n. 9
0
 public function common($params)
 {
     $Register = Register::getInstance();
     $output = '';
     if (!strpos($params, '{{ users_rating }}')) {
         return $params;
     }
     $Cache = new Cache();
     $Cache->lifeTime = 600;
     if ($Cache->check('pl_users_rating')) {
         $users = $Cache->read('pl_users_rating');
         $users = json_decode($users, true);
     } else {
         $users = $this->DB->select('users', DB_ALL, array('order' => '`rating` DESC', 'limit' => $this->limit));
         //$users = $this->DB->query($sql);
         $Cache->write(json_encode($users), 'pl_users_rating', array());
     }
     if (!empty($users)) {
         foreach ($users as $key => $user) {
             $link = get_link($user['name'], getProfileUrl($user['id']));
             $ava = file_exists(ROOT . '/sys/avatars/' . $user['id'] . '.jpg') ? get_url('/sys/avatars/' . $user['id'] . '.jpg') : get_url('/sys/img/noavatar.png');
             $output .= sprintf($this->wrap, $ava, $link, $user['rating'], $user['posts']);
         }
     }
     $output .= '<div class="etopu">' . get_link('Весь рейтинг', '/users/index?order=rating') . '</div>';
     return str_replace('{{ users_rating }}', $output, $params);
 }
Esempio n. 10
0
 public function run($formData, $step, &$state)
 {
     $response = parent::run($formData, $step, $state);
     if (!$response->isSuccessful()) {
         return $response;
     }
     $stepsData = [];
     foreach ($state['steps'] as $aStep) {
         if ($stepData = $aStep->getData()) {
             $stepsData = array_merge($stepsData, $stepData);
         }
     }
     unset($stepsData['languages']);
     unset($_SESSION['install_locale']);
     InstallerUtils::createConfig($stepsData, BASE_PATH . '/api');
     InstallerUtils::createTables(BASE_PATH);
     InstallerUtils::addDefaultSettings($stepsData, BASE_PATH);
     $stepsData = InstallerUtils::addDefaultUser($stepsData);
     InstallerUtils::installSchema($stepsData['db_schema'], BASE_PATH);
     $data = ['user' => ['email' => $stepsData['directus_email'], 'token' => $stepsData['user_token'], 'password' => $stepsData['directus_password']], 'project' => ['name' => $stepsData['directus_name'], 'version' => DIRECTUS_VERSION, 'url' => get_url()], 'database' => ['host' => $stepsData['db_host'], 'name' => $stepsData['db_name'], 'user' => $stepsData['db_user'], 'password' => $stepsData['db_password']]];
     if ($response->getData('send_config_email')) {
         Mail::send('mail/new-install.twig.html', $data, function ($message) use($data) {
             $message->setSubject(__t('your_new_directus_instance_x', ['name' => $data['project']['name']]));
             $message->setTo($data['user']['email']);
         });
     }
     return $response;
 }
Esempio n. 11
0
 function __construct()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     }
 }
 /**
  * 检测用户是否已经登陆 
  */
 public final function check_member()
 {
     if (GROUP_NAME == 'Member' && MODULE_NAME == 'Index' && in_array(ACTION_NAME, array('login', 'register', 'logout', 'connectregister'))) {
         return true;
     } else {
         if (AppframeAction::$Cache['uid']) {
             //禁止访问会员组
             if (AppframeAction::$Cache['User']['groupid'] == 1) {
                 service("Passport")->logoutLocal();
                 $this->error("您的会员组为禁止访问!", CONFIG_SITEURL);
             } else {
                 if (AppframeAction::$Cache['User']['groupid'] == 7) {
                     //邮箱认证
                     service("Passport")->logoutLocal();
                     $this->error("您还没有进行邮箱认证!", CONFIG_SITEURL);
                 }
             }
             //锁定用户
             if (AppframeAction::$Cache['User']['islock'] == 1) {
                 service("Passport")->logoutLocal();
                 $this->error("您的帐号已经被锁定!", CONFIG_SITEURL);
             }
         } else {
             service("Passport")->logoutLocal();
             $forward = isset($_REQUEST['forward']) ? $_REQUEST['forward'] : get_url();
             cookie("forward", $forward);
             $this->error("您的会话已过期,请重新登录。!", U("Member/Index/login"));
         }
     }
 }
Esempio n. 13
0
 /**
  * Render the widget in frontend
  *
  * @param array $args
  * @param array $instance
  * @return string
  */
 function get_widget($args, $instance)
 {
     extract(wp_parse_args($instance, array('align' => '', 'animation' => '', 'class' => '', 'style' => '', 'size' => '', 'image' => array(), 'name' => '', 'subtitle' => '', '_content' => '', 'output' => '')));
     if (is_admin()) {
         return "<center><i class='icon-picture  icon-4x'></i></center>";
     }
     if (isset($image['id']) && !empty($image['id'])) {
         $img = wp_get_attachment_image_src($image['id'], 'medium');
         $use_image = " src='{$img[0]}' width='{$img[1]}' height='{$img[2]}' ";
         //button link
         if (is_array($link) && count($link) > 0) {
             $link = get_url($link);
         } else {
             $link = '#';
         }
         $target = $link_target == '_blank' ? 'target="_blank"' : '';
         $class = $color . " " . $size . " " . $style;
         if ($icon_select == '1') {
             $font_icon = '<i class="' . $icon . '"></i> ';
             $class = $class . " btn-with-icon";
         }
         $link = '<a href="' . $link . '" class="btn ' . $class . '" ' . $target . '>' . $font_icon . $label . '</a>';
         $output = "\n            <div class='shape'>\n                <a href='#' class='team-overlay hexagon'></a>\n                <div class='details'>\n                    <span class='heading'>{$name}</span>\n\n                    <p>\n                        {$subtitle} <br />\n                        {$_content}\n                    </p> \n                    <br />       \n                    {$link}      \n                </div>\n                <div class='bg'></div>\n                <div class='base'>\n                    <img class='img-responsive' {$use_image} alt='' />\n                </div>\n            </div>\n            ";
     }
     return $output;
 }
 /**
  * Show and process config category form
  *
  * @param void
  * @return null
  */
 function update_category()
 {
     $category = ConfigCategories::findById(get_id());
     if (!$category instanceof ConfigCategory) {
         flash_error(lang('config category dnx'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     if ($category->isEmpty()) {
         flash_error(lang('config category is empty'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     $options = $category->getOptions(false);
     $categories = ConfigCategories::getAll(false);
     tpl_assign('category', $category);
     tpl_assign('options', $options);
     tpl_assign('config_categories', $categories);
     $submitted_values = array_var($_POST, 'options');
     if (is_array($submitted_values)) {
         foreach ($options as $option) {
             $new_value = array_var($submitted_values, $option->getName());
             if (is_null($new_value) || $new_value == $option->getValue()) {
                 continue;
             }
             $option->setValue($new_value);
             $option->save();
         }
         // foreach
         flash_success(lang('success update config category', $category->getDisplayName()));
         $this->redirectTo('administration', 'configuration');
     }
     // if
     $this->setSidebar(get_template_path('update_category_sidebar', 'config'));
 }
 private function loadPanels($options)
 {
     if (!$this->panels) {
         $contact_pg_ids = ContactPermissionGroups::getPermissionGroupIdsByContactCSV(logged_user()->getId(), false);
         $this->panels = array();
         $sql = "\r\n\t\t\t\tSELECT * FROM " . TABLE_PREFIX . "tab_panels \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tenabled = 1 AND\t\t\t\t\t\r\n\t\t\t\t\t( \t\r\n\t\t\t\t\t\tplugin_id IS NULL OR plugin_id=0 OR\r\n\t\t\t\t\t\tplugin_id IN (SELECT id FROM " . TABLE_PREFIX . "plugins WHERE is_installed = 1 AND is_activated = 1) \r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND id IN (SELECT tab_panel_id FROM " . TABLE_PREFIX . "tab_panel_permissions WHERE permission_group_id IN ({$contact_pg_ids}))\r\n\t\t\t\tORDER BY ordering ASC ";
         $res = DB::execute($sql);
         while ($row = $res->fetchRow()) {
             $object = array("title" => lang($row['title']), "id" => $row['id'], "quickAddTitle" => lang($row['default_controller']), "refreshOnWorkspaceChange" => (bool) $row['refresh_on_context_change'], "defaultController" => $row['default_controller'], "defaultContent" => array("type" => "url", "data" => get_url($row['default_controller'], $row['default_action'])), "enabled" => $row['enabled'], "type" => $row['type'], "tabTip" => lang($row['title']));
             if (config_option('show_tab_icons')) {
                 $object["iconCls"] = $row['icon_cls'];
             }
             if ($row['initial_controller'] && $row['initial_action']) {
                 $object["initialContent"] = array("type" => "url", "data" => get_url($row['initial_controller'], $row['initial_action']));
             }
             if ($row['id'] == 'more-panel' && config_option('getting_started_step') >= 99) {
                 $object['closable'] = true;
                 if (!user_config_option('settings_closed')) {
                     $this->panels[] = $object;
                 }
             } else {
                 $this->panels[] = $object;
             }
         }
     }
     return $this->panels;
 }
Esempio n. 16
0
 public function index()
 {
     $url = get_url();
     //获取当前页面的URL地址
     $memb = M('Member');
     if (IS_POST) {
         $idarr = I('post.idarr');
         $where = array('vip_id' => array('in', $idarr));
         $res = $memb->where($where)->delete();
         if ($res) {
             echo "<script>window.location.href=" . $url . ";</script>";
         } else {
             echo "<script>alert('删除失败');window.history.go(-1);</script>";
         }
     }
     $current = I('get.page', 1);
     $limit = 20;
     $art = ($current - 1) * $limit;
     $fir = strpos($url, 'page');
     if ($fir) {
         $purl = mb_substr($url, 0, $fir - 1);
     } else {
         $purl = $url;
     }
     $count = $memb->count();
     $show = list_page($current, $limit, $count, $purl);
     $vip = $memb->order('vip_addtime DESC')->limit($art, $limit)->select();
     $data = array('vip' => $vip, 'show' => $show);
     $this->assign($data);
     $this->display();
 }
 function manage_links($links)
 {
     global $base_url, $login_uid, $page_uid;
     $cnt = count($links);
     if ($cnt == 0) {
         return $links;
     }
     $result = array();
     for ($i = 0; $i < $cnt; $i++) {
         $result[$i]['comment_id'] = $links[$i]['comment_id'];
         $result[$i]['user_id'] = $links[$i]['user_id'];
         $result[$i]['comment'] = $links[$i]['comment'];
         $result[$i]['created'] = $links[$i]['created'];
         $usr = new User();
         $usr->load((int) $links[$i]['user_id']);
         $result[$i]['user_name'] = $usr->login_name;
         $result[$i]['picture'] = $usr->picture;
         $result[$i]['first_name'] = $usr->first_name;
         $result[$i]['last_name'] = $usr->last_name;
         $temp_array = array($links[$i]['parent_id'], $links[$i]['user_id']);
         if (in_array($login_uid, $temp_array)) {
             $result[$i]['delete_link'] = $base_url . '/deletecomment.php?comment_id=' . $links[$i]['comment_id'];
         }
         $login = User::get_login_name_from_id($links[$i]['user_id']);
         $current_url = $base_url . '/' . FILE_USER_BLOG . '?uid=' . $links[$i]['user_id'];
         $url_perms = array('current_url' => $current_url, 'login' => $login);
         $url = get_url(FILE_USER_BLOG, $url_perms);
         $result[$i]['hyper_link'] = $url;
     }
     return $result;
 }
Esempio n. 18
0
function msgbox($msg = '', $event = 'BACK', $die = 1)
{
    global $PHP_SELF;
    $script = $msg ? 'alert("' . $msg . '");' : NULL;
    switch ($event) {
        case 'BACK':
            $script .= 'history.back(-1);';
            break;
        case 'NOT':
            break;
        case 'CLOSE':
            $script .= 'window.opener=null; window.open("","_self"); window.close();';
            break;
        case 'CURRENT':
            $script .= 'location = "' . $PHP_SELF . '";';
            break;
        case 'CURRENTS':
            $script .= 'location = "' . get_url() . '";';
            break;
        default:
            $script .= 'location = "' . $event . '";';
            break;
    }
    if (!empty($script)) {
        echo '<script type="text/javascript">' . $script . '</script> ';
    }
    $die && exit;
}
Esempio n. 19
0
 function tuijian_goods($list = 8)
 {
     $w = "(g.is_best='1' OR g.is_new='1' OR g.is_hot='1' OR g.is_promote='1')";
     $sql = "SELECT g.goods_id,g.goods_sn,g.goods_bianhao,g.goods_name,g.market_price,g.shop_price,g.promote_price,g.goods_thumb,g.goods_img,g.promote_price, g.promote_start_date, g.promote_end_date,g.is_promote,g.sale_count,b.brand_name FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}brand` AS b ON g.brand_id=b.brand_id WHERE g.is_on_sale='1' AND g.is_alone_sale='1' AND {$w} ORDER BY RAND() DESC LIMIT {$list}";
     $rt = $this->App->find($sql);
     $rts = array();
     if (!empty($rt)) {
         foreach ($rt as $k => $row) {
             $rts[$k] = $row;
             $rts[$k]['goods_thumb'] = SITE_URL . $row['goods_thumb'];
             $rts[$k]['goods_img'] = SITE_URL . $row['goods_img'];
             $rts[$k]['url'] = get_url($row['goods_name'], $row['goods_id'], SITE_URL . 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
             if ($row['is_promote'] == '1') {
                 //促销 价格
                 if ($row['promote_start_date'] < mktime() && $row['promote_end_date'] > mktime()) {
                     $row['promote_price'] = format_price($row['promote_price']);
                 } else {
                     $row['promote_price'] = "0.00";
                 }
             } else {
                 $row['promote_price'] = "0.00";
             }
             $rts[$k]['promote_price'] = $row['promote_price'];
         }
         unset($rt);
     }
     return $rts;
 }
Esempio n. 20
0
		public function oauth() {
			pc_base::load_plugin_class('weibooauth','',0);
			$setting = getcache('weibo_var','plugins');			
			if(!isset($_REQUEST['oauth_verifier']) || $_REQUEST['oauth_verifier'] == '') {
				if($this->auth_db->get_one(array('source'=>'sina'))) {
					$txt = '授权成功,<a href="?m=zl_admin&c=plugin&a=config&pluginid='.$this->pluginid.'&module=removeauth&pc_hash='.$_SESSION['pc_hash'].'">解除绑定</a>';
				} else {
					$o = new WeiboOAuth( $setting['wb_akey'] , $setting['wb_skey']);
					$keys = $o->getRequestToken();
					print_r($keys);
					$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , get_url());
					$_SESSION['keys'] = $keys;
					$txt = '<a href="'.$aurl.'">点击进行授权</a>';
				}
				
			} else {
				$o = new WeiboOAuth( $setting['wb_akey'] , $setting['wb_skey'] , $_SESSION['keys']['oauth_token'] , $_SESSION['keys']['oauth_token_secret']  );
				$last_key = $o->getAccessToken(  $_REQUEST['oauth_verifier'] ) ;				
				$c = new WeiboClient( $setting['wb_akey'] , $setting['wb_skey'] , $last_key['oauth_token'] , $last_key['oauth_token_secret']  );
				$ms  = $c->home_timeline(); // done
				$me = $c->verify_credentials();	
				$this->auth_db->insert(array('uid'=>$me['id'],'token'=>$last_key['oauth_token'],'tsecret'=>$last_key['oauth_token_secret'],'source'=>'sina'));
				$txt = '授权成功,'.$me['name'].'<a href="?m=zl_admin&c=plugin&a=config&pluginid='.$this->pluginid.'&module=removeauth&pc_hash='.$_SESSION['pc_hash'].'">解除绑定</a>';
			}
			include $this->op->plugin_tpl('oauth',PLUGIN_ID);
		}
 function postToEWAY($payment_id, $url, $vars)
 {
     global $db;
     $varsx = array();
     foreach ($vars as $k => $v) {
         $varsx[] = urlencode($k) . "=" . urlencode($v);
     }
     $result = get_url($url = $url . "?" . join('&', $varsx));
     $payment = $db->get_payment($payment_id);
     $payment['data'][] = $vars;
     $payment['data'][] = array('result' => $result);
     // Simple parser
     $parser = xml_parser_create();
     xml_parse_into_struct($parser, $result, $vals, $index);
     xml_parser_free($parser);
     foreach ($index as $k => $v) {
         foreach ($v as $vv) {
             if ($vals[$vv]['value']) {
                 $ret[$k] = $vals[$vv]['value'];
             }
         }
     }
     $payment['data'][] = $ret;
     $db->update_payment($payment_id, $payment);
     return $ret;
 }
Esempio n. 22
0
 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('uploads');
     $urls = get_url('', 'file', 'uploads/iotds', 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
     if ($urls[0] == '') {
         if (!is_null(post_param_integer('id', NULL))) {
             $rows = $GLOBALS['SITE_DB']->query_select('iotds', array('url', 'thumb_url'), array('id' => post_param_integer('id')), '', 1);
             $urls = $rows[0];
             $url = $urls['url'];
             $thumb_url = $urls['thumb_url'];
         } else {
             warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
         }
     } else {
         $url = $urls[0];
         $thumb_url = $urls[1];
     }
     $caption = comcode_to_tempcode(post_param('caption', ''));
     $title = comcode_to_tempcode(post_param('title', ''));
     require_code('images');
     $thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, $caption, true);
     $url = url_is_local($url) ? get_custom_base_url() . '/' . $url : $url;
     $preview = do_template('IOTD', array('ID' => '', 'IMAGE_URL' => $url, 'SUBMITTER' => strval(get_member()), 'VIEW_URL' => $url, 'IMAGE' => $thumb, 'CAPTION' => $title));
     return array($preview, NULL);
 }
Esempio n. 23
0
 function get_site_nav($t = 'middle')
 {
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes');
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && !$cache->GetClose()) {
         include $fn;
     } else {
         $rts = array();
         $sql = "SELECT * FROM `{$this->App->prefix()}nav` WHERE is_show = '1' AND type = '{$t}' ORDER BY vieworder ASC, id ASC";
         $rt = $this->App->find($sql);
         $tr = explode('.', basename($_SERVER['PHP_SELF']));
         if (!empty($rt)) {
             $site = Common::class_url();
             foreach ($rt as $row) {
                 $dtr[0] = "";
                 if (!empty($row['url']) && strpos($row['url'], '.')) {
                     $dtr = explode('.', basename($row['url']));
                 }
                 if (isset($tr[0]) && $tr[0] == $dtr[0]) {
                     $row['active'] = 1;
                 } else {
                     $row['active'] = 0;
                 }
                 $row['url'] = get_url($row['name'], $row['cid'], $site . $row['url'], 'nav');
                 $rts[] = $row;
             }
             unset($rt);
         }
         $cache->write($fn, $rts, 'rts');
     }
     return $rts;
 }
Esempio n. 24
0
/**
 * 微信通过code换取网页授权access_token并获取用户信息,登录
 */
function checkLogin($code)
{
    if (empty($code)) {
        getWxCode('snsapi_userinfo', U());
    } else {
        $code = trim($_GET['code']);
        $state = trim($_GET['state']);
        $appid = Wx_C('wx_appid');
        $secret = Wx_C('wx_secret');
        $url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $appid . '&secret=' . $secret . '&code=' . $code . '&grant_type=authorization_code';
        $info = json_decode(get_url($url));
        $token = $info->access_token;
        $openid = $dejson->openid;
        $url = 'https://api.weixin.qq.com/sns/userinfo?access_token=' . $token . '&openid=' . $openid . '&lang=zh_CN';
        $member = json_decode(get_url($url));
        $data = array('openid' => $member->openid, 'member_name' => $member->nickname, 'gender' => $member->sex, 'city' => $member->city, 'province' => $member->province, 'avatar' => $member->headimgurl);
        $where = array('openid' => $data['openid']);
        $res = M('member')->where($where)->find();
        if (!$res) {
            M('member')->add($data);
        } else {
            M('member')->where($where)->save($data);
        }
        session('openid', $data['openid']);
    }
}
Esempio n. 25
0
 function index()
 {
     $this->title("友情链接 - " . $GLOBALS['LANG']['site_name']);
     $this->meta("title", "友情链接");
     $type = "default";
     $rt = $this->Cache->read(3600);
     if (is_null($rt)) {
         $sql = "SELECT tb1.article_title,tb1.article_id FROM `{$this->App->prefix()}article` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
         $sql .= " ON tb1.cat_id = tb2.cat_id";
         $sql .= " WHERE tb2.type='{$type}' ORDER BY tb1.vieworder ASC,tb1.article_id DESC LIMIT 8";
         $rt['article_list'] = $this->App->find($sql);
         if (!empty($rt['article_list'])) {
             foreach ($rt['article_list'] as $k => $row) {
                 $rt['article_list'][$k]['url'] = get_url($row['article_title'], $row['article_id'], $type . '.php?id=' . $row['article_id'], 'article', array($type, 'article', $row['article_id']));
             }
             unset($article_list);
         }
         $sql = "SELECT * FROM `{$this->App->prefix()}friend_link`";
         $rt['link_list'] = $this->App->find($sql);
         $this->Cache->write($rt);
     }
     //全站banner
     $rt['quanzhan'] = $this->action('banner', 'quanzhan');
     $this->set('rt', $rt);
     $this->template('friendlink');
 }
function excute($url = '', $data)
{
    connectRedis();
    $response = array();
    $loop = count($data);
    for ($i = 0; $i < $loop; $i++) {
        # code...
        $pid = pcntl_fork();
        if (!$pid) {
            // sleep(1);
            print "In child {$i}\n";
            if (array_key_exists($i, $data)) {
                $x = 7;
                $k = get_url($data[$i]);
                setRedis("data", $i);
            }
            exit($i);
        }
    }
    #process
    while (pcntl_waitpid(0, $status) != -1) {
        $status = pcntl_wexitstatus($status);
        echo "Child {$status} completed\n";
    }
    // dd($response);
    return $response;
}
Esempio n. 27
0
 public function __construct()
 {
     $this->url = get_url();
     $this->path = '';
     $this->method = $_SERVER['REQUEST_METHOD'];
     //$uri = rawurldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
 }
Esempio n. 28
0
/**
 *  post数据
 *  @param string $url		post的url
 *  @param int $limit		返回的数据的长度
 *  @param string $post		post数据,字符串形式username='******'&password='******'
 *  @param string $cookie	模拟 cookie,字符串形式username='******'&password='******'
 *  @param string $ip		ip地址
 *  @param int $timeout		连接超时时间
 *  @param bool $block		是否为阻塞模式
 *  @return string			返回字符串
 */
function ps_post($url, $limit = 0, $post = '', $cookie = '', $ip = '', $timeout = 15, $block = true)
{
    $return = '';
    $matches = parse_url($url);
    $host = $matches['host'];
    $path = $matches['path'] ? $matches['path'] . ($matches['query'] ? '?' . $matches['query'] : '') : '/';
    $port = !empty($matches['port']) ? $matches['port'] : 80;
    $siteurl = get_url();
    if ($post) {
        $out = "POST {$path} HTTP/1.1\r\n";
        $out .= "Accept: */*\r\n";
        $out .= "Referer: " . $siteurl . "\r\n";
        $out .= "Accept-Language: zh-cn\r\n";
        $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $out .= "User-Agent: {$_SERVER['HTTP_USER_AGENT']}\r\n";
        $out .= "Host: {$host}\r\n";
        $out .= 'Content-Length: ' . strlen($post) . "\r\n";
        $out .= "Connection: Close\r\n";
        $out .= "Cache-Control: no-cache\r\n";
        $out .= "Cookie: {$cookie}\r\n\r\n";
        $out .= $post;
    } else {
        $out = "GET {$path} HTTP/1.1\r\n";
        $out .= "Accept: */*\r\n";
        $out .= "Referer: " . $siteurl . "\r\n";
        $out .= "Accept-Language: zh-cn\r\n";
        $out .= "User-Agent: {$_SERVER['HTTP_USER_AGENT']}\r\n";
        $out .= "Host: {$host}\r\n";
        $out .= "Connection: Close\r\n";
        $out .= "Cookie: {$cookie}\r\n\r\n";
    }
    $fp = @fsockopen($ip ? $ip : $host, $port, $errno, $errstr, $timeout);
    if (!$fp) {
        return '';
    }
    stream_set_blocking($fp, $block);
    stream_set_timeout($fp, $timeout);
    @fwrite($fp, $out);
    $status = stream_get_meta_data($fp);
    if ($status['timed_out']) {
        return '';
    }
    while (!feof($fp)) {
        if (($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) {
            break;
        }
    }
    $stop = false;
    while (!feof($fp) && !$stop) {
        $data = fread($fp, $limit == 0 || $limit > 8192 ? 8192 : $limit);
        $return .= $data;
        if ($limit) {
            $limit -= strlen($data);
            $stop = $limit <= 0;
        }
    }
    @fclose($fp);
    return $return;
}
Esempio n. 29
0
 public function index()
 {
     if (IS_POST) {
         $this->redirect('index', $_POST);
     }
     //搜索
     $search = I('get.search');
     if (!empty($search)) {
         $this->assign("search", $search);
         //添加开始时间
         $start_time = I('get.start_time');
         if (!empty($start_time)) {
             $this->assign('start_times', $start_time);
             $start_time = strtotime($start_time);
             $where['create_time'] = array("EGT", $start_time);
             $this->assign('start_time', $start_time);
         }
         //添加结束时间
         $end_time = I('get.end_time');
         if (!empty($end_time)) {
             $this->assign('end_times', $end_time);
             $end_time = strtotime($end_time);
             $where['create_time'] = array("ELT", $end_time);
             $this->assign('end_time', $end_time);
         }
         //时间搜索条件
         if ($end_time > 0 && $start_time > 0) {
             $where['create_time'] = array(array('EGT', $start_time), array('ELT', $end_time));
         }
         //是否审核
         $status = I('get.status', 2, 'intval');
         if ($status != 2) {
             $where["status"] = array("EQ", $status);
         }
         $this->assign("status", $status);
         //全部栏目
         $menu = I('get.menu');
         if (!empty($menu)) {
             $where["menu"] = array("EQ", $menu);
             $this->assign("menu", $menu);
         }
         //搜索关键字
         $keyword = \Input::getVar(I('get.keyword'));
         if (!empty($keyword)) {
             $this->assign("keyword", $keyword);
             $where['title'] = array("LIKE", "%{$keyword}%");
         }
     } else {
         $this->assign("status", 2);
     }
     $count = M('Advert')->where($where)->count();
     $page = $this->page($count, 20);
     $list = M('Advert')->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array('id' => 'DESC'))->select();
     $this->assign("list", $list);
     $this->assign("Page", $page->show());
     session('backurl', get_url());
     //页面跳转SESSION
     $this->display();
 }
Esempio n. 30
0
function links_my_tasks_dropdown()
{
    echo '<li class="header"><a href="' . get_url('links', 'index') . '">' . lang('links') . '</a></li>';
    if (ProjectLink::canAdd(logged_user(), active_project())) {
        echo '<li><a href="' . get_url('links', 'add_link') . '">' . lang('add link') . '</a></li>';
    }
    // if
}