function add_email_to_db()
{
    global $wpdb, $current_user;
    if ($_REQUEST['action'] == 'add') {
        $email_name = $_REQUEST['email_name'];
        $email_subject = $_REQUEST['email_subject'];
        $email_text = $_REQUEST['email_text'];
        if (!function_exists('espresso_member_data')) {
            $current_user->ID = 1;
        }
        $sql = array('email_name' => $email_name, 'email_text' => $email_text, 'email_subject' => $email_subject, 'wp_user' => $current_user->ID);
        $sql_data = array('%s', '%s', '%s', '%s');
        if ($wpdb->insert(EVENTS_EMAIL_TABLE, $sql, $sql_data)) {
            ?>
		<div id="message" class="updated fade"><p><strong>The email <?php 
            echo htmlentities2($_REQUEST['email_name']);
            ?>
 has been added.</strong></p></div>
	<?php 
        } else {
            ?>
		<div id="message" class="error"><p><strong>The email <?php 
            echo htmlentities2($_REQUEST['email_name']);
            ?>
 was not saved. <?php 
            print mysql_error();
            ?>
.</strong></p></div>

<?php 
        }
    }
}
function event_espresso_form_builder_insert()
{
    global $wpdb, $current_user;
    //$wpdb->show_errors();
    $event_id = empty($_REQUEST['event_id']) ? 0 : $_REQUEST['event_id'];
    $event_name = empty($_REQUEST['event_name']) ? '' : $_REQUEST['event_name'];
    $question = $_POST['question'];
    $question_type = $_POST['question_type'];
    $question_values = empty($_POST['values']) ? NULL : $_POST['values'];
    $required = !empty($_POST['required']) ? $_POST['required'] : 'N';
    $admin_only = !empty($_POST['admin_only']) ? $_POST['admin_only'] : 'N';
    $sequence = $_POST['sequence'] ? $_POST['sequence'] : '0';
    if (!function_exists('espresso_member_data')) {
        $current_user->ID = 1;
    }
    if ($wpdb->query("INSERT INTO " . EVENTS_QUESTION_TABLE . " (question_type, question, response, required, admin_only, sequence,wp_user)" . " VALUES ('" . $question_type . "', '" . $question . "', '" . $question_values . "', '" . $required . "', '" . $admin_only . "', " . $sequence . ",'" . $current_user->ID . "')")) {
        ?>
		<div id="message" class="updated fade"><p><strong>The question <?php 
        echo htmlentities2($_REQUEST['question']);
        ?>
 has been added.</strong></p></div>
	<?php 
    } else {
        ?>
		<div id="message" class="error"><p><strong>The question <?php 
        echo htmlentities2($_REQUEST['question']);
        ?>
 was not saved. <?php 
        //$wpdb->print_error();
        ?>
.</strong></p></div>

<?php 
    }
}
Beispiel #3
0
/**
 * Smarty escape modifier plugin
 *
 * Type:     modifier<br>
 * Name:     escape<br>
 * Purpose:  Escape the string according to escapement type
 * @link http://smarty.php.net/manual/en/language.modifier.escape.php
 *          escape (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param html|htmlall|url|quotes|hex|hexentity|javascript
 * @return string
 */
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-8859-1')
{
    switch ($esc_type) {
        case 'html':
            return htmlspecialchars2($string, ENT_QUOTES, $char_set);
        case 'htmlall':
            return htmlentities2($string, ENT_QUOTES, $char_set);
        case 'url':
            return rawurlencode($string);
        case 'urlpathinfo':
            return str_replace('%2F', '/', rawurlencode($string));
        case 'quotes':
            // escape unescaped single quotes
            return preg_replace("%(?<!\\\\)'%", "\\'", $string);
        case 'hex':
            // escape every character into hex
            $return = '';
            for ($x = 0; $x < strlen($string); $x++) {
                $return .= '%' . bin2hex($string[$x]);
            }
            return $return;
        case 'hexentity':
            $return = '';
            for ($x = 0; $x < strlen($string); $x++) {
                $return .= '&#x' . bin2hex($string[$x]) . ';';
            }
            return $return;
        case 'decentity':
            $return = '';
            for ($x = 0; $x < strlen($string); $x++) {
                $return .= '&#' . ord($string[$x]) . ';';
            }
            return $return;
        case 'javascript':
            // escape quotes and backslashes, newlines, etc.
            return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\\/'));
        case 'mail':
            // safe way to display e-mail address on a web page
            return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
        case 'nonstd':
            // escape non-standard chars, such as ms document quotes
            $_res = '';
            for ($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
                $_ord = ord(substr($string, $_i, 1));
                // non-standard char, escape it
                if ($_ord >= 126) {
                    $_res .= '&#' . $_ord . ';';
                } else {
                    $_res .= substr($string, $_i, 1);
                }
            }
            return $_res;
        default:
            return $string;
    }
}
 /**
  * Escape string conter XSS attack
  *
  * @since 1.0
  * @param String $value
  * @param String $type
  * @return String
  */
 private static function esc_xss($value, $type)
 {
     switch ($type) {
         case 'html':
             $value = self::rip_tags($value);
             break;
         case 'code':
             $value = htmlentities2($value);
             break;
     }
     return $value;
 }
Beispiel #5
0
/**
 *  author display_name
 *  
 */
