Example #1
0
/**
 * oEmbed filter replacement callback.
 *
 * Override basic function by setting Drupal system variable
 * `oembed_resolve_link_callback` to a new function name with this signature.
 *
 * @param string $url
 *   URL to embed.
 * @param array $options
 *   oEmbed request options.
 *
 * @return string
 *   Rendered oEmbed response.
 */
function oembedinline_oembed_resolve_link($url, $options = array())
{
    // If file_entity module is enabled, treat the URL as an uploaded file.
    // Inline is used to defer the rendering of the embedded content until the
    // entity is actually viewed. This technique allows content to be cached by
    // Drupal's filter system.
    $view_mode = 'full';
    if (isset($options['view_mode'])) {
        $view_mode = $options['view_mode'];
        unset($options['view_mode']);
    }
    $url = decode_entities($url);
    $element = array();
    $file = oembed_url_to_file($url);
    $file->override = $options;
    if (isset($file->fid)) {
        $macro_params = array();
        $macro_params[] = 'entity';
        $macro_params[] = 'type=file';
        $macro_params[] = 'id=' . $file->fid;
        $macro_params[] = 'view_mode=' . $view_mode;
        $element = array('#markup' => "\r\n" . '[' . implode('|', $macro_params) . ']' . "\r\n");
    }
    $return = drupal_render($element);
    if (empty($return)) {
        $return = $url;
    }
    return $return;
}
Example #2
0
 /**
  * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
  *
  * Renders the contextual fields.
  *
  * @param \Drupal\views\ResultRow $values
  *   The values retrieved from a single row of a view's query result.
  *
  * @see contextual_preprocess()
  * @see contextual_contextual_links_view_alter()
  */
 public function render(ResultRow $values)
 {
     $links = array();
     foreach ($this->options['fields'] as $field) {
         $rendered_field = $this->view->style_plugin->getField($this->view->row_index, $field);
         if (empty($rendered_field)) {
             continue;
         }
         $title = $this->view->field[$field]->last_render_text;
         $path = '';
         if (!empty($this->view->field[$field]->options['alter']['path'])) {
             $path = $this->view->field[$field]->options['alter']['path'];
         }
         if (!empty($title) && !empty($path)) {
             // Make sure that tokens are replaced for this paths as well.
             $tokens = $this->getRenderTokens(array());
             $path = strip_tags(decode_entities(strtr($path, $tokens)));
             $links[$field] = array('href' => $path, 'title' => $title);
             if (!empty($this->options['destination'])) {
                 $links[$field]['query'] = drupal_get_destination();
             }
         }
     }
     // Renders a contextual links placeholder.
     if (!empty($links)) {
         $contextual_links = array('contextual' => array('', array(), array('contextual-views-field-links' => UrlHelper::encodePath(Json::encode($links)))));
         $element = array('#type' => 'contextual_links_placeholder', '#id' => _contextual_links_to_id($contextual_links));
         return drupal_render($element);
     } else {
         return '';
     }
 }
/**
 * Apply advanced options to a generated member id string.
 */
function _membership_entity_token_clean_string($string, $settings)
{
    // Remove all HTML tags from the string.
    $return = strip_tags(decode_entities($string));
    // Get rid of words that are on the ignore list
    $ignore_words = $settings['ignore_words'];
    $ignore_words_regex = preg_replace(array('/^[,\\s]+|[,\\s]+$/', '/[,\\s]+/'), array('', '\\b|\\b'), $ignore_words);
    if ($ignore_words_regex) {
        $ignore_words_regex = '/\\b' . $ignore_words_regex . '\\b/i';
        $words_removed = preg_replace($ignore_words_regex, '', $return);
        if (drupal_strlen(trim($words_removed)) > 0) {
            $return = $words_removed;
        }
    }
    // Replace whitespace with the separator.
    $return = _membership_entity_token_clean_separator($return, $settings['separator']);
    // Convert to lower or upper case.
    if ($settings['case'] == 'lower') {
        $return = drupal_strtolower($return);
    } else {
        if ($settings['case'] == 'upper') {
            $return = drupal_strtoupper($return);
        }
    }
    // Shorten to maxlength.
    if (!empty($settings['maxlength'])) {
        $return = truncate_utf8($return, $settings['maxlength']);
    }
    return $return;
}
/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *   An array containing the breadcrumb links.
 * @return a string containing the breadcrumb output.
 */
function burzenski_breadcrumb($variables)
{
    $breadcrumb = $variables['breadcrumb'];
    $breadcrumb[] = l(drupal_get_title(), $_GET["q"]);
    if (!empty($breadcrumb)) {
        $output = '<ul>';
        $first = true;
        foreach ($breadcrumb as $key => $value) {
            if ($first) {
                $output .= '<li>' . $value . '</li>';
                $first = false;
            } else {
                $pos = strpos($value, ">");
                $innerText = substr($value, $pos + 1, strlen($value) - $pos - 5);
                if (strlen($innerText) > 45) {
                    $newValue = substr($innerText, 0, 42) . "...";
                    $value = str_replace($innerText, $newValue, $value);
                }
                $output .= '<li>&gt;</li><li>' . decode_entities($value) . '</li>';
            }
        }
        $output .= '</ul>';
        return $output;
    }
}
function asta_2015_form_alter(&$form, &$form_state, $form_id)
{
    if ($form_id == 'search_block_form') {
        // HTML5 placeholder attribute
        $form['search_block_form']['#attributes']['placeholder'] = t('Search');
        $form['actions']['submit']['#value'] = decode_entities('&#xf002;');
    }
}
Example #6
0
 function calcula()
 {
     if (enString($this->web, '.com/v/')) {
         $this->web = 'https://www.youtube.com/watch?v=' . substr($this->web, strposF($this->web, '.com/v/'));
     }
     $this->web = strtr($this->web, array('//m.' => '//www.'));
     //id
     parse_str(parse_url($this->web, PHP_URL_QUERY), $vars);
     //$id=$vars['v']
     dbug_r($vars);
     $encontrado = false;
     $intentos = 3;
     $tube = new youtube();
     $links = $tube->parse($this->web_descargada);
     dbug_r($links);
     $web2 = $this->web;
     while (($links === false || count($links) == 0) && $intentos > 0) {
         dbug("ERROR: " . $tube->error);
         dbug('reintentando en 0.1s');
         usleep(100000);
         $tube = new youtube();
         $links = $tube->parse(CargaWebCurl($web2, '', 0, '', array(), true, true));
         dbug_r($links);
         --$intentos;
     }
     $obtenido = array('enlaces' => array());
     if ($links) {
         //imagen
         //https://i1.ytimg.com/vi/8GLNKyfdnQg/0.jpg
         $imagen = 'https://i1.ytimg.com/vi/' . $vars['v'] . '/0.jpg';
         $titulo = entre1y2($this->web_descargada, '<meta name="title" content="', '"');
         $titulo = limpiaTitulo($titulo);
         foreach ($links as &$link) {
             //'ext','p','axb','2D-3D','audio','url'
             $obtenido['enlaces'][] = array('url' => $link['url'] . "&title=" . urlencode(decode_entities($titulo)), 'tipo' => 'http', 'url_txt' => $link['p'] . ' ' . $link['ext'] . ($link['2D-3D'] === '3D' ? ': 3D' : '') . ($link['audio'] ? ' - ' . $link['audio'] : ''));
         }
         $obtenido['titulo'] = $titulo;
         $obtenido['imagen'] = $imagen;
         finalCadena($obtenido, false);
     } else {
         setErrorWebIntera($tube->error);
         return;
     }
 }
Example #7
0
 /**
  * Gets the list of links used by this field.
  *
  * @return array
  *   The links which are used by the render function.
  */
 protected function getLinks()
 {
     $links = array();
     foreach ($this->options['fields'] as $field) {
         if (empty($this->view->field[$field]->last_render_text)) {
             continue;
         }
         $title = $this->view->field[$field]->last_render_text;
         $path = '';
         if (!empty($this->view->field[$field]->options['alter']['path'])) {
             $path = $this->view->field[$field]->options['alter']['path'];
         }
         // Make sure that tokens are replaced for this paths as well.
         $tokens = $this->getRenderTokens(array());
         $path = strip_tags(decode_entities(strtr($path, $tokens)));
         $links[$field] = array('href' => $path, 'title' => $title);
         if (!empty($this->options['destination'])) {
             $links[$field]['query'] = drupal_get_destination();
         }
     }
     return $links;
 }
Example #8
0
 function location_manager($telegram, $user_id, $chat_id, $location)
 {
     $lon = $location["longitude"];
     $lat = $location["latitude"];
     $response = $telegram->getData();
     $response = str_replace(" ", "%20", $response);
     $reply = "http://nominatim.openstreetmap.org/reverse?email=piersoft2@gmail.com&format=json&lat=" . $lat . "&lon=" . $lon . "&zoom=18&addressdetails=1";
     $json_string = file_get_contents($reply);
     $parsed_json = json_decode($json_string);
     //var_dump($parsed_json);
     $comune = "";
     $temp_c1 = $parsed_json->{'display_name'};
     if ($parsed_json->{'address'}->{'town'}) {
         $temp_c1 .= "\nCittĂƒÂ : " . $parsed_json->{'address'}->{'town'};
         $comune .= $parsed_json->{'address'}->{'town'};
     } else {
         $comune .= $parsed_json->{'address'}->{'city'};
     }
     if ($parsed_json->{'address'}->{'village'}) {
         $comune .= $parsed_json->{'address'}->{'village'};
     }
     $location = "Sto cercando le localitĂƒÂ  contenti \"" . $comune . "\" tramite le coordinate che hai inviato: " . $lat . "," . $lon;
     $content = array('chat_id' => $chat_id, 'text' => $location, 'disable_web_page_preview' => true);
     $telegram->sendMessage($content);
     $alert = "";
     //	echo $comune;
     $urlgd = "db/luoghi.csv";
     $inizio = 0;
     $homepage = "";
     $csv = array_map('str_getcsv', file($urlgd));
     $count = 0;
     foreach ($csv as $data => $csv1) {
         $count = $count + 1;
     }
     if ($count == 0 || $count == 1) {
         $location = "Nessun luogo trovato";
         $content = array('chat_id' => $chat_id, 'text' => $location, 'disable_web_page_preview' => true);
         $telegram->sendMessage($content);
     }
     function decode_entities($text)
     {
         $text = htmlentities($text, ENT_COMPAT, 'ISO-8859-1', true);
         $text = preg_replace('/&#(\\d+);/me', "chr(\\1)", $text);
         #decimal notation
         $text = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $text);
         #hex notation
         $text = html_entity_decode($text, ENT_COMPAT, "UTF-8");
         #NOTE: UTF-8 does not work!
         return $text;
     }
     $result = 0;
     for ($i = $inizio; $i < $count; $i++) {
         $filter = strtoupper($csv[$i][3]);
         if (strpos(decode_entities($filter), strtoupper($comune)) !== false) {
             $result = 1;
             $homepage .= "\n";
             $homepage .= "Nome: " . decode_entities($csv[$i][0]) . "\n";
             $homepage .= "Risorsa: " . decode_entities($csv[$i][1]) . "\n";
             if ($csv[$i][4] != NULL) {
                 $homepage .= "Indirizzo: " . decode_entities($csv[$i][4]);
             }
             if ($csv[$i][5] != NULL) {
                 $homepage .= ", " . decode_entities($csv[$i][5]);
             }
             $homepage .= "\n";
             if ($csv[$i][3] != NULL) {
                 $homepage .= "Comune: " . decode_entities($csv[$i][3]) . "\n";
             }
             if ($csv[$i][9] != NULL) {
                 $homepage .= "Web: " . decode_entities($csv[$i][9]) . "\n";
             }
             if ($csv[$i][10] != NULL) {
                 $homepage .= "Email: " . decode_entities($csv[$i][10]) . "\n";
             }
             //	if($csv[$i][22] !=NULL)	$homepage .="Descrizione: ".substr(decode_entities($csv[$i][22]), 0, 400)."..[....]\n";
             if ($csv[$i][11] != NULL) {
                 $homepage .= "Tel: " . decode_entities($csv[$i][11]) . "\n";
             }
             if ($csv[$i][14] != NULL) {
                 $homepage .= "Servizi: " . decode_entities($csv[$i][14]) . "\n";
             }
             if ($csv[$i][15] != NULL) {
                 $homepage .= "Attrezzature: " . decode_entities($csv[$i][15]) . "\n";
             }
             if ($csv[$i][16] != NULL) {
                 $homepage .= "Foto1: " . decode_entities($csv[$i][16]) . "\n";
             }
             if ($csv[$i][17] != NULL) {
                 $homepage .= "(realizzata da: " . decode_entities($csv[$i][17]) . ")\n";
             }
             if ($csv[$i][18] != NULL) {
                 $homepage .= "Foto2: " . decode_entities($csv[$i][18]) . "\n";
             }
             if ($csv[$i][19] != NULL) {
                 $homepage .= "(realizzata da: " . decode_entities($csv[$i][19]) . ")\n";
             }
             if ($csv[$i][7] != NULL) {
                 $homepage .= "Mappa:\n";
                 $homepage .= "http://www.openstreetmap.org/?mlat=" . $csv[$i][7] . "&mlon=" . $csv[$i][8] . "#map=19/" . $csv[$i][7] . "/" . $csv[$i][8];
             }
             $homepage .= "\n____________\n";
         }
     }
     $chunks = str_split($homepage, self::MAX_LENGTH);
     foreach ($chunks as $chunk) {
         $content = array('chat_id' => $chat_id, 'text' => $chunk, 'disable_web_page_preview' => true);
         $telegram->sendMessage($content);
     }
     $this->create_keyboard_temp($telegram, $chat_id);
     exit;
 }
 /**
  * Transforms an HTML string into plain text, preserving its structure.
  *
  * The output will be suitable for use as 'format=flowed; delsp=yes' text
  * (RFC 3676) and can be passed directly to MailManagerInterface::mail() for sending.
  *
  * We deliberately use LF rather than CRLF, see MailManagerInterface::mail().
  *
  * This function provides suitable alternatives for the following tags:
  * <a> <em> <i> <strong> <b> <br> <p> <blockquote> <ul> <ol> <li> <dl> <dt>
  * <dd> <h1> <h2> <h3> <h4> <h5> <h6> <hr>
  *
  * @param string $string
  *   The string to be transformed.
  * @param array $allowed_tags
  *   (optional) If supplied, a list of tags that will be transformed. If
  *   omitted, all supported tags are transformed.
  *
  * @return string
  *   The transformed string.
  */
 public static function htmlToText($string, $allowed_tags = NULL)
 {
     // Cache list of supported tags.
     if (empty(static::$supportedTags)) {
         static::$supportedTags = array('a', 'em', 'i', 'strong', 'b', 'br', 'p', 'blockquote', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr');
     }
     // Make sure only supported tags are kept.
     $allowed_tags = isset($allowed_tags) ? array_intersect(static::$supportedTags, $allowed_tags) : static::$supportedTags;
     // Make sure tags, entities and attributes are well-formed and properly
     // nested.
     $string = Html::normalize(Xss::filter($string, $allowed_tags));
     // Apply inline styles.
     $string = preg_replace('!</?(em|i)((?> +)[^>]*)?>!i', '/', $string);
     $string = preg_replace('!</?(strong|b)((?> +)[^>]*)?>!i', '*', $string);
     // Replace inline <a> tags with the text of link and a footnote.
     // 'See <a href="http://drupal.org">the Drupal site</a>' becomes
     // 'See the Drupal site [1]' with the URL included as a footnote.
     static::htmlToMailUrls(NULL, TRUE);
     $pattern = '@(<a[^>]+?href="([^"]*)"[^>]*?>(.+?)</a>)@i';
     $string = preg_replace_callback($pattern, 'static::htmlToMailUrls', $string);
     $urls = static::htmlToMailUrls();
     $footnotes = '';
     if (count($urls)) {
         $footnotes .= "\n";
         for ($i = 0, $max = count($urls); $i < $max; $i++) {
             $footnotes .= '[' . ($i + 1) . '] ' . $urls[$i] . "\n";
         }
     }
     // Split tags from text.
     $split = preg_split('/<([^>]+?)>/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
     // Note: PHP ensures the array consists of alternating delimiters and
     // literals and begins and ends with a literal (inserting $null as
     // required).
     // Odd/even counter (tag or no tag).
     $tag = FALSE;
     // Case conversion function.
     $casing = NULL;
     $output = '';
     // All current indentation string chunks.
     $indent = array();
     // Array of counters for opened lists.
     $lists = array();
     foreach ($split as $value) {
         // Holds a string ready to be formatted and output.
         $chunk = NULL;
         // Process HTML tags (but don't output any literally).
         if ($tag) {
             list($tagname) = explode(' ', strtolower($value), 2);
             switch ($tagname) {
                 // List counters.
                 case 'ul':
                     array_unshift($lists, '*');
                     break;
                 case 'ol':
                     array_unshift($lists, 1);
                     break;
                 case '/ul':
                 case '/ol':
                     array_shift($lists);
                     // Ensure blank new-line.
                     $chunk = '';
                     break;
                     // Quotation/list markers, non-fancy headers.
                 // Quotation/list markers, non-fancy headers.
                 case 'blockquote':
                     // Format=flowed indentation cannot be mixed with lists.
                     $indent[] = count($lists) ? ' "' : '>';
                     break;
                 case 'li':
                     $indent[] = isset($lists[0]) && is_numeric($lists[0]) ? ' ' . $lists[0]++ . ') ' : ' * ';
                     break;
                 case 'dd':
                     $indent[] = '    ';
                     break;
                 case 'h3':
                     $indent[] = '.... ';
                     break;
                 case 'h4':
                     $indent[] = '.. ';
                     break;
                 case '/blockquote':
                     if (count($lists)) {
                         // Append closing quote for inline quotes (immediately).
                         $output = rtrim($output, "> \n") . "\"\n";
                         // Ensure blank new-line.
                         $chunk = '';
                     }
                     // Fall-through.
                 // Fall-through.
                 case '/li':
                 case '/dd':
                     array_pop($indent);
                     break;
                 case '/h3':
                 case '/h4':
                     array_pop($indent);
                 case '/h5':
                 case '/h6':
                     // Ensure blank new-line.
                     $chunk = '';
                     break;
                     // Fancy headers.
                 // Fancy headers.
                 case 'h1':
                     $indent[] = '======== ';
                     $casing = 'drupal_strtoupper';
                     break;
                 case 'h2':
                     $indent[] = '-------- ';
                     $casing = 'drupal_strtoupper';
                     break;
                 case '/h1':
                 case '/h2':
                     $casing = NULL;
                     // Pad the line with dashes.
                     $output = static::htmlToTextPad($output, $tagname == '/h1' ? '=' : '-', ' ');
                     array_pop($indent);
                     // Ensure blank new-line.
                     $chunk = '';
                     break;
                     // Horizontal rulers.
                 // Horizontal rulers.
                 case 'hr':
                     // Insert immediately.
                     $output .= static::wrapMail('', implode('', $indent)) . "\n";
                     $output = static::htmlToTextPad($output, '-');
                     break;
                     // Paragraphs and definition lists.
                 // Paragraphs and definition lists.
                 case '/p':
                 case '/dl':
                     // Ensure blank new-line.
                     $chunk = '';
                     break;
             }
         } else {
             // Convert inline HTML text to plain text; not removing line-breaks or
             // white-space, since that breaks newlines when sanitizing plain-text.
             $value = trim(decode_entities($value));
             if (drupal_strlen($value)) {
                 $chunk = $value;
             }
         }
         // See if there is something waiting to be output.
         if (isset($chunk)) {
             // Apply any necessary case conversion.
             if (isset($casing)) {
                 $chunk = $casing($chunk);
             }
             $line_endings = Settings::get('mail_line_endings', PHP_EOL);
             // Format it and apply the current indentation.
             $output .= static::wrapMail($chunk, implode('', $indent)) . $line_endings;
             // Remove non-quotation markers from indentation.
             $indent = array_map('\\Drupal\\Core\\Mail\\MailFormatHelper::htmlToTextClean', $indent);
         }
         $tag = !$tag;
     }
     return $output . $footnotes;
 }
Example #10
0
}
// include custom frontend init scripts based on module definitions
if (count($phpwcms['modules_fe_init'])) {
    foreach ($phpwcms['modules_fe_init'] as $value) {
        include_once $value;
    }
}
// redirect to login form if user is not logged in and has no permission to access level
if (!PERMIT_ACCESS && !_getFeUserLoginStatus()) {
    if (!empty($block['feloginurl'])) {
        $template_default['login_form_url'] = str_replace('{SITE}', PHPWCMS_URL, $block['feloginurl']);
    } elseif (empty($template_default['login_form_url'])) {
        $template_default['login_form_url'] = PHPWCMS_URL;
    }
    // store current URL
    $_SESSION['LOGIN_REDIRECT'] = decode_entities(FE_CURRENT_URL);
    // redirect to login form
    headerRedirect($template_default['login_form_url'], 401);
}
//reads all articles for active cat into array
$content["articles"] = get_actcat_articles_data($content["cat_id"]);
$content["article_list_count"] = count($content["articles"]);
// generating a list of articles inside the current article category
if (!$aktion[4]) {
    if ($content['404error']['status'] === false && ($content["article_list_count"] || $content['struct'][$content['cat_id']]['acat_topcount'] == -1)) {
        $content['opengraph']['type'] = 'article';
        if ($content['struct'][$content['cat_id']]['acat_topcount'] == -1 || $content["article_list_count"] === 1 && empty($template_default['settings']['force_article_list_mode'])) {
            // if($temp_counter == 1) {
            // if only 1 article for this category available
            // then show this article directly
            // sets article ID to this only 1 article
?>
      <?php 
echo ibtimes_header_node_social_share_buttons();
?>
      <div class="sticky_social">
        <div class="article-social">
          <ul class="share">
            <li>
              <a href="https://www.facebook.com/sharer/sharer.php?u=<?php 
print $url;
?>
" class="facebook" target="_blank"></a>
            </li>
            <li>
              <a href="http://twitter.com/intent/tweet?status=<?php 
print urlencode(decode_entities($title));
?>
+<?php 
print $url;
?>
" class="twitter" target="_blank"></a>
            </li>
            <li>
              <a href="https://www.tumblr.com/share/link?url=<?php 
print $url;
?>
" class="tumblr" target="_blank"></a>
            </li>
            <li class="share-more">
              <a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php 
print $url;
Example #12
0
/**
 * Overrides theme('easy_breadcrumb').
 */
function europa_easy_breadcrumb($variables)
{
    $breadcrumb = $variables['breadcrumb'];
    $segments_quantity = $variables['segments_quantity'];
    $separator = $variables['separator'];
    $html = '';
    // We don't print out "Home" if it's the only breadcrumb component.
    if ($segments_quantity > 1) {
        $html .= '<ol class="breadcrumb">';
        for ($i = 0, $s = $segments_quantity - 1; $i < $segments_quantity; ++$i) {
            $it = $breadcrumb[$i];
            $content = decode_entities($it['content']);
            if (isset($it['url'])) {
                $html .= '<li>' . l($content, $it['url'], array('attributes' => array('class' => $it['class']))) . '</li>';
            } else {
                $class = implode(' ', $it['class']);
                $html .= '<li class="active ' . $class . '">' . $content . '</li>';
            }
            if ($i < $s) {
                $html .= '<span class="active breadcrumb-separator"> ' . $separator . ' </span>';
            }
        }
        $html .= '</ol>';
    }
    return $html;
}
Example #13
0
 /**
  * Returns to tokens for arguments.
  *
  * This function is similar to views_handler_field::getRenderTokens()
  * but without fields tokens.
  */
 public function getArgumentsTokens()
 {
     $tokens = array();
     if (!empty($this->view->build_info['substitutions'])) {
         $tokens = $this->view->build_info['substitutions'];
     }
     // Add tokens for every argument (contextual filter) and path arg.
     $handlers = count($this->view->display_handler->getHandlers('argument'));
     for ($count = 1; $count <= $handlers; $count++) {
         if (!isset($tokens["%{$count}"])) {
             $tokens["%{$count}"] = '';
         }
         // Use strip tags as there should never be HTML in the path.
         // However, we need to preserve special characters like " that
         // were removed by String::checkPlain().
         $tokens["!{$count}"] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
     }
     return $tokens;
 }
            $sql .= 'adplace_created, adplace_changed, adplace_status, adplace_title, ';
            $sql .= 'adplace_format, adplace_width, adplace_height, adplace_prefix, adplace_suffix';
            $sql .= ') VALUES (';
            $sql .= "'" . aporeplace($plugin['data']['adplace_created']) . "', ";
            $sql .= "'" . aporeplace($plugin['data']['adplace_changed']) . "', ";
            $sql .= $plugin['data']['adplace_status'] . ", ";
            $sql .= "'" . aporeplace($plugin['data']['adplace_title']) . "', ";
            $sql .= $plugin['data']['adplace_format'] . ", ";
            $sql .= $plugin['data']['adplace_width'] . ", ";
            $sql .= $plugin['data']['adplace_height'] . ", ";
            $sql .= "'" . aporeplace($plugin['data']['adplace_prefix']) . "', ";
            $sql .= "'" . aporeplace($plugin['data']['adplace_suffix']) . "'";
            $sql .= ')';
            if (@_dbQuery($sql, 'INSERT')) {
                if (isset($_POST['save'])) {
                    headerRedirect(decode_entities(MODULE_HREF) . '&listadplace=1');
                }
            } else {
                $plugin['error']['update'] = mysql_error();
            }
        }
    }
}
// try to read entry from database
if ($plugin['id'] && !isset($plugin['error'])) {
    $sql = 'SELECT * FROM ' . DB_PREPEND . 'phpwcms_ads_place WHERE adplace_id=' . $plugin['id'];
    $plugin['data'] = _dbQuery($sql);
    $plugin['data'] = $plugin['data'][0];
}
// default values
if (empty($plugin['data'])) {
<div class="indepth <?php 
echo $class_style;
?>
">
  <?php 
if (!empty($title)) {
    ?>
    <div class="block-title"><?php 
    echo decode_entities($title);
    ?>
</div>
  <?php 
}
?>
  <ul class="clearfix">
    <?php 
foreach ($nodes as $node) {
    ?>
      <li>
        <?php 
    if (!empty($node->image)) {
        ?>
          <div class="image hidden-sm hidden-xs"><?php 
        echo ibtimes_article_node_link($node, $node->image, array('html' => TRUE));
        ?>
</div>
        <?php 
    }
    ?>
        <div class="category"><?php 
    echo l($node->section->name, 'taxonomy/term/' . $node->section->tid);
Example #16
0
 /**
  * Sanitizes the HTML select element's options.
  *
  * The function is recursive to support optgroups.
  */
 protected function prepareFilterSelectOptions(&$options)
 {
     foreach ($options as $value => $label) {
         // Recurse for optgroups.
         if (is_array($label)) {
             $this->prepareFilterSelectOptions($options[$value]);
         } elseif (is_object($label) && isset($label->option)) {
             $this->prepareFilterSelectOptions($options[$value]->option);
         } else {
             // Cast the label to a string since it can be an object.
             // @see \Drupal\Core\StringTranslation\TranslationWrapper
             $options[$value] = strip_tags(decode_entities((string) $label));
         }
     }
 }
 /**
  * Decode html entities
  *
  * @param mixed $field
  *   A string or an array of strings
  *
  * @return mixed
  *   Decoded text
  */
 public static function decodeEntities($field)
 {
     if (is_array($field)) {
         foreach ($field as &$f) {
             $f = self::decodeEntities($f);
         }
         return $field;
     }
     return decode_entities($field);
 }
Example #18
0
function doHtmlEntityPHPCleanUp($string, $charset)
{
    $string = html_entities($string);
    return decode_entities($string);
}
Example #19
0
        //	$myurl = check_url($myurl);
        //	$myurl = ERegI('^[a-z0-9_]+://', $myurl) ? $myurl : 'http://'.$myurl;
        //print '<a href="' . $myurl . '">Official website for ' . $title . '</a>';
        print $node->field_canoe_club_website[0]['view'];
    } else {
        print "No website available.";
    }
    ?>
  </li>
  <li>
  <?php 
    $mapcoords = $node->field_map_coordinates[0]['value'];
    if ($mapcoords) {
        $coords = explode(" ", check_plain($mapcoords));
        $coords = $coords[0] . "+" . $coords[1];
        print l("Map " . decode_entities($title), 'http://maps.google.com/maps?q=' . $coords . '&ie=UTF8&z=15');
    } else {
        print 'Map location not available.  ' . l('Add map coordinates.', 'node/' . $node->nid . '/edit');
    }
    ?>
  </li>
  </ul>
  <br />
    <p><em><?php 
    print $submitted;
    ?>
 </em></p>
  </div>


  <div class="links">See something wrong? <?php 
Example #20
0
            $sql .= 'glossary_created, glossary_changed, glossary_title, glossary_tag, ';
            $sql .= 'glossary_keyword, glossary_text, glossary_highlight, glossary_object, glossary_status';
            $sql .= ') VALUES (';
            $sql .= "'" . aporeplace($glossary['data']['glossary_created']) . "', ";
            $sql .= "'" . aporeplace($glossary['data']['glossary_changed']) . "', ";
            $sql .= "'" . aporeplace($glossary['data']['glossary_title']) . "', ";
            $sql .= "'" . aporeplace($glossary['data']['glossary_tag']) . "', ";
            $sql .= "'" . aporeplace($glossary['data']['glossary_keyword']) . "', ";
            $sql .= "'" . aporeplace($glossary['data']['glossary_text']) . "', ";
            $sql .= aporeplace($glossary['data']['glossary_highlight']) . ', ';
            $sql .= "'" . aporeplace(serialize($glossary['data']['glossary_object'])) . "', ";
            $sql .= aporeplace($glossary['data']['glossary_status']);
            $sql .= ')';
            if ($result = @_dbQuery($sql, 'INSERT')) {
                if (isset($_POST['save'])) {
                    headerRedirect(decode_entities(GLOSSARY_HREF));
                }
                if (!empty($result['INSERT_ID'])) {
                    $glossary['id'] = $result['INSERT_ID'];
                }
            } else {
                $glossary['error']['update'] = mysql_error();
            }
        }
    }
}
// try to read entry from database
if ($glossary['id'] && !isset($glossary['error'])) {
    $sql = 'SELECT * FROM ' . DB_PREPEND . 'phpwcms_glossary WHERE glossary_id=' . $glossary['id'];
    $glossary['data'] = _dbQuery($sql);
    $glossary['data'] = $glossary['data'][0];
Example #21
0
 /**
  * Build all the arguments.
  */
 protected function _buildArguments()
 {
     // Initially, we want to build sorts and fields. This can change, though,
     // if we get a summary view.
     if (empty($this->argument)) {
         return TRUE;
     }
     // build arguments.
     $position = -1;
     $substitutions = array();
     $status = TRUE;
     // Get the title.
     $title = $this->display_handler->getOption('title');
     // Iterate through each argument and process.
     foreach ($this->argument as $id => $arg) {
         $position++;
         $argument = $this->argument[$id];
         if ($argument->broken()) {
             continue;
         }
         $argument->setRelationship();
         $arg = isset($this->args[$position]) ? $this->args[$position] : NULL;
         $argument->position = $position;
         if (isset($arg) || $argument->hasDefaultArgument()) {
             if (!isset($arg)) {
                 $arg = $argument->getDefaultArgument();
                 // make sure default args get put back.
                 if (isset($arg)) {
                     $this->args[$position] = $arg;
                 }
                 // remember that this argument was computed, not passed on the URL.
                 $argument->is_default = TRUE;
             }
             // Set the argument, which will also validate that the argument can be set.
             if (!$argument->setArgument($arg)) {
                 $status = $argument->validateFail($arg);
                 break;
             }
             if ($argument->isException()) {
                 $arg_title = $argument->exceptionTitle();
             } else {
                 $arg_title = $argument->getTitle();
                 $argument->query($this->display_handler->useGroupBy());
             }
             // Add this argument's substitution
             $substitutions['%' . ($position + 1)] = $arg_title;
             $substitutions['!' . ($position + 1)] = strip_tags(decode_entities($arg));
             // Test to see if we should use this argument's title
             if (!empty($argument->options['title_enable']) && !empty($argument->options['title'])) {
                 $title = $argument->options['title'];
             }
         } else {
             // determine default condition and handle.
             $status = $argument->defaultAction();
             break;
         }
         // Be safe with references and loops:
         unset($argument);
     }
     // set the title in the build info.
     if (!empty($title)) {
         $this->build_info['title'] = $title;
     }
     // Store the arguments for later use.
     $this->build_info['substitutions'] = $substitutions;
     return $status;
 }
Example #22
0
if (isset($phpwcms['modules'][$module]['path'])) {
    // module default stuff
    // load special backend CSS
    $BE['HEADER']['module_calendar.css'] = '	<link href="' . $phpwcms['modules'][$module]['dir'] . 'template/backend.calendar.css" rel="stylesheet" type="text/css" />';
    // put translation back to have easier access to it - use it as relation
    $BLM =& $BL['modules'][$module];
    define('MODULE_HREF', 'phpwcms.php?do=modules&amp;module=' . $module);
    $glossary = array();
    if (isset($_GET['edit'])) {
        // handle posts and read data
        include_once $phpwcms['modules'][$module]['path'] . 'inc/processing.inc.php';
        // edit form
        include_once $phpwcms['modules'][$module]['path'] . 'backend.editform.php';
    } elseif (isset($_GET['verify'])) {
        // active/inactive
        $sql = 'UPDATE ' . DB_PREPEND . 'phpwcms_calendar SET ';
        $sql .= "calendar_status=" . (intval($_GET['verify']) ? 1 : 0) . " ";
        $sql .= "WHERE calendar_id=" . intval($_GET['editid']);
        @_dbQuery($sql, 'UPDATE');
        headerRedirect(decode_entities(MODULE_HREF));
    } elseif (isset($_GET['delete'])) {
        // delete
        $sql = 'UPDATE ' . DB_PREPEND . 'phpwcms_calendar SET ';
        $sql .= "calendar_status=9 WHERE calendar_id=" . intval($_GET['delete']);
        @_dbQuery($sql, 'UPDATE');
        headerRedirect(decode_entities(MODULE_HREF));
    } else {
        // listing
        include_once $phpwcms['modules'][$module]['path'] . 'backend.listing.php';
    }
}
Example #23
0
                         $POST_ERR[$key] = $cnt_form["fields"][$key]['error'];
                     }
                     break;
                 case 'REGEX':
                     if ($cnt_form["fields"][$key]['value'] !== '' && !preg_match($cnt_form['special_attribute']['pattern'], $cnt_form["fields"][$key]['value'])) {
                         $POST_ERR[$key] = $cnt_form["fields"][$key]['error'];
                     }
                     break;
                 case 'DEC':
                 case 'FLOAT':
                     if ($cnt_form["fields"][$key]['value'] !== '' && !is_float_ex($cnt_form["fields"][$key]['value'])) {
                         $POST_ERR[$key] = $cnt_form["fields"][$key]['error'];
                     }
                     break;
                 case 'IDENT':
                     if (isset($cnt_form['special_attribute']['default']) && decode_entities($cnt_form['special_attribute']['default']) != decode_entities($cnt_form["fields"][$key]['value'])) {
                         $POST_ERR[$key] = $cnt_form["fields"][$key]['error'];
                     }
                     break;
                 case 'DATE':
                     if ($cnt_form["fields"][$key]['value'] !== '' && isset($cnt_form['special_attribute']['dateformat']) && !is_date($cnt_form["fields"][$key]['value'], $cnt_form['special_attribute']['dateformat'])) {
                         $POST_ERR[$key] = $cnt_form["fields"][$key]['error'];
                     }
                     break;
             }
         }
     }
 } else {
     if (isset($cnt_form['special_attribute']['default']) && isset($cnt_form['special_attribute']['type']) && $cnt_form['special_attribute']['type'] == 'DATE' && $cnt_form['special_attribute']['default'] == 'NOW') {
         echo 'ja';
         if (isset($cnt_form['special_attribute']['dateformat'])) {
 /**
  * Save segment target translations for the given language
  *
  * @param obj
  *    the SimpleXMLElement object containing the translations to be saved
  * @param string
  *    the language code under which to save the translations
  */
 public static function saveSegmentTranslations($document_xml, $target_language)
 {
     $non_lingotek_locales_targets = self::getNonLingotekLocalesTargets($document_xml, $target_language);
     $plural_mapping = variable_get('lingotek_config_plural_mapping', array());
     $rows = array();
     $sql = 'INSERT INTO {locales_target} (lid, translation, language, plid, plural, translation_agent_id) VALUES ';
     $subsql = '';
     $icount = 0;
     $lingotek_agent = self::getLingotekTranslationAgentId();
     foreach ($document_xml as $drupal_field_name => $xml_obj) {
         $lid = self::getLidFromTag($drupal_field_name);
         if (!in_array($lid, $non_lingotek_locales_targets)) {
             $content = (string) $xml_obj->element;
             $content = lingotek_unfilter_placeholders(decode_entities($content));
             $plural_lid = array_key_exists($lid, $plural_mapping);
             $rows += array(":l_{$icount}" => $lid, ":c_{$icount}" => $content, ":lang_{$icount}" => $target_language, ":plid_{$icount}" => $plural_lid ? $plural_mapping[$lid]['plid'] : 0, ":plural_{$icount}" => $plural_lid ? $plural_mapping[$lid]['plural'] : 0, ":agent_{$icount}" => $lingotek_agent);
             $subsql .= "( :l_{$icount}, :c_{$icount}, :lang_{$icount}, :plid_{$icount}, :plural_{$icount}, :agent_{$icount}),";
             $icount++;
         }
     }
     if (!empty($rows)) {
         $subsql = rtrim($subsql, ',');
         db_query($sql . $subsql, $rows);
     }
 }
 /**
  * Tests the failed search text, and various other text on the search page.
  */
 function testSearchText()
 {
     $this->drupalLogin($this->searching_user);
     $this->drupalGet('search/node');
     $this->assertText(t('Enter your keywords'));
     $this->assertText(t('Search'));
     $this->assertTitle(t('Search') . ' | Drupal', 'Search page title is correct');
     $edit = array();
     $search_terms = 'bike shed ' . $this->randomMachineName();
     $edit['keys'] = $search_terms;
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $this->assertText(t('Consider loosening your query with OR. bike OR shed will often show more results than bike shed.'), 'Help text is displayed when search returns no results.');
     $this->assertText(t('Search'));
     $title_source = 'Search for @keywords | Drupal';
     $this->assertTitle(t($title_source, array('@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE))), 'Search page title is correct');
     $this->assertNoText('Node', 'Erroneous tab and breadcrumb text is not present');
     $this->assertNoText(t('Node'), 'Erroneous translated tab and breadcrumb text is not present');
     $this->assertText(t('Content'), 'Tab and breadcrumb text is present');
     // Search for a longer text, and see that it is in the title, truncated.
     $edit = array();
     $search_terms = 'Every word is like an unnecessary stain on silence and nothingness.';
     $edit['keys'] = $search_terms;
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $this->assertTitle(t($title_source, array('@keywords' => 'Every word is like an unnecessary stain on silence and…')), 'Search page title is correct');
     // Search for a string with a lot of special characters.
     $search_terms = 'Hear nothing > "see nothing" `feel' . " '1982.";
     $edit['keys'] = $search_terms;
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $actual_title = (string) current($this->xpath('//title'));
     $this->assertEqual($actual_title, decode_entities(t($title_source, array('@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)))), 'Search page title is correct');
     $edit['keys'] = $this->searching_user->getUsername();
     $this->drupalPostForm('search/user', $edit, t('Search'));
     $this->assertText(t('Search'));
     $this->assertTitle(t($title_source, array('@keywords' => Unicode::truncate($this->searching_user->getUsername(), 60, TRUE, TRUE))));
     // Test that search keywords containing slashes are correctly loaded
     // from the GET params and displayed in the search form.
     $arg = $this->randomMachineName() . '/' . $this->randomMachineName();
     $this->drupalGet('search/node', array('query' => array('keys' => $arg)));
     $input = $this->xpath("//input[@id='edit-keys' and @value='{$arg}']");
     $this->assertFalse(empty($input), 'Search keys with a / are correctly set as the default value in the search box.');
     // Test a search input exceeding the limit of AND/OR combinations to test
     // the Denial-of-Service protection.
     $limit = \Drupal::config('search.settings')->get('and_or_limit');
     $keys = array();
     for ($i = 0; $i < $limit + 1; $i++) {
         // Use a key of 4 characters to ensure we never generate 'AND' or 'OR'.
         $keys[] = $this->randomMachineName(4);
         if ($i % 2 == 0) {
             $keys[] = 'OR';
         }
     }
     $edit['keys'] = implode(' ', $keys);
     $this->drupalPostForm('search/node', $edit, t('Search'));
     $this->assertRaw(t('Your search used too many AND/OR expressions. Only the first @count terms were included in this search.', array('@count' => $limit)));
     // Test that a search on Node or User with no keywords entered generates
     // the "Please enter some keywords" message.
     $this->drupalPostForm('search/node', array(), t('Search'));
     $this->assertText(t('Please enter some keywords'), 'With no keywords entered, message is displayed on node page');
     $this->drupalPostForm('search/user', array(), t('Search'));
     $this->assertText(t('Please enter some keywords'), 'With no keywords entered, message is displayed on user page');
     // Make sure the "Please enter some keywords" message is NOT displayed if
     // you use "or" words or phrases in Advanced Search.
     $this->drupalPostForm('search/node', array('or' => $this->randomMachineName() . ' ' . $this->randomMachineName()), t('Advanced search'));
     $this->assertNoText(t('Please enter some keywords'), 'With advanced OR keywords entered, no keywords message is not displayed on node page');
     $this->drupalPostForm('search/node', array('phrase' => '"' . $this->randomMachineName() . '" "' . $this->randomMachineName() . '"'), t('Advanced search'));
     $this->assertNoText(t('Please enter some keywords'), 'With advanced phrase entered, no keywords message is not displayed on node page');
     // Verify that if you search for a too-short keyword, you get the right
     // message, and that if after that you search for a longer keyword, you
     // do not still see the message.
     $this->drupalPostForm('search/node', array('keys' => $this->randomMachineName(1)), t('Search'));
     $this->assertText('You must include at least one positive keyword', 'Keyword message is displayed when searching for short word');
     $this->assertNoText(t('Please enter some keywords'), 'With short word entered, no keywords message is not displayed');
     $this->drupalPostForm(NULL, array('keys' => $this->randomMachineName()), t('Search'));
     $this->assertNoText('You must include at least one positive keyword', 'Keyword message is not displayed when searching for long word after short word search');
     // Test that if you search for a URL with .. in it, you still end up at
     // the search page. See issue https://drupal.org/node/890058.
     $this->drupalPostForm('search/node', array('keys' => '../../admin'), t('Search'));
     $this->assertResponse(200, 'Searching for ../../admin with non-admin user does not lead to a 403 error');
     $this->assertText('no results', 'Searching for ../../admin with non-admin user gives you a no search results page');
     // Test that if you search for a URL starting with "./", you still end up
     // at the search page. See issue https://drupal.org/node/1421560.
     $this->drupalPostForm('search/node', array('keys' => '.something'), t('Search'));
     $this->assertResponse(200, 'Searching for .something does not lead to a 403 error');
     $this->assertText('no results', 'Searching for .something gives you a no search results page');
 }
		<td>&nbsp;</td>
		<td>
		<?php 
if (empty($plugin['data']['adcampaign_id'])) {
    echo '<input name="submit" type="submit" class="button" value="' . $BL['be_admin_fcat_button2'] . '" />' . LF;
} else {
    echo '<input name="submit" type="submit" class="button" value="' . $BL['be_article_cnt_button1'] . '" />' . LF;
    echo '<input name="save" type="submit" class="button" value="' . $BL['be_article_cnt_button3'] . '" />' . LF;
}
?>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<input name="new" type="button" class="button" value="<?php 
echo ucfirst($BL['be_msg_new']);
?>
" onclick="location.href='<?php 
echo decode_entities(MODULE_HREF);
?>
&campaign=1&edit=0';return false;" />
			<input name="close" type="button" class="button" value="<?php 
echo $BL['be_admin_struct_close'];
?>
" onclick="location.href='<?php 
echo decode_entities(MODULE_HREF);
?>
&listcampaign=1';return false;" />
		</td>
	</tr>

</table>

</form>
 /**
  * Check for meta refresh tag and if found call backdropGet() recursively. This
  * function looks for the http-equiv attribute to be set to "Refresh"
  * and is case-sensitive.
  *
  * @return
  *   Either the new page content or FALSE.
  */
 protected function checkForMetaRefresh()
 {
     if (strpos($this->backdropGetContent(), '<meta ') && $this->parse()) {
         $refresh = $this->xpath('//meta[@http-equiv="Refresh"]');
         if (!empty($refresh)) {
             // Parse the content attribute of the meta tag for the format:
             // "[delay]: URL=[page_to_redirect_to]".
             if (preg_match('/\\d+;\\s*URL=(?P<url>.*)/i', $refresh[0]['content'], $match)) {
                 return $this->backdropGet($this->getAbsoluteUrl(decode_entities($match['url'])));
             }
         }
     }
     return FALSE;
 }
Example #28
0
 /**
  * Recursive function to add replacements for nested query string parameters.
  *
  * E.g. if you pass in the following array:
  *   array(
  *     'foo' => array(
  *       'a' => 'value',
  *       'b' => 'value',
  *     ),
  *     'bar' => array(
  *       'a' => 'value',
  *       'b' => array(
  *         'c' => value,
  *       ),
  *     ),
  *   );
  *
  * Would yield the following array of tokens:
  *   array(
  *     '%foo_a' => 'value'
  *     '%foo_b' => 'value'
  *     '%bar_a' => 'value'
  *     '%bar_b_c' => 'value'
  *   );
  *
  * @param $array
  *   An array of values.
  *
  * @param $parent_keys
  *   An array of parent keys. This will represent the array depth.
  *
  * @return
  *   An array of available tokens, with nested keys representative of the array structure.
  */
 protected function getTokenValuesRecursive(array $array, array $parent_keys = array())
 {
     $tokens = array();
     foreach ($array as $param => $val) {
         if (is_array($val)) {
             // Copy parent_keys array, so we don't affect other elements of this
             // iteration.
             $child_parent_keys = $parent_keys;
             $child_parent_keys[] = $param;
             // Get the child tokens.
             $child_tokens = $this->getTokenValuesRecursive($val, $child_parent_keys);
             // Add them to the current tokens array.
             $tokens += $child_tokens;
         } else {
             // Create a token key based on array element structure.
             $token_string = !empty($parent_keys) ? implode('_', $parent_keys) . '_' . $param : $param;
             $tokens['%' . $token_string] = strip_tags(decode_entities($val));
         }
     }
     return $tokens;
 }
            $sql .= "\t'" . aporeplace($plugin['data']['adcampaign_title']) . "', ";
            $sql .= "\t'" . aporeplace($plugin['data']['adcampaign_comment']) . "', ";
            $sql .= "\t'" . aporeplace($plugin['data']['adcampaign_datestart']) . "', ";
            $sql .= "\t'" . aporeplace($plugin['data']['adcampaign_dateend']) . "', ";
            $sql .= $plugin['data']['adcampaign_maxview'] . ", ";
            $sql .= $plugin['data']['adcampaign_maxclick'] . ", ";
            $sql .= $plugin['data']['adcampaign_maxviewuser'] . ", ";
            $sql .= $plugin['data']['adcampaign_type'] . ", ";
            $sql .= $plugin['data']['adcampaign_place'] . ", ";
            $sql .= "\t'" . aporeplace(serialize($plugin['data']['adcampaign_data'])) . "'";
            $sql .= ')';
            if ($plugin_new_id = @_dbQuery($sql, 'INSERT')) {
                if (isset($_POST['save'])) {
                    headerRedirect(decode_entities(MODULE_HREF) . '&listcampaign=1');
                } elseif (!empty($plugin_new_id['INSERT_ID'])) {
                    headerRedirect(decode_entities(MODULE_HREF) . '&campaign=1&edit=' . $plugin_new_id['INSERT_ID']);
                }
            } else {
                $plugin['error']['update'] = mysql_error();
            }
        }
    }
}
// try to read entry from database
if ($plugin['id'] && !isset($plugin['error'])) {
    $sql = 'SELECT *,';
    $sql .= "DATE_FORMAT(adcampaign_datestart, '%d" . $BLM['date_delimiter'] . "%m" . $BLM['date_delimiter'] . "%Y') AS adcampaign_date_start, ";
    $sql .= "DATE_FORMAT(adcampaign_dateend,   '%d" . $BLM['date_delimiter'] . "%m" . $BLM['date_delimiter'] . "%Y') AS adcampaign_date_end, ";
    $sql .= "DATE_FORMAT(adcampaign_datestart, '%H:%i') AS adcampaign_time_start, ";
    $sql .= "DATE_FORMAT(adcampaign_dateend,   '%H:%i') AS adcampaign_time_end ";
    $sql .= 'FROM ' . DB_PREPEND . 'phpwcms_ads_campaign WHERE adcampaign_id=' . $plugin['id'];
Example #30
-1
/**
 * Processes an HTML attribute value and ensures it does not contain an URL
 * with a disallowed protocol (e.g. javascript:)
 *
 * @param $string
 *   The string with the attribute value.
 * @param $decode
 *   Whether to decode entities in the $string. Set to FALSE if the $string
 *   is in plain text, TRUE otherwise. Defaults to TRUE.
 * @return
 *   Cleaned up and HTML-escaped version of $string.
 */
function filter_xss_bad_protocol($string, $decode = TRUE)
{
    static $allowed_protocols;
    if (!isset($allowed_protocols)) {
        $allowed_protocols = array_flip(dPgetConfig('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'tel', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'rtsp')));
    }
    // Get the plain text representation of the attribute value (i.e. its meaning).
    if ($decode) {
        $string = decode_entities($string);
    }
    // Iteratively remove any invalid protocol found.
    do {
        $before = $string;
        $colonpos = strpos($string, ':');
        if ($colonpos > 0) {
            // We found a colon, possibly a protocol. Verify.
            $protocol = substr($string, 0, $colonpos);
            // If a colon is preceded by a slash, question mark or hash, it cannot
            // possibly be part of the URL scheme. This must be a relative URL,
            // which inherits the (safe) protocol of the base document.
            if (preg_match('![/?#]!', $protocol)) {
                break;
            }
            // Per RFC2616, section 3.2.3 (URI Comparison) scheme comparison must be case-insensitive
            // Check if this is a disallowed protocol.
            if (!isset($allowed_protocols[strtolower($protocol)])) {
                $string = substr($string, $colonpos + 1);
            }
        }
    } while ($before != $string);
    return check_plain($string);
}