function et_epanel_admin_js()
 {
     $epanel_jsfolder = get_template_directory_uri() . '/epanel/js';
     nxt_enqueue_script('jquery-ui-tabs');
     nxt_enqueue_script('jquery-form');
     nxt_enqueue_script('epanel_checkbox', $epanel_jsfolder . '/checkbox.js');
     nxt_enqueue_script('epanel_functions_init', $epanel_jsfolder . '/functions-init.js');
     nxt_localize_script('epanel_functions_init', 'ePanelSettings', array('clearpath' => get_template_directory_uri() . '/epanel/images/empty.png', 'epanel_nonce' => nxt_create_nonce('epanel_nonce')));
     nxt_enqueue_script('epanel_colorpicker', $epanel_jsfolder . '/colorpicker.js');
     nxt_enqueue_script('epanel_eye', $epanel_jsfolder . '/eye.js');
 }
    /**
     * Add the Javascript to the top
     **/
    function addTopJs()
    {
        ?>
		<script type="text/javascript">
		
			jQuery(document).ready(function(){
				
				// Add a link to see full stats on the Analytics website
				jQuery('#google-analytics-summary h3.hndle span').append('<span class="postbox-title-action"><a href="http://google.com/analytics/" class="edit-box open-box"><?php 
        _e('View Full Stat Report', 'google-analyticator');
        ?>
</a></span>');
				
				// Grab the widget data
				jQuery.ajax({
					type: 'post',
					url: 'admin-ajax.php',
					data: {
						action: 'ga_stats_widget',
						_ajax_nonce: '<?php 
        echo nxt_create_nonce("google-analyticator-statsWidget_get");
        ?>
'
					},
					success: function(html) {
						// Hide the loading message
						jQuery('#google-analytics-summary .inside small').remove();
						
						// Place the widget data in the area
						jQuery('#google-analytics-summary .inside .target').html(html);
						
						// Display the widget data
						jQuery('#google-analytics-summary .inside .target').slideDown();
						
						// Handle displaying the graph
						jQuery('.ga_visits').sparkline(ga_visits, { type:'line', width:'100%', height:'75px', lineColor:'#aaa', fillColor:'#f0f0f0', spotColor:false, minSpotColor:false, maxSpotColor:false, chartRangeMin:0 });
					}
				});
			
			});
		
		</script>
		<?php 
    }
Exemple #3
0
/**
 * Action method for completing the 'login' action.  This action is used when a user is logging in from
 * nxt-login.php.
 *
 * @param string $identity_url verified OpenID URL
 */
function openid_finish_login($identity_url, $action)
{
    if ($action != 'login') {
        return;
    }
    // create new user account if appropriate
    $user_id = get_user_by_openid($identity_url);
    if ($identity_url && !$user_id && get_option('users_can_register')) {
        $user_data =& openid_get_user_data($identity_url);
        openid_create_new_user($identity_url, $user_data);
    }
    // return to nxt-login page
    $url = get_option('siteurl') . '/nxt-login.php';
    if (empty($identity_url)) {
        $url = add_query_arg('openid_error', openid_message(), $url);
    }
    $url = add_query_arg(array('finish_openid' => 1, 'identity_url' => urlencode($identity_url), 'redirect_to' => $_SESSION['openid_finish_url'], '_nxtnonce' => nxt_create_nonce('openid_login_' . md5($identity_url))), $url);
    nxt_safe_redirect($url);
    exit;
}
Exemple #4
0
echo htmlspecialchars($this->_config->get_string('minify.ccjs.path.java'));
?>
" size="60" /></td>
</tr>
<tr>
    <th><label for="minify_ccjs_path_jar">Path to JAR file:</label></th>
    <td><input id="minify_ccjs_path_jar" class="js_enabled" type="text" name="minify.ccjs.path.jar" value="<?php 
echo htmlspecialchars($this->_config->get_string('minify.ccjs.path.jar'));
?>
" size="60" /></td>
</tr>
<tr>
    <th>&nbsp;</th>
    <td>
        <input class="minifier_test button {type: 'ccjs', nonce: '<?php 
echo nxt_create_nonce('w3tc');
?>
'}" type="button" value="Test Closure Compiler" />
        <span class="minifier_test_status w3tc-status w3tc-process"></span>
    </td>
</tr>
<tr>
    <th><label for="minify_ccjs_options_compilation_level">Compilation level:</label></th>
    <td>
        <select id="minify_ccjs_options_compilation_level" class="js_enabled" name="minify.ccjs.options.compilation_level">
            <?php 
foreach ($compilation_levels as $compilation_level_key => $compilation_level_name) {
    ?>
            <option value="<?php 
    echo $compilation_level_key;
    ?>
 /**
  * edit_assignment_screen( $vars )
  *
  * Hooks into screen_handler
  * Edit assignment screen
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function edit_assignment_screen($vars)
 {
     global $bp;
     $nonce_name = 'edit_assignment';
     $updated_assignment_id = $this->current_assignment;
     $old_assignment = $this->is_assignment($this->current_assignment);
     if (!$this->has_assignment_caps($bp->loggedin_user->id) && !is_super_admin() || $bp->loggedin_user->id != $old_assignment->post_author) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to update the assignment.', 'bpsp');
         return $vars;
     }
     // Update assignment
     if (isset($_POST['assignment']) && $_POST['assignment']['object'] == 'group' && BPSP_Lectures::is_lecture($_POST['assignment']['lecture_id']) && isset($_POST['_nxtnonce'])) {
         $updated_assignment = $_POST['assignment'];
         $is_nonce = nxt_verify_nonce($_POST['_nxtnonce'], $nonce_name);
         if (true != $is_nonce) {
             $vars['error'] = __('Nonce Error while editing the assignment.', 'bpsp');
         } else {
             if (isset($updated_assignment['title']) && isset($updated_assignment['content']) && isset($updated_assignment['course_id']) && is_numeric($updated_assignment['group_id'])) {
                 $updated_assignment['title'] = strip_tags($updated_assignment['title']);
                 $updated_assignment_id = nxt_update_post(array('ID' => $old_assignment->ID, 'post_title' => $updated_assignment['title'], 'post_content' => $updated_assignment['content']));
                 if (is_object($updated_assignment_id) && isset($updated_assignment_id->ID)) {
                     $updated_assignment_id = $updated_assignment_id->ID;
                 }
                 if ($updated_assignment_id) {
                     nxt_set_post_terms($updated_assignment_id, $updated_assignment['course_id'], 'course_id');
                     if (strtotime($updated_assignment['due_date'])) {
                         update_post_meta($updated_assignment_id, 'due_date', $updated_assignment['due_date'], $old_assignment->due_date);
                     }
                     if (isset($updated_assignment['lecture_id'])) {
                         update_post_meta($updated_assignment_id, 'lecture_id', $updated_assignment['lecture_id']);
                     }
                     // Save the formbuilder
                     if (isset($updated_assignment['form']) && !empty($updated_assignment['form'])) {
                         $this->frmb->load_serialized($updated_assignment['form']);
                         if ($this->frmb->get_data()) {
                             update_post_meta($updated_assignment_id, 'form_data', $this->frmb->get_data(), $old_assignment->form_data);
                         }
                     }
                     $vars['message'] = __('Assignment was updated.', 'bpsp');
                     do_action('courseware_assignment_activity', $this->is_assignment($updated_assignment_id), 'update');
                 } else {
                     $vars['error'] = __('Assignment could not be updated.', 'bpsp');
                 }
             }
         }
     }
     $vars['name'] = 'edit_assignment';
     $vars['group_id'] = $bp->groups->current_group->id;
     $vars['user_id'] = $bp->loggedin_user->id;
     $vars['lecture_id'] = get_post_meta(isset($new_assignment_id) ? $new_assignment_id : $old_assignment->ID, 'lecture_id', true);
     $vars['lectures'] = BPSP_Lectures::has_lectures($bp->groups->current_group->id);
     $vars['assignment'] = $this->is_assignment($updated_assignment_id);
     $vars['assignment_edit_uri'] = $vars['current_uri'] . '/assignment/' . $this->current_assignment->post_name . '/edit/';
     $vars['assignment_delete_uri'] = $vars['current_uri'] . '/assignment/' . $this->current_assignment->post_name . '/delete/';
     $vars['assignment_permalink'] = $vars['current_uri'] . '/assignment/' . $this->current_assignment->post_name;
     $vars['nonce'] = nxt_nonce_field($nonce_name, '_nxtnonce', true, false);
     $vars['delete_nonce'] = add_query_arg('_nxtnonce', nxt_create_nonce('delete_assignment'), $vars['assignment_delete_uri']);
     $vars['trail'] = array($vars['assignment']->lecture->post_title => $vars['assignment']->lecture->permalink, __('Editing Assignment: ') . $vars['assignment']->post_title => $vars['assignment']->permalink);
     return $vars;
 }
 /**
  * bibs_screen()
  *
  * Hooks into courseware_below_* for handling bibs screen
  */
 function bibs_screen($vars)
 {
     global $bp;
     $nonce_name = 'bibs';
     $nonce_delete_name = 'delete_bib';
     $nonce_edit_name = 'edit_bib';
     // Are we dealing with courses or assignments?
     if (isset($vars['assignment'])) {
         $post_id = $vars['assignment']->ID;
     } elseif (isset($vars['course'])) {
         $post_id = $vars['course']->ID;
     } else {
         $post_id = null;
     }
     if ($post_id) {
         $this->current_parent = $post_id;
     }
     $is_nonce = isset($_POST['_nxtnonce']) ? nxt_verify_nonce($_POST['_nxtnonce'], $nonce_name) : false;
     if ($is_nonce && isset($_POST['bib'])) {
         if (!$this->has_bib_caps($bp->loggedin_user->id) && !is_super_admin()) {
             $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to add bibliography entries.', 'bpsp');
             return $vars;
         }
         // Add an existing bib
         if (isset($_POST['bib']['existing']) && !empty($_POST['bib']['existing'])) {
             $data = $this->get_bib($_POST['bib']['existing']);
             if ($this->add_bib($data, false, $post_id)) {
                 $vars['message'] = __('Bibliography added', 'bpsp');
             } else {
                 $vars['error'] = __('Bibliography could not be added', 'bpsp');
             }
         } elseif (!empty($_POST['bib']['www']['title']) && !empty($_POST['bib']['www']['url'])) {
             if ($this->add_www($_POST['bib']['www'], $post_id)) {
                 $vars['message'] = __('Entry added', 'bpsp');
             } else {
                 $vars['error'] = __('Entry could not be added', 'bpsp');
             }
         } elseif (!empty($_POST['bib']['book'])) {
             if ($this->add_book($_POST['bib']['book'], $post_id)) {
                 $vars['message'] = __('Book added', 'bpsp');
             } else {
                 $vars['error'] = __('Book could not be added', 'bpsp');
             }
         } else {
             $vars['error'] = __('No bibliography entry could be added.', 'bpsp');
         }
     }
     if (isset($vars['course']) && $vars['course']->ID) {
         $this->current_parent = $vars['course']->ID;
     }
     if (isset($vars['assignment']) && $vars['assignment']->ID) {
         $this->current_parent = $vars['assignment']->ID;
     }
     $vars['has_bibs'] = true;
     $vars['post_id'] = $this->current_parent;
     $vars['has_bib_caps'] = $this->has_bib_caps($bp->loggedin_user->id);
     $vars['bibs'] = $this->has_bibs($this->current_parent);
     $vars['bibdb'] = $this->load_bibs(true);
     $vars['bibs_nonce'] = nxt_nonce_field($nonce_name, '_nxtnonce', true, false);
     $vars['bibs_delete_permalink'] = $vars['current_uri'] . '/delete_bibliography';
     $vars['bibs_edit_permalink'] = $vars['current_uri'] . '/edit_bibliography';
     $vars['bibs_delete_uri'] = add_query_arg('_nxtnonce', nxt_create_nonce($nonce_delete_name), $vars['bibs_delete_permalink']);
     $vars['bibs_edit_uri'] = $vars['current_uri'] . '/edit_bibliography';
     return $vars;
 }
function woo_admin_head()
{
    ?>
		<script type="text/javascript">
			jQuery(document).ready( function() {
				// Create sanitary variable for use in the JavaScript conditional.
				<?php 
    $is_reset = 'false';
    if (isset($_REQUEST['reset'])) {
        $is_reset = $_REQUEST['reset'];
        $is_reset = strtolower(strip_tags(trim($is_reset)));
    } else {
        $is_reset = 'false';
    }
    // End IF Statement
    ?>
			if( '<?php 
    echo $is_reset;
    ?>
' == 'true' ) {

				var reset_popup = jQuery( '#woo-popup-reset' );
				reset_popup.fadeIn();
				window.setTimeout(function() {
					   reset_popup.fadeOut();
					}, 2000);
			}

			//Update Message popup
			jQuery.fn.center = function () {
				this.animate({"top":( jQuery(window).height() - this.height() - 200 ) / 2+jQuery(window).scrollTop() + "px"},100);
				this.css( "left", 250 );
				return this;
			}

			jQuery( '#woo-popup-save' ).center();
			jQuery( '#woo-popup-reset' ).center();
			jQuery(window).scroll(function() {

				jQuery( '#woo-popup-save' ).center();
				jQuery( '#woo-popup-reset' ).center();

			});

			//Save everything else
			jQuery( '#wooform' ).submit(function() {

					function newValues() {
					  var serializedValues = jQuery( "#wooform *").not( '.woo-ignore').serialize();
					  return serializedValues;
					}
					jQuery( ":checkbox, :radio").click(newValues);
					jQuery( "select").change(newValues);
					jQuery( '.ajax-loading-img').fadeIn();
					var serializedReturn = newValues();

					// var ajax_url = '<?php 
    echo admin_url("admin-ajax.php");
    ?>
';

					 //var data = {data : serializedReturn};
					var data = {
						<?php 
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes') {
        ?>
						type: 'options',
						<?php 
    }
    ?>
						<?php 
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes_framework_settings') {
        ?>
						type: 'framework',
						<?php 
    }
    ?>
						<?php 
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes_seo') {
        ?>
						type: 'seo',
						<?php 
    }
    ?>
						<?php 
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'woothemes_tumblog') {
        ?>
						type: 'tumblog',
						<?php 
    }
    ?>

						action: 'woo_ajax_post_action',
						data: serializedReturn,

						<?php 
    // Nonce Security
    ?>
						<?php 
    if (function_exists('nxt_create_nonce')) {
        $woo_nonce = nxt_create_nonce('wooframework-theme-options-update');
    }
    // End IF Statement
    ?>

						_ajax_nonce: '<?php 
    echo $woo_nonce;
    ?>
'
					};

					jQuery.post(ajaxurl, data, function(response) {

						var success = jQuery( '#woo-popup-save' );
						var loading = jQuery( '.ajax-loading-img' );
						loading.fadeOut();
						success.fadeIn();
						window.setTimeout(function() {
						   success.fadeOut();
						}, 2000);
					});

					return false;

				});

			});
		</script>