function wpi_get_author_name($type = 'hcard')
{
    global $authordata;
    $name = $display_name = apply_filters('the_author', $authordata->display_name);
    $name = $display_name = ent2ncr(htmlentities2($name));
    $author_url = $authordata->user_url;
    $author_url = $author_url != 'http://' ? $author_url : WPI_URL;
    switch ($type) {
        case 'link':
            /** simple links
             *	
             */
            $attribs = array('href' => $author_url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . '&apos;s Website', 'rev' => 'author:' . $authordata->user_nicename);
            $output = _t('a', $display_name, $attribs);
            break;
        case 'hcard':
            /** convert to microformats
             *	address:a:span
             */
            // split the name
            $name = explode('name', $name);
            if (is_array($name)) {
                if (Wpi::hasCount($name)) {
                    if (isset($name[0])) {
                        $output = _t('span', $name[0], array('class' => 'nickname'));
                    }
                    if (isset($name[1])) {
                        $output = _t('span', $name[0], array('class' => 'given-name')) . ' ';
                        $output .= _t('span', $name[1], array('class' => 'family-name'));
                    }
                }
            } else {
                $output = _t('span', $author_name, array('class' => 'nickname'));
            }
            // author post url;
            $url = get_author_posts_url($authordata->ID, $authordata->user_nicename);
            $url = apply_filters(wpiFilter::FILTER_LINKS, $url);
            $attribs = array('href' => $url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . '&apos;s Author page', 'rev' => 'author:' . $authordata->user_nicename);
            $output = _t('a', $output, $attribs);
            // microID sha-1 hash
            $hash = get_microid_hash($authordata->user_email, $author_url);
            // wrap hcard
            $output = _t('cite', $output, array('class' => 'vcard microid-' . $hash));
            break;
        default:
            $output = $name;
            break;
    }
    return apply_filters(wpiFilter::FILTER_AUTHOR_NAME . $type, $output);
}
Beispiel #6
0
function affwp_search_users()
{
    if (empty($_POST['search'])) {
        die('-1');
    }
    if (!current_user_can('manage_affiliates')) {
        die('-1');
    }
    $search_query = htmlentities2(trim($_POST['search']));
    do_action('affwp_pre_search_users', $search_query);
    $args = array();
    if (isset($_POST['status'])) {
        $status = mb_strtolower(htmlentities2(trim($_POST['status'])));
        switch ($status) {
            case 'none':
                $affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
                $args = array('exclude' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
                break;
            case 'any':
                $affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
                $args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
                break;
            default:
                $affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999, 'status' => $status));
                $args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
        }
    }
    //make sure we filter the search columns so they only include the columns we want to search
    //this filter was exposed by WordPress in WP 3.6.0
    add_filter('user_search_columns', function ($search_columns, $search, WP_User_Query $WP_User_Query) {
        return array('user_login', 'display_name', 'user_email');
    }, 10, 3);
    //add search string to args
    $args['search'] = mb_strtolower(htmlentities2(trim($_POST['search'])));
    //get users matching search
    $found_users = get_users($args);
    if ($found_users) {
        $user_list = '<ul>';
        foreach ($found_users as $user) {
            $user_list .= '<li><a href="#" data-id="' . esc_attr($user->ID) . '" data-login="******">' . esc_html($user->user_login) . '</a></li>';
        }
        $user_list .= '</ul>';
        echo json_encode(array('results' => $user_list, 'id' => 'found'));
    } else {
        echo json_encode(array('results' => '<p>' . __('No users found', 'affiliate-wp') . '</p>', 'id' => 'fail'));
    }
    die;
}
function affwp_search_users()
{
    if (empty($_POST['search'])) {
        die('-1');
    }
    if (!current_user_can('manage_affiliates')) {
        die('-1');
    }
    $search_query = htmlentities2(trim($_POST['search']));
    do_action('affwp_pre_search_users', $search_query);
    $args = array();
    if (isset($_POST['status'])) {
        $status = mb_strtolower(htmlentities2(trim($_POST['status'])));
        switch ($status) {
            case 'none':
                $affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
                $args = array('exclude' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
                break;
            case 'any':
                $affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
                $args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
                break;
            default:
                $affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999, 'status' => $status));
                $args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
        }
    }
    $found_users = array_filter(get_users($args), function ($user) {
        $q = mb_strtolower(htmlentities2(trim($_POST['search'])));
        $user_login = mb_strtolower($user->user_login);
        $display_name = mb_strtolower($user->display_name);
        $user_email = mb_strtolower($user->user_email);
        // Detect query term matches from these user fields (in order of priority)
        return false !== mb_strpos($user_login, $q) || false !== mb_strpos($display_name, $q) || false !== mb_strpos($user_email, $q);
    });
    if ($found_users) {
        $user_list = '<ul>';
        foreach ($found_users as $user) {
            $user_list .= '<li><a href="#" data-id="' . esc_attr($user->ID) . '" data-login="******">' . esc_html($user->user_login) . '</a></li>';
        }
        $user_list .= '</ul>';
        echo json_encode(array('results' => $user_list, 'id' => 'found'));
    } else {
        echo json_encode(array('results' => '<p>' . __('No users found', 'affiliate-wp') . '</p>', 'id' => 'fail'));
    }
    die;
}
function add_to_calendar()
{
    global $wpdb, $current_user, $org_options;
    $event_id = $_REQUEST['id'];
    $results = $wpdb->get_results("SELECT * FROM " . get_option('events_detail_tbl') . " WHERE id =" . $event_id);
    foreach ($results as $result) {
        $event_id = $result->id;
        $event_name = $result->event_name;
        $event_desc = $result->event_desc;
        $start_date = $result->start_date;
        $end_date = $result->end_date;
        $start_time = $result->start_time;
        $end_time = $result->end_time;
        $calendar_category = $_REQUEST['calendar_category'];
        $linky = home_url() . '/?page_id=' . $org_options['event_page_id'] . '&regevent_action=register&event_id=' . $event_id . '&name_of_event=' . $event_name;
        $sql = "INSERT INTO " . WP_CALENDAR_TABLE . " SET event_title='" . mysql_escape_string($event_name) . "', event_desc='" . mysql_escape_string($event_desc) . "', event_begin='" . mysql_escape_string($start_date) . "', event_recur='S', event_repeats='0', event_end='" . mysql_escape_string($end_date) . "', event_time='" . mysql_escape_string($start_time) . "', event_author=" . $current_user->ID . ", event_category=" . mysql_escape_string($calendar_category) . ", event_link='" . mysql_escape_string($linky) . "'";
    }
    if ($wpdb->query($sql)) {
        ?>
		<div id="message" class="updated fade"><p><strong><?php 
        _e('The event', 'event_espresso');
        ?>
 <a href="<?php 
        echo $_SERVER["REQUEST_URI"];
        ?>
#event-id-<?php 
        echo $wpdb->insert_id;
        ?>
"><?php 
        echo htmlentities2($event_name);
        ?>
</a> <?php 
        _e('has been added.', 'event_espresso');
        ?>
</strong></p></div>
<?php 
    } else {
        ?>
		<div id="message" class="error"><p><strong><?php 
        _e('There was an error in your submission, please try again. The event was not saved!', 'event_espresso');
        print mysql_error();
        ?>
.</strong></p></div>
<?php 
    }
}
function update_event_email()
{
    global $wpdb;
    $email_id = $_REQUEST['email_id'];
    $email_name = $_REQUEST['email_name'];
    $email_subject = $_REQUEST['email_subject'];
    $email_text = $_REQUEST['email_text'];
    $sql = array('email_name' => $email_name, 'email_text' => $email_text, 'email_subject' => $email_subject);
    $update_id = array('id' => $email_id);
    $sql_data = array('%s', '%s', '%s');
    if ($wpdb->update(EVENTS_EMAIL_TABLE, $sql, $update_id, $sql_data, array('%d'))) {
        ?>
	<div id="message" class="updated fade"><p><strong><?php 
        _e('The email', 'event_espresso');
        ?>
 <?php 
        echo stripslashes(htmlentities2($_REQUEST['email_name']));
        ?>
 <?php 
        _e('has been updated', 'event_espresso');
        ?>
.</strong></p></div>
<?php 
    } else {
        ?>
	<div id="message" class="error"><p><strong><?php 
        _e('The email', 'event_espresso');
        ?>
 <?php 
        echo stripslashes(htmlentities2($_REQUEST['email_name']));
        ?>
 <?php 
        _e('was not updated', 'event_espresso');
        ?>
. <?php 
        print mysql_error();
        ?>
.</strong></p></div>

<?php 
    }
}
Beispiel #10
0
function affwp_search_users()
{
    if (empty($_POST['user_name'])) {
        die('-1');
    }
    if (!current_user_can('manage_affiliates')) {
        die('-1');
    }
    $search_query = htmlentities2(trim($_POST['user_name']));
    do_action('affwp_pre_search_users', $search_query);
    $found_users = get_users(array('number' => 9999, 'search' => $search_query . '*'));
    if ($found_users) {
        $user_list = '<ul>';
        foreach ($found_users as $user) {
            $user_list .= '<li><a href="#" data-id="' . esc_attr($user->ID) . '" data-login="******">' . esc_html($user->user_login) . '</a></li>';
        }
        $user_list .= '</ul>';
        echo json_encode(array('results' => $user_list, 'id' => 'found'));
    } else {
        echo json_encode(array('results' => '<p>' . __('No users found', 'affiliate-wp') . '</p>', 'id' => 'fail'));
    }
    die;
}
    protected function ga_options_do_network_errors()
    {
        if (isset($_REQUEST['updated']) && $_REQUEST['updated']) {
            ?>
				<div id="setting-error-settings_updated" class="updated settings-error">
				<p>
				<strong><?php 
            _e('Settings saved.', 'google-apps-login');
            ?>
</strong>
				</p>
				</div>
			<?php 
        }
        if (isset($_REQUEST['error_setting']) && is_array($_REQUEST['error_setting']) && isset($_REQUEST['error_code']) && is_array($_REQUEST['error_code'])) {
            $error_code = $_REQUEST['error_code'];
            $error_setting = $_REQUEST['error_setting'];
            if (count($error_code) > 0 && count($error_code) == count($error_setting)) {
                for ($i = 0; $i < count($error_code); ++$i) {
                    ?>
				<div id="setting-error-settings_<?php 
                    echo $i;
                    ?>
" class="error settings-error">
				<p>
				<strong><?php 
                    echo htmlentities2($this->get_error_string($error_setting[$i] . '|' . $error_code[$i]));
                    ?>
</strong>
				</p>
				</div>
					<?php 
                }
            }
        }
    }
