function display_tab()
{
    if (is_admin()) {
        // return without running if we are in the admin
        return;
    }
    // set the value for the tab display to true
    // this can only be changed by the 'plugin_display_tab' filter)
    $display_tab = true;
    // apply filter for the display of the tab so it can be turned on and off conditionally
    $display_tab = apply_filters('plugin_display_tab', $display_tab);
    // do not display the tab if the value has been turned off
    if ($display_tab == false) {
        return;
    }
    // get the current page url
    $current_page_url = get_full_url();
    // get the tab url from the plugin option variable array
    $plugin_option_array = get_option('options');
    $tab_url = $plugin_option_array['tab_url'];
    // compare the page url and the option tab - don't render the tab if the values are the same
    if ($tab_url != $current_page_url) {
        // hook to get option values and dynamically render css to support the tab classes
        add_action('wp_head', 'custom_css_hook');
        // hook to get option values and write the div for the Simple Side Tab to display
        add_action('wp_footer', 'body_tag_html');
    }
}
Example #2
0
function kaixin_sync($data)
{
    $sys_config = kaixin_init();
    if (!$sys_config) {
        return 'kaixin_init is invalid';
    }
    $tid = is_numeric($data['tid']) ? $data['tid'] : 0;
    if ($tid < 1) {
        return 'tid is invalid';
    }
    $uid = is_numeric($data['uid']) ? $data['uid'] : 0;
    if ($uid < 1) {
        return 'uid is invalid';
    }
    $totid = is_numeric($data['totid']) ? $data['totid'] : 0;
    $content = $data['content'];
    if (false !== strpos($content, '[')) {
        $content = preg_replace('~\\[([^\\]]{1,6}?)\\]~', '(#\\1)', $content);
    }
    $content = array_iconv($sys_config['charset'], 'UTF-8', trim(strip_tags($content)));
    if (!$content) {
        return 'content is invalid';
    }
    $content .= " " . get_full_url($sys_config['site_url'], 'index.php?mod=topic&code=' . $tid);
    $kaixin_bind_info = kaixin_bind_info($uid);
    if (!$kaixin_bind_info) {
        return 'bind_info is empty';
    }
    if (!kaixin_has_bind($uid)) {
        return 'bind_info is invalid';
    }
    $kaixin_bind_topic = DB::fetch_first("select * from " . DB::table('kaixin_bind_topic') . " where `tid`='{$tid}'");
    if ($kaixin_bind_topic) {
        return 'bind_topic is invalid';
    } else {
        DB::query("insert into " . DB::table('kaixin_bind_topic') . " (`tid`) values ('{$tid}')");
    }
    $ret = array();
    if ($totid < 1) {
        $p = array();
        $p['access_token'] = $kaixin_bind_info['token'];
        $p['content'] = $content;
        $imageid = (int) $data['imageid'];
        if ($imageid > 0 && $sys_config['kaixin']['is_sync_image']) {
            $topic_image = topic_image($imageid, 'original');
            if (is_image(ROOT_PATH . $topic_image)) {
                $p['picurl'] = $sys_config['site_url'] . '/' . $topic_image;
                $p['save_to_album'] = 1;
            }
        }
        $ret = kaixin_api('records/add', $p);
    }
    $kaixin_id = is_numeric($ret['rid']) ? $ret['rid'] : 0;
    if ($kaixin_id > 0) {
        DB::query("UPDATE " . DB::table('kaixin_bind_topic') . " SET `kaixin_id`='{$kaixin_id}' WHERE `tid`='{$tid}'");
    }
    return $ret;
}
Example #3
0
/**
 * 组装获取code授权URL
 */
function getAccesstokenUrl($appid)
{
    $nowUrl = get_full_url();
    //获取当前访问的url地址
    $redirectUrl = urlencode($nowUrl);
    //url 编码
    $accessTokenUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $appid . '&redirect_uri=' . $redirectUrl . '&response_type=code&scope=snsapi_base&state=123#wechat_redirect';
    return $accessTokenUrl;
}
Example #4
0
 public static function check_signature($client_sig)
 {
     $user = Loader::get_user();
     if (!$client_sig) {
         return FALSE;
     }
     if (!$user->get_module(User::M_SECRET_KEY)->check_secret_key()) {
         $user->get_module(User::M_SECRET_KEY)->unset_secret_key();
         Session::destroy(Session::get_sid(), Session::ST_INCORRECT);
         return FALSE;
     }
     //Создаём серверную сигнатуру
     //1. получаем все параметры и удаляем параметр с сигнатурой
     $all_params = Buffer::get_post();
     unset($all_params['sig']);
     $elements_sig = array();
     //2. извлекаем значения из пришедших параметров в обязательный список параметров на серврере
     $params = config('web', 'sig_params');
     foreach ($params as $param) {
         //некоторые параметрый дублируем в ручную, по тем правилам, по которомы они дложны были создаваться на клиенте
         switch ($param) {
             case Session::COOKIE_ID:
                 $elements_sig[$param] = Session::get_sid();
                 break;
             case 'location':
                 $elements_sig[$param] = get_full_url();
                 $elements_sig[$param] = str_replace('/www.', '/', $elements_sig[$param]);
                 break;
             default:
                 $elements_sig[$param] = isset($all_params[$param]) ? $all_params[$param] : '';
         }
         if (isset($all_params[$param])) {
             unset($all_params[$param]);
         }
     }
     //Если в запросе остались какие-то параметры то добавляем их в конец массива
     if (!empty($all_params)) {
         $elements_sig = array_merge($elements_sig, $all_params);
     }
     //3. получаем секретный ключ текущего пользователя
     $elements_sig[self::NAME_SECRET_KEY] = $user->get_secret_key();
     //4. Сортируем и собираем в строку элементы запроса
     $server_sig = array();
     ksort($elements_sig);
     foreach ($elements_sig as $key => $value) {
         $server_sig[] = $key . '=' . $value;
     }
     //5. Формируем сигнатуру сервера
     $server_sig = md5(implode('&', $server_sig));
     //6. Сравниваем результаты
     if ($server_sig == $client_sig) {
         return TRUE;
     }
     return FALSE;
 }