<?php 
}
 /**
  * single_response_screen( $vars )
  *
  * Hooks into screen_handler
  * Displays a single response screen
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function single_response_screen($vars)
 {
     global $bp;
     $nonce_delete_name = 'response_delete';
     $response = null;
     if (!empty($this->current_response)) {
         $response = $this->current_response;
     } else {
         $response = $this->has_response();
     }
     if ($this->group_responses_status() && !$this->has_response_caps() && $bp->loggedin_user->id != $response->post_author) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to access a private response.', 'bpsp');
         return $vars;
     }
     $vars['name'] = 'single_response';
     $vars['assignment_permalink'] = $vars['current_uri'] . '/assignment/' . $this->current_assignment->post_name;
     $vars['assignment'] = $this->current_assignment;
     $vars['response'] = $response;
     if (is_super_admin() || $this->has_response_caps()) {
         $vars['response_delete_permalink'] = $vars['assignment_permalink'] . '/response/' . $response->post_name . '/delete';
         $vars['response_delete_uri'] = add_query_arg('_nxtnonce', nxt_create_nonce($nonce_delete_name), $vars['response_delete_permalink']);
     }
     $vars['trail'] = array($this->current_assignment->lecture->post_title => $this->current_assignment->lecture->permalink, $this->current_assignment->post_title => $this->current_assignment->permalink, $response->post_title => '');
     return apply_filters('courseware_response', $vars);
 }
    function column_comment($comment)
    {
        global $post, $comment_status;
        $user_can = $this->user_can;
        $comment_url = esc_url(get_comment_link($comment->comment_ID));
        $the_comment_status = nxt_get_comment_status($comment->comment_ID);
        $ptime = date('G', strtotime($comment->comment_date));
        if (abs(time() - $ptime) < 86400) {
            $ptime = sprintf(__('%s ago'), human_time_diff($ptime));
        } else {
            $ptime = mysql2date(__('Y/m/d \\a\\t g:i A'), $comment->comment_date);
        }
        if ($user_can) {
            $del_nonce = esc_html('_nxtnonce=' . nxt_create_nonce("delete-comment_{$comment->comment_ID}"));
            $approve_nonce = esc_html('_nxtnonce=' . nxt_create_nonce("approve-comment_{$comment->comment_ID}"));
            $url = "comment.php?c={$comment->comment_ID}";
            $approve_url = esc_url($url . "&action=approvecomment&{$approve_nonce}");
            $unapprove_url = esc_url($url . "&action=unapprovecomment&{$approve_nonce}");
            $spam_url = esc_url($url . "&action=spamcomment&{$del_nonce}");
            $unspam_url = esc_url($url . "&action=unspamcomment&{$del_nonce}");
            $trash_url = esc_url($url . "&action=trashcomment&{$del_nonce}");
            $untrash_url = esc_url($url . "&action=untrashcomment&{$del_nonce}");
            $delete_url = esc_url($url . "&action=deletecomment&{$del_nonce}");
        }
        echo '<div class="submitted-on">';
        /* translators: 2: comment date, 3: comment time */
        printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), $comment_url, get_comment_date(__('Y/m/d')), get_comment_date(get_option('time_format')));
        if ($comment->comment_parent) {
            $parent = get_comment($comment->comment_parent);
            $parent_link = esc_url(get_comment_link($comment->comment_parent));
            $name = get_comment_author($parent->comment_ID);
            printf(' | ' . __('In reply to <a href="%1$s">%2$s</a>.'), $parent_link, $name);
        }
        echo '</div>';
        comment_text();
        if ($user_can) {
            ?>
		<div id="inline-<?php 
            echo $comment->comment_ID;
            ?>
" class="hidden">
		<textarea class="comment" rows="1" cols="1"><?php 
            echo esc_textarea(apply_filters('comment_edit_pre', $comment->comment_content));
            ?>
</textarea>
		<div class="author-email"><?php 
            echo esc_attr($comment->comment_author_email);
            ?>
</div>
		<div class="author"><?php 
            echo esc_attr($comment->comment_author);
            ?>
</div>
		<div class="author-url"><?php 
            echo esc_attr($comment->comment_author_url);
            ?>
</div>
		<div class="comment_status"><?php 
            echo $comment->comment_approved;
            ?>
</div>
		</div>
		<?php 
        }
        if ($user_can) {
            // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
            $actions = array('approve' => '', 'unapprove' => '', 'reply' => '', 'quickedit' => '', 'edit' => '', 'spam' => '', 'unspam' => '', 'trash' => '', 'untrash' => '', 'delete' => '');
            if ($comment_status && 'all' != $comment_status) {
                // not looking at all comments
                if ('approved' == $the_comment_status) {
                    $actions['unapprove'] = "<a href='{$unapprove_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . esc_attr__('Unapprove this comment') . "'>" . __('Unapprove') . '</a>';
                } else {
                    if ('unapproved' == $the_comment_status) {
                        $actions['approve'] = "<a href='{$approve_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . esc_attr__('Approve this comment') . "'>" . __('Approve') . '</a>';
                    }
                }
            } else {
                $actions['approve'] = "<a href='{$approve_url}' class='dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__('Approve this comment') . "'>" . __('Approve') . '</a>';
                $actions['unapprove'] = "<a href='{$unapprove_url}' class='dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__('Unapprove this comment') . "'>" . __('Unapprove') . '</a>';
            }
            if ('spam' != $the_comment_status && 'trash' != $the_comment_status) {
                $actions['spam'] = "<a href='{$spam_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}::spam=1 vim-s vim-destructive' title='" . esc_attr__('Mark this comment as spam') . "'>" . _x('Spam', 'verb') . '</a>';
            } elseif ('spam' == $the_comment_status) {
                $actions['unspam'] = "<a href='{$unspam_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1 vim-z vim-destructive'>" . _x('Not Spam', 'comment') . '</a>';
            } elseif ('trash' == $the_comment_status) {
                $actions['untrash'] = "<a href='{$untrash_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1 vim-z vim-destructive'>" . __('Restore') . '</a>';
            }
            if ('spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS) {
                $actions['delete'] = "<a href='{$delete_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
            } else {
                $actions['trash'] = "<a href='{$trash_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}::trash=1 delete vim-d vim-destructive' title='" . esc_attr__('Move this comment to the trash') . "'>" . _x('Trash', 'verb') . '</a>';
            }
            if ('spam' != $the_comment_status && 'trash' != $the_comment_status) {
                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>" . __('Edit') . '</a>';
                $actions['quickedit'] = '<a onclick="commentReply.open( \'' . $comment->comment_ID . '\',\'' . $post->ID . '\',\'edit\' );return false;" class="vim-q" title="' . esc_attr__('Quick Edit') . '" href="#">' . __('Quick&nbsp;Edit') . '</a>';
                $actions['reply'] = '<a onclick="commentReply.open( \'' . $comment->comment_ID . '\',\'' . $post->ID . '\' );return false;" class="vim-r" title="' . esc_attr__('Reply to this comment') . '" href="#">' . __('Reply') . '</a>';
            }
            $actions = apply_filters('comment_row_actions', array_filter($actions), $comment);
            $i = 0;
            echo '<div class="row-actions">';
            foreach ($actions as $action => $link) {
                ++$i;
                ('approve' == $action || 'unapprove' == $action) && 2 === $i || 1 === $i ? $sep = '' : ($sep = ' | ');
                // Reply and quickedit need a hide-if-no-js span when not added with ajax
                if (('reply' == $action || 'quickedit' == $action) && !defined('DOING_AJAX')) {
                    $action .= ' hide-if-no-js';
                } elseif ($action == 'untrash' && $the_comment_status == 'trash' || $action == 'unspam' && $the_comment_status == 'spam') {
                    if ('1' == get_comment_meta($comment->comment_ID, '_nxt_trash_meta_status', true)) {
                        $action .= ' approve';
                    } else {
                        $action .= ' unapprove';
                    }
                }
                echo "<span class='{$action}'>{$sep}{$link}</span>";
            }
            echo '</div>';
        }
    }