Beispiel #12
0
 private function _setContent()
 {
     $content = false;
     if (is_object($this->osd)) {
         $blog_name = htmlentities2($this->osd->blog_name);
         $title = sprintf(__('%s Search', WPI_META), $blog_name);
         $desc = $blog_name . ', ' . $this->osd->blog_desc;
         $email = 'postmaster+abuse@' . parse_url($this->osd->blog_url, PHP_URL_HOST);
         $search_uri = $this->osd->blog_url . '/' . $this->osd->search_param;
         $xml = "\t" . '<ShortName>' . $title . '</ShortName>' . "\n";
         $xml .= "\t" . '<Description>' . $desc . '</Description>' . "\n";
         $xml .= "\t" . '<Contact>' . $email . '</Contact>' . "\n";
         $xml .= "\t" . '<Url type="' . $this->osd->blog_html_type . '" method="get" template="' . $search_uri . '"></Url>' . "\n";
         $xml .= "\t" . '<LongName>' . $title . '</LongName>' . "\n";
         if ($this->osd->blog_favicon) {
             $xml .= "\t" . '<Image height="16" width="16" type="image/vnd.microsoft.icon">' . $this->osd->blog_favicon . '</Image>' . "\n";
         }
         $xml .= "\t" . '<Query role="example" searchTerms="blogging" />';
         $xml .= "\n\t" . '<Developer>ChaosKaizer</Developer>';
         $xml .= "\n\t" . '<Attribution>Search data &amp;copy; ' . date('Y', $_SERVER['REQUEST_TIME']) . ', ' . $blog_name . ', Some Rights Reserved. CC by-nc 2.5.</Attribution>';
         $xml .= "\n\t" . '<SyndicationRight>open</SyndicationRight>';
         $xml .= "\n\t" . '<AdultContent>false</AdultContent>';
         $xml .= "\n\t" . '<Language>' . $this->osd->language . '</Language>';
         $xml .= "\n\t" . '<OutputEncoding>UTF-8</OutputEncoding>';
         $xml .= "\n\t" . '<InputEncoding>UTF-8</InputEncoding>' . "\n";
     }
     $this->content = $xml;
     unset($xml);
 }
Beispiel #13
0
 function espresso_google_map_link($atts)
 {
     extract($atts);
     $address = "{$address}";
     $city = "{$city}";
     $state = "{$state}";
     $zip = "{$zip}";
     $country = "{$country}";
     $text = isset($text) ? "{$text}" : "";
     $type = isset($type) ? "{$type}" : "";
     $map_w = isset($map_w) ? "{$map_w}" : 400;
     $map_h = isset($map_h) ? "{$map_h}" : 400;
     $gaddress = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
     $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($gaddress));
     switch ($type) {
         case 'text':
         default:
             $text = $text == '' ? __('Map and Directions', 'event_espresso') : $text;
             break;
         case 'url':
             $text = $google_map;
             break;
         case 'map':
             $google_map_link = '<a href="' . $google_map . '" target="_blank">' . '<img id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2('http://maps.googleapis.com/maps/api/staticmap?center=' . urlencode($gaddress) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode($gaddress) . '&amp;sensor=false') . '" /></a>';
             return $google_map_link;
     }
     $google_map_link = '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
     return $google_map_link;
 }
function searchandreplace_action()
{
    if (isset($_POST['submitted'])) {
        check_admin_referer('searchandreplace_nonce');
        $myecho = '';
        if (empty($_POST['search_text'])) {
            $myecho .= '<div class="error"><p><strong>&raquo; ' . __('You must specify some text to replace!', FB_SAR_TEXTDOMAIN) . '</strong></p></div><br class="clear">';
        } else {
            $myecho .= '<div class="updated fade">';
            $myecho .= '<p><strong>&raquo; ' . __('Performing search', FB_SAR_TEXTDOMAIN);
            if (!isset($_POST['sall'])) {
                $_POST['sall'] = NULL;
            }
            if ($_POST['sall'] == 'srall') {
                $myecho .= ' ' . __('and replacement', FB_SAR_TEXTDOMAIN);
            }
            $myecho .= ' ...</strong></p>';
            $myecho .= '<p>&raquo; ' . __('Searching for', FB_SAR_TEXTDOMAIN) . ' <code>' . stripslashes(htmlentities2($_POST['search_text'])) . '</code>';
            if (isset($_POST['replace_text']) && $_POST['sall'] == 'srall') {
                $myecho .= __('and replacing with', FB_SAR_TEXTDOMAIN) . ' <code>' . stripslashes(htmlentities2($_POST['replace_text'])) . '</code></p>';
            }
            $myecho .= '</div><br class="clear" />';
            if (!isset($_POST['replace_text'])) {
                $_POST['replace_text'] = NULL;
            }
            $error = searchandreplace_doit($_POST['search_text'], $_POST['replace_text'], $_POST['sall'], isset($_POST['content']), isset($_POST['guid']), isset($_POST['id']), isset($_POST['title']), isset($_POST['excerpt']), isset($_POST['meta_value']), isset($_POST['comment_content']), isset($_POST['comment_author']), isset($_POST['comment_author_email']), isset($_POST['comment_author_url']), isset($_POST['comment_count']), isset($_POST['cat_description']), isset($_POST['tag']), isset($_POST['user_id']), isset($_POST['user_login']), isset($_POST['singups']));
            if ($error != '') {
                $myecho .= $error;
            } else {
                $myecho .= '<p>' . __('Completed successfully!', FB_SAR_TEXTDOMAIN) . '</p></div>';
            }
        }
        echo $myecho;
    }
}
Beispiel #15
0
/**
 * Setup OpenID errors to be displayed to the user.
 */
function openid_login_errors()
{
    $self = basename($GLOBALS['pagenow']);
    if ($self != 'wp-login.php') {
        return;
    }
    if (array_key_exists('openid_error', $_REQUEST)) {
        global $error;
        $error = htmlentities2($_REQUEST['openid_error']);
    }
}
Beispiel #16
0
        ?>
    </p>
	<p><input type="submit" name="submit" value="<?php 
        _e('Upload File');
        ?>
" /></p>
    </form>
</div><?php 
        break;
    case 'upload':
        $imgalt = basename(isset($_POST['imgalt']) ? $_POST['imgalt'] : '');
        $img1_name = strlen($imgalt) ? $imgalt : basename($_FILES['img1']['name']);
        $img1_name = preg_replace('/[^a-z0-9_.]/i', '', $img1_name);
        $img1_size = $_POST['img1_size'] ? intval($_POST['img1_size']) : intval($_FILES['img1']['size']);
        $img1_type = strlen($imgalt) ? $_POST['img1_type'] : $_FILES['img1']['type'];
        $imgdesc = htmlentities2($_POST['imgdesc']);
        $pi = pathinfo($img1_name);
        $imgtype = strtolower($pi['extension']);
        if (in_array($imgtype, $allowed_types) == false) {
            die(sprintf(__('File %1$s of type %2$s is not allowed.'), $img1_name, $imgtype));
        }
        if (strlen($imgalt)) {
            $pathtofile = get_settings('fileupload_realpath') . "/" . $imgalt;
            $img1 = $_POST['img1'];
        } else {
            $pathtofile = get_settings('fileupload_realpath') . "/" . $img1_name;
            $img1 = $_FILES['img1']['tmp_name'];
        }
        // makes sure not to upload duplicates, rename duplicates
        $i = 1;
        $pathtofile2 = $pathtofile;
<?php

/**************************************************************************************************
 * basic example of using WpUserState class
 **************************************************************************************************/