Example #5
0
 public static function route($rule, $call)
 {
     /* CHECK IF THE ROUTE IS GOOD */
     $params = self::check($rule, true);
     if ($params !== false) {
         // check routed
         self::$routed = true;
         $to_replace = array();
         $with = array();
         for ($i = 1; $i < count($params); $i++) {
             $to_replace[] = '$' . $i;
             $with[] = $params[$i];
         }
         if (is_callable($call)) {
             call_user_func_array($call, $with);
         } else {
             $call_params = substr(strstr($call, '?'), 1);
             foreach (explode("&", $call_params) as $chuck) {
                 $param = explode("=", $chuck);
                 $param[1] = urldecode(str_replace($to_replace, $with, $param[1]));
                 if ($param[1] != '') {
                     $_GET[$param[0]] = $param[1];
                 }
             }
             // CHECK WHAT FILE TO ROUTE
             $call_file = strstr($call, "?", 1);
             $call_path = FOLDER_BASE . $call_file;
             if ($call_file != "index.php" && file_exists($call_path)) {
                 // INCLUDE FILE
                 include $call_path;
                 // REMOVE ALL PARAMS
                 foreach (explode("&", $call_params) as $chuck) {
                     $param = explode("=", $chuck);
                     unset($_GET[$param[0]]);
                 }
             }
         }
     } else {
         self::$url_request = self::$url_request . "/";
         if (self::check($rule) !== false) {
             redirect(get_full_url() . "/");
         } else {
             self::$url_request = substr(self::$url_request, 0, -1);
         }
     }
 }
Example #6
0
 function loadTags($ids, $lang, $isurl = FALSE)
 {
     $langstr = $lang == $this->CI->Cache_model->defaultLang ? '' : '?lang=' . $lang;
     if (!$ids) {
         return FALSE;
     }
     $idarr = explode(',', $ids);
     $data = $this->CI->Data_model->getData(array('id' => $idarr, 'lang' => $lang), 'listorder', 0, 0, 'tags');
     if (!$data) {
         return FALSE;
     }
     $dataarr = array();
     foreach ($data as $item) {
         $dataarr[] = $isurl ? '<a href="' . get_full_url('tags/' . $item['url'] . $langstr) . '">' . $item['title'] . '</a>' : $item['title'];
     }
     $datastr = implode(',', $dataarr);
     return $datastr;
 }