/**
 * Adds AJAX to the GA settings page
 **/
function ga_admin_ajax()
{
    if (function_exists('register_widget')) {
        # Only attempt to replace code if we're authenticated or attempting to authenticate
        if (isset($_REQUEST['token']) && $_REQUEST['token'] != '' || trim(get_option('ga_google_token')) != '') {
            ?>
		<script type="text/javascript">
	
			jQuery(document).ready(function(){
			
				// Grab the widget data
				jQuery.ajax({
					type: 'post',
					url: 'admin-ajax.php',
					data: {
						action: 'ga_ajax_accounts',
						_ajax_nonce: '<?php 
            echo nxt_create_nonce("google-analyticator-accounts_get");
            ?>
'<?php 
            if (isset($_GET['token'])) {
                ?>
,
						token: '<?php 
                echo esc_js($_GET["token"]);
                ?>
'
						<?php 
            }
            ?>
					},
					success: function(html) {
						if ( html != '' )
							jQuery('#ga_ajax_accounts').html(html);
						else
							jQuery('#ga_connect_error').show();
					}
				});
		
			});
	
		</script>
		<?php 
        }
    }
}
Exemple #11
0
function _nxt_dashboard_recent_comments_row(&$comment, $show_date = true)
{
    $GLOBALS['comment'] =& $comment;
    $comment_post_url = get_edit_post_link($comment->comment_post_ID);
    $comment_post_title = strip_tags(get_the_title($comment->comment_post_ID));
    $comment_post_link = "<a href='{$comment_post_url}'>{$comment_post_title}</a>";
    $comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
    $actions_string = '';
    if (current_user_can('edit_comment', $comment->comment_ID)) {
        // preorder it: Approve | Reply | Edit | Spam | Trash
        $actions = array('approve' => '', 'unapprove' => '', 'reply' => '', 'edit' => '', 'spam' => '', 'trash' => '', 'delete' => '');
        $del_nonce = esc_html('_nxtnonce=' . nxt_create_nonce("delete-comment_{$comment->comment_ID}"));
        $approve_nonce = esc_html('_nxtnonce=' . nxt_create_nonce("approve-comment_{$comment->comment_ID}"));
        $approve_url = esc_url("comment.php?action=approvecomment&p={$comment->comment_post_ID}&c={$comment->comment_ID}&{$approve_nonce}");
        $unapprove_url = esc_url("comment.php?action=unapprovecomment&p={$comment->comment_post_ID}&c={$comment->comment_ID}&{$approve_nonce}");
        $spam_url = esc_url("comment.php?action=spamcomment&p={$comment->comment_post_ID}&c={$comment->comment_ID}&{$del_nonce}");
        $trash_url = esc_url("comment.php?action=trashcomment&p={$comment->comment_post_ID}&c={$comment->comment_ID}&{$del_nonce}");
        $delete_url = esc_url("comment.php?action=deletecomment&p={$comment->comment_post_ID}&c={$comment->comment_ID}&{$del_nonce}");
        $actions['approve'] = "<a href='{$approve_url}' class='dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__('Approve this comment') . "'>" . __('Approve') . '</a>';
        $actions['unapprove'] = "<a href='{$unapprove_url}' class='dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__('Unapprove this comment') . "'>" . __('Unapprove') . '</a>';
        $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>" . __('Edit') . '</a>';
        $actions['reply'] = '<a onclick="commentReply.open(\'' . $comment->comment_ID . '\',\'' . $comment->comment_post_ID . '\');return false;" class="vim-r hide-if-no-js" title="' . esc_attr__('Reply to this comment') . '" href="#">' . __('Reply') . '</a>';
        $actions['spam'] = "<a href='{$spam_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}::spam=1 vim-s vim-destructive' title='" . esc_attr__('Mark this comment as spam') . "'>" . _x('Spam', 'verb') . '</a>';
        if (!EMPTY_TRASH_DAYS) {
            $actions['delete'] = "<a href='{$delete_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}::trash=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
        } else {
            $actions['trash'] = "<a href='{$trash_url}' class='delete:the-comment-list:comment-{$comment->comment_ID}::trash=1 delete vim-d vim-destructive' title='" . esc_attr__('Move this comment to the trash') . "'>" . _x('Trash', 'verb') . '</a>';
        }
        $actions = apply_filters('comment_row_actions', array_filter($actions), $comment);
        $i = 0;
        foreach ($actions as $action => $link) {
            ++$i;
            ('approve' == $action || 'unapprove' == $action) && 2 === $i || 1 === $i ? $sep = '' : ($sep = ' | ');
            // Reply and quickedit need a hide-if-no-js span
            if ('reply' == $action || 'quickedit' == $action) {
                $action .= ' hide-if-no-js';
            }
            $actions_string .= "<span class='{$action}'>{$sep}{$link}</span>";
        }
    }
    ?>

		<div id="comment-<?php 
    echo $comment->comment_ID;
    ?>
" <?php 
    comment_class(array('comment-item', nxt_get_comment_status($comment->comment_ID)));
    ?>
>
			<?php 
    if (!$comment->comment_type || 'comment' == $comment->comment_type) {
        ?>

			<?php 
        echo get_avatar($comment, 50);
        ?>

			<div class="dashboard-comment-wrap">
			<h4 class="comment-meta">
				<?php 
        printf(__('From %1$s on %2$s%3$s'), '<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link . ' ' . $comment_link, ' <span class="approve">' . __('[Pending]') . '</span>');
        ?>
			</h4>

			<?php 
    } else {
        switch ($comment->comment_type) {
            case 'pingback':
                $type = __('Pingback');
                break;
            case 'trackback':
                $type = __('Trackback');
                break;
            default:
                $type = ucwords($comment->comment_type);
        }
        $type = esc_html($type);
        ?>
			<div class="dashboard-comment-wrap">
			<?php 
        /* translators: %1$s is type of comment, %2$s is link to the post */
        ?>
			<h4 class="comment-meta"><?php 
        printf(_x('%1$s on %2$s', 'dashboard'), "<strong>{$type}</strong>", $comment_post_link . " " . $comment_link);
        ?>
</h4>
			<p class="comment-author"><?php 
        comment_author_link();
        ?>
</p>

			<?php 
    }
    // comment_type
    ?>
			<blockquote><p><?php 
    comment_excerpt();
    ?>
</p></blockquote>
			<p class="row-actions"><?php 
    echo $actions_string;
    ?>
</p>
			</div>
		</div>
<?php 
}
Exemple #12
0
/**
 * Parse the NXTClass request.  If the query var 'openid' is present, then
 * handle the request accordingly.
 *
 * @param nxt $nxt nxt instance for the current request
 */
function openid_parse_request($nxt)
{
    if (array_key_exists('openid', $nxt->query_vars)) {
        openid_clean_request();
        switch ($nxt->query_vars['openid']) {
            case 'consumer':
                @session_start();
                $action = $_SESSION['openid_action'];
                // no action, which probably means OP-initiated login.  Set
                // action to 'login', and redirect to home page when finished
                if (empty($action)) {
                    $action = 'login';
                    if (empty($_SESSION['openid_finish_url'])) {
                        //$_SESSION['openid_finish_url'] = get_option('home');
                    }
                }
                finish_openid($action);
                break;
            case 'server':
                openid_server_request($_REQUEST['action']);
                break;
            case 'ajax':
                if (check_admin_referer('openid_ajax')) {
                    header('Content-Type: application/json');
                    echo '{ "valid":' . (is_url_openid($_REQUEST['url']) ? 'true' : 'false') . ', "nonce":"' . nxt_create_nonce('openid_ajax') . '" }';
                    exit;
                }
        }
    }
}
/**
 * @since 0.1.0
 */
function members_content_permissions_meta_box($object, $box)
{
    global $nxt_roles;
    /* Get the roles saved for the post. */
    $roles = get_post_meta($object->ID, '_members_access_role', false);
    /* Convert old post meta to the new system if no roles were found. */
    if (empty($roles)) {
        $roles = members_convert_old_post_meta($object->ID);
    }
    ?>

	<input type="hidden" name="content_permissions_meta_nonce" value="<?php 
    echo nxt_create_nonce(plugin_basename(__FILE__));
    ?>
" />

	<div style="overflow: hidden; margin-left: 5px;">

		<p>
		<?php 
    _e("Limit access to this post's content to users of the selected roles.", 'members');
    ?>
		</p>

		<?php 
    /* Loop through each of the available roles. */
    foreach ($nxt_roles->role_names as $role => $name) {
        $checked = false;
        /* If the role has been selected, make sure it's checked. */
        if (is_array($roles) && in_array($role, $roles)) {
            $checked = ' checked="checked" ';
        }
        ?>

			<div style="width: 32%; float: left; margin: 0 0 5px 0;">
				<label for="members_access_role-<?php 
        echo $role;
        ?>
">
					<input type="checkbox" name="members_access_role[<?php 
        echo $role;
        ?>
]" id="members_access_role-<?php 
        echo $role;
        ?>
" <?php 
        echo $checked;
        ?>
 value="<?php 
        echo $role;
        ?>
" /> 
					<?php 
        echo esc_html($name);
        ?>
				</label>
			</div>
		<?php 
    }
    ?>

	</div>

	<p style="clear: left;">
		<span class="howto"><?php 
    printf(__('If no roles are selected, everyone can view the content. The post author, any users who can edit this post, and users with the %s capability can view the content regardless of role.', 'members'), '<code>restrict_content</code>');
    ?>
</span>
	</p>

	<p>
		<label for="members_access_error"><?php 
    _e('Custom error messsage:', 'members');
    ?>
</label>
		<textarea id="members_access_error" name="members_access_error" cols="60" rows="2" tabindex="30" style="width: 99%;"><?php 
    echo esc_html(get_post_meta($object->ID, '_members_access_error', true));
    ?>
</textarea>
		<br />
		<span class="howto"><?php 
    _e('Message shown to users that do no have permission to view the post.', 'members');
    ?>
</span>
	</p>

<?php 
}
function woothemes_framework_settings_page()
{
    $themename = get_option('woo_themename');
    $manualurl = get_option('woo_manual');
    $shortname = 'framework_woo';
    //Framework Version in Backend Head
    $woo_framework_version = get_option('woo_framework_version');
    //Version in Backend Head
    $theme_data = get_theme_data(get_template_directory() . '/style.css');
    $local_version = $theme_data['Version'];
    //GET themes update RSS feed and do magic
    include_once ABSPATH . nxtINC . '/feed.php';
    $pos = strpos($manualurl, 'documentation');
    $theme_slug = str_replace("/", '', substr($manualurl, $pos + 13));
    //13 for the word documentation
    //add filter to make the rss read cache clear every 4 hours
    add_filter('nxt_feed_cache_transient_lifetime', create_function('$a', 'return 14400;'));
    $framework_options = array();
    $framework_options[] = array('name' => __('Admin Settings', 'woothemes'), 'icon' => 'general', 'type' => 'heading');
    $framework_options[] = array('name' => __('Super User (username)', 'woothemes'), 'desc' => sprintf(__('Enter your %s to hide the Framework Settings and Update Framework from other users. Can be reset from the %s under %s.', 'woothemes'), '<strong>' . __('username', 'woothemes') . '</strong>', '<a href="' . admin_url('options.php') . '">' . __('nxt options page', 'woothemes') . '</a>', '<code>framework_woo_super_user</code>'), 'id' => $shortname . '_super_user', 'std' => '', 'class' => 'text', 'type' => 'text');
    $framework_options[] = array('name' => __('Disable SEO Menu Item', 'woothemes'), 'desc' => sprintf(__('Disable the %s menu item in the theme menu.', 'woothemes'), '<strong>' . __('SEO', 'woothemes') . '</strong>'), 'id' => $shortname . '_seo_disable', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Disable Sidebar Manager Menu Item', 'woothemes'), 'desc' => sprintf(__('Disable the %s menu item in the theme menu.', 'woothemes'), '<strong>' . __('Sidebar Manager', 'woothemes') . '</strong>'), 'id' => $shortname . '_sbm_disable', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Disable Backup Settings Menu Item', 'woothemes'), 'desc' => sprintf(__('Disable the %s menu item in the theme menu.', 'woothemes'), '<strong>' . __('Backup Settings', 'woothemes') . '</strong>'), 'id' => $shortname . '_backupmenu_disable', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Disable Buy Themes Menu Item', 'woothemes'), 'desc' => sprintf(__('Disable the %s menu item in the theme menu.', 'woothemes'), '<strong>' . __('Buy Themes', 'woothemes') . '</strong>'), 'id' => $shortname . '_buy_themes_disable', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Enable Custom Navigation', 'woothemes'), 'desc' => sprintf(__('Enable the old %s menu item. Try to use %s instead, as this function is outdated.', 'woothemes'), '<strong>' . __('Custom Navigation', 'woothemes') . '</strong>', '<a href="' . admin_url('nav-menus.php') . '">' . __('nxt Menus', 'woothemes') . '</a>'), 'id' => $shortname . '_woonav', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Theme Update Notification', 'woothemes'), 'desc' => __('This will enable notices on your theme options page that there is an update available for your theme.', 'woothemes'), 'id' => $shortname . '_theme_version_checker', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('WooFramework Update Notification', 'woothemes'), 'desc' => __('This will enable notices on your theme options page that there is an update available for the WooFramework.', 'woothemes'), 'id' => $shortname . '_framework_version_checker', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Theme Settings', 'woothemes'), 'icon' => 'general', 'type' => 'heading');
    $framework_options[] = array('name' => __('Remove Generator Meta Tags', 'woothemes'), 'desc' => __('This disables the output of generator meta tags in the HEAD section of your site.', 'woothemes'), 'id' => $shortname . '_disable_generator', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Image Placeholder', 'woothemes'), 'desc' => __('Set a default image placeholder for your thumbnails. Use this if you want a default image to be shown if you haven\'t added a custom image to your post.', 'woothemes'), 'id' => $shortname . '_default_image', 'std' => '', 'type' => 'upload');
    $framework_options[] = array('name' => __('Disable Shortcodes Stylesheet', 'woothemes'), 'desc' => __('This disables the output of shortcodes.css in the HEAD section of your site.', 'woothemes'), 'id' => $shortname . '_disable_shortcodes', 'std' => '', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Output "Tracking Code" Option in Header', 'woothemes'), 'desc' => sprintf(__('This will output the %s option in your header instead of the footer of your website.', 'woothemes'), '<strong>' . __('Tracking Code', 'woothemes') . '</strong>'), 'id' => $shortname . '_move_tracking_code', 'std' => 'false', 'type' => 'checkbox');
    $framework_options[] = array('name' => __('Branding', 'woothemes'), 'icon' => 'misc', 'type' => 'heading');
    $framework_options[] = array('name' => __('Options panel header', 'woothemes'), 'desc' => __('Change the header image for the WooThemes Backend.', 'woothemes'), 'id' => $shortname . '_backend_header_image', 'std' => '', 'type' => 'upload');
    $framework_options[] = array('name' => __('Options panel icon', 'woothemes'), 'desc' => __('Change the icon image for the NXTClass backend sidebar.', 'woothemes'), 'id' => $shortname . '_backend_icon', 'std' => '', 'type' => 'upload');
    $framework_options[] = array('name' => __('NXTClass login logo', 'woothemes'), 'desc' => __('Change the logo image for the NXTClass login page.', 'woothemes'), 'id' => $shortname . '_custom_login_logo', 'std' => '', 'type' => 'upload');
    $framework_options[] = array('name' => __('NXTClass login URL', 'woothemes'), 'desc' => __('Change the URL that the logo image on the NXTClass login page links to.', 'woothemes'), 'id' => $shortname . '_custom_login_logo_url', 'std' => '', 'class' => 'text', 'type' => 'text');
    $framework_options[] = array('name' => __('NXTClass login logo Title', 'woothemes'), 'desc' => __('Change the title of the logo image on the NXTClass login page.', 'woothemes'), 'id' => $shortname . '_custom_login_logo_title', 'std' => '', 'class' => 'text', 'type' => 'text');
    /*
    	$framework_options[] = array( 	'name' => __( 'Font Stacks (Beta)', 'woothemes' ),
    									'icon' => 'typography',
    									'type' => 'heading' );
    
    	$framework_options[] = array( 	'name' => __( 'Font Stack Builder', 'woothemes' ),
    									'desc' => __( 'Use the font stack builder to add your own custom font stacks to your theme.
    									To create a new stack, fill in the name and a CSS ready font stack.
    									Once you have added a stack you can select it from the font menu on any of the
    									Typography settings in your theme options.', 'woothemes' ),
    									'id' => $shortname . '_font_stack',
    									'std' => 'Added Font Stacks',
    									'type' => 'string_builder" );
    */
    global $nxt_version;
    if ($nxt_version >= '3.1') {
        $framework_options[] = array('name' => __('NXTClass Toolbar', 'woothemes'), 'icon' => 'header', 'type' => 'heading');
        $framework_options[] = array('name' => __('Disable NXTClass Toolbar', 'woothemes'), 'desc' => __('Disable the NXTClass Toolbar.', 'woothemes'), 'id' => $shortname . '_admin_bar_disable', 'std' => '', 'type' => 'checkbox');
        $framework_options[] = array('name' => __('Enable the WooFramework Toolbar enhancements', 'woothemes'), 'desc' => __('Enable several WooFramework-specific enhancements to the NXTClass Toolbar, such as custom navigation items for "Theme Options".', 'woothemes'), 'id' => $shortname . '_admin_bar_enhancements', 'std' => '', 'type' => 'checkbox');
    }
    // PressTrends Integration
    if (defined('WOO_PRESSTRENDS_THEMEKEY')) {
        $framework_options[] = array('name' => __('PressTrends', 'woothemes'), 'icon' => 'presstrends', 'type' => 'heading');
        $framework_options[] = array('name' => __('Enable PressTrends Tracking', 'woothemes'), 'desc' => __('Enable sending of usage data to PressTrends.', 'woothemes'), 'id' => $shortname . '_presstrends_enable', 'std' => 'false', 'type' => 'checkbox');
        $framework_options[] = array('name' => __('What is PressTrends?', 'woothemes'), 'desc' => '', 'id' => $shortname . '_presstrends_info', 'std' => sprintf(__('PressTrends is a simple usage tracker that allows us to see how our customers are using WooThemes themes - so that we can help improve them for you. %sNone%s of your personal data is sent to PressTrends.%sFor more information, please view the PressTrends %s.', 'woothemes'), '<strong>', '</strong>', '<br /><br />', '<a href="http://presstrends.io/privacy" target="_blank">' . __('privacy policy', 'woothemes') . '</a>'), 'type' => 'info');
    }
    update_option('woo_framework_template', $framework_options);
    ?>

    <div class="wrap" id="woo_container">
    <div id="woo-popup-save" class="woo-save-popup"><div class="woo-save-save"><?php 
    _e('Options Updated', 'woothemes');
    ?>
</div></div>
    <div id="woo-popup-reset" class="woo-save-popup"><div class="woo-save-reset"><?php 
    _e('Options Reset', 'woothemes');
    ?>
</div></div>
        <form action='' enctype="multipart/form-data" id="wooform" method="post">
        <?php 
    // Add nonce for added security.
    if (function_exists('nxt_nonce_field')) {
        nxt_nonce_field('wooframework-framework-options-update');
    }
    // End IF Statement
    $woo_nonce = '';
    if (function_exists('nxt_create_nonce')) {
        $woo_nonce = nxt_create_nonce('wooframework-framework-options-update');
    }
    // End IF Statement
    if ($woo_nonce == '') {
    } else {
        ?>
	    	<input type="hidden" name="_ajax_nonce" value="<?php 
        echo $woo_nonce;
        ?>
" />
	    <?php 
    }
    // End IF Statement
    ?>
            <div id="header">
                <div class="logo">
                <?php 
    if (get_option('framework_woo_backend_header_image')) {
        ?>
                <img alt="" src="<?php 
        echo get_option('framework_woo_backend_header_image');
        ?>
"/>
                <?php 
    } else {
        ?>
                <img alt="WooThemes" src="<?php 
        echo get_template_directory_uri();
        ?>
/functions/images/logo.png"/>
                <?php 
    }
    ?>
                </div>
                <div class="theme-info">
                    <span class="theme"><?php 
    echo $themename;
    ?>
 <?php 
    echo $local_version;
    ?>
</span>
                    <span class="framework"><?php 
    printf(__('Framework %s', 'woothemes'), $woo_framework_version);
    ?>
</span>
                </div>
                <div class="clear"></div>
            </div>
            <div id="support-links">
                <ul>
                    <li class="changelog"><a title="Theme Changelog" href="<?php 
    echo $manualurl;
    ?>
#Changelog"><?php 
    _e('View Changelog', 'woothemes');
    ?>
</a></li>
                    <li class="docs"><a title="Theme Documentation" href="<?php 
    echo $manualurl;
    ?>
"><?php 
    _e('View Themedocs', 'woothemes');
    ?>
</a></li>
                    <li class="forum"><a href="http://www.woothemes.com/support-forum" target="_blank"><?php 
    _e('Visit Forum', 'woothemes');
    ?>
</a></li>
                    <li class="right"><img style="display:none" src="<?php 
    echo get_template_directory_uri();
    ?>
/functions/images/loading-top.gif" class="ajax-loading-img ajax-loading-img-top" alt="<?php 
    esc_attr_e('Working...', 'woothemes');
    ?>
" /><a href="#" id="expand_options">[+]</a> <input type="submit" value="<?php 
    esc_attr_e('Save All Changes', 'woothemes');
    ?>
" class="button submit-button" /></li>
                </ul>
            </div>
            <?php 
    $return = woothemes_machine($framework_options);
    ?>
            <div id="main">
                <div id="woo-nav">
                    <ul>
                        <?php 
    echo $return[1];
    ?>
                    </ul>
                </div>
                <div id="content">
   				<?php 
    echo $return[0];
    ?>
                </div>
                <div class="clear"></div>

            </div>
            <div class="save_bar_top">
            <input type="hidden" name="woo_save" value="save" />
            <img style="display:none" src="<?php 
    echo get_template_directory_uri();
    ?>
/functions/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="<?php 
    esc_attr_e('Working...', 'woothemes');
    ?>
" />
            <input type="submit" value="<?php 
    esc_attr_e('Save All Changes', 'woothemes');
    ?>
" class="button submit-button" />
            </form>

            <form action="<?php 
    echo esc_attr($_SERVER['REQUEST_URI']);
    ?>
" method="post" style="display:inline" id="wooform-reset">
            <?php 
    // Add nonce for added security.
    if (function_exists('nxt_nonce_field')) {
        nxt_nonce_field('wooframework-framework-options-reset');
    }
    // End IF Statement
    $woo_nonce = '';
    if (function_exists('nxt_create_nonce')) {
        $woo_nonce = nxt_create_nonce('wooframework-framework-options-reset');
    }
    // End IF Statement
    if ($woo_nonce == '') {
    } else {
        ?>
		    	<input type="hidden" name="_ajax_nonce" value="<?php 
        echo $woo_nonce;
        ?>
" />
		    <?php 
    }
    // End IF Statement
    ?>
            <span class="submit-footer-reset">
<!--             <input name="reset" type="submit" value="<?php 
    esc_attr_e('Reset Options', 'woothemes');
    ?>
" class="button submit-button reset-button" onclick="return confirm( '<?php 
    esc_attr_e('Click OK to reset. Any settings will be lost!', 'woothemes');
    ?>
' );" /> -->
            <input type="hidden" name="woo_save" value="reset" />
            </span>
        	</form>


            </div>

    <div style="clear:both;"></div>
    </div><!--wrap-->
<?php 
}
Exemple #15
0
/**
 * Process the signup nonce created in signup_nonce_fields().
 *
 * @since MU
 * @uses nxt_create_nonce()
 *
 * @param array $result
 * @return array
 */
function signup_nonce_check($result)
{
    if (!strpos($_SERVER['PHP_SELF'], 'nxt-signup.php')) {
        return $result;
    }
    if (nxt_create_nonce('signup_form_' . $_POST['signup_form_id']) != $_POST['_signup_form']) {
        nxt_die(__('Please try again!'));
    }
    return $result;
}
Exemple #16
0
/**
 * Retrieve or display nonce hidden field for forms.
 *
 * The nonce field is used to validate that the contents of the form came from
 * the location on the current site and not somewhere else. The nonce does not
 * offer absolute protection, but should protect against most cases. It is very
 * important to use nonce field in forms.
 *
 * The $action and $name are optional, but if you want to have better security,
 * it is strongly suggested to set those two parameters. It is easier to just
 * call the function without any parameters, because validation of the nonce
 * doesn't require any parameters, but since crackers know what the default is
 * it won't be difficult for them to find a way around your nonce and cause
 * damage.
 *
 * The input name will be whatever $name value you gave. The input value will be
 * the nonce creation value.
 *
 * @package NXTClass
 * @subpackage Security
 * @since 2.0.4
 *
 * @param string $action Optional. Action name.
 * @param string $name Optional. Nonce name.
 * @param bool $referer Optional, default true. Whether to set the referer field for validation.
 * @param bool $echo Optional, default true. Whether to display or return hidden form field.
 * @return string Nonce field.
 */
function nxt_nonce_field($action = -1, $name = "_nxtnonce", $referer = true, $echo = true)
{
    $name = esc_attr($name);
    $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . nxt_create_nonce($action) . '" />';
    if ($referer) {
        $nonce_field .= nxt_referer_field(false);
    }
    if ($echo) {
        echo $nonce_field;
    }
    return $nonce_field;
}
function woothemes_seo_page()
{
    $themename = get_option('woo_themename');
    $manualurl = get_option('woo_manual');
    $shortname = 'seo_woo';
    //Framework Version in Backend Head
    $woo_framework_version = get_option('woo_framework_version');
    //Version in Backend Head
    $theme_data = get_theme_data(get_template_directory() . '/style.css');
    $local_version = $theme_data['Version'];
    //GET themes update RSS feed and do magic
    include_once ABSPATH . nxtINC . '/feed.php';
    $pos = strpos($manualurl, 'documentation');
    $theme_slug = str_replace("/", "", substr($manualurl, $pos + 13));
    //13 for the word documentation
    //add filter to make the rss read cache clear every 4 hours
    add_filter('nxt_feed_cache_transient_lifetime', create_function('$a', 'return 14400;'));
    $inner_pages = array('a' => 'Page title; Blog title', 'b' => 'Page title;', 'c' => 'Blog title; Page title;', 'd' => 'Page title; Blog description', 'e' => 'Blog title; Page title; Blog description');
    $seo_options = array();
    $seo_options[] = array("name" => "General Settings", "icon" => "general", "type" => "heading");
    $seo_options[] = array("name" => "Please Read", "type" => "info", "std" => "Welcome to the WooSEO feature. <br /><small>Here we help you take control of your search engine readiness with some in-built theme options. Our themes do however support some of NXTClass.org's most commonly used SEO plugins - <strong>All-in-One SEO Pack</strong>, <strong>Headspace 2</strong> and <strong>NXTClass SEO By Yoast</strong>. Use the checkbox below to use 3rd party plugin data.</small>");
    $seo_options[] = array("name" => "Use 3rd Party Plugin Data", "desc" => "Meta data added to <strong>custom fields in posts and pages</strong> will be extracted and used where applicable. This typically does not include Homepages and Archives, and only Singular templates.", "id" => $shortname . "_use_third_party_data", "std" => "false", "type" => "checkbox");
    $seo_options[] = array("name" => "Hide SEO custom fields", "desc" => "Check this box to hide the input fields created in the post and page edit screens.", "id" => $shortname . "_hide_fields", "std" => "false", "type" => "checkbox");
    $seo_options[] = array("name" => "Page Title", "icon" => "misc", "type" => "heading");
    $seo_options[] = array("name" => "Separator", "desc" => "Define a new separator character for your page titles.", "id" => $shortname . "_seperator", "std" => "|", "type" => "text");
    $seo_options[] = array("name" => "Blog Title", "desc" => "NOTE: This is the same setting as per the SETTINGS > GENERAL tab in the NXTClass backend.", "id" => "blogname", "std" => "", "type" => "text");
    $seo_options[] = array("name" => "Blog Description", "desc" => "NOTE: This is the same setting as per the SETTINGS > GENERAL tab in the NXTClass backend.", "id" => "blogdescription", "std" => "", "type" => "text");
    $seo_options[] = array("name" => "Enable woo_title()", "desc" => "woo_title() makes use of NXTClass's built in nxt_title() function to control the output for your page titles. It's also recommended for use with plugins.", "id" => $shortname . "_nxt_title", "std" => "false", "class" => "collapsed", "type" => "checkbox");
    $seo_options[] = array("name" => "Disable Custom Titles", "desc" => "If you prefer to have uniform titles across you theme. Alternatively they will be generated from custom fields and/or plugin data.", "id" => $shortname . "_nxt_custom_field_title", "std" => "false", "class" => "hidden", "type" => "checkbox");
    $seo_options[] = array("name" => "Paged Variable", "desc" => "The name variable that will appear then paging through archives.", "id" => $shortname . "_paged_var", "std" => "Page", "class" => "hidden", "type" => "text");
    $seo_options[] = array("name" => "Paged Variable Position", "desc" => "Change the position where the paged variable will appear.", "id" => $shortname . "_paged_var_pos", "std" => "before", "class" => "hidden", "options" => array('before' => 'Before', 'after' => 'After'), "type" => "select2");
    $seo_options[] = array("name" => "Homepage Title Layout", "desc" => "Define the order the title, description and meta data appears in.", "id" => $shortname . "_home_layout", "std" => "", "class" => "hidden", "options" => array('a' => 'Blog title; blog description', 'b' => 'Blog title', 'c' => 'Blog description'), "type" => "select2");
    $seo_options[] = array("name" => "Single Title Layout", "desc" => "Define the order the title, description and meta data appears in.", "id" => $shortname . "_single_layout", "std" => "", "class" => "hidden", "options" => $inner_pages, "type" => "select2");
    $seo_options[] = array("name" => "Page Title Layout", "desc" => "Define the order the title, description and meta data appears in.", "id" => $shortname . "_page_layout", "std" => "", "class" => "hidden", "options" => $inner_pages, "type" => "select2");
    $seo_options[] = array("name" => "Archive Title Layout", "desc" => "Define the order the title, description and meta data appears in.", "id" => $shortname . "_archive_layout", "std" => "", "class" => "hidden", "options" => $inner_pages, "type" => "select2");
    $seo_options[] = array("name" => "Indexing Meta", "icon" => "misc", "type" => "heading");
    /*$seo_options[] = array( "name" => "Add Indexing Meta",
    		"desc" => "Add links to the header telling the search engine what the start, next, previous and home urls are.",
    		"id" => $shortname."_meta_basics",
    		"std" => "false",
    		"type" => "checkbox" ); */
    $seo_options[] = array("name" => "Archive Indexing", "desc" => "Select which archives to index on your site. Aids in removing duplicate content from being indexed, preventing content dilution.", "id" => $shortname . "_meta_indexing", "std" => "category", "type" => "multicheck", "options" => array('category' => 'Category Archives', 'tag' => 'Tag Archives', 'posttype' => 'Post Type Archives', 'taxonomy' => 'Taxonomy Archives', 'author' => 'Author Pages', 'search' => 'Search Results', 'date' => 'Date Archives'));
    $seo_options[] = array("name" => "Add 'nofollow' meta", "desc" => "By default your site outputs 'follow' meta on all your pages, meaning search engines will follow all links. <br />Enable this option to output 'nofollow' meta, which will tell search engines to <strong>not follow</strong> links on your site.", "id" => $shortname . "_meta_single_follow", "std" => "", "type" => "checkbox");
    $seo_options[] = array("name" => "Description Meta", "icon" => "misc", "type" => "heading");
    $seo_options[] = array("name" => "Homepage Description", "desc" => "Choose where to populate your Homepage meta description from.", "id" => $shortname . "_meta_home_desc", "std" => "a", "options" => array("a" => "Off", "b" => "From nxt Site Description", "c" => "From Custom Homepage Description"), "type" => "radio");
    $seo_options[] = array("name" => "Custom Homepage Description", "desc" => "Add a custom meta description to your homepage.", "id" => $shortname . "_meta_home_desc_custom", "std" => "", "type" => "textarea");
    $seo_options[] = array("name" => "Single Page/Post Description", "desc" => "Add your post/page description from custom fields. <strong>* See below</strong>", "id" => $shortname . "_meta_single_desc", "std" => "a", "options" => array("a" => "Off *", "b" => "From Customs Field and/or Plugins", "c" => "Automatically from Post/Page Content"), "type" => "radio");
    $seo_options[] = array("name" => "Global Post/Page Descriptions", "desc" => "Add a custom meta description to your posts and pages. This will only show if no other data is available from the selection above. Will still be added even if setting above is set to \"Off\".", "id" => $shortname . "_meta_single_desc_sitewide", "std" => "", "class" => "collapsed", "type" => "checkbox");
    $seo_options[] = array("name" => "Add Global Description", "desc" => "Add your global decription.", "id" => $shortname . "_meta_single_desc_custom", "std" => "", "class" => "hidden", "type" => "textarea");
    $seo_options[] = array("name" => "Keyword Meta", "icon" => "misc", "type" => "heading");
    $seo_options[] = array("name" => "Homepage Keywords", "desc" => "Choose where to populate your Homepage meta description from.", "id" => $shortname . "_meta_home_key", "std" => "a", "options" => array("a" => "Off", "c" => "From Custom Homepage Keywords"), "type" => "radio");
    $seo_options[] = array("name" => "Custom Homepage Keywords", "desc" => "Add a (comma separated) list of keywords to your homepage.", "id" => $shortname . "_meta_home_key_custom", "std" => "", "type" => "textarea");
    $seo_options[] = array("name" => "Single Page/Post Keywords", "desc" => "Add your post/page keywords from custom field. <strong>* See below</strong>", "id" => $shortname . "_meta_single_key", "std" => "a", "options" => array("a" => "Off *", "b" => "From Custom Fields and/or Plugins", "c" => "Automatically from Post Tags &amp; Categories"), "type" => "radio");
    $seo_options[] = array("name" => "Custom Post/Page Keywords", "desc" => "Add custom meta keywords to your posts and pages. This will only show if no other data is available from the options above. Even if the option above is set to <strong>'Off'</strong>, this will still be added to your site.", "id" => $shortname . "_meta_single_key_sitewide", "std" => "", "class" => "collapsed", "type" => "checkbox");
    $seo_options[] = array("name" => "Custom Post/Page Keywords", "desc" => "Add a (comma separated) list of keywords to your posts and pages.", "id" => $shortname . "_meta_single_key_custom", "std" => "", "class" => "hidden", "type" => "textarea");
    update_option('woo_seo_template', $seo_options);
    ?>


    <div class="wrap" id="woo_container">
    <?php 
    if (class_exists('All_in_One_SEO_Pack') || class_exists('Headspace_Plugin') || class_exists('nxtSEO_Admin') || class_exists('nxtSEO_Frontend')) {
        echo "<div id='woo-seo-notice' class='woo-notice'><p><strong>3rd Party SEO Plugin(s) Detected</strong> - Some WooTheme SEO functionality has been disabled.</p></div>";
    }
    ?>

    <?php 
    if (get_option('blog_public') == 0) {
        echo "<div id='woo-seo-notice-privacy' class='woo-notice'><p><strong>This site is set to Private</strong> - SEO is disabled, change settings <a href='" . admin_url('options-privacy.php') . "'>here</a>.</p></div>";
    }
    ?>

    <div id="woo-popup-save" class="woo-save-popup"><div class="woo-save-save">Options Updated</div></div>
    <div id="woo-popup-reset" class="woo-save-popup"><div class="woo-save-reset">Options Reset</div></div>
        <form action="" enctype="multipart/form-data" id="wooform" method="post">
        <?php 
    // Add nonce for added security.
    if (function_exists('nxt_nonce_field')) {
        nxt_nonce_field('wooframework-seo-options-update');
    }
    // End IF Statement
    $woo_nonce = '';
    if (function_exists('nxt_create_nonce')) {
        $woo_nonce = nxt_create_nonce('wooframework-seo-options-update');
    }
    // End IF Statement
    if ($woo_nonce == '') {
    } else {
        ?>

	    	<input type="hidden" name="_ajax_nonce" value="<?php 
        echo $woo_nonce;
        ?>
" />
	    <?php 
    }
    // End IF Statement
    ?>

            <div id="header">
               <div class="logo">
                <?php 
    if (get_option('framework_woo_backend_header_image')) {
        ?>

                <img alt="" src="<?php 
        echo get_option('framework_woo_backend_header_image');
        ?>
"/>
                <?php 
    } else {
        ?>

                <img alt="WooThemes" src="<?php 
        echo get_template_directory_uri();
        ?>
/functions/images/logo.png"/>
                <?php 
    }
    ?>

                </div>
                <div class="theme-info">
                    <span class="theme"><?php 
    echo $themename;
    ?>
 <?php 
    echo $local_version;
    ?>
</span>
                    <span class="framework">Framework <?php 
    echo $woo_framework_version;
    ?>
</span>
                </div>
                <div class="clear"></div>
            </div>
            <div id="support-links">

                <ul>
                    <li class="changelog"><a title="Theme Changelog" href="<?php 
    echo $manualurl;
    ?>
#Changelog">View Changelog</a></li>
                    <li class="docs"><a title="Theme Documentation" href="<?php 
    echo $manualurl;
    ?>
">View Themedocs</a></li>
                    <li class="forum"><a href="http://www.woothemes.com/support-forum" target="_blank">Visit Forum</a></li>
                    <li class="right"><img style="display:none" src="<?php 
    echo get_template_directory_uri();
    ?>
/functions/images/loading-top.gif" class="ajax-loading-img ajax-loading-img-top" alt="Working..." /><a href="#" id="expand_options">[+]</a> <input type="submit" value="Save All Changes" class="button submit-button" /></li>
                </ul>

            </div>
            <?php 
    $return = woothemes_machine($seo_options);
    ?>

            <div id="main">
                <div id="woo-nav">
                    <ul>
                        <?php 
    echo $return[1];
    ?>

                    </ul>
                </div>
                <div id="content">
                <?php 
    echo $return[0];
    ?>

                </div>
                <div class="clear"></div>

            </div>
            <div class="save_bar_top">
            <img style="display:none" src="<?php 
    echo get_template_directory_uri();
    ?>
/functions/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
            <input type="hidden" name="woo_save" value="save" />
            <input type="submit" value="Save All Changes" class="button submit-button" />
            </form>

            <form action="<?php 
    echo esc_attr($_SERVER['REQUEST_URI']);
    ?>
" method="post" style="display:inline" id="wooform-reset">
            <?php 
    // Add nonce for added security.
    if (function_exists('nxt_nonce_field')) {
        nxt_nonce_field('wooframework-seo-options-reset');
    }
    // End IF Statement
    $woo_nonce = '';
    if (function_exists('nxt_create_nonce')) {
        $woo_nonce = nxt_create_nonce('wooframework-seo-options-reset');
    }
    // End IF Statement
    if ($woo_nonce == '') {
    } else {
        ?>

		    	<input type="hidden" name="_ajax_nonce" value="<?php 
        echo $woo_nonce;
        ?>
" />
		    <?php 
    }
    // End IF Statement
    ?>

            <span class="submit-footer-reset">
            <input name="reset" type="submit" value="Reset All SEO Options" class="button submit-button reset-button" onclick="return confirm( 'Click OK to reset all SEO options. All settings will be lost!' );" />
            <input type="hidden" name="woo_save" value="reset" />
            </span>
        	</form>

            </div>

    <div style="clear:both;"></div>
    </div><!--wrap-->

<?php 
}
Exemple #18
0
switch ($action) {
    case 'update':
        check_admin_referer('edit-plugin_' . $file);
        $newcontent = stripslashes($_POST['newcontent']);
        if (is_writeable($real_file)) {
            $f = fopen($real_file, 'w+');
            fwrite($f, $newcontent);
            fclose($f);
            $network_wide = is_plugin_active_for_network($file);
            // Deactivate so we can test it.
            if (is_plugin_active($file) || isset($_POST['phperror'])) {
                if (is_plugin_active($file)) {
                    deactivate_plugins($file, true);
                }
                update_option('recently_activated', array($file => time()) + (array) get_option('recently_activated'));
                nxt_redirect(add_query_arg('_nxtnonce', nxt_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file={$file}&liveupdate=1&scrollto={$scrollto}&networkwide=" . $network_wide));
                exit;
            }
            nxt_redirect(self_admin_url("plugin-editor.php?file={$file}&a=te&scrollto={$scrollto}"));
        } else {
            nxt_redirect(self_admin_url("plugin-editor.php?file={$file}&scrollto={$scrollto}"));
        }
        exit;
        break;
    default:
        if (isset($_GET['liveupdate'])) {
            check_admin_referer('edit-plugin-test_' . $file);
            $error = validate_plugin($file);
            if (is_nxt_error($error)) {
                nxt_die($error);
            }
Exemple #19
0
/**
 * Print jQuery call to modify comment form.
 *
 * @action: comment_form
 **/
function openid_comment_form()
{
    global $nxt_scripts;
    if (comments_open() && !is_user_logged_in() && isset($nxt_scripts) && $nxt_scripts->query('openid')) {
        ?>
		<span id="openid_comment">
			<label>
				<input type="checkbox" id="login_with_openid" name="login_with_openid" checked="checked" />
				<?php 
        _e('Authenticate this comment using <span class="openid_link">OpenID</span>.', 'openid');
        ?>
			</label>
		</span>
		<script type="text/javascript">jQuery(function(){ add_openid_to_comment_form('<?php 
        echo site_url('index.php');
        ?>
', '<?php 
        echo nxt_create_nonce('openid_ajax');
        ?>
') })</script>
<?php 
    }
}
 function ajax_action_generate_nonce()
 {
     echo nxt_create_nonce('wooframework-shortcode-generator');
     die;
 }
Exemple #21
0
if ($action) {
    $network_wide = false;
    if ((isset($_GET['networkwide']) || 'network-activate-selected' == $action) && is_multisite() && current_user_can('manage_network_plugins')) {
        $network_wide = true;
    }
    switch ($action) {
        case 'activate':
            if (!current_user_can('activate_plugins')) {
                nxt_die(__('You do not have sufficient permissions to activate plugins for this site.'));
            }
            check_admin_referer('activate-plugin_' . $plugin);
            $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), $network_wide);
            if (is_nxt_error($result)) {
                if ('unexpected_output' == $result->get_error_code()) {
                    $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status={$status}&paged={$page}&s={$s}");
                    nxt_redirect(add_query_arg('_error_nonce', nxt_create_nonce('plugin-activation-error_' . $plugin), $redirect));
                    exit;
                } else {
                    nxt_die($result);
                }
            }
            $recent = (array) get_option('recently_activated');
            if (isset($recent[$plugin])) {
                unset($recent[$plugin]);
                update_option('recently_activated', $recent);
            }
            if (isset($_GET['from']) && 'import' == $_GET['from']) {
                nxt_redirect(self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))));
                // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
            } else {
                nxt_redirect(self_admin_url("plugins.php?activate=true&plugin_status={$status}&paged={$page}&s={$s}"));
Exemple #22
0
 /**
  * edit_schedule_screen( $vars )
  *
  * Hooks into screen_handler
  * Edit schedule screen
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function edit_schedule_screen($vars)
 {
     global $bp;
     $nonce_name = 'edit_schedule';
     $old_schedule = $this->is_schedule($this->current_schedule);
     $old_schedule->terms = nxt_get_object_terms($old_schedule->ID, 'group_id');
     if (!$this->has_schedule_caps($bp->loggedin_user->id) || !is_super_admin() && $bp->groups->current_group->id != $old_schedule->terms[0]->name) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to update the schedule.', 'bpsp');
         return $vars;
     }
     // Update schedule
     if (isset($_POST['schedule']) && $_POST['schedule']['object'] == 'group' && isset($_POST['_nxtnonce'])) {
         if (empty($_POST['schedule']['desc']) || empty($_POST['schedule']['start_date'])) {
             $vars['error'] = __('New schedule could not be added. Missing description and/or start date.', 'bpsp');
             $_POST = null;
             return $this->edit_schedule_screen($vars);
         }
         $updated_schedule = $_POST['schedule'];
         if (isset($updated_schedule['end_date']) && !empty($updated_schedule['end_date'])) {
             $valid_dates = $this->datecheck($updated_schedule['start_date'], $updated_schedule['end_date']);
         } else {
             $valid_dates = true;
         }
         $is_nonce = nxt_verify_nonce($_POST['_nxtnonce'], $nonce_name);
         if (true != $is_nonce) {
             $vars['error'] = __('Nonce Error while editing a schedule.', 'bpsp');
         } else {
             if (!empty($updated_schedule['group_id']) && $valid_dates) {
                 $updated_schedule_id = nxt_update_post(array('ID' => $old_schedule->ID, 'post_title' => sanitize_text_field($updated_schedule['title']), 'post_content' => sanitize_text_field($updated_schedule['desc'])));
                 if ($updated_schedule_id) {
                     if (!empty($updated_schedule['course_id']) && BPSP_Courses::is_course($updated_schedule['course_id'])) {
                         nxt_set_post_terms($updated_schedule_id, $updated_schedule['course_id'], 'course_id');
                     } elseif (empty($updated_schedule['course_id'])) {
                         nxt_set_post_terms($updated_schedule_id, '', 'course_id');
                     }
                     update_post_meta($updated_schedule_id, 'start_date', $updated_schedule['start_date'], $old_schedule->start_date);
                     update_post_meta($updated_schedule_id, 'end_date', $updated_schedule['end_date'], $old_schedule->end_date);
                     if (isset($updated_schedule['lecture_id'])) {
                         update_post_meta($updated_schedule_id, 'lecture_id', $updated_schedule['lecture_id']);
                     }
                     if (!empty($updated_schedule['location'])) {
                         if ($old_schedule->location) {
                             update_post_meta($updated_schedule_id, 'location', $updated_schedule['location'], $old_schedule->location);
                         } else {
                             add_post_meta($updated_schedule_id, 'location', $updated_schedule['location']);
                         }
                     }
                     $vars['message'] = __('Schedule was updated.', 'bpsp');
                 } else {
                     $vars['error'] = __('Schedule could not be updated.', 'bpsp');
                 }
             }
         }
     }
     $vars['name'] = 'edit_schedule';
     $vars['group_id'] = $bp->groups->current_group->id;
     $vars['course_id'] = $this->current_course->ID;
     $vars['lecture_id'] = get_post_meta($old_schedule->ID, 'lecture_id', true);
     $vars['user_id'] = $bp->loggedin_user->id;
     $vars['lectures'] = BPSP_Lectures::has_lectures($bp->groups->current_group->id);
     $vars['schedule'] = $this->is_schedule($old_schedule->ID);
     $vars['schedule_edit_uri'] = $vars['current_uri'] . '/schedule/' . $this->current_schedule . '/edit';
     $vars['schedule_delete_uri'] = $vars['current_uri'] . '/schedule/' . $this->current_schedule . '/delete';
     $vars['schedule_delete_title'] = __('Delete Course', 'bpsp');
     $vars['schedule_permalink'] = $vars['current_uri'] . '/schedule/' . $this->current_schedule;
     $vars['nonce'] = nxt_nonce_field($nonce_name, '_nxtnonce', true, false);
     $vars['delete_nonce'] = add_query_arg('_nxtnonce', nxt_create_nonce('delete_schedule'), $vars['schedule_delete_uri']);
     $vars['trail'] = array($vars['schedule']->lecture->post_title => $vars['schedule']->lecture->permalink, __('Editing Schedule: ', 'bpsp') . $vars['schedule']->post_title => $vars['schedule']->permalink);
     return $vars;
 }
 function fake_page()
 {
     global $nxt_query, $post;
     if ($nxt_query->is_404 && isset($_GET['redlink']) && $_GET['redlink'] == 1) {
         $new_title = strip_tags($_GET['title']);
         $new_page_nonce = nxt_create_nonce('nxtw_new_page_nonce');
         $get_params = '?new_wiki_page=true&nonce=' . $new_page_nonce . '&title=' . $new_title;
         $new_link = '<a href="' . get_bloginfo('url') . '/wiki/new' . $get_params . '">Click here to create it.</a>';
         $id = -42;
         // need an id
         $post = new stdClass();
         $post->ID = $id;
         $post->post_category = array('Uncategorized');
         //Add some categories. an array()???
         $post->post_content = 'A wiki page with the title ' . $new_title . ' could not be found. ' . $new_link;
         //The full text of the post.
         $post->post_excerpt = $post->post_content;
         //For all your post excerpt needs.
         $post->post_status = 'publish';
         //Set the status of the new post.
         $post->post_title = 'New Wiki Page';
         //The title of your post.
         $post->post_type = 'page';
         //Sometimes you might want to post a page.
         $post->comment_status = 'open';
         $post->post_date = date('Y-m-d H:i:s', time());
         $nxt_query->queried_object = $post;
         $nxt_query->post = $post;
         $nxt_query->found_posts = 1;
         $nxt_query->post_count = 1;
         $nxt_query->max_num_pages = 1;
         $nxt_query->is_single = 1;
         $nxt_query->is_404 = false;
         $nxt_query->is_posts_page = false;
         $nxt_query->posts = array($post);
         $nxt_query->is_page = true;
         $nxt_query->page = 1;
         //$nxt_query->is_post=true;
         //$nxt_query->page=false;
     }
 }
 /**
  * edit_lecture_screen( $vars )
  *
  * Hooks into screen_handler
  * Edit lecture screen
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function edit_lecture_screen($vars)
 {
     global $bp;
     $nonce_name = 'edit_lecture';
     $updated_lecture_id = $this->current_lecture;
     $old_lecture = $this->is_lecture($this->current_lecture);
     if (!$this->has_lecture_caps($bp->loggedin_user->id) && $bp->loggedin_user->id != $old_lecture->post_author && $bp->groups->current_group->id != $old_lecture->group[0]->name && !is_super_admin()) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to update the lecture.', 'bpsp');
         return $vars;
     }
     // Update lecture
     if (isset($_POST['lecture']) && $_POST['lecture']['object'] == 'group' && isset($_POST['_nxtnonce'])) {
         $updated_lecture = $_POST['lecture'];
         $is_nonce = nxt_verify_nonce($_POST['_nxtnonce'], $nonce_name);
         if (true != $is_nonce) {
             $vars['error'] = __('Nonce Error while editing the lecture.', 'bpsp');
         } else {
             if (isset($updated_lecture['title']) && isset($updated_lecture['content']) && is_numeric($updated_lecture['group_id'])) {
                 $updated_lecture['title'] = strip_tags($updated_lecture['title']);
                 $updated_lecture_id = nxt_update_post(array('ID' => $old_lecture->ID, 'post_title' => $updated_lecture['title'], 'post_content' => $updated_lecture['content'], 'post_parent' => intval($updated_lecture['parent']), 'menu_order' => intval($updated_lecture['order'])));
                 if ($updated_lecture_id) {
                     $vars['message'] = __('Lecture was updated.', 'bpsp');
                     do_action('courseware_lecture_activity', $this->is_lecture($updated_lecture_id), 'update');
                 } else {
                     $vars['error'] = __('Lecture could not be updated.', 'bpsp');
                 }
             }
         }
     }
     $vars['name'] = 'edit_lecture';
     $vars['group_id'] = $bp->groups->current_group->id;
     $vars['user_id'] = $bp->loggedin_user->id;
     $vars['lecture'] = $this->is_lecture($updated_lecture_id);
     $vars['lectures'] = $this->has_lectures($bp->groups->current_group->id);
     $vars['lecture_edit_uri'] = $vars['current_uri'] . '/lecture/' . $this->current_lecture->post_name . '/edit/';
     $vars['lecture_delete_uri'] = $vars['current_uri'] . '/lecture/' . $this->current_lecture->post_name . '/delete/';
     $vars['lecture_permalink'] = $vars['current_uri'] . '/lecture/' . $this->current_lecture->post_name;
     $vars['nonce'] = nxt_nonce_field($nonce_name, '_nxtnonce', true, false);
     $vars['delete_nonce'] = add_query_arg('_nxtnonce', nxt_create_nonce('delete_lecture'), $vars['lecture_delete_uri']);
     $vars['trail'] = array($this->current_lecture->course->post_title => $this->current_lecture->course->permalink, __('Editing Lecture: ', 'bpsp') . $this->current_lecture->post_title => $this->current_lecture->permalink);
     return $vars;
 }
Exemple #25
0
/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param unknown_type $errors
 */
function media_upload_form($errors = null)
{
    global $type, $tab, $pagenow, $is_IE, $is_opera, $is_iphone;
    if ($is_iphone) {
        return;
    }
    $upload_action_url = admin_url('async-upload.php');
    $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
    $_type = isset($type) ? $type : '';
    $_tab = isset($tab) ? $tab : '';
    $upload_size_unit = $max_upload_size = nxt_max_upload_size();
    $sizes = array('KB', 'MB', 'GB');
    for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
        $upload_size_unit /= 1024;
    }
    if ($u < 0) {
        $upload_size_unit = 0;
        $u = 0;
    } else {
        $upload_size_unit = (int) $upload_size_unit;
    }
    ?>

<div id="media-upload-notice"><?php 
    if (isset($errors['upload_notice'])) {
        echo $errors['upload_notice'];
    }
    ?>
</div>
<div id="media-upload-error"><?php 
    if (isset($errors['upload_error']) && is_nxt_error($errors['upload_error'])) {
        echo $errors['upload_error']->get_error_message();
    }
    ?>
</div>
<?php 
    // Check quota for this blog if multisite
    if (is_multisite() && !is_upload_space_available()) {
        echo '<p>' . sprintf(__('Sorry, you have filled your storage quota (%s MB).'), get_space_allowed()) . '</p>';
        return;
    }
    do_action('pre-upload-ui');
    $post_params = array("post_id" => $post_id, "_nxtnonce" => nxt_create_nonce('media-form'), "type" => $_type, "tab" => $_tab, "short" => "1");
    $post_params = apply_filters('upload_post_params', $post_params);
    // hook change! old name: 'swfupload_post_params'
    $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => $max_upload_size . 'b', 'url' => $upload_action_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $post_params);
    $plupload_init = apply_filters('plupload_init', $plupload_init);
    ?>

<script type="text/javascript">
<?php 
    // Verify size is an int. If not return default value.
    $large_size_h = absint(get_option('large_size_h'));
    if (!$large_size_h) {
        $large_size_h = 1024;
    }
    $large_size_w = absint(get_option('large_size_w'));
    if (!$large_size_w) {
        $large_size_w = 1024;
    }
    ?>
var resize_height = <?php 
    echo $large_size_h;
    ?>
, resize_width = <?php 
    echo $large_size_w;
    ?>
,
nxtUploaderInit = <?php 
    echo json_encode($plupload_init);
    ?>
;
</script>

<div id="plupload-upload-ui" class="hide-if-no-js">
<?php 
    do_action('pre-plupload-upload-ui');
    // hook change, old name: 'pre-flash-upload-ui'
    ?>
<div id="drag-drop-area">
	<div class="drag-drop-inside">
	<p class="drag-drop-info"><?php 
    _e('Drop files here');
    ?>
</p>
	<p><?php 
    _ex('or', 'Uploader: Drop files here - or - Select Files');
    ?>
</p>
	<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php 
    esc_attr_e('Select Files');
    ?>
" class="button" /></p>
	</div>
</div>
<?php 
    do_action('post-plupload-upload-ui');
    // hook change, old name: 'post-flash-upload-ui'
    ?>
</div>

<div id="html-upload-ui" class="hide-if-js">
<?php 
    do_action('pre-html-upload-ui');
    ?>
	<p id="async-upload-wrap">
		<label class="screen-reader-text" for="async-upload"><?php 
    _e('Upload');
    ?>
</label>
		<input type="file" name="async-upload" id="async-upload" />
		<?php 
    submit_button(__('Upload'), 'button', 'html-upload', false);
    ?>
		<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php 
    _e('Cancel');
    ?>
</a>
	</p>
	<div class="clear"></div>
<?php 
    do_action('post-html-upload-ui');
    ?>
</div>

<span class="max-upload-size"><?php 
    printf(__('Maximum upload file size: %d%s.'), esc_html($upload_size_unit), esc_html($sizes[$u]));
    ?>
</span>
<?php 
    if (($is_IE || $is_opera) && $max_upload_size > 100 * 1024 * 1024) {
        ?>
	<span class="big-file-warning"><?php 
        _e('Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.');
        ?>
</span>
<?php 
    }
    do_action('post-upload-ui');
}
Exemple #26
0
 /**
  * Localize the flash uploader class wrapper
  */
 protected function localize_script()
 {
     nxt_localize_script('ice-uploader', 'iceEasyFlashUploaderL10n', array('upload_url' => admin_url(ICE_Enqueue::SCRIPT_ASYNC), 'flash_url' => includes_url('js/swfupload/swfupload.swf'), 'pp_auth_cookie' => is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE], 'pp_logged_in_cookie' => $_COOKIE[LOGGED_IN_COOKIE], 'pp_nxtnonce' => nxt_create_nonce('media-form'), 'file_size_limit' => 1024 * 1024, 'button_image_url' => includes_url('images/upload.png?ver=20100531')));
 }
 /**
  * gradebook_screen( $vars )
  *
  * Hooks into screen_handler
  * Adds a UI to assignments for gradebook management.
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function gradebook_screen($vars)
 {
     global $bp;
     $nonce_name = 'gradebook_nonce';
     $nonce_import_name = 'gradebook_import_nonce';
     $nonce_clear_name = 'gradebook_clear_nonce';
     if (!$this->has_gradebook_caps($bp->loggedin_user->id) && !is_super_admin()) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to manage gradebook.', 'bpsp');
         return $vars;
     }
     $students = BP_Groups_Member::get_all_for_group($bp->groups->current_group->id);
     if (isset($_POST['_nxtnonce'])) {
         $is_nonce = nxt_verify_nonce($_POST['_nxtnonce'], $nonce_name);
     }
     if (isset($_POST['_nxtnonce']) && true != $is_nonce) {
         $vars['die'] = __('BuddyPress Courseware Nonce Error while updating gradebook.', 'bpsp');
         return $vars;
     }
     $gradebook_id = $this->has_gradebook($this->current_assignment);
     if (!$gradebook_id) {
         $vars['die'] = __('BuddyPress Courseware Error while creating gradebook.', 'bpsp');
         return $vars;
     }
     if (!empty($_POST['grade'])) {
         foreach ($_POST['grade'] as $grade) {
             if (!empty($grade) && !empty($grade['uid']) && !empty($grade['value'])) {
                 # If grade was added or updated!
                 $status = $this->save_grade($gradebook_id, $grade);
                 if ($status !== null) {
                     $data = array('grade' => $grade, 'teacher' => $bp->loggedin_user->userdata, 'assignment' => $this->current_assignment);
                     if ($status == true) {
                         do_action('courseware_grade_added', $data);
                     } else {
                         do_action('courseware_grade_updated', $data);
                     }
                 }
             }
         }
         $vars['message'] = __('Gradebook saved.', 'bpsp');
     }
     $vars['name'] = 'gradebook';
     $vars['students'] = $students['members'];
     if (empty($vars['grades'])) {
         $vars['grades'] = $this->load_grades($gradebook_id, true);
     }
     $vars['bpsp_gradebook_format'] = get_option('bpsp_gradebook_format');
     $vars['assignment'] = BPSP_Assignments::is_assignment($this->current_assignment);
     $vars['gradebook_permalink'] = $vars['assignment_permalink'] . '/gradebook';
     $vars['clear_gradebook_permalink'] = add_query_arg('_nxtnonce', nxt_create_nonce($nonce_clear_name), $vars['gradebook_permalink'] . '/clear');
     $vars['import_gradebook_nonce'] = nxt_nonce_field($nonce_import_name, '_nxtnonce', true, false);
     $vars['nonce'] = nxt_nonce_field($nonce_name, '_nxtnonce', true, false);
     return $vars;
 }
 /**
  * Returns nonce field HTML
  *
  * @param string $action
  * @param string $name
  * @param bool $referer
  * @param bool $echo
  * @return string
  */
 function nonce_field($action = -1, $name = '_nxtnonce', $referer = true)
 {
     $name = esc_attr($name);
     $return = '<input type="hidden" name="' . $name . '" value="' . nxt_create_nonce($action) . '" />';
     if ($referer) {
         $return .= nxt_referer_field(false);
     }
     return $return;
 }
$jfb_log = "Starting login process (Client: " . $_SERVER['REMOTE_ADDR'] . ", Version: {$jfb_version}, Browser: " . $browser['shortname'] . " " . $browser['version'] . " for " . $browser['platform'] . ")\n";
//Run one hook before ANYTHING happens.
do_action('nxtfb_prelogin');
//Check the nonce to make sure this was a valid login attempt (unless the user has disabled nonce checking)
if (!get_option($opt_jfb_disablenonce)) {
    if (nxt_verify_nonce($_REQUEST[$jfb_nonce_name], $jfb_nonce_name) != 1) {
        //If there's already a user logged in, tell the user and give them a link back to where they were.
        $currUser = nxt_get_current_user();
        if ($currUser->ID) {
            $msg = "User \"{$currUser->user_login}\" has already logged in via another browser session.\n";
            $jfb_log .= $msg;
            j_mail("FB Double-Login: "******" -> " . get_bloginfo('name'));
            die($msg . "<br /><br /><a href=\"" . $_POST['redirectTo'] . "\">Continue</a>");
        }
        //If the nonce failed for some other reason, report the error.
        $jfb_log .= "nxt: nonce check failed (expected '" . nxt_create_nonce($jfb_nonce_name) . "', received '" . $_REQUEST['_nxtnonce'] . "')\n" . "    Original Components) " . get_option($opt_jfb_generated_nonce) . "\n" . "    Current Components)  " . jfb_debug_nonce_components() . "\n";
        if (function_exists('get_plugins')) {
            $plugins = get_plugins();
            $jfb_log .= "    Active Plugins:\n";
            foreach ($plugins as $plugin) {
                $jfb_log .= "      " . $plugin['Name'] . ' ' . $plugin['Version'] . "\n";
            }
        }
        j_die("Nonce check failed, login aborted.\nThis usually due to your browser's privacy settings or a server-side caching plugin.  If you get this error on multiple browsers, please contact the site administrator.\n");
    }
    $jfb_log .= "nxt: nonce check passed\n";
} else {
    $jfb_log .= "nxt: nonce check DISABLED\n";
}
//Get the redirect URL
if (!isset($_POST['redirectTo']) || !$_POST['redirectTo']) {
Exemple #30
0
     }
     if ($do_lock && empty($_POST['auto_draft']) && $id && is_numeric($id)) {
         $lock_result = nxt_set_post_lock($id);
         $supplemental['active-post-lock'] = implode(':', $lock_result);
     }
     if ($nonce_age == 2) {
         $supplemental['replace-autosavenonce'] = nxt_create_nonce('autosave');
         $supplemental['replace-getpermalinknonce'] = nxt_create_nonce('getpermalink');
         $supplemental['replace-samplepermalinknonce'] = nxt_create_nonce('samplepermalink');
         $supplemental['replace-closedpostboxesnonce'] = nxt_create_nonce('closedpostboxes');
         $supplemental['replace-_ajax_linking_nonce'] = nxt_create_nonce('internal-linking');
         if ($id) {
             if ($_POST['post_type'] == 'post') {
                 $supplemental['replace-_nxtnonce'] = nxt_create_nonce('update-post_' . $id);
             } elseif ($_POST['post_type'] == 'page') {
                 $supplemental['replace-_nxtnonce'] = nxt_create_nonce('update-page_' . $id);
             }
         }
     }
     if (!empty($alert)) {
         $supplemental['alert'] = $alert;
     }
     $x = new nxt_Ajax_Response(array('what' => 'autosave', 'id' => $id, 'data' => $id ? $data : '', 'supplemental' => $supplemental));
     $x->send();
     break;
 case 'closed-postboxes':
     check_ajax_referer('closedpostboxes', 'closedpostboxesnonce');
     $closed = isset($_POST['closed']) ? explode(',', $_POST['closed']) : array();
     $closed = array_filter($closed);
     $hidden = isset($_POST['hidden']) ? explode(',', $_POST['hidden']) : array();
     $hidden = array_filter($hidden);