function render($data = NULL, $layout = NULL, $sharp = 'default', $pathinfo = false) { if ($layout == null) { if (is_ajax_request()) { $layout = 'ajax'; } elseif (is_mobile_request()) { $layout = 'mobile'; } else { $layout = 'web'; } } $GLOBALS['layout'] = $layout; $GLOBALS['sharp'] = $sharp; $layout_file = AROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html'; $data = apply_filter('CTRL_' . g('c') . '_' . g('a') . '_RENDER_FILTER', $data); $GLOBALS['LP_RENDER_DATA'] = $data; if (file_exists($layout_file)) { @extract($data); require $layout_file; } else { $layout_file = CROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html'; if (file_exists($layout_file)) { @extract($data); require $layout_file; } } }
function admin_getpanellink($page, $action, $command = '') { $link = BLOG_BASEURL . 'admin.php?p=' . $page . '&action=' . $action; if ($command) { $link .= '&' . $command; } return wp_specialchars(apply_filter('admin_panel_link', $link, $page, $action, $command)); }
public function getInfo($info) { if (isset($this->info[$info])) { $content = apply_filter("discussion_{$category}", $this->info[$info]); return $content; } else { return False; } }
function get_company_modules($filter = false) { if ($filter != '') { apply_filter($filter); } $this->db->join('modules', 'modules.module_id=company_modules.module_id'); $res = $this->db->get('company_modules'); return $res->result_array(); }
public function getInfo($info) { if (isset($this->info[$info])) { $content = apply_filter("solution_{$info}", $this->info[$info]); return $content; } else { return False; } }
function check_login() { $not_check = array(); $not_check = apply_filter('CTRL_PLUGIN_LOGIN_FILTER', $not_check); if (strtolower(g('c')) == 'plugin' && in_array(g('a'), $not_check)) { // for some plugin no need to login // not check } else { if (!is_login()) { return info_page('您访问的页面需要先<a href="?c=guest">登入</a>'); } } }
function check_login() { $not_check = array(); $not_check = apply_filter('CTRL_PLUGIN_LOGIN_FILTER', $not_check); if (strtolower(g('c')) == 'plugin' && in_array(g('a'), $not_check)) { // for some plugin no need to login // not check } else { if (!is_login()) { return info_page(__('NEED_LOGIN')); } } }
public function get_payments($filter = false) { /* apply filter for query */ if ($filter) { apply_filter($filter); } $this->db->select('payment_received.*,people.last_name,people.company_name,invoice.invoice_no,invoice.total_amount as invoice_amount,invoice.bill_date as invoice_date'); $this->db->where('payment_received.companyid', $this->session->userdata('companyid')); $this->db->join('invoice', 'payment_received.inid=invoice.inid', 'left'); $this->db->join('customer', 'invoice.custid=customer.custid', 'left'); $this->db->join('people', 'customer.people_id=people.people_id'); $rs = $this->db->get('payment_received'); $result = $rs->result_array(); return $result; }
/** * Enqueue the javascript file used for client side product loading * * This script is only enqued if: * - the product loader type is client * - the $post is a WP_Post * - the post's content has the shortcode cc_product * - the script is included by $force * * @param boolean $force (optional default: false) */ function cc_enqueue_cart66_wordpress_js($force = false) { $product_loader = CC_Admin_Setting::get_option('cart66_main_settings', 'product_loader'); $post_type = get_query_var('post_type'); wp_enqueue_script('jquery'); // Always include jQuery for the sake of the sidebar widgets $product_post_types = array('cc_product'); if (has_filter('cc_product_post_types')) { $product_post_types = apply_filter('cc_product_post_types', $product_post_types); } if ($force || in_array($post_type, $product_post_types) || 'client' == $product_loader && cc_page_has_products()) { $cloud = new CC_Cloud_API_V1(); $source = $cloud->protocol . 'manage.' . $cloud->app_domain . '/assets/cart66.wordpress.js'; wp_enqueue_script('cart66-wordpress', $source, 'jquery', '1.0', true); } }
public static function validate_fields($group_field = '', $fields = array()) { if (empty(self::$fields)) { self::get_fields(); } if (empty(self::$fields[$group_field])) { return null; } $arr_results = array(); $group_fields = self::$fields[$group_field]; if (is_array($fields)) { foreach ($fields as $i => $field) { foreach ($group_fields as $j => $default_field) { if ($field['id'] == $default_field['id']) { $arr_results[] = $field; } } } } return apply_filter('dln_form_submit_item_validate_fields', $arr_results, $group_field, $fields); }
function get_files($filter = false) { if ($this->session->userdata('role') != 'admin') { $this->db->where('file.companyid', $this->session->userdata('companyid')); } if ($filter != '') { apply_filter($filter); } $this->db->select('file.*,p1.first_name as lead_fname,p1.last_name as lead_lname,p2.first_name as client_fname,p2.last_name as client_lname,p3.first_name as emp_fname,p3.last_name as emp_lname,project.project_title,p4.first_name as user_fname,p4.last_name as user_lname'); $this->db->join('project', 'project.project_id=file.project_id', 'left'); $this->db->join('lead', 'lead.lead_id=file.lead_id', 'left'); $this->db->join('people p1', 'lead.people_id=p1.people_id', 'left'); $this->db->join('customer', 'customer.custid=file.client_id', 'left'); $this->db->join('people p2', 'customer.people_id=p2.people_id', 'left'); $this->db->join('employee', 'employee.emp_id=file.emp_id', 'left'); $this->db->join('people p3', 'employee.people_id=p3.people_id', 'left'); $this->db->join('users', 'users.uid=file.upload_by', 'left'); $this->db->join('people p4', 'users.people_id=p4.people_id', 'left'); $rs = $this->db->get('file'); return $rs->result_array(); }
/** * Constructor for class-video * * @param object &$album the owning album * @param sting $filename the filename of the image * @return Image */ function Video(&$album, $filename) { // $album is an Album object; it should already be created. if (!is_object($album)) { return NULL; } $this->classSetup($album, $filename); $this->video = true; $this->objectsThumb = checkObjectsThumb($album->localpath, $filename); // Check if the file exists. if (!file_exists($this->localpath) || is_dir($this->localpath)) { $this->exists = false; return NULL; } // This is where the magic happens... $album_name = $album->name; $this->updateDimensions(); // TODO: figure out how to know if this should change. I.e. old videos, changes of the flash player. if (parent::PersistentObject('images', array('filename' => $filename, 'albumid' => $this->album->id), 'filename', false, empty($album_name))) { $newDate = strftime('%Y/%m/%d %T', filemtime($this->localpath)); $this->set('date', $newDate); $alb = $this->album; if (!is_null($alb)) { if (is_null($alb->getDateTime()) || getOption('album_use_new_image_date')) { $this->album->setDateTime($newDate); // not necessarily the right one, but will do. Can be changed in Admin $this->album->save(); } } $title = $this->getDefaultTitle(); $this->set('title', sanitize($title, 2)); $this->set('mtime', filemtime($this->localpath)); apply_filter('new_image', $this); $this->save(); } }
function get_lead($lead_id = false, $people_id = false, $name = false, $mobile = false, $lead_owner = false, $filter = false) { if ($this->session->userdata('role') != 'admin') { $this->db->where('lead.companyid', $this->session->userdata('companyid')); } if ($filter != '') { apply_filter($filter); } if ($lead_id != '') { $this->db->where('lead.lead_id', $lead_id); } if ($people_id != '') { $this->db->where('p1.people_id', $people_id); } if ($name != '') { $this->db->like('p1.first_name', $name); $this->db->or_like('p1.last_name', $name); } if ($mobile != '') { $this->db->where('p1.mobile', $mobile); } if ($lead_owner != '') { $this->db->like('p2.first_name', $lead_owner); $this->db->or_like('p2.last_name', $lead_owner); } $this->db->select('lead.*,p1.*,lead_source.*,lead_status.*,employee.*,p2.first_name as emp_first,p2.last_name as emp_secound,lead.people_id as lead_people,lead.updated_at as lupdate,lead.created_at as lcreatedate'); //, count(activity_id) as act_cnt $this->db->join('people p1', 'p1.people_id=lead.people_id'); $this->db->join('lead_source', 'lead_source.lead_source_id=lead.lead_source'); $this->db->join('lead_status', 'lead_status.lead_status_id=lead.lead_status'); $this->db->join('product', 'product.product_id=lead.product', 'left'); $this->db->join('employee', 'lead.lead_owner=employee.emp_id'); $this->db->join('people p2', 'p2.people_id=employee.people_id'); $res = $this->db->get('lead'); return $res->result_array(); }
/** +---------------------------------------------------------- * 编译模板文件内容 * 包括模板解析、同步路径和编码转换 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param mixed $tmplContent 模板内容 * @param string $charset 模板输出字符集 +---------------------------------------------------------- * @return string +---------------------------------------------------------- */ protected function compiler($tmplContent, $charset = '') { //模板解析 $tmplContent = $this->parse($tmplContent); // 特殊变量替换 if (empty($charset)) { $charset = C('OUTPUT_CHARSET'); } //项目公共目录 $tmplContent = str_ireplace('../public', APP_PUBLIC_URL, $tmplContent); //网站公共目录 $tmplContent = str_replace('__PUBLIC__', WEB_PUBLIC_URL, $tmplContent); // 项目模板目录 $tmplContent = str_replace('__TMPL__', APP_TMPL_URL, $tmplContent); //网站根目录 $tmplContent = str_replace('__ROOT__', __ROOT__, $tmplContent); //当前项目地址 $tmplContent = str_replace('__APP__', __APP__, $tmplContent); //当前模块地址 $tmplContent = str_replace('__URL__', __URL__, $tmplContent); //当前项目操作地址 $tmplContent = str_replace('__ACTION__', __ACTION__, $tmplContent); //当前页面操作地址 $tmplContent = str_replace('__SELF__', __SELF__, $tmplContent); if (ini_get('short_open_tag')) { // 开启短标签的情况要将<?标签用echo方式输出 否则无法正常输出xml标识 $tmplContent = preg_replace('/(<\\?(?!php|=|$))/i', '<?php echo \'\\1\'; ?>' . "\n", $tmplContent); } //编码替换 if (C('TEMPLATE_CHARSET') != $charset) { $tmplContent = str_ireplace('charset=' . C('TEMPLATE_CHARSET'), 'charset=' . $charset, $tmplContent); } // 令牌验证 $tmplContent = preg_replace('/<\\/form(\\s*)>/is', '<?php if(C("TOKEN_ON")):?><input type="hidden" name="<?php echo C("TOKEN_NAME");?>" value="<?php echo Session::get(C("TOKEN_NAME")); ?>"/><?php endif;?></form>', $tmplContent); if (C('THINK_PLUGIN_ON')) { // 模版过滤插件调用 $tmplContent = apply_filter('tmpl_replace', $tmplContent); } // 还原被替换的Literal标签 $tmplContent = preg_replace('/<!--###literal(\\d)###-->/eis', "\$this->restoreLiteral('\\1')", $tmplContent); return $tmplContent; }
/** * Downloads the source's HTML via server-side call for the given URL. * * @since 4.2.0 * @access public * * @param string $url URL to scan. * @return string Source's HTML sanitized markup */ public function fetch_source_html($url) { global $wp_version; if (empty($url)) { return new WP_Error('invalid-url', __('A valid URL was not provided.')); } $remote_url = wp_safe_remote_get($url, array('timeout' => 30, 'user-agent' => 'Press This (WordPress/' . $wp_version . '); ' . get_bloginfo('url'))); if (is_wp_error($remote_url)) { return $remote_url; } $useful_html_elements = array('img' => array('src' => true, 'width' => true, 'height' => true), 'iframe' => array('src' => true), 'link' => array('rel' => true, 'itemprop' => true, 'href' => true), 'meta' => array('property' => true, 'name' => true, 'content' => true)); /** * Filter 'useful' HTML elements list for fetch source step. * * @since 4.5.0 * * @param array $elements Default list of useful elements. */ $useful_html_elements = apply_filter('press_this_useful_html_elements', $useful_html_elements); $source_content = wp_remote_retrieve_body($remote_url); $source_content = wp_kses($source_content, $useful_html_elements); return $source_content; }
public static function processShortcode($slider) { // Increase slider counter to make slider IDs // that are guaranteed to be unique self::$sliderCount++; // Slider and markup data $slides = $slider['data']; $id = $slider['id']; $sliderID = 'layerslider_' . $id . '_' . self::$sliderCount; $output = ''; // Include slider file if (is_array($slides)) { // Get phpQuery if (!class_exists('phpQuery')) { libxml_use_internal_errors(true); include LS_ROOT_PATH . '/helpers/phpQuery.php'; } include LS_ROOT_PATH . '/config/defaults.php'; include LS_ROOT_PATH . '/includes/slider_markup_init.php'; include LS_ROOT_PATH . '/includes/slider_markup_html.php'; $output = implode('', $output); } // Filter to override the printed HTML markup if (has_filter('layerslider_slider_markup')) { $output = apply_filter('layerslider_slider_markup', $output); } // Return data if (get_option('ls_concatenate_output', true)) { $output = trim(preg_replace('/\\s+/u', ' ', $output)); } // Bug fix in v5.4.0: Use self closing tag for <source> $output = str_replace('></source>', ' />', $output); return $output; }
/** * creates a textobject (image standin) * * @param object $album the owner album * @param string $filename the filename of the text file * @return TextObject */ function TextObject($album, $filename) { // $album is an Album object; it should already be created. if (!is_object($album)) { return NULL; } $this->classSetup($album, $filename); $this->objectsThumb = checkObjectsThumb($album->localpath, $filename); // Check if the file exists. if (!file_exists($this->localpath) || is_dir($this->localpath)) { $this->exists = false; return NULL; } if (parent::PersistentObject('images', array('filename' => $filename, 'albumid' => $this->album->id), 'filename', false, false)) { $this->updateDimensions(); $title = $this->getDefaultTitle(); $this->set('title', $title); $this->set('mtime', filemtime($this->localpath)); apply_filter('new_image', $this); $this->save(); } }
function sp_aioseo_canonical_url($url) { global $spVars, $spGlobals, $spIsForum, $wp_query; if ($spIsForum) { $url = sp_canonical_url(); } else { # Do we need to change this from an SP perspective $wpPost = $wp_query->get_queried_object(); $url = apply_filter('sph_aioseo_canonical_url', $url, $wpPost); } $spGlobals['canonicalurl'] = true; return $url; }
function send_ping($sub_id = false, $level_id = false, $user_id = false) { $this->ping = $this->get_ping(); if (!class_exists('nxt_Http')) { include_once ABSPATH . nxtINC . '/class-http.php'; } $pingdata = $this->pingconstants; if (empty($user_id)) { $user = nxt_get_current_user(); $member = new M_Membership($user->ID); } else { $member = new M_Membership($user_id); } foreach ($pingdata as $key => $value) { switch ($key) { case '%blogname%': $pingdata[$key] = get_option('blogname'); break; case '%blogurl%': $pingdata[$key] = get_option('home'); break; case '%username%': $pingdata[$key] = $member->user_login; break; case '%usernicename%': $pingdata[$key] = $member->user_nicename; break; case '%networkname%': $pingdata[$key] = get_site_option('site_name'); break; case '%networkurl%': $pingdata[$key] = get_site_option('siteurl'); break; case '%subscriptionname%': if (!$sub_id) { $ids = $member->get_subscription_ids(); if (!empty($ids)) { $sub_id = $ids[0]; } } if (!empty($sub_id)) { $sub =& new M_Subscription($sub_id); $pingdata[$key] = $sub->sub_name(); } else { $pingdata[$key] = ''; } break; case '%levelname%': if (!$level_id) { $ids = $member->get_level_ids(); if (!empty($ids)) { $levels = $ids[0]; } } if (!empty($levels->level_id)) { $level =& new M_Level($levels->level_id); $pingdata[$key] = $level->level_title(); } else { $pingdata[$key] = ''; } break; case '%timestamp%': $pingdata[$key] = time(); break; default: $pingdata[$key] = apply_filter('membership_pingfield_' . $key, ''); break; } } $url = $this->ping->pingurl; // Globally replace the values in the ping and then make it into an array to send $pingmessage = str_replace(array_keys($pingdata), array_values($pingdata), $this->ping->pinginfo); $pingmessage = array_map('trim', explode("\n", $pingmessage)); // make the ping message into a sendable bit of text $pingtosend = array(); foreach ($pingmessage as $key => $value) { $temp = explode("=", $value); $pingtosend[$temp[0]] = $temp[1]; } // Send the request if (class_exists('nxt_Http')) { $request = new nxt_Http(); switch ($this->ping->pingtype) { case 'GET': $url = untrailingslashit($url) . "?"; foreach ($pingtosend as $key => $val) { if (substr($url, -1) != '?') { $url .= "&"; } $url .= $key . "=" . urlencode($val); } $result = $request->request($url, array('method' => 'GET', 'body' => '')); break; case 'POST': $result = $request->request($url, array('method' => 'POST', 'body' => $pingtosend)); break; } /* 'headers': an array of response headers, such as "x-powered-by" => "PHP/5.2.1" 'body': the response string sent by the server, as you would see it with you web browser 'response': an array of HTTP response codes. Typically, you'll want to have array('code'=>200, 'message'=>'OK') 'cookies': an array of cookie information */ $this->add_history($pingtosend, $result); } }
/** +---------------------------------------------------------- * 加载模板和页面输出 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param string $templateFile 模板文件名 留空为自动获取 * @param string $charset 模板输出字符集 * @param string $contentType 输出类型 * @param string $varPrefix 模板变量前缀 * @param integer $mode 0 返回 1 输出 2 下载 +---------------------------------------------------------- * @throws ThinkExecption +---------------------------------------------------------- */ public function fetch($templateFile = '', $charset = '', $contentType = 'text/html', $varPrefix = '', $display = false) { $startTime = array_sum(explode(' ', microtime())); if (null === $templateFile) { // 使用null参数作为模版名直接返回不做任何输出 return; } if ('layout::' == substr($templateFile, 0, 8)) { $this->layout(substr($templateFile, 8)); return; } if (empty($charset)) { $charset = C('OUTPUT_CHARSET'); } // 网页字符编码 header("Content-Type:" . $contentType . "; charset=" . $charset); header("Cache-control: private"); //支持页面回跳 // 设置输出缓存 ini_set('output_buffering', 4096); $zlibCompress = ini_get('zlib.output_compression'); if (empty($zlibCompress) && function_exists('ini_set')) { ini_set('zlib.output_compression', 1); } // 缓存初始化过滤 apply_filter('ob_init'); //页面缓存 ob_start(); ob_implicit_flush(0); // 缓存开启后执行的过滤 apply_filter('ob_start'); // 模版文件名过滤 $templateFile = apply_filter('template_file', $templateFile); if ('' == $templateFile) { // 如果模板文件名为空 按照默认规则定位 $templateFile = C('TMPL_FILE_NAME'); } elseif (strpos($templateFile, '@')) { // 引入其它主题的操作模板 必须带上模块名称 例如 blue@User:add $templateFile = TMPL_PATH . '/' . str_replace(array('@', ':'), '/', $templateFile) . C('TEMPLATE_SUFFIX'); } elseif (strpos($templateFile, ':')) { // 引入其它模块的操作模板 $templateFile = TEMPLATE_PATH . '/' . str_replace(':', '/', $templateFile) . C('TEMPLATE_SUFFIX'); } elseif (!file_exists($templateFile)) { // 引入当前模块的其它操作模板 $templateFile = dirname(C('TMPL_FILE_NAME')) . '/' . $templateFile . C('TEMPLATE_SUFFIX'); } if (!file_exists($templateFile)) { throw_exception(L('_TEMPLATE_NOT_EXIST_')); } // 模版变量过滤 $this->tVar = apply_filter('template_var', $this->tVar); //根据不同模版引擎进行处理 if ('PHP' == $this->type || empty($this->type)) { // 默认使用PHP模版 include $templateFile; } elseif ('THINK' == $this->type) { // 使用内置的ThinkTemplate模板引擎 if (!$this->checkCache($templateFile)) { // 缓存无效 重新编译 $compiler = true; import('Think.Template.ThinkTemplate'); $tpl = new ThinkTemplate(); // 编译并加载模板文件 $tpl->load($templateFile, $charset, $this->tVar, $varPrefix); } else { // 缓存有效 直接载入模板缓存 // 模板阵列变量分解成为独立变量 extract($this->tVar, empty($varPrefix) ? EXTR_OVERWRITE : EXTR_PREFIX_ALL, $varPrefix); //载入模版缓存文件 include CACHE_PATH . md5($templateFile) . C('CACHFILE_SUFFIX'); } } else { // 通过插件的方式扩展第三方模板引擎 use_compiler(C('TMPL_ENGINE_TYPE'), $templateFile, $this->tVar, $charset, $varPrefix); } // 获取并清空缓存 $content = ob_get_clean(); // 输出编码转换 $content = auto_charset($content, C('TEMPLATE_CHARSET'), $charset); // 输出过滤 $content = apply_filter('ob_content', $content); if (C('HTML_CACHE_ON')) { // 写入静态文件 HtmlCache::writeHTMLCache($content); } if ($display) { $showTime = $this->showTime($startTime); echo $content; if (C('SHOW_RUN_TIME')) { echo '<div class="think_run_time">' . $showTime . '</div>'; } if (C('SHOW_PAGE_TRACE')) { // 显示页面Trace信息 读取Trace定义文件 // 定义格式 return array('当前页面'=>$_SERVER['PHP_SELF'],'通信协议'=>$_SERVER['SERVER_PROTOCOL'],...); $traceFile = CONFIG_PATH . '_trace.php'; if (file_exists($traceFile)) { $_trace = (include $traceFile); } else { $_trace = array(); } // 系统默认显示信息 $this->trace('当前页面', $_SERVER['PHP_SELF']); $this->trace('请求方法', $_SERVER['REQUEST_METHOD']); $this->trace('通信协议', $_SERVER['SERVER_PROTOCOL']); $this->trace('请求时间', Date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME'])); $this->trace('用户代理', $_SERVER['HTTP_USER_AGENT']); $this->trace('会话ID', session_id()); $this->trace('运行数据', $showTime); $this->trace('输出编码', $charset); $this->trace('加载类库', $GLOBALS['include_file']); $this->trace('模板编译', !empty($compiler) ? '重新编译' : '读取缓存'); if (isset(Log::$log[SQL_LOG_DEBUG])) { $log = Log::$log[SQL_LOG_DEBUG]; $this->trace('SQL记录', is_array($log) ? count($log) . '条SQL<br/>' . implode('<br/>', $log) : '无SQL记录'); } else { $this->trace('SQL记录', '无SQL记录'); } $this->trace('错误记录', count(App::$debug) . '条注意<br/>' . implode('<br/>', App::$debug)); $_trace = array_merge($_trace, $this->trace); $_trace = auto_charset($_trace, 'utf-8'); $_title = auto_charset('页面Trace信息', 'utf-8'); // 调用Trace页面模板 include THINK_PATH . '/Tpl/PageTrace.tpl.php'; } return null; } else { return $content; } }
function validate_input() { global $C, $P, $U, $db; $maxmessage = get_setting('maxmessage'); $U['message'] = substr($_REQUEST['message'], 0, $maxmessage); $U['rejected'] = substr($_REQUEST['message'], $maxmessage); if ($U['postid'] === $_REQUEST['postid']) { // ignore double post=reload from browser or proxy $U['message'] = ''; } elseif (time() - $U['lastpost'] <= 1) { // time between posts too short, reject! $U['rejected'] = $_REQUEST['message']; $U['message'] = ''; } if (preg_match('/&[^;]{0,8}$/', $U['message']) && preg_match('/^([^;]{0,8};)/', $U['rejected'], $match)) { $U['message'] .= $match[0]; $U['rejected'] = preg_replace("/^{$match['0']}", '', $U['rejected']); } if (!empty($U['rejected'])) { $U['rejected'] = trim($U['rejected']); $U['rejected'] = htmlspecialchars($U['rejected']); } $U['message'] = htmlspecialchars($U['message']); $U['message'] = preg_replace("/(\r?\n|\r\n?)/", '<br>', $U['message']); if (isset($_REQUEST['multi'])) { $U['message'] = preg_replace('/\\s*<br>/', '<br>', $U['message']); $U['message'] = preg_replace('/<br>(<br>)+/', '<br><br>', $U['message']); $U['message'] = preg_replace('/<br><br>\\s*$/', '<br>', $U['message']); $U['message'] = preg_replace('/^<br>\\s*$/', '', $U['message']); } else { $U['message'] = str_replace('<br>', ' ', $U['message']); } $U['message'] = trim($U['message']); $U['message'] = preg_replace('/\\s+/', ' ', $U['message']); $U['delstatus'] = $U['status']; $U['recipient'] = ''; if ($_REQUEST['sendto'] === '*') { $U['poststatus'] = '1'; $U['displaysend'] = sprintf(get_setting('msgsendall'), style_this($U['nickname'], $U['style'])); } elseif ($_REQUEST['sendto'] === '?' && $U['status'] >= 3) { $U['poststatus'] = '3'; $U['displaysend'] = sprintf(get_setting('msgsendmem'), style_this($U['nickname'], $U['style'])); } elseif ($_REQUEST['sendto'] === '#' && $U['status'] >= 5) { $U['poststatus'] = '5'; $U['displaysend'] = sprintf(get_setting('msgsendmod'), style_this($U['nickname'], $U['style'])); } elseif ($_REQUEST['sendto'] === '&' && $U['status'] >= 6) { $U['poststatus'] = '6'; $U['displaysend'] = sprintf(get_setting('msgsendadm'), style_this($U['nickname'], $U['style'])); } else { // known nick in room? $stmt = $db->prepare("SELECT * FROM {$C['prefix']}ignored WHERE (ignby=? AND ign=?) OR (ignby=? AND ign=?);"); $stmt->execute(array($U['nickname'], $_REQUEST['sendto'], $_REQUEST['sendto'], $U['nickname'])); if (!$stmt->fetch(PDO::FETCH_NUM)) { foreach ($P as $chatter) { if ($_REQUEST['sendto'] === $chatter[0]) { $U['recipient'] = $chatter[0]; $U['displayrecp'] = style_this($chatter[0], $chatter[1]); break; } } } if (!empty($U['recipient'])) { $U['poststatus'] = '9'; $U['delstatus'] = '9'; $U['displaysend'] = sprintf(get_setting('msgsendprv'), style_this($U['nickname'], $U['style']), $U['displayrecp']); } else { // nick left already or ignores us $U['message'] = ''; $U['rejected'] = ''; } } if (isset($U['poststatus'])) { apply_filter(); create_hotlinks(); apply_linkfilter(); if (add_message()) { $U['lastpost'] = time(); $stmt = $db->prepare("UPDATE {$C['prefix']}sessions SET lastpost=?, postid=? WHERE session=?;"); $stmt->execute(array($U['lastpost'], $_REQUEST['postid'], $U['session'])); } } }
$components = array(); $filter_fragment = SqlFilterCardDAV($qry_filters, $components); if ($filter_fragment !== false) { $where .= ' ' . $filter_fragment['sql']; $params = $filter_fragment['params']; } } else { dbg_error_log('cardquery', 'No query filters'); } $sql = 'SELECT * FROM caldav_data INNER JOIN addressbook_resource USING(dav_id)' . $where; if (isset($c->strict_result_ordering) && $c->strict_result_ordering) { $sql .= " ORDER BY dav_id"; } $qry = new AwlQuery($sql, $params); if ($qry->Exec("cardquery", __LINE__, __FILE__) && $qry->rows() > 0) { while ($address_object = $qry->Fetch()) { if (!$need_post_filter || apply_filter($qry_filters, $address_object)) { if ($bound_from != $target_collection->dav_name()) { $address_object->dav_name = str_replace($bound_from, $target_collection->dav_name(), $address_object->dav_name); } if (count($address_data_properties) > 0) { $vcard = new VCard($address_object->caldav_data); $vcard->MaskProperties($address_data_properties); $address_object->caldav_data = $vcard->Render(); } $responses[] = component_to_xml($properties, $address_object); } } } $multistatus = new XMLElement("multistatus", $responses, $reply->GetXmlNsArray()); $request->XMLResponse(207, $multistatus);
$where .= " AND (calendar_item.class != 'PRIVATE' OR calendar_item.class IS NULL) "; } if (isset($c->hide_TODO) && $c->hide_TODO && !$target_collection->HavePrivilegeTo('DAV::write-content')) { $where .= " AND caldav_data.caldav_type NOT IN ('VTODO') "; } if (isset($c->hide_older_than) && intval($c->hide_older_than > 0)) { $where .= " AND calendar_item.dtstart > (now() - interval '" . intval($c->hide_older_than) . " days') "; } $sql = 'SELECT caldav_data.*,calendar_item.* FROM collection INNER JOIN caldav_data USING(collection_id) INNER JOIN calendar_item USING(dav_id) ' . $where; if (isset($c->strict_result_ordering) && $c->strict_result_ordering) { $sql .= " ORDER BY caldav_data.dav_id"; } $qry = new AwlQuery($sql, $params); if ($qry->Exec("calquery", __LINE__, __FILE__) && $qry->rows() > 0) { while ($calendar_object = $qry->Fetch()) { if (!$need_post_filter || apply_filter($qry_filters, $calendar_object)) { if ($bound_from != $target_collection->dav_name()) { $calendar_object->dav_name = str_replace($bound_from, $target_collection->dav_name(), $calendar_object->dav_name); } if ($need_expansion) { $vResource = new vComponent($calendar_object->caldav_data); $expanded = expand_event_instances($vResource, $expand_range_start, $expand_range_end); if ($expanded->ComponentCount() == 0) { continue; } $calendar_object->caldav_data = $expanded->Render(); } $responses[] = calendar_to_xml($properties, $calendar_object); } } }
public static function send_result($data) { $data = apply_filter('API_' . g('a') . '_OUTPUT_FILTER', $data); $obj = array(); $obj['err_code'] = '0'; $obj['err_msg'] = 'success'; $obj['data'] = $data; if (g('API_EMBED_MODE') == 1) { return json_encode($obj); } else { header('Content-type: application/json'); die(json_encode($obj)); } }
function upload_as_form($url, $data) { @session_write_close(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $ch = apply_filter('UPLOAD_CURL_SETTINGS', $ch); $response = curl_exec($ch); return $response; }
} if (isset($c->hide_TODO) && ($c->hide_TODO === true || is_string($c->hide_TODO) && preg_match($c->hide_TODO, $_SERVER['HTTP_USER_AGENT'])) && !$target_collection->HavePrivilegeTo('all')) { $where .= " AND caldav_data.caldav_type NOT IN ('VTODO') "; } if (isset($c->hide_older_than) && intval($c->hide_older_than > 0)) { $where .= " AND (CASE WHEN caldav_data.caldav_type<>'VEVENT' OR calendar_item.dtstart IS NULL THEN true ELSE calendar_item.dtstart > (now() - interval '" . intval($c->hide_older_than) . " days') END) "; } $sql = 'SELECT ' . $distinct . ' caldav_data.*,calendar_item.* FROM collection INNER JOIN caldav_data USING(collection_id) INNER JOIN calendar_item USING(dav_id) ' . $where; if (isset($c->strict_result_ordering) && $c->strict_result_ordering) { $sql .= " ORDER BY caldav_data.dav_id"; } $qry = new AwlQuery($sql, $params); if ($qry->Exec("calquery", __LINE__, __FILE__) && $qry->rows() > 0) { while ($dav_object = $qry->Fetch()) { try { if (!$need_post_filter || apply_filter($qry_filters, $dav_object)) { if ($bound_from != $target_collection->dav_name()) { $dav_object->dav_name = str_replace($bound_from, $target_collection->dav_name(), $dav_object->dav_name); } if ($need_expansion) { $vResource = new vComponent($dav_object->caldav_data); $expanded = getVCalendarRange($vResource); if (!$expanded->overlaps($range_filter)) { continue; } $expanded = expand_event_instances($vResource, $expand_range_start, $expand_range_end, $expand_as_floating); if ($expanded->ComponentCount() == 0) { continue; } if ($need_expansion) { $dav_object->caldav_data = $expanded->Render();
/** * Load all of the albums names that are found in the Albums directory on disk. * Returns an array containing this list. * * @return array */ function loadAlbumNames() { $albumdir = $this->getAlbumDir(); if (!is_dir($albumdir) || !is_readable($albumdir)) { if (!is_dir($albumdir)) { $msg .= sprintf(gettext('Error: The \'albums\' directory (%s) cannot be found.'), $this->albumdir); } else { $msg .= sprintf(gettext('Error: The \'albums\' directory (%s) is not readable.'), $this->albumdir); } die($msg); } $dir = opendir($albumdir); $albums = array(); while ($dirname = readdir($dir)) { $dirname = FilesystemToUTF8($dirname); if (is_dir($albumdir . $dirname) && substr($dirname, 0, 1) != '.' || hasDyanmicAlbumSuffix($dirname)) { $albums[] = $dirname; } } closedir($dir); return apply_filter('album_filter', $albums); }
$filters['description'] = $_POST['desc_text']; break; } } $_SESSION['filters'] = $filters; } //********************* // MAIN PROCESS //********************* $action_type = "list"; if (isset($_REQUEST['action_type'])) { $action_type = $_REQUEST['action_type']; } switch ($action_type) { case "filter": apply_filter($_POST['enable_filter']); case "list": show_available_money($config); ?> <table border="0" cellpadding="10"> <tr> <td width="400"><?php show_add_detail_form($config); ?> </td> <td><?php show_filter_form($config); ?> </td> </tr>
function ends_on_level_in_sub($sub_id) { $sql = $this->db->prepare("SELECT * FROM {$this->membership_relationships} WHERE user_id = %d AND sub_id = %d", $this->ID, $sub_id); $results = $this->db->get_results($sql); if (!empty($results)) { foreach ($results as $key => $r) { return apply_filter('membership_ends_on_level_in_sub', $sub_id, mysql2date("U", $rel->expirydate)); } } }
/** +---------------------------------------------------------- * 执行应用程序 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @return void +---------------------------------------------------------- * @throws ThinkExecption +---------------------------------------------------------- */ public function exec() { //创建Action控制器实例 if (defined('C_MODULE_NAME')) { $module = A(C_MODULE_NAME); } else { $module = A(MODULE_NAME); } if (!$module) { // 是否定义Empty模块 $module = A("Empty"); if (!$module) { // 模块不存在 if (C('DEBUG_MODE')) { // 调试模式 抛出异常 throw_exception(L('_MODULE_NOT_EXIST_') . MODULE_NAME); } else { // 部署模式重定向到默认模块 $url = __APP__ . '/' . C('DEFAULT_MODULE'); redirect($url); } } } //获取当前操作名 $action = ACTION_NAME . C('ACTION_SUFFIX'); if (defined('C_ACTION_NAME')) { // 执行操作链 最多只能有一个输出 $actionList = explode(':', C_ACTION_NAME); foreach ($actionList as $action) { $module->{$action}(); } } else { //如果存在前置操作,首先执行 if (method_exists($module, '_before_' . $action)) { $module->{'_before_' . $action}(); } //执行操作 $module->{$action}(); //如果存在后置操作,继续执行 if (method_exists($module, '_after_' . $action)) { $module->{'_after_' . $action}(); } } // 执行应用结束过滤器 apply_filter('app_end'); // 写入错误日志 if (C('WEB_LOG_RECORD')) { Log::save(); } return; }