Example #7
0
function get_full_url()
{
    $https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 || !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
    return ($https ? 'https://' : 'http://') . (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] . '@' : '') . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ($https && $_SERVER['SERVER_PORT'] === 443 || $_SERVER['SERVER_PORT'] === 80 ? '' : ':' . $_SERVER['SERVER_PORT'])) . substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
}
$base_id = $_GET['base_id'];
$id = $_GET['id'];
try {
    if (!$base_id || !$id) {
        throw new Exception('Wrong Parameter');
    }
    $highResFile = dirname(__FILE__) . '/files/' . $base_id . '/boxed/' . $id;
    $thumbFile = dirname(__FILE__) . '/files/' . $base_id . '/boxed/thumbnail/' . $id;
    $highResUrl = get_full_url() . '/files/' . $base_id . '/boxed/' . $id;
    $thumbUrl = get_full_url() . '/files/' . $base_id . '/boxed/thumbnail/' . $id;
    $downLink = get_full_url() . '/download.php?base_id=' . urlencode($base_id) . '&id=' . urlencode($id);
    $shareLink = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if (!is_file($highResFile) || !is_file($thumbFile)) {
        throw new Exception('File Not Found');
    }
} catch (Exception $e) {
    header('Location: 404.html');
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
Example #8
0
function update_page_links_by_full_url($buffer, $allLinksFromDB, $hostname)
{
    $regexp = "<a\\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\\/a>";
    $regexp1 = "href=(\"??)([^\" >]*?\\1)";
    preg_match_all("/{$regexp}/siU", $buffer, $matches);
    $pieces = preg_split("/{$regexp}/siU", $buffer);
    $ret = null;
    foreach ($matches[0] as $k => $link) {
        $l = preg_split("/{$regexp1}/siU", $link);
        $new = $l[0] . "href=\"" . get_full_url($matches[2][$k], $hostname) . "\"" . $l[1];
        $ret .= $pieces[$k] . $new;
        /*
                    $l=preg_split("/$regexp1/siU",$link);
                    $found=0;
                    foreach($allLinksFromDB as $key=>$value)
                    {
                        if($value[0]===$matches[2][$k])
                        {
        
                            $new=$l[0]."href=\"".get_full_url($value[0],$hostname)."\"".$l[1];
                            $ret.=$pieces[$k].$new;
                            $found=1;
                            break;
                        }
                    }
                    if($found==0)
                    {
                        $ret.=$pieces[$k].$matches[0][$k];
                        $found=0;
                    }
        */
    }
    $ret .= $pieces[sizeof($pieces) - 1];
    return $ret;
}
/**
 * Build Timthumb URL
 *
 * @param string $path_img
 * @param BEA_Images|null $image_size
 *
 * @return string
 */
function get_timthumb_url($path_img, $image_size = null)
{
    if (!empty($image_size)) {
        return get_full_url($_SERVER, true) . 'functions/vendor/timthumb.php?src=' . $path_img . '&h=' . $image_size->height . '&w=' . $image_size->width . '&zc=' . (int) $image_size->crop;
    } else {
        return get_full_url($_SERVER, true) . 'functions/vendor/timthumb.php?src=' . $path_img;
    }
}
Example #10
0
function save_previous($suffix = "")
{
    $_SESSION['previous' . $suffix] = get_full_url();
}
Example #11
0
 function publishShare()
 {
     $id = (int) $this->Get['id'];
     $name = DB::result_first("select title from " . TABLE_PREFIX . "event where id = '{$id}'");
     $value = '我觉得活动【' . $name . '】不错,推荐给大家,地址:' . get_full_url($this->Config['site_url'], "index.php?mod=event&code=detail&id={$id}");
     $item_id = $id;
     include template('vote/vote_toweibo');
     exit;
 }
Example #12
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . '/_/inc/init.php';
if (!isConnected()) {
    header('Location: index.php?redirect_uri=' . get_full_url() . $_SERVER['REQUEST_URI']);
    exit;
}
require '_/inc/UploadHandler.php';
$upload_handler = new UploadHandler();
Example #13
0
 function eventDetail()
 {
     $id = intval($this->Get['id']);
     load::logic('event');
     $EventLogic = new EventLogic();
     $param = array('where' => " a.id = '{$id}' ");
     $return = $EventLogic->getEventInfo($param);
     $rs = $return['event_list'][$id];
     if (!$rs) {
         $this->Messager("活动不存在或已删除", -1);
     }
     if (!$rs['verify'] || $rs['verify'] == 0) {
         if ($rs['postman'] != MEMBER_ID) {
             $this->Messager("活动还在审核中", -1);
         }
     }
     $from = array();
     if ($rs['item'] == 'qun' && $rs['item_id'] > 0) {
         load::logic('qun');
         $qun_logic = new QunLogic();
         $qunInfo = $qun_logic->get_qun_info($rs['item_id']);
         $rs['qunname'] = $qunInfo['name'];
         $from['name'] = $this->Config[changeword][weiqun] . '--' . $rs['qunname'];
         $from['url'] = get_full_url('', 'index.php?mod=qun&qid=' . $rs['item_id']);
     } else {
         #if NEDU
         if (defined('NEDU_MOYO')) {
             if ($rs['item'] && $rs['item_id']) {
                 $app = nlogic('com.object')->get_info($rs['item'], $rs['item_id']);
                 if ($app) {
                     $from = array('name' => $app['object_name'], 'url' => $app['object_url']);
                 }
             }
         }
         #endif
     }
     $app_member_arr = $EventLogic->getAllUser(array('where' => " a.id = '{$id}' and a.app = 1 and a.play = 0 ", 'order' => " order by a.app_time ", 'limit' => " limit 6 "), 'app');
     $app_count = $app_member_arr['count'];
     $app_member = $app_member_arr['member'];
     $play_member_arr = $EventLogic->getAllUser(array('where' => " a.id = '{$id}' and a.play = 1  ", 'order' => " order by a.play_time ", 'limit' => " limit 6 "), 'play');
     $play_count = $play_member_arr['count'];
     $play_member = $play_member_arr['member'];
     $member = $this->Member;
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     jfunc('app');
     $gets = array('mod' => 'event', 'code' => "detail", 'id' => $id);
     $page_url = 'index.php?' . url_implode($gets);
     $options = array('page' => true, 'perpage' => 5, 'page_url' => $page_url);
     $topic_info = app_get_topic_list('event', $id, $options);
     $topic_list = array();
     if (!empty($topic_info)) {
         $topic_list = $topic_info['list'];
         $page_arr['html'] = $topic_info['page']['html'];
         $no_from = true;
     }
     $this->item = 'event';
     $this->item_id = $id;
     $set_qun_closed = 1;
     $set_event_closed = 1;
     $set_fenlei_closed = 1;
     $this->Title = $rs['title'];
     include template('event/event_dateil');
 }
Example #14
0
$searchname = isset($_GET['s']) ? $_GET['s'] : "";
$searchfid = isset($_GET['fid']) ? $_GET['fid'] : "";
$start = is_numeric($_GET['start']) ? $_GET['start'] : 0;
$end = is_numeric($_GET['end']) ? $_GET['end'] : 50;
$filenb = $fdao->countFiles();
if ($searchfid != "") {
    $filesList = array($fdao->getByFid($searchfid));
} else {
    if ($searchname != "") {
        $filesList = $fdao->searchByName($searchname);
    } else {
        $filesList = $fdao->getLastFiles($start, $end);
    }
}
$filesTotalSize = $fdao->filesTotalSize() / 1000000;
$fullurl = get_full_url() . '/';
$sdao = new SessionsDao();
$sessionscount = $sdao->countSessions();
$usercount = $sdao->countUsers();
$sessionstoday = $sdao->getSessionToday();
$action = isset($_GET['dis']) ? $_GET['dis'] : 1;
?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js ie ie6 lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js ie ie7 lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js ie ie8 lt-ie9"> <![endif]-->
<!--[if IE 9]>         <html class="no-js ie ie9 lt-ie10"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js"> <!--<![endif]-->
<head>
    <title><?php 
echo $Hoster_name;
Example #15
0
    function _setlist($data, $ismultiple = true)
    {
        $newdata = $ismultiple ? $data : ($newdata[0] = $data);
        if ($ismultiple) {
            $newdata = $data;
        } else {
            $newdata = array(0 => $data);
        }
        $newstr = '';
        foreach ($newdata as $key => $item) {
            $item['func'] = '';
            if ($this->Purview_model->checkPurviewFunc($this->tablefunc, 'edit')) {
                $item['func'] .= $this->Purview_model->getSingleFunc(site_aurl($this->tablefunc . '/edit/' . $item['id']), 'edit');
            }
            if ($this->Purview_model->checkPurviewFunc($this->tablefunc, 'edit')) {
                $item['func'] .= $this->Purview_model->getSingleFunc(site_aurl($this->tablefunc . '/order'), 'order');
            }
            if ($this->Purview_model->checkPurviewFunc($this->tablefunc, 'del')) {
                $item['func'] .= $this->Purview_model->getSingleFunc(site_aurl($this->tablefunc . '/del/' . $item['id']), 'sdel', $item['id']);
            }
            $typestr = isset($this->typearr[$item['type']]) ? '[<font color="green">' . $this->typearr[$item['type']]['title'] . '</font>]' : '';
            $newstr .= '<tr id="tid_' . $item['id'] . '">
			<td width=30><input type=checkbox name="optid[]" value=' . $item['id'] . '></td>
			<td width=50><input type="hidden" name="ids[]" value="' . $item['id'] . '"><input type="text" name="listorder[]" class="input-order" size="3" value="' . $item['listorder'] . '"></td>
			<td width=40>' . $item['id'] . '</td>
			<td width=150>' . $typestr . '<a href="' . get_full_url($item['url']) . '" target="_blank">' . $item['title'] . '</a></td>
			<td width=250 style="word-break:break-all;"><a href="' . get_full_url($item['url']) . '" target="_blank">' . get_full_url($item['url']) . '</a></td>
			<td>' . $item['remark'] . '</td>
			<td width=50 >' . lang('status' . $item['status']) . '</td>
			<td width=50>' . $item['func'] . '</td></tr>';
        }
        return $newstr;
    }
Example #16
0
 function invite()
 {
     $qid = intval(trim($this->Get['qid']));
     if (empty($qid)) {
         $this->Messager('错误的操作');
     }
     $qun_info = $this->QunLogic->get_qun_info($qid);
     if (empty($qun_info)) {
         $this->Messager('当前' . $this->Config[changeword][weiqun] . '不存在或者已经被删除了');
     }
     $config = jconf::get();
     $invite_url = get_full_url($config['site_url'], "/index.php?mod=qun&qid=" . $qid);
     $this->Title = $this->Config[changeword][weiqun] . "邀请 - " . $qun_info['name'];
     include_once template('qun/invite');
 }
Example #17
0
    if (!is_dir(dirname(__FILE__) . '/files/' . session_id() . '/boxed/')) {
        mkdir(dirname(__FILE__) . '/files/' . session_id() . '/boxed/', 0777, true);
    }
    if ($extension == "gif") {
        $res = imagegif($image_p, dirname(__FILE__) . '/files/' . session_id() . '/boxed/' . $fileBaseName);
    } else {
        if ($extension == "png") {
            $res = imagepng($image_p, dirname(__FILE__) . '/files/' . session_id() . '/boxed/' . $fileBaseName);
        } else {
            $res = imagejpeg($image_p, dirname(__FILE__) . '/files/' . session_id() . '/boxed/' . $fileBaseName, 96);
        }
    }
    if (!$res) {
        throw new Exception('Failed To Create Boxed Image');
    }
    $result['url'] = get_full_url() . '/files/' . urlencode(session_id()) . '/boxed/' . urlencode($fileBaseName);
    $result['thumbnailUrl'] = get_full_url() . '/files/' . urlencode(session_id()) . '/boxed/thumbnail/' . urlencode($fileBaseName);
    $result['shareLink'] = get_full_url() . '/share.php?base_id=' . urlencode(session_id()) . '&id=' . urlencode($fileBaseName);
    $result['downLink'] = get_full_url() . '/download.php?base_id=' . urlencode(session_id()) . '&id=' . urlencode($fileBaseName);
    $result['width'] = $width;
    $result['color'] = $color;
} catch (Exception $e) {
    $result['error'] = $e->getMessage();
}
function get_full_url()
{
    $https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 || !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
    return ($https ? 'https://' : 'http://') . (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] . '@' : '') . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ($https && $_SERVER['SERVER_PORT'] === 443 || $_SERVER['SERVER_PORT'] === 80 ? '' : ':' . $_SERVER['SERVER_PORT'])) . substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
}
header('Content-type: application/json');
echo json_encode($result);
Example #18
0
<?php

//não permite que o arquivo seja acessado diretamente
if (basename($_SERVER["PHP_SELF"]) == "perfil.php") {
    die("Este arquivo não pode ser acessado diretamente.");
}
?>

<script type="text/javascript">
    $(document).ready(function() {
	$('#fileupload').fileupload({
	    url: '<?php 
echo get_full_url() . '/ajax/perfil/image_upload';
?>
',
	    dataType: 'json',
	    autoUpload: true,
	    maxFileSize: 5000000,
	    acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
	    done: function (e, data) {
		$.each(data.result.files, function (index, file) {
		    $('#imagem-perfil').attr('src', file.url);
		    $('#thumb-perfil').attr('src', file.thumbnailUrl);
		    
		});
	    }
	});
    });
</script>

<ul class="breadcrumb">
    $line = $result->fetch_assoc();
    if ($line["user"] == $user && (strpos($line["rights"], 'all') !== false || strpos($line["rights"], 'notes') !== false)) {
        $max_size = 26843545600;
    } else {
        $max_size = 0;
    }
} elseif (isset($_SESSION["notes-user"])) {
    //check if teachers user exists an has permissions
    $user = $_SESSION["notes-user"];
    $request = "SELECT * FROM teachers_users WHERE user = '******'";
    $result = $connection->query($request);
    $line = $result->fetch_assoc();
    if ($line["user"] == $user) {
        $max_size = $line["max_user_space"];
    } else {
        $max_size = 0;
    }
} else {
    $max_size = 0;
}
if (getFolderSize("../../../" . $config->plugin_notes_engine_fpath) + $_FILES['files']['size'] > $max_size * 1073741824) {
    echo '{"files":[{"error":"max user folder size exceeded or invalid user"}]}';
    exit;
}
$options = ['upload_dir' => str_replace("core/modules/php/notes-engine-upload.php", "", $_SERVER['SCRIPT_FILENAME']) . $config->plugin_notes_engine_fpath . "/" . findPath($_POST["target"]) . "/", 'upload_url' => str_replace("core/modules/php", "", get_full_url()) . $config->plugin_notes_engine_fpath . "/" . findPath($_POST["target"]) . "/", 'inline_file_types' => '/\\.(?!(php|js|pl|cgi|html|css|xml|json|swf|jar|class|py|rb|sh|bat|fcgi|inc)).+$/i', 'accept_file_types' => '/\\.(?!(php|pl|cgi|sh|fcgi|inc)).+$/i'];
$upload_handler = new UploadHandler($options);
function get_full_url()
{
    $https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 || !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
    return ($https ? 'https://' : 'http://') . (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] . '@' : '') . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] . ($https && $_SERVER['SERVER_PORT'] === 443 || $_SERVER['SERVER_PORT'] === 80 ? '' : ':' . $_SERVER['SERVER_PORT'])) . substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
}
Example #20
0
 function _output_code($row, $ret_row = 0)
 {
     $row['width'] = $row['width'] ? $row['width'] : '100%';
     $row['height'] = $row['height'] ? $row['height'] : '1000px';
     $row['output_code'] = '<div id="jishigou_div">内容正在加载中,请稍候……</div><script type="text/javascript" src="' . get_full_url($this->Config['site_url'], "index.php?mod=output&code=url_js&id={$row['id']}&hash={$row['hash']}&per_page_num={$row['per_page_num']}&content_default=" . urlencode($row['content_default'])) . '&width=' . urlencode($row['width']) . '&height=' . urlencode($row['height']) . '" charset="' . $this->Config['charset'] . '"></script>';
     $row['output_code'] = jhtmlspecialchars($row['output_code']);
     if ($ret_row) {
         return $row;
     } else {
         return $row['output_code'];
     }
 }
 /**
  * 获取转发主题信息 For DiscuzX1.5
  * @param $tid int 论坛thread id
  * @return array
  */
 function forShare($tid)
 {
     /* 主题URL */
     $baseurl = XWB_plugin::siteUrl();
     $topic_url = $baseurl . 'index.php?mod=topic&code=' . $tid;
     if (function_exists('get_full_url')) {
         $topic_url = get_full_url($baseurl, 'index.php?mod=topic&code=' . $tid);
     }
     $url = ' ' . $topic_url;
     /* 获取微博信息 */
     $db = XWB_plugin::getDB();
     $topic = $db->fetch_first("SELECT `tid`,`content`,`imageid` FROM " . XWB_S_TBPRE . "topic WHERE tid='{$tid}'");
     if (empty($topic)) {
         return FALSE;
     }
     /* 转码 */
     $message = $this->_convert(trim($topic['content']));
     /* 过滤UBB与表情 */
     $message = $this->_filter($message);
     $message = strip_tags($message);
     /* 将最后附带的url给删除 */
     $message = preg_replace("|\\s*http:/" . "/[a-z0-9-\\.\\?\\=&_@/%#]*\$|sim", "", $message);
     /* 合并标题和链接 */
     $message = $message . $url;
     // 取出所有图片
     $img_urls = array();
     if ($topic['imageid'] && XWB_plugin::pCfg('is_upload_image')) {
         $image_file = "/images/topic/" . jsg_face_path($topic['imageid']) . $topic['imageid'] . "_o.jpg";
         if (is_file(XWB_S_ROOT . $image_file)) {
             $img_urls[] = $baseurl . $image_file;
         }
     }
     return array('url' => $topic_url, 'message' => $message, 'pics' => array_map('trim', $img_urls));
 }
Example #22
0
function _replace_tag($matches)
{
    global $urlid, $striptags, $iframe;
    $url = get_full_url($matches[4]);
    if (in_array('ads', $striptags) && strtolower($matches[2]) == 'img' && preg_match("/\\/ads?\\//i", $url)) {
        return '';
    }
    // switch on tag
    switch (strtolower($matches[2])) {
        // attn: order is crucial as $url needs be saved to get overwritten
        case 'form':
            $append = "<input type='hidden' name='{$urlid}' value='{$url}'/>";
            $url = getScheme() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
            if ($iframe) {
                $append .= "<input type='hidden' name='iframe' value='{$iframe}'/>";
            }
            break;
        case 'area':
            $parameters = "?{$urlid}=" . urlencode($url);
            $url = getScheme() . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
            if ($iframe) {
                $parameters .= "&iframe=" . $iframe;
            }
            break;
    }
    return $matches[1] . $url . $parameters . $matches[5] . $append;
}
Example #23
0
?>

<?php 
if (isset($content)) {
    ?>
<h1>Edit Text Page</h1><?php 
} else {
    ?>
<h1>New Text Page</h1><?php 
}
?>
    
<br>

<form action="<?php 
echo get_full_url();
?>
" method="post">
    
    <?php 
_inc("parts/messages");
?>
    
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label for="title">Page title</label>
                <input type="text" class="form-control" id="title" name="page_title" placeholder="Type the page title" value="<?php 
echo isset($_POST['page_title']) ? $_POST['page_title'] : (isset($content['content_title']) ? $content['content_title'] : '');
?>
">
Example #24
0
 function loadLink($type = 0)
 {
     $cachestr = 'link_' . $this->currentLang . '_' . $type;
     $cache = $this->CI->cache->get($cachestr);
     if (!$cache) {
         $datawhere = array('lang' => $this->currentLang, 'status' => 1);
         if ($type > 0) {
             $datawhere['type'] = $type;
         }
         $data = $this->CI->Data_model->getData($datawhere, 'listorder,id desc', 0, 0, 'link');
         $num = 0;
         foreach ($data as $item) {
             $item['url'] = get_full_url($item['url']);
             $item['thumb'] = get_image_url($item['thumb']);
             $cache[$num] = $item;
             $num++;
         }
         $this->CI->cache->save($cachestr, $cache, 86400);
     }
     return $cache ? $cache : array();
 }
Example #25
0
require_once BASEPATH . 'global/loader.php';
require_once BASEPATH . 'global/log.php';
require_once BASEPATH . 'global/session.php';
require_once BASEPATH . 'global/security.php';
require_once BASEPATH . 'user/user.php';
try {
    // Устанавливаем или проверяем соединение с db
    db::connect();
    $postfix = '_strategy';
    $strategy = NULL;
    //выполняем действия относительно выбранных параметров
    switch (ENVIRONMENT) {
        case 'development':
        case 'production':
            //Парсим url адрес
            $url = get_full_url();
            $ap = NULL;
            $options = NULL;
            $data_URL = parse_url($url);
            $path = $data_URL['path'];
            $path = trim($path, '/');
            $path = explode('/', $path);
            $i = 0;
            $route = config('route');
            //Определяем язык, если он включён
            if (config('settings', 'multilingualism')) {
                $lang = $path[$i];
                if (empty($path[$i]) or !in_array($lang, config('settings', 'supported_lang'))) {
                    Buffer::set(URL_LANG, config('settings', 'default_lang'));
                    if (!empty($path[$i])) {
                        header('Location: ' . base_url(implode('/', $path)));
Example #26
0
 }
 $content = array_iconv($GLOBALS['_J']['charset'], 'utf-8', trim(strip_tags($data['content'])));
 if (!$content) {
     return;
 }
 $totid = (int) $data['totid'];
 $imageid = (int) $data['imageid'];
 $topic = jtable('topic')->row($tid);
 if (!$topic) {
     return;
 }
 if ('sina' == $topic['from']) {
     return;
 }
 //内容后附加链接地址
 $link = get_full_url($GLOBALS['_J']['config']['site_url'], 'index.php?mod=topic&code=' . $tid);
 $length = 140 - ceil(strlen(urlencode($link)) * 0.5);
 //2个字母为1个字
 $content = sina_weibo_substr($content, $length);
 $content .= ' ' . $link;
 $xwb_bind_info = DB::fetch_first("select * from " . DB::table('xwb_bind_info') . " where `uid`='{$uid}'");
 if (!$xwb_bind_info) {
     return;
 }
 $xwb_bind_topic = DB::fetch_first("select * from " . DB::table('xwb_bind_topic') . " where `tid`='{$tid}'");
 if ($xwb_bind_topic) {
     return;
 }
 DB::query("insert into " . DB::table('xwb_bind_topic') . " (`tid`) values ('{$tid}')");
 $p = array('access_token' => $xwb_bind_info['access_token']);
 $rets = array();
Example #27
0
<?php

define('BEA_IMG_SAMPLE_DIR', dirname(__FILE__) . '/../../assets/img/sample/');
require dirname(__FILE__) . '/url.php';
define('BEA_IMG_SAMPLE_URL', get_full_url($_SERVER, true) . '../assets/img/sample/');
require dirname(__FILE__) . '/compat.php';
require dirname(__FILE__) . '/post-thumbnail.php';
require dirname(__FILE__) . '/../../functions/class-bea-images.php';
global $bea_image;
$bea_image = new BEA_Images();
Example #28
0
function renren_sync($data)
{
    $sys_config = renren_init();
    if (!$sys_config) {
        return 'renren_init is invalid';
    }
    $tid = is_numeric($data['tid']) ? $data['tid'] : 0;
    if ($tid < 1) {
        return 'tid is invalid';
    }
    $uid = is_numeric($data['uid']) ? $data['uid'] : 0;
    if ($uid < 1) {
        return 'uid is invalid';
    }
    $totid = is_numeric($data['totid']) ? $data['totid'] : 0;
    $content = $data['content'];
    if (false !== strpos($content, '[')) {
        $content = preg_replace('~\\[([^\\]]{1,6}?)\\]~', '(\\1)', $content);
    }
    $content = trim(strip_tags($content));
    $name = array_iconv($sys_config['charset'], 'UTF-8', cutstr($content, 50));
    $content = array_iconv($sys_config['charset'], 'UTF-8', $content);
    if (!$content) {
        return 'content is invalid';
    }
    $url = get_full_url($sys_config['site_url'], 'index.php?mod=topic&code=' . $tid);
    $renren_bind_info = renren_bind_info($uid);
    if (!$renren_bind_info) {
        return 'bind_info is empty';
    }
    if (!renren_has_bind($uid)) {
        return 'bind_info is invalid';
    }
    $renren_bind_topic = DB::fetch_first("select * from " . DB::table('renren_bind_topic') . " where `tid`='{$tid}'");
    if ($renren_bind_topic) {
        return 'bind_topic is invalid';
    } else {
        DB::query("insert into " . DB::table('renren_bind_topic') . " (`tid`) values ('{$tid}')");
    }
    $ret = array();
    if ($totid < 1) {
        $p = array();
        $p['access_token'] = $renren_bind_info['token'];
        $p['name'] = $name;
        $p['description'] = $content;
        $p['url'] = $url;
        $p['action_name'] = array_iconv($sys_config['charset'], 'UTF-8', '来自:' . $sys_config['site_name']);
        $p['action_link'] = $url;
        $imageid = (int) $data['imageid'];
        if ($imageid > 0 && $sys_config['renren']['is_sync_image']) {
            $topic_image = topic_image($imageid, 'original');
            if (is_image(ROOT_PATH . $topic_image)) {
                $p['image'] = $sys_config['site_url'] . '/' . $topic_image;
            }
        }
        $ret = renren_api('feed.publishFeed', $p);
    }
    $renren_id = is_numeric($ret['post_id']) ? $ret['post_id'] : 0;
    if ($renren_id > 0) {
        DB::query("UPDATE " . DB::table('renren_bind_topic') . " SET `renren_id`='{$renren_id}' WHERE `tid`='{$tid}'");
    }
    return $ret;
}
Example #29
0
 function Enter()
 {
     $share_time = get_param('share_time');
     if (MEMBER_ID > 0 && $share_time > 0 && $share_time + 300 > time()) {
         $bind_info = sina_weibo_bind_info(MEMBER_ID);
         if ($share_time == $bind_info['share_time']) {
             $_site_url = substr($this->Config['site_url'], strpos($this->Config['site_url'], ':/' . '/') + 3);
             $share_msg = "我刚绑定了新浪微博帐户,可以使用新浪微博帐户登录{$this->Config['site_name']}(" . $_site_url . ")、不再担心忘记密码;还可以在{$this->Config['site_name']}发微博同步发到新浪上,吸引更多人关注;你也来试试吧 " . get_full_url($this->Config['site_url'], "index.php?mod=account&code=sina") . " ";
             $TopicLogic = jlogic('topic');
             $_POST['syn_to_sina'] = sina_weibo_bind_setting($bind_info) ? 1 : 0;
             $add_result = $TopicLogic->Add($share_msg);
             DB::query("update " . TABLE_PREFIX . "xwb_bind_info set `share_time`='" . mt_rand(1, 1111111111) . "' where `uid`='" . MEMBER_ID . "'");
             $this->_update();
         }
     }
     exit;
 }
Example #30
0
 private function test_utility_helper()
 {
     $this->unit->use_strict(true);
     $this->unit->run(get_github_url(), 'is_string', 'get_github_url()');
     $this->unit->run(get_facebook_url(), 'is_string', 'get_facebook_url()');
     $this->unit->run(get_twitter_url(), 'is_string', 'get_twitter_url()');
     $this->unit->run(get_google_map_key(), 'is_string', 'get_google_map_key()');
     $this->unit->run(get_ga_code(), 'is_string', 'get_ga_code()');
     $this->unit->run(is_null_or_empty_string(''), 'is_true', 'is_null_or_empty_string()');
     $this->unit->run(is_null_or_empty_string('test'), 'is_false', 'is_null_or_empty_string()');
     $this->unit->run(is_null_or_empty_string(1), 'is_false', 'is_null_or_empty_string()');
     $this->unit->run(start_with('abcdef', 'ab'), 'is_true', 'start_with()');
     $this->unit->run(start_with('abcdef', 'cd'), 'is_false', 'start_with()');
     $this->unit->run(start_with('abcdef', 'ef'), 'is_false', 'start_with()');
     $this->unit->run(start_with('abcdef', ''), 'is_true', 'start_with()');
     $this->unit->run(start_with('', 'abcdef'), 'is_false', 'start_with()');
     $this->unit->run(end_with("abcdef", "ab"), 'is_false', 'end_with()');
     $this->unit->run(end_with("abcdef", "cd"), 'is_false', 'end_with()');
     $this->unit->run(end_with("abcdef", "ef"), 'is_true', 'end_with()');
     $this->unit->run(end_with("abcdef", ""), 'is_true', 'end_with()');
     $this->unit->run(end_with("", "abcdef"), 'is_false', 'end_with()');
     $this->unit->run(get_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www2.manager.co.th'), 'manager.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://test.manager.co.th'), 'manager.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://manager.co.th'), 'manager.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://thaiware.com'), 'thaiware.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.thaiware.com'), 'thaiware.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://test.thaiware.com'), 'thaiware.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'ktb.co.th', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_domain_name()');
     $this->unit->run(get_domain_name('http://www.wegointer.com/category/variety/'), 'wegointer.com', 'get_domain_name()');
     $this->unit->run(get_domain_name(), 'lab.jojoee.com', 'get_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_domain_name()');
     $this->unit->run(get_full_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www2.manager.co.th'), 'www2.manager.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://test.manager.co.th'), 'test.manager.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://manager.co.th'), 'manager.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://thaiware.com'), 'thaiware.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.thaiware.com'), 'www.thaiware.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://test.thaiware.com'), 'test.thaiware.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_full_domain_name()');
     $this->unit->run(get_full_domain_name(), 'lab.jojoee.com', 'get_full_domain_name()');
     $url = 'http://sub.wegointer.com/category/variety/';
     $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()');
     $url = 'http://www.wegointer.com/category/variety/';
     $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()');
     $this->unit->run(get_full_url(), 'http://lab.jojoee.com/nn/test', 'get_full_url()');
     // 404, 301
     // $this->unit->run(is_url_exists('http://jojoee.com/404'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://fashion.spokedark.tv/2015/04/24/dichan-magazine/'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://www.jojoee.com/'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()');
     // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()');
     // $this->unit->run(is_url_redirects('http://www.jojoee.com/'), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_404('http://jojoee.com/404'), 'is_true', 'is_404()');
     // $url = 'http://fashion.spokedark.tv/?p=6600';
     // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()');
     // don't know why it doesn't work
     // $url = 'http://movies.spokedark.tv?p=10054/';
     // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()');
     // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()');
     $this->unit->run(get_extension('file.jpeg'), 'jpeg', 'get_extension()');
     $this->unit->run(get_extension('file.bk.zip'), 'zip', 'get_extension()');
     $this->unit->run(remove_trailing_slash('/category/product/'), '/category/product', 'remove_trailing_slash()');
     $this->unit->run(remove_trailing_slash('/category/product'), '/category/product', 'remove_trailing_slash()');
     $this->unit->run(remove_trailing_slash('category/product/'), 'category/product', 'remove_trailing_slash()');
     for ($i = 0; $i < 20; $i++) {
         $urls = $this->get_posts();
         foreach ($urls as $url) {
             $this->unit->run($url['is_publish'], '0', 'get_posts()');
         }
     }
 }