include 'D:/xampp/htdocs/myblog/personal/uwiuw/version/class/UserState.php';
$WpUserState = new WpUserState('sqlModule.php');
$userRegister = new userRegister();
$result = $userRegister::isProtectedUser(2, TRUE);
$hasildebug = print_r($result, TRUE);
echo '<pre style="font-size:14px">' . '$userRegister : ' . htmlentities2($hasildebug) . '</pre>';
/**
 * get_series_link() - returns what the url is for the series id passed as the parameter.
 * requires series_id
 *
 * @package Organize Series WordPress Plugin
 * @since 2.0
 *
 * @uses get_series_permastruct() - gets the permastructure for series.
 * @uses get_term() - get's the series information from the taxonomy tables.
 * @uses get_option() - with the parameter 'home' calls up the uri for the home directory of the WordPress install.
 * @uses str_replace()
 * @uses apply_filters() - with 'series_link' as the callback for pluggable filtering of the series_link.
 *
 * @param int $series_id - the series_id we want the link for.
 *
 * @return string - the final constructed series link.
*/
function get_series_link($series_id = '')
{
    global $orgseries;
    $series_token = '%' . SERIES_QUERYVAR . '%';
    if (empty($series_id) || $series_id == null) {
        $series_slug = get_query_var(SERIES_QUERYVAR);
    }
    if (is_numeric($series_id)) {
        $series_slug = get_term_field('slug', $series_id, 'series');
    } else {
        if ($series_slug_get = get_term_by('name', htmlentities2($series_id), 'series')) {
            $series_slug = $series_slug_get;
        }
    }
    if (empty($series_slug) || $series_slug == null || $series_slug == '') {
        return false;
    }
    $serieslink = get_term_link($series_slug, 'series');
    return apply_filters('series_link', $serieslink, $series_id);
}
Beispiel #19
0
    /**
     *  HTML template
     */
    public function output()
    {
        wp_enqueue_style('wp-color-picker');
        wp_enqueue_script('wp-color-picker');
        if (isset($_GET['build_css']) && ($_GET['build_css'] == '1' || $_GET['build_css'] == 'true') || isset($_GET['settings-updated']) && ($_GET['settings-updated'] === '1' || $_GET['settings-updated'] === 'true')) {
            $this->buildCustomColorCss();
            $this->buildCustomCss();
        }
        $use_custom = get_option(self::$field_prefix . 'use_custom');
        ?>
	<div class="wrap vc-settings" id="wpb-js-composer-settings">
		<h2><?php 
        _e('Visual Composer Settings', LANGUAGE_ZONE);
        ?>
</h2>
		<?php 
        ?>
		<h2 class="nav-tab-wrapper vc-settings-tabs">
			<?php 
        foreach ($this->tabs as $tab => $title) {
            ?>
			<a href="#vc-settings-<?php 
            echo $tab;
            ?>
"
			   class="vc-settings-tab-control nav-tab<?php 
            echo $this->active_tab == $tab ? ' nav-tab-active' : '';
            ?>
"><?php 
            echo $title;
            ?>
</a>
			<?php 
        }
        ?>
		</h2>
		<?php 
        foreach ($this->tabs as $tab => $title) {
            ?>
		<?php 
            if ($tab == 'element_css') {
                ?>
			<form action="options.php" method="post" id="vc-settings-<?php 
                echo $tab;
                ?>
"
				  class="vc-settings-tab-content<?php 
                echo $this->active_tab == $tab ? ' vc-settings-tab-content-active' : '';
                ?>
">
				<?php 
                settings_fields($this->option_group . '_' . $tab);
                ?>
				<div class="deprecated">
					<p>
						<?php 
                _e("<strong>Deprecated:</strong> To override class names that are applied to Visual Composer content elements you should use WordPress add_filter('vc_shortcodes_css_class') function. <a class='vc_show_example'>See Example</a>.", LANGUAGE_ZONE);
                ?>
					</p>
				</div>
				<div class="vc_helper">
					<?php 
                $row_css_class = ($value = get_option(self::$field_prefix . 'row_css_class')) ? $value : '';
                $column_css_classes = ($value = get_option(self::$field_prefix . 'column_css_classes')) ? (array) $value : array();
                if (!empty($row_css_class) || strlen(implode('', array_values($column_css_classes))) > 0) {
                    echo '<p>' . __('You have used element class names settings to replace row and column css classes.') . '</p>';
                    echo '<p>' . __('Below is code snippet which you should add to your functions.php file in your theme, to replace row and column classes with custom classes saved by you earlier.') . '</p>';
                    $function = <<<EOF
\t\t<?php
\t\tfunction custom_css_classes_for_vc_row_and_vc_column(\$class_string, \$tag) {
EOF;
                    if (!empty($row_css_class)) {
                        $function .= <<<EOF

\t\t\tif(\$tag=='vc_row' || \$tag=='vc_row_inner') {
\t\t\t\t\$class_string = str_replace('vc_row-fluid', '{$row_css_class}', \$class_string);
\t\t\t}
EOF;
                    }
                    $started_column_replace = false;
                    for ($i = 1; $i <= 12; $i++) {
                        if (!empty($column_css_classes['span' . $i])) {
                            if (!$started_column_replace) {
                                $started_column_replace = true;
                                $function .= <<<EOF

\t\t\tif(\$tag=='vc_column' || \$tag=='vc_column_inner') {

EOF;
                            }
                            $function .= <<<EOF
\t\t\t\t\$class_string = str_replace('vc_span{$i}', '{$column_css_classes['span' . $i]}', \$class_string);

EOF;
                        }
                    }
                    if ($started_column_replace) {
                        $function .= <<<EOF
\t\t\t}
EOF;
                    }
                    $function .= <<<EOF

\t\t\treturn \$class_string;
\t\t}
\t\t// Filter to Replace default css class for vc_row shortcode and vc_column
\t\tadd_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
\t\t?>
EOF;
                    echo '<div class="vc_filter_function"><pre>' . htmlentities2($function) . '</pre></div>';
                } else {
                    $function = <<<EOF
\t\t<?php
\t\tfunction custom_css_classes_for_vc_row_and_vc_column(\$class_string, \$tag) {
\t\t\tif(\$tag=='vc_row' || \$tag=='vc_row_inner') {
\t\t\t\t\$class_string = str_replace('vc_row-fluid', 'my_row-fluid', \$class_string);
\t\t\t}
\t\t\tif(\$tag=='vc_column' || \$tag=='vc_column_inner') {
\t\t\t\t\$class_string = preg_replace('/vc_span(\\d{1,2})/', 'my_span\$1', \$class_string);
\t\t\t}
\t\t\treturn \$class_string;
\t\t}
\t\t// Filter to Replace default css class for vc_row shortcode and vc_column
\t\tadd_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
\t\t?>
EOF;
                    echo '<div class="vc_filter_function"><pre>' . htmlentities2($function) . '</pre></div>';
                }
                ?>
				</div>
				<?php 
                settings_fields($this->option_group . '_' . $tab);
                ?>
				<?php 
                do_settings_sections($this->page . '_' . $tab);
                ?>
				<?php 
                wp_nonce_field('wpb_js_settings_save_action', 'wpb_js_nonce_field');
                ?>
				<input type="hidden" name="vc_action" value="" id="vc-settings-<?php 
                echo $tab;
                ?>
-action"/>
				<a href="#" class="button vc-restore-button"
				   id="vc-settings-custom-css-reset-data"><?php 
                _e('Remove all saved', LANGUAGE_ZONE);
                ?>
</a>
			</form>
			<?php 
            } elseif ($tab == 'automapper') {
                ?>
			<form action="options.php" method="post" id="vc-settings-<?php 
                echo $tab;
                ?>
"
				  class="vc-settings-tab-content<?php 
                echo $this->active_tab == $tab ? ' vc-settings-tab-content-active' : '';
                ?>
"<?php 
                echo apply_filters('vc_setting-tab-form-' . $tab, '');
                ?>
>
				<?php 
                vc_automapper()->renderHtml();
                ?>
			</form>
			<?php 
            } else {
                ?>
			<?php 
                $css = $tab == 'color' && $use_custom ? ' color_enabled' : '';
                ?>
			<form action="options.php" method="post" id="vc-settings-<?php 
                echo $tab;
                ?>
"
				  class="vc-settings-tab-content<?php 
                echo ($this->active_tab == $tab ? ' vc-settings-tab-content-active' : '') . $css;
                ?>
"<?php 
                echo apply_filters('vc_setting-tab-form-' . $tab, '');
                ?>
>
				<?php 
                settings_fields($this->option_group . '_' . $tab);
                ?>
				<?php 
                do_settings_sections($this->page . '_' . $tab);
                ?>
				<?php 
                wp_nonce_field('wpb_js_settings_save_action', 'wpb_js_nonce_field');
                ?>
				<?php 
                $submit_button_attributes = array();
                $license_activation_key = vc_license()->deactivation();
                if ($tab === 'updater' && !empty($license_activation_key)) {
                    $submit_button_attributes['disabled'] = 'true';
                }
                ?>
				<?php 
                submit_button(__('Save Changes', LANGUAGE_ZONE), 'primary', 'submit', true, $submit_button_attributes);
                ?>
				<input type="hidden" name="vc_action" value="" id="vc-settings-<?php 
                echo $tab;
                ?>
-action"/>
				<?php 
                if ($tab == 'color') {
                    ?>
				<a href="#" class="button vc-restore-button"
				   id="vc-settings-color-restore-default"><?php 
                    _e('Restore to defaults', LANGUAGE_ZONE);
                    ?>
</a>
				<?php 
                }
                ?>
				<?php 
                if ($tab === 'updater') {
                    ?>
				<input type="hidden" id="vc-settings-license-status" name="vc_license_status"
					   value="<?php 
                    echo empty($license_activation_key) ? 'not_activated' : 'activated';
                    ?>
"/>
				<a href="#" class="button vc-activate-license-button"
				   id="vc-settings-activate-license"><?php 
                    empty($license_activation_key) ? _e('Activate license', LANGUAGE_ZONE) : _e('Deactivate license', LANGUAGE_ZONE);
                    ?>
</a>
				<span class="vc-updater-spinner-wrapper" style="display: none;" id="vc-updater-spinner"><img
				  src="<?php 
                    echo get_site_url();
                    ?>
/wp-admin/images/wpspin_light.gif"/></span>
				<?php 
                }
                ?>
			</form>
			<?php 
            }
            ?>

		<?php 
        }
        ?>
	</div>
	<?php 
    }
function GeographLinks(&$posterText, $thumbs = false)
{
    global $imageCredits, $CONF, $global_thumb_count;
    //look for [[gridref_or_photoid]] and [[[gridref_or_photoid]]]
    if (preg_match_all('/\\[\\[(\\[?)(\\w{0,3} ?\\d+ ?\\d*)(\\]?)\\]\\]/', $posterText, $g_matches)) {
        $thumb_count = 0;
        foreach ($g_matches[2] as $i => $g_id) {
            //photo id?
            if (is_numeric($g_id)) {
                if ($global_thumb_count > $CONF['global_thumb_limit'] || $thumb_count > $CONF['post_thumb_limit']) {
                    $posterText = preg_replace("/\\[?\\[\\[{$g_id}\\]\\]\\]?/", "[[<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\">{$g_id}</a>]]", $posterText);
                } else {
                    if (!isset($g_image)) {
                        $g_image = new GridImage();
                    }
                    $ok = $g_image->loadFromId($g_id);
                    if ($g_image->moderation_status == 'rejected') {
                        $posterText = str_replace("[[[{$g_id}]]]", '<img src="/photos/error120.jpg" width="120" height="90" alt="image no longer available"/>', $posterText);
                    } elseif ($ok) {
                        $g_title = $g_image->grid_reference . ' : ' . htmlentities2($g_image->title);
                        if ($g_matches[1][$i]) {
                            if ($thumbs) {
                                $g_title .= ' by ' . htmlentities($g_image->realname);
                                $g_img = $g_image->getThumbnail(120, 120, false, true);
                                $posterText = str_replace("[[[{$g_id}]]]", "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\" target=\"_blank\" title=\"{$g_title}\">{$g_img}</a>", $posterText);
                                if (isset($imageCredits[$g_image->realname])) {
                                    $imageCredits[$g_image->realname]++;
                                } else {
                                    $imageCredits[$g_image->realname] = 1;
                                }
                            } else {
                                //we don't place thumbnails in non forum links
                                $posterText = str_replace("[[[{$g_id}]]]", "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\">{$g_title}</a>", $posterText);
                            }
                        } else {
                            $posterText = preg_replace("/(?<!\\[)\\[\\[{$g_id}\\]\\]/", "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\">{$g_title}</a>", $posterText);
                        }
                    }
                    $global_thumb_count++;
                }
                $thumb_count++;
            } else {
                //link to grid ref
                $posterText = str_replace("[[{$g_id}]]", "<a href=\"http://{$_SERVER['HTTP_HOST']}/gridref/{$g_id}\">" . str_replace(' ', '+', $g_id) . "</a>", $posterText);
            }
        }
    }
    if ($CONF['CONTENT_HOST'] != $_SERVER['HTTP_HOST']) {
        $posterText = str_replace($CONF['CONTENT_HOST'], $_SERVER['HTTP_HOST'], $posterText);
    }
    $posterText = preg_replace('/(?<!["\'>F=])(https?:\\/\\/[\\w\\.-]+\\.\\w{2,}\\/?[\\w\\~\\-\\.\\?\\,=\'\\/\\\\+&%\\$#\\(\\)\\;\\:]*)(?<!\\.)(?!["\'])/e', "smarty_function_external(array('href'=>\"\$1\",'text'=>'Link','nofollow'=>1,'title'=>\"\$1\"))", $posterText);
    $posterText = preg_replace('/(?<![\\/F\\.])(www\\.[\\w\\.-]+\\.\\w{2,}\\/?[\\w\\~\\-\\.\\?\\,=\'\\/\\\\+&%\\$#\\(\\)\\;\\:]*)(?<!\\.)(?!["\'])/e', "smarty_function_external(array('href'=>\"http://\$1\",'text'=>'Link','nofollow'=>1,'title'=>\"\$1\"))", $posterText);
    return $posterText;
}
Beispiel #21
0
         preg_match('/^[A-Z]{1,3}\\d\\d(\\d)\\d\\d(\\d)$/', $_GET['viewcenti'], $matches);
         if (!isset($matches[2])) {
             die("invalid Grid Reference");
         }
         $custom_where .= " and viewpoint_eastings != 0";
         //to stop XX0XX0 matching 4fig GRs
         $custom_where .= " and ((viewpoint_eastings div 100) mod 10) = " . $matches[1];
         $custom_where .= " and ((viewpoint_northings div 100) mod 10) = " . $matches[2];
         $grid_ok = $square->setByFullGridRef($_GET['viewcenti'], true, true);
         $e = intval($square->nateastings / 1000);
         $n = intval($square->natnorthings / 1000);
         $custom_where .= " and viewpoint_eastings DIV 1000 = {$e} AND viewpoint_northings DIV 1000 = {$n}";
         $smarty->assign('gridrefraw', stripslashes($_GET['viewcenti']));
         $smarty->assign('gridref2', strlen($square->grid_reference) <= 2 + $CONF['gridpreflen'][$square->reference_index]);
     }
     $filtered_title .= " photographer in " . htmlentities2($_GET['viewcenti']) . " Centisquare<a href=\"/help/squares\">?</a>";
 }
 if ($custom_where) {
     $smarty->assign('filtered_title', $filtered_title);
     $smarty->assign('filtered', 1);
 }
 if ($USER->user_id && !empty($_GET['nl'])) {
     $extra = "&amp;nl=1";
     $smarty->assign('nl', 1);
     if (!empty($_GET['ht'])) {
         $extra .= "&amp;ht=1";
         $smarty->assign('ht', 1);
     }
     if ($USER->hasPerm('moderator')) {
         $user_crit = "1";
         $cacheseconds = 600;
    for ($i = 0; $i <= $numSmilies; $i++) {
        if ($_POST['code_' . $i] != $_POST['oldcode_' . $i] || $_POST['image_' . $i] != $_POST['oldimage_' . $i]) {
            if ($_POST['code_' . $i] == "") {
                $act = "deleted";
                $qSmiley = "delete from smilies where code='" . $_POST['oldcode_' . $i] . "'";
            } else {
                $act = "edited to \"" . $_POST['image_' . $i] . "\"";
                $qSmiley = "update smilies set code='" . $_POST['code_' . $i] . "', image='" . $_POST['image_' . $i] . "' where code='" . $_POST['oldcode_' . $i] . "'";
            }
            $rSmiley = Query($qSmiley);
            $log .= "Smiley \"" . $_POST['oldcode_' . $i] . "\" " . $act . ".<br />";
        }
    }
    if ($_POST['code_add'] && $_POST['image_add']) {
        $qSmiley = "insert into smilies (code,image) value ('" . $_POST['code_add'] . "', '" . $_POST['image_add'] . "')";
        $rSmiley = Query($qSmiley);
        $log .= "Smiley \"" . $_POST['code_add'] . "\" added.<br />";
    }
    if ($log) {
        Alert($log, "Log");
    }
}
$smileyList = "";
$qSmilies = "select * from smilies";
$rSmilies = Query($qSmilies);
while ($smiley = Fetch($rSmilies)) {
    $cellClass = ($cellClass + 1) % 2;
    $i++;
    $smileyList .= format("\n\t\t\t<tr class=\"cell{0}\">\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"code_{1}\" value=\"{2}\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"oldcode_{1}\" value=\"{2}\" />\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"image_{1}\" value=\"{3}\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"oldimage_{1}\" value=\"{3}\" />\n\t\t\t\t\t<img src=\"img/smilies/{4}\" alt=\"{5}\" title=\"{5}\">\n\t\t\t\t</td>\n\t\t\t</tr>\n", $cellClass, $i, htmlentities2($smiley['code']), htmlentities2($smiley['image']), $smiley['image'], $smiley['code']);
}
write("\n\t<div class=\"outline margin width25 faq\">\n\t\tTo add, fill in both bottom fields and apply.<br />\n\t\tTo edit, change either code or image fields to <em>not</em> match their hidden counterparts.\n\t</div>\n\n\t<form method=\"post\" action=\"editsmilies.php\">\n\n\t\t<table class=\"outline margin\" style=\"width: 30%;\">\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th>\n\t\t\t\t\tCode\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\tImage\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t{0}\n\t\t\t<tr class=\"header0\">\n\t\t\t\t<th colspan=\"2\">\n\t\t\t\t\tAdd\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"code_add\" />\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"text\" name=\"image_add\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t<tr class=\"cell2\">\n\t\t\t\t<td>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"Apply\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"key\" value=\"{1}\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t</table>\n\t</form>\n", $smileyList, $key);
/**
 * Handle OpenID profile management.
 */
function openid_profile_management()
{
    global $action;
    wp_reset_vars(array('action'));
    switch ($action) {
        case 'add':
            check_admin_referer('openid-add_openid');
            $user = wp_get_current_user();
            $auth_request = openid_begin_consumer($_POST['openid_identifier']);
            $userid = get_user_by_openid($auth_request->endpoint->claimed_id);
            if ($userid) {
                global $error;
                if ($user->ID == $userid) {
                    $error = __('You already have this OpenID!', 'openid');
                } else {
                    $error = __('This OpenID is already associated with another user.', 'openid');
                }
                return;
            }
            $finish_url = admin_url(current_user_can('edit_users') ? 'users.php' : 'profile.php');
            $finish_url = add_query_arg('page', $_REQUEST['page'], $finish_url);
            openid_start_login($_POST['openid_identifier'], 'verify', $finish_url);
            break;
        case 'delete':
            openid_profile_delete_openids($_REQUEST['delete']);
            break;
        default:
            if (array_key_exists('message', $_REQUEST)) {
                $message = $_REQUEST['message'];
                $messages = array('', __('Unable to authenticate OpenID.', 'openid'), __('OpenID assertion successful, but this URL is already associated with another user on this blog.', 'openid'), __('Added association with OpenID.', 'openid'));
                if (is_numeric($message)) {
                    $message = $messages[$message];
                } else {
                    $message = htmlentities2($message);
                }
                $message = __($message, 'openid');
                if (array_key_exists('update_url', $_REQUEST) && $_REQUEST['update_url']) {
                    $message .= '<br />' . __('<strong>Note:</strong> For security reasons, your profile URL has been updated to match your OpenID.', 'openid');
                }
                openid_message($message);
                openid_status($_REQUEST['status']);
            }
            break;
    }
}
    function add_groupon_to_db()
    {
        do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
        global $wpdb;
        $submit = isset($_POST['Submit']) ? true : false;
        $add_action = !empty($_REQUEST['action']) && $_REQUEST['action'] == 'add' ? true : false;
        $groupon_code = empty($_REQUEST['groupon_code']) ? false : htmlentities2($_REQUEST['groupon_code']);
        $groupon_status = empty($_REQUEST['groupon_status']) ? false : $_REQUEST['groupon_status'];
        $groupon_holder = empty($_REQUEST['groupon_holder']) ? false : $_REQUEST['groupon_holder'];
        if ($submit) {
            if ($add_action) {
                $sql = "INSERT INTO " . EVENTS_GROUPON_CODES_TABLE . " (groupon_code, groupon_status, groupon_holder) VALUES('{$groupon_code}', '{$groupon_status}', '{$groupon_holder}')";
                if ($wpdb->query($sql)) {
                    ?>
						<div id="message" class="updated fade"><p><strong><?php 
                    _e('The groupon code ' . $groupon_code . ' has been added.', 'event_espresso');
                    ?>
</strong></p></div>
						<?php 
                } else {
                    ?>
						<div id="message" class="error"><p><strong><?php 
                    _e('The groupon code ' . $groupon_code . ' was not saved.', 'event_espresso');
                    ?>
 <?php 
                    //print $wpdb->print_error();
                    ?>
.</strong></p></div>
						<?php 
                }
            }
        }
    }
    private static function display_fix_metas_list($img_post_id, $posts, $meta_counter, $p, $im)
    {
        if ($meta_counter) {
            $header = __('We found ' . $meta_counter . $im . $p . 'which needed to add or change meta information', 'wp-meta-seo');
        } else {
            $header = __('We found 0 image which needed to add or change meta information', 'wp-meta-seo');
        }
        //Get default meta information of the image
        $img_post = get_post($img_post_id);
        $alt = get_post_meta($img_post_id, '_wp_attachment_image_alt', true);
        $title = $img_post->post_title;
        ?>
		<h3 class="content-header"><?php 
        echo $header;
        ?>
</h3>
		<div class="content-box">
			<table class="wp-list-table widefat fixed posts">
				<thead></thead>
				<tbody>
					<?php 
        $alternate = '';
        ?>
					<?php 
        if (count($posts) < 1) {
            ?>
					<tr><td colspan="10" style="height:95%"><?php 
            echo __('This image has still not been inserted in any post!', 'wp-meta-seo');
            ?>
</td></tr>
					<?php 
        } else {
            ?>
					<tr class="metaseo-border-bottom">
					<td colspan="1">ID</td>
					<td colspan="2">Title</td>
					<td colspan="2">Image</td>
					<td colspan="5">Image Meta</td>
					</tr>
					<?php 
            foreach ($posts as $post) {
                ?>
						<?php 
                foreach ($post['meta'] as $k => $meta) {
                    ?>
						<?php 
                    $alternate = 'alternate' == $alternate ? '' : 'alternate';
                    $file_name = substr($meta['img_src'], strrpos($meta['img_src'], '/') + 1);
                    ?>
						<tr class="<?php 
                    echo $alternate;
                    ?>
">
							<td colspan="1"><?php 
                    echo $post['ID'];
                    ?>
</td>
							<td colspan="2">
								<p><?php 
                    echo $post['title'];
                    ?>
</p>
							</td>
							<td colspan="2">
								<div class="metaseo-img-wrapper">
									<img src="<?php 
                    echo $meta['img_src'];
                    ?>
" />
								</div>
							</td>
							<td colspan="5">
								<?php 
                    foreach ($meta['type'] as $type => $value) {
                        ?>
								<div class="metaseo-img-wrapper">
									<?php 
                        $specialChr = array('"', '\'');
                        foreach ($specialChr as $chr) {
                            $value = str_replace($chr, htmlentities2($chr), $value);
                        }
                        ?>
									<input type="text" value="<?php 
                        echo $value != '' ? $value : '';
                        ?>
" id="metaseo-img-<?php 
                        echo $type . '-' . $post['ID'];
                        ?>
" class="metaseo-fix-meta metaseo-img-<?php 
                        echo $type;
                        ?>
" data-meta-key="_metaseo_fix_metas" data-post-id="<?php 
                        echo $post['ID'];
                        ?>
" data-img-post-id="<?php 
                        echo $img_post_id;
                        ?>
" data-meta-type="<?php 
                        echo $type;
                        ?>
" data-meta-order="<?php 
                        echo $k;
                        ?>
" data-file-name="<?php 
                        echo $file_name;
                        ?>
" placeholder="<?php 
                        echo $value == '' ? __(ucfirst($type) . ' is empty', 'wp-meta-seo') : '';
                        ?>
" onfocus="metaseo_fix_meta(this);" onblur="updateInputBlur(this)" onkeydown="return checkeyCode(event,this)" />
									<span class="meta-update"></span>
									<?php 
                        if (trim(${$type}) != '' && trim(${$type}) != $value) {
                            ?>
                                    <a class="button meta-default" href="#" data-default-value="<?php 
                            echo esc_attr(${$type});
                            ?>
" title="Add to input box" onclick="add_meta_default(this)"> <?php 
                            echo '<img src= "' . WPMETASEO_PLUGIN_URL . 'img/img-arrow.png" />';
                            ?>
 Copy </a>																			
                                                                        <span class="img_seo_type"><?php 
                            echo ${$type};
                            ?>
</span>
									<?php 
                        }
                        ?>
								</div>
								<?php 
                    }
                    ?>
								<span class="saved-info"></span>
							</td>
						</tr>
						<?php 
                }
                ?>
					<?php 
            }
            ?>
					<?php 
        }
        ?>
				</tbody>
				<tfoot></tfoot>
			</table>
		</div>
		<div style="padding:5px"></div>		
	<?php 
    }
Beispiel #26
0
        $pid = mysql_insert_id();
        $qPostsText = "insert into posts_text (pid,text) values (" . $pid . ",'" . $post . "')";
        $rPostsText = Query($qPostsText);
        $qFora = "update forums set numposts=" . ($forum['numposts'] + 1) . ", lastpostdate=" . time() . ", lastpostuser="******", lastpostid=" . $pid . " where id=" . $fid . " limit 1";
        $rFora = Query($qFora);
        $qThreads = "update threads set lastposter=" . $postingAs . ", lastpostdate=" . time() . ", replies=" . ($thread['replies'] + 1) . ", lastpostid=" . $pid . $mod . " where id=" . $tid . " limit 1";
        $rThreads = Query($qThreads);
        Report("New reply by [b]" . $postingAsUser['name'] . "[/] in [b]" . $thread['title'] . "[/] (" . $forum['title'] . ") -> [g]#HERE#?pid=" . $pid, $isHidden);
        Redirect(__("Posted!"), "thread.php?pid=" . $pid . "#" . $pid, __("the thread"));
        exit;
    } else {
        Alert(__("Enter a message and try again."), __("Your post is empty."));
    }
}
if ($_POST['text']) {
    $prefill = htmlentities2(deSlashMagic($_POST['text']));
}
if ($_POST['action'] == __("Preview")) {
    if ($_POST['text']) {
        $previewPost['text'] = $prefill;
        $previewPost['num'] = $postingAsUser['posts'] + 1;
        $previewPost['posts'] = $postingAsUser['posts'] + 1;
        $previewPost['id'] = "???";
        $previewPost['uid'] = $postingAs;
        $copies = explode(",", "title,name,displayname,picture,sex,powerlevel,avatar,postheader,signature,signsep,regdate,lastactivity,lastposttime,rankset");
        foreach ($copies as $toCopy) {
            $previewPost[$toCopy] = $postingAsUser[$toCopy];
        }
        $previewPost['mood'] = (int) $_POST['mood'];
        $previewPost['options'] = 0;
        if ($_POST['nopl']) {
Beispiel #27
0
        if (!empty($page['extract'])) {
            $smarty->assign('meta_description', "User contributed article about, " . $page['extract']);
        }
        if (!empty($page['gridsquare_id'])) {
            $square = new GridSquare();
            $square->loadFromId($page['gridsquare_id']);
            $smarty->assign('grid_reference', $square->grid_reference);
            require_once 'geograph/conversions.class.php';
            $conv = new Conversions();
            list($lat, $long) = $conv->gridsquare_to_wgs84($square);
            $smarty->assign('lat', $lat);
            $smarty->assign('long', $long);
        }
        if (preg_match('/\\bgeograph\\b/i', $page['category_name'])) {
            $db->Execute("set @last=0");
            $users = $db->getAll("select realname,modifier,update_time,if(approved = @last,1,0) as same,@last := approved \r\n\t\t\tfrom article_revisions \r\n\t\t\tleft join user on (article_revisions.modifier = user.user_id)\r\n\t\t\twhere article_id = {$page['article_id']}");
            $arr = array();
            foreach ($users as $idx => $row) {
                if ($row['same'] == 1 && $row['modifier'] != $page['user_id'] && !isset($arr[$row['modifier']])) {
                    $arr[$row['modifier']] = "<a href=\"/profile/{$row['modifier']}\">" . htmlentities2($row['realname']) . "</a>";
                }
            }
            $str = preg_replace('/, ([^\\,]*?)$/', ' and $1', implode(', ', $arr));
            $smarty->assign('moreCredits', $str);
        }
    }
} else {
    $smarty->assign('user_id', $page['user_id']);
    $smarty->assign('url', $page['url']);
}
$smarty->display($template, $cacheid);
Beispiel #28
0
        /**
         *  HTML template
         */
        public function output()
        {
            wp_enqueue_style('wp-color-picker');
            wp_enqueue_script('wp-color-picker');
            if (isset($_GET['vc_action']) && $_GET['vc_action'] === 'upgrade') {
                $this->upgradeFromEnvato();
            }
            if (isset($_GET['build_css']) && ($_GET['build_css'] == '1' || $_GET['build_css'] == 'true') || isset($_GET['settings-updated']) && ($_GET['settings-updated'] === '1' || $_GET['settings-updated'] === 'true')) {
                $this->buildCustomColorCss();
                $this->buildCustomCss();
            }
            $use_custom = get_option(self::$field_prefix . 'use_custom');
            ?>
<div class="wrap vc-settings" id="wpb-js-composer-settings">
    <?php 
            screen_icon();
            ?>
    <h2><?php 
            _e('Visual Composer Settings', 'js_composer');
            ?>
</h2>
    <?php 
            ?>
    <h2 class="nav-tab-wrapper vc-settings-tabs">
        <?php 
            foreach ($this->tabs as $tab => $title) {
                ?>
        <a href="#vc-settings-<?php 
                echo $tab;
                ?>
" class="vc-settings-tab-control nav-tab<?php 
                echo $this->active_tab == $tab ? ' nav-tab-active' : '';
                ?>
"><?php 
                echo $title;
                ?>
</a>
        <?php 
            }
            ?>
    </h2>
    <?php 
            foreach ($this->tabs as $tab => $title) {
                ?>
    <?php 
                if ($tab == 'element_css') {
                    ?>
        <form action="options.php" method="post" id="vc-settings-<?php 
                    echo $tab;
                    ?>
" class="vc-settings-tab-content<?php 
                    echo $this->active_tab == $tab ? ' vc-settings-tab-content-active' : '';
                    ?>
">
        <?php 
                    settings_fields($this->option_group . '_' . $tab);
                    ?>
        <div class="deprecated">
            <p>
            <?php 
                    _e("<strong>Deprecated:</strong> To override class names that are applied to Visual Composer content elements you should use WordPress add_filter('vc_shortcodes_css_class') function. <a class='vc_show_example'>See Example</a>.", "js_composer");
                    ?>
            </p>
        </div>
        <div class="vc_helper">
        <?php 
                    $row_css_class = ($value = get_option(self::$field_prefix . 'row_css_class')) ? $value : '';
                    $column_css_classes = ($value = get_option(self::$field_prefix . 'column_css_classes')) ? (array) $value : array();
                    if (!empty($row_css_class) || strlen(implode('', array_values($column_css_classes))) > 0) {
                        echo '<p>' . __('You have used element class names settings to replace row and column css classes.') . '</p>';
                        echo '<p>' . __('Below is code snippet which you should add to your functions.php file in your theme, to replace row and column classes with custom classes saved by you earlier.') . '</p>';
                        $function = <<<EOF
            <?php
            function custom_css_classes_for_vc_row_and_vc_column(\$class_string, \$tag) {
EOF;
                        if (!empty($row_css_class)) {
                            $function .= <<<EOF

                if(\$tag=='vc_row' || \$tag=='vc_row_inner') {
                    \$class_string = str_replace('vc_row-fluid', '{$row_css_class}', \$class_string);
                }
EOF;
                        }
                        $started_column_replace = false;
                        for ($i = 1; $i <= 12; $i++) {
                            if (!empty($column_css_classes['span' . $i])) {
                                if (!$started_column_replace) {
                                    $started_column_replace = true;
                                    $function .= <<<EOF

                if(\$tag=='vc_column' || \$tag=='vc_column_inner') {

EOF;
                                }
                                $function .= <<<EOF
                    \$class_string = str_replace('vc_span{$i}', '{$column_css_classes['span' . $i]}', \$class_string);

EOF;
                            }
                        }
                        if ($started_column_replace) {
                            $function .= <<<EOF
                }
EOF;
                        }
                        $function .= <<<EOF

                return \$class_string;
            }
            // Filter to Replace default css class for vc_row shortcode and vc_column
            add_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
            ?>
EOF;
                        echo '<div class="vc_filter_function"><pre>' . htmlentities2($function) . '</pre></div>';
                        /*
                        $show_notification_button = get_option(self::$notification_name);
                        if($show_notification_button === 'true') {
                            echo '<button class="button button-primary" id="vc-settings-disable-notification-button">'.__("Don't notify me about this", "js_composer").'</button>';
                        }
                        */
                    } else {
                        $function = <<<EOF
            <?php
            function custom_css_classes_for_vc_row_and_vc_column(\$class_string, \$tag) {
                if(\$tag=='vc_row' || \$tag=='vc_row_inner') {
                    \$class_string = str_replace('vc_row-fluid', 'my_row-fluid', \$class_string);
                }
                if(\$tag=='vc_column' || \$tag=='vc_column_inner') {
                    \$class_string = preg_replace('/vc_span(\\d{1,2})/', 'my_span\$1', \$class_string);
                }
                return \$class_string;
            }
            // Filter to Replace default css class for vc_row shortcode and vc_column
            add_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
            ?>
EOF;
                        echo '<div class="vc_filter_function"><pre>' . htmlentities2($function) . '</pre></div>';
                    }
                    ?>
            </div>
            <?php 
                    settings_fields($this->option_group . '_' . $tab);
                    ?>
            <?php 
                    do_settings_sections($this->page . '_' . $tab);
                    ?>
            <?php 
                    wp_nonce_field('wpb_js_settings_save_action', 'wpb_js_nonce_field');
                    ?>
            <input type="hidden" name="vc_action" value="" id="vc-settings-<?php 
                    echo $tab;
                    ?>
-action"/>
            <a href="#" class="button vc-restore-button" id="vc-settings-custom-css-reset-data"><?php 
                    _e('Remove all saved', "js_composer");
                    ?>
</a>
        </form>

        <?php 
                } else {
                    ?>
        <?php 
                    $css = $tab == 'color' && $use_custom ? ' color_enabled' : '';
                    ?>
        <form action="options.php" method="post" id="vc-settings-<?php 
                    echo $tab;
                    ?>
" class="vc-settings-tab-content<?php 
                    echo ($this->active_tab == $tab ? ' vc-settings-tab-content-active' : '') . $css;
                    ?>
"<?php 
                    echo apply_filters('vc_setting-tab-form-' . $tab, '');
                    ?>
>
            <?php 
                    settings_fields($this->option_group . '_' . $tab);
                    ?>
            <?php 
                    do_settings_sections($this->page . '_' . $tab);
                    ?>
            <?php 
                    wp_nonce_field('wpb_js_settings_save_action', 'wpb_js_nonce_field');
                    ?>
            <?php 
                    submit_button(__('Save Changes', 'js_composer'));
                    ?>
            <input type="hidden" name="vc_action" value="" id="vc-settings-<?php 
                    echo $tab;
                    ?>
-action"/>
            <?php 
                    if ($tab == 'color') {
                        ?>
            <a href="#" class="button vc-restore-button" id="vc-settings-color-restore-default"><?php 
                        _e('Restore to defaults', 'js_composer');
                        ?>
</a>
            <?php 
                    }
                    ?>
        </form>
        <?php 
                }
                ?>

    <?php 
            }
            ?>
</div>
<?php 
        }
     $post = htmlentities2(deSlashMagic($pm['text']));
     $post = preg_replace("'/me '", "[b]* " . $loguser['name'] . "[/b] ", $post);
     //to prevent identity confusion
     $post = str_replace("\n", "##TSURUPETTANYOUJO##", $post);
     TidyPost($post);
     $post = str_replace("##TSURUPETTANYOUJO##", "\n", $post);
     $post = "<!-- ###MULTIREP:" . $_POST['to'] . " ### -->" . $post;
     $post = mysql_real_escape_string($post);
     $qPMT = "update pmsgs_text set title = '" . justEscape($_POST['title']) . "', text = '" . $post . "' where pid = " . $pmid;
     $rPMT = Query($qPMT);
     $qPM = "update pmsgs set userto = " . $firstTo . " where id = " . $pmid;
     $rPM = Query($qPM);
     Redirect(__("PM draft updated!"), "private.php?show=2", __("your PM box"));
     exit;
 } else {
     $post = htmlentities2(deSlashMagic($pm['text']));
     $post = preg_replace("'/me '", "[b]* " . $loguser['name'] . "[/b] ", $post);
     //to prevent identity confusion
     $post = str_replace("\n", "##TSURUPETTANYOUJO##", $post);
     TidyPost($post);
     $post = mysql_real_escape_string($post);
     $qPMT = "update pmsgs_text set title = '" . justEscape($_POST['title']) . "', text = '" . $post . "' where pid = " . $pmid;
     $rPMT = Query($qPMT);
     $qPM = "update pmsgs set drafting = 0 where id = " . $pmid;
     $rPM = Query($qPM);
     foreach ($recipIDs as $recipient) {
         if ($recipient == $firstTo) {
             continue;
         }
         $qPM = "insert into pmsgs (userto, userfrom, date, ip, msgread) values (" . $recipient . ", " . $loguserid . ", " . time() . ", '" . $_SERVER['REMOTE_ADDR'] . "', 0)";
         $rPM = Query($qPM);
} else {
    $networklink = new kmlNetworkLink(null, 'Geograph SuperLayer');
    $desc = <<<END_HTML
<table bgcolor="#000066" border="0"><tr bgcolor="#000066"><td bgcolor="#000066">
<a href="http://{$_SERVER['HTTP_HOST']}/"><img src="http://{$_SERVER['HTTP_HOST']}/templates/basic/img/logo.gif" height="74" width="257"/></a>
</td></tr></table>

<p><i>The Geograph British Isles project aims to collect geographically representative photographs and information for every square kilometre of the UK and the Republic of Ireland, and you can be part of it.</i></p>

<p>Click on the Camera Icon or Thumbnails to view a bigger image, and follow the link to view the full resolution image on the geograph website.</p>
END_HTML;
    if ($i) {
        require_once 'geograph/searchcriteria.class.php';
        require_once 'geograph/searchengine.class.php';
        $engine = new SearchEngine($i);
        $desc .= "<p>Displaying results for search for images<i>" . htmlentities2($engine->criteria->searchdesc) . "</i></p>";
    } else {
        $desc .= <<<END_HTML
<p>This SuperLayer allows full access to the thousends of images contributed to Geograph since March 2005, the view starts depicting a coarse overview of the current coverage, zooming in reveals more detail until pictures themselves become visible.</p>

<p>This SuperLayer will automatically update, but by design is not realtime, so can take a number of weeks for new pictures to become available in the SuperLayer.</p>
END_HTML;
    }
    $desc .= <<<END_HTML
<p><b>Join us now at: <a href="http://{$_SERVER['HTTP_HOST']}/">{$_SERVER['HTTP_HOST']}</a></b></p>
END_HTML;
    $networklink->setItemCDATA('description', $desc);
    $networklink->setItem('Snippet', 'move...scroll...rotate...tilt, to view the Geograph Archive...');
    $UrlTag = $networklink->useUrl("http://{$_SERVER['HTTP_HOST']}/kml-superlayer.php?download" . ($i ? "&i={$i}" : ''));
    $UrlTag->setItem('refreshMode', 'onInterval');
    $UrlTag->setItem('refreshInterval', 60 * 60 * 24);