/** * Display link position edit action * * @param $row */ function display_link_position(&$row) { global $LinkOwner, $htsrv_url; // TODO: fp>dh: can you please implement cumbs in here? I don't clearly understand your code. // TODO: dh> only handle images $id = 'display_position_' . $row->link_ID; // NOTE: dh> using method=get so that we can use regenerate_url (for non-JS). $r = '<form action="" method="post"> <select id="' . $id . '" name="link_position">' . Form::get_select_options_string($LinkOwner->get_positions(), $row->link_position, true) . '</select>' . '<script type="text/javascript">jQuery("#' . $id . '").change( { url: "' . $htsrv_url . '", crumb: "' . get_crumb('link') . '" }, function( event ) { evo_display_position_onchange( this, event.data.url, event.data.crumb ) } );</script>'; $r .= '<noscript>'; // Add hidden fields for non-JS $url = regenerate_url('p,itm_ID,action', 'link_ID=' . $row->link_ID . '&action=set_link_position&' . url_crumb('link'), '', '&'); $params = explode('&', substr($url, strpos($url, '?') + 1)); foreach ($params as $param) { list($k, $v) = explode('=', $param); $r .= '<input type="hidden" name="' . htmlspecialchars($k) . '" value="' . htmlspecialchars($v) . '" />'; } $r .= '<input class="SaveButton" type="submit" value="»" />'; $r .= '</noscript>'; $r .= '</form>'; return $r; }
?> comment_post.php" method="post" id="bComment_form_id_<?php echo $Item->ID; ?> "> <input type="hidden" name="comment_post_ID" value="<?php echo $Item->ID(); ?> " /> <input type="hidden" name="redirect_to" value="<?php echo $Item->get_feedback_url($disp == 'feedback-popup', '&'); ?> " /> <input type="hidden" name="crumb_comment" value="<?php echo get_crumb('comment'); ?> " /> <?php if (!empty($comment_reply_ID)) { ?> <input type="hidden" name="reply_ID" value="<?php echo $comment_reply_ID; ?> " /> <a href="<?php echo url_add_param($Item->get_permanent_url(), 'reply_ID=' . $comment_reply_ID . '&redir=no') . '#c' . $comment_reply_ID; ?> "><?php echo T_('You are currently replying to a specific comment'); ?>
/** * Print out JavaScript to change a link position */ function echo_link_position_js() { global $htsrv_url; ?> <script type="text/javascript"> jQuery( document ).on( 'change', 'select[id^=display_position_]', { url: '<?php echo $htsrv_url; ?> ', crumb: '<?php echo get_crumb('link'); ?> ' }, function( event ) { evo_display_position_onchange( this, event.data.url, event.data.crumb ); } ); </script> <?php }
'90%', '80%', true, '<?php echo TS_('Add/Link files'); ?> ', '', true ); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: { 'action': 'import_files', 'crumb_import': '<?php echo get_crumb('import'); ?> ', }, success: function( result ) { openModalWindow( result, '90%', '80%', true, '<?php echo TS_('Upload/Manage import files'); ?> ', '' ); } } ); return false; } <?php }
/** * Display the login form js part, to get the user salt and encrypt the password * * @param array params */ function display_login_js_handler($params) { global $dummy_fields, $Session; $params = array_merge(array('get_widget_login_hidden_fields' => false), $params); ?> <script type="text/javascript"> var requestSent = false; var login = document.getElementById("<?php echo $dummy_fields['login']; ?> "); if( login.value.length > 0 ) { // Focus on the password field: document.getElementById("<?php echo $dummy_fields['pwd']; ?> ").focus(); } else { // Focus on the login field: login.focus(); } function processSubmit(e) { if (e.preventDefault) e.preventDefault(); if( requestSent ) { // A submit request was already sent, do not send another return; } requestSent = true; var form = document.getElementById("login_form"); var username = form.<?php echo $dummy_fields['login']; ?> .value; var get_widget_login_hidden_fields = <?php echo $params['get_widget_login_hidden_fields'] ? 'true' : 'false'; ?> ; var sessionid = '<?php echo $Session->ID; ?> '; if( !form.<?php echo $dummy_fields['pwd']; ?> || !form.pwd_salt || typeof hex_sha1 == "undefined" && typeof hex_md5 == "undefined" ) { return true; } jQuery.ajax({ type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: { '<?php echo $dummy_fields['login']; ?> ': username, 'action': 'get_user_salt', 'get_widget_login_hidden_fields': get_widget_login_hidden_fields, 'crumb_loginsalt': '<?php echo get_crumb('loginsalt'); ?> ', }, success: function(result) { var pwd_container = jQuery('#pwd_hashed_container'); var parsed_result; try { parsed_result = JSON.parse(result); } catch( e ) { pwd_container.html( result ); return; } var raw_password = form.<?php echo $dummy_fields['pwd']; ?> .value; var salts = parsed_result['salts']; if( get_widget_login_hidden_fields ) { form.crumb_loginform.value = parsed_result['crumb']; form.pwd_salt.value = parsed_result['pwd_salt']; sessionid = parsed_result['session_id']; } for( var index in salts ) { var pwd_hashed = hex_sha1( hex_md5( salts[index] + raw_password ) + form.pwd_salt.value ); pwd_container.append( '<input type="hidden" value="' + pwd_hashed + '" name="pwd_hashed[]">' ); } form.<?php echo $dummy_fields['pwd']; ?> .value = 'padding_padding_padding_padding_padding_padding_hashed_' + sessionid; /* to detect cookie problems */ // (paddings to make it look like encryption on screen. When the string changes to just one more or one less *, it looks like the browser is changing the password on the fly) // Append the correct login action as hidden input field pwd_container.append( '<input type="hidden" value="1" name="login_action[login]">' ); form.submit(); } }); // You must return false to prevent the default form behavior return false; } <?php if ($params['transmit_hashed_password']) { // Hash the password onsubmit and clear the original pwd field // TODO: dh> it would be nice to disable the clicked/used submit button. That's how it has been when the submit was attached to the submit button(s) ?> // Set login form submit handler jQuery( '#login_form' ).bind( 'submit', processSubmit ); <?php } ?> </script> <?php }
/** * JS Behaviour: Output JavaScript code to moderate the comments * Vote on the comment * Change a status of the comment */ function echo_comment_moderate_js() { if (!is_logged_in(false)) { return false; } global $Blog; if (empty($Blog)) { return false; } ?> <script type="text/javascript"> /* <![CDATA[ */ function fadeIn( selector, color ) { if( jQuery( selector ).length == 0 ) { return; } if( jQuery( selector ).get(0).tagName == 'TR' ) { // Fix selector, <tr> cannot have a css property background-color selector = selector + ' td'; } var bg_color = jQuery( selector ).css( 'backgroundColor' ); jQuery( selector ).animate( { backgroundColor: color }, 200 ); return bg_color; } function fadeInStatus( selector, status ) { switch( status ) { case 'published': return fadeIn( selector, '#99EE44' ); case 'community': return fadeIn( selector, '#2E8BB9' ); case 'protected': return fadeIn( selector, '#FF9C2A' ); case 'review': return fadeIn( selector, '#CC0099' ); } } // Display voting tool when JS is enable jQuery( '.vote_spam' ).show(); // Set comments vote function setCommentVote( id, type, vote ) { var row_selector = '#comment_row_' + id; var highlight_class = ''; var color = ''; switch(vote) { case 'spam': color = fadeIn( row_selector, '#ffc9c9' ); highlight_class = 'roundbutton_red'; break; case 'notsure': color = fadeIn( row_selector, '#bbbbbb' ); break; case 'ok': color = fadeIn( row_selector, '#bcffb5' ); highlight_class = 'roundbutton_green'; break; } if( highlight_class != '' ) { jQuery( '#vote_'+type+'_'+id ).find( 'a.roundbutton, span.roundbutton' ).addClass( highlight_class ); } jQuery.ajax({ type: "POST", url: "<?php echo get_samedomain_htsrv_url(); ?> anon_async.php", data: { "blogid": "<?php echo $Blog->ID; ?> ", "commentid": id, "type": type, "vote": vote, "action": "set_comment_vote", "crumb_comment": "<?php echo get_crumb('comment'); ?> ", }, success: function(result) { if( color != '' ) { // Revert the color fadeIn( row_selector, color ); } jQuery("#vote_"+type+"_"+id).after( ajax_debug_clear( result ) ); jQuery("#vote_"+type+"_"+id).remove(); } }); } // Set comment status function setCommentStatus( id, status, redirect_to ) { var row_selector = '[id=comment_row_' + id + ']'; var color = fadeInStatus( row_selector, status ); jQuery.ajax({ type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> anon_async.php', data: { 'blogid': '<?php echo $Blog->ID; ?> ', 'commentid': id, 'status': status, 'action': 'moderate_comment', 'redirect_to': redirect_to, 'crumb_comment': '<?php echo get_crumb('comment'); ?> ', }, success: function(result) { if( color != '' ) { // Revert the color fadeIn( row_selector, color ); } var statuses = ajax_debug_clear( result ).split( ':' ); var new_status = statuses[0]; if( new_status == '' ) { // Status was not changed return; } var class_name = jQuery( row_selector ).attr( 'class' ); class_name = class_name.replace( /vs_([a-z]+)/g, 'vs_' + new_status ); jQuery( row_selector ).attr( 'class', class_name ); update_moderation_buttons( row_selector, statuses[1], statuses[2] ); } }); } // Add classes for first and last roundbuttons, because css pseudo-classes don't support to exclude hidden elements function update_moderation_buttons( selector, raise_status, lower_status ) { var parent_selector = '.roundbutton_group '; if( typeof( selector ) != 'undefined' ) { parent_selector = selector + ' ' + parent_selector; } selector = parent_selector + '.roundbutton_text'; // Clear previous classes of first and last visible buttons jQuery( selector ).removeClass( 'first-child last-child btn_next_status' ); // Make the raise and lower button are visible jQuery( selector + '.btn_raise_' + raise_status ).addClass( 'btn_next_status' ); jQuery( selector + '.btn_lower_' + lower_status ).addClass( 'btn_next_status' ); // Add classes for first and last buttons to fix round corners jQuery( selector + ':visible:first' ).addClass( 'first-child' ); jQuery( selector + ':visible:last' ).addClass( 'last-child' ); } /* ]]> */ </script> <?php }
/** * Create a crumb param to be passed in action urls... * * @access public * @param string crumb_name */ function url_crumb($crumb_name) { return 'crumb_' . $crumb_name . '=' . get_crumb($crumb_name); }
if (!$get_widget_login_hidden_fields) { // If the request was received from the normal login form check the loginsalt crumb $Session->assert_received_crumb('loginsalt'); } $result = array(); if ($get_widget_login_hidden_fields) { // Get the loginform crumb, the password encryption salt, and the Session ID for the widget login form $pwd_salt = $Session->get('core.pwd_salt'); if (empty($pwd_salt)) { // Session salt is not generated yet, needs to generate $pwd_salt = generate_random_key(64); $Session->set('core.pwd_salt', $pwd_salt, 86400); $Session->dbsave(); // save now, in case there's an error later, and not saving it would prevent the user from logging in. } $result['crumb'] = get_crumb('loginform'); $result['pwd_salt'] = $pwd_salt; $result['session_id'] = $Session->ID; } $login = param($dummy_fields['login'], 'string', ''); $check_field = is_email($login) ? 'user_email' : 'user_login'; // Get the most recently used 3 users with matching email address $salts = $DB->get_col('SELECT user_salt FROM T_users WHERE ' . $check_field . ' = ' . $DB->quote(utf8_strtolower($login)) . ' ORDER BY user_lastseen_ts DESC, user_status ASC LIMIT 3'); // Make sure to return at least one salt, to make it unable to guess if user exists with the given login if (empty($salts)) { // User with the given login was not found add one random salt value $salts[] = generate_random_key(8); }
/** * Initialize JavaScript for AJAX loading of popup window to report user * * @param array Params */ function echo_file_properties() { global $admin_url; ?> <script type="text/javascript"> //<![CDATA[ <?php // Initialize JavaScript to build and open window echo_modalwindow_js(); ?> // Window to edit file function file_properties( root, path, file ) { openModalWindow( '<span class="loader_img loader_file_edit absolute_center" title="<?php echo T_('Loading...'); ?> "></span>', '80%', '', true, '<?php echo TS_('File properties'); ?> ', '<?php echo TS_('Save Changes!'); ?> ', true, true ); jQuery.ajax( { type: 'POST', url: '<?php echo $admin_url; ?> ', data: { 'ctrl': 'files', 'action': 'edit_properties', 'root': root, 'path': path, 'fm_selected': [ file ], 'mode': 'modal', 'crumb_file': '<?php echo get_crumb('file'); ?> ', }, success: function( result ) { openModalWindow( result, '80%', '',true, '<?php echo TS_('File properties'); ?> ', '<?php echo TS_('Save Changes!'); ?> ', false, true ); } } ); return false; } //]]> </script> <?php }
/** * Initialize JavaScript for AJAX loading of popup window to report user */ function echo_user_report_js() { global $rsc_url, $admin_url; ?> <script type="text/javascript"> function user_report( user_ID, user_tab_from ) { userReportForm( '<img src="<?php echo $rsc_url; ?> img/ajax-loader2.gif" alt="<?php echo T_('Loading...'); ?> " title="<?php echo T_('Loading...'); ?> " style="display:block;margin:auto;position:absolute;top:0;bottom:0;left:0;right:0;" />', '680px' ); jQuery.ajax( { type: 'POST', url: '<?php echo $admin_url; ?> ', data: { 'ctrl': 'user', 'user_tab': 'report', 'user_tab_from': user_tab_from, 'user_ID': user_ID, 'display_mode': 'js', 'crumb_user': '******'user'); ?> ', }, success: function(result) { userReportForm( result, '680px' ); } } ); return false; } /* * This is called when we get the response from the server: */ function userReportForm( the_html, width ) { if( typeof width == 'undefined' ) { width = '560px'; } // add placeholder for antispam settings form: jQuery( 'body' ).append( '<div id="screen_mask" onclick="closeUserReportForm()"></div><div id="overlay_page" style="width:' + width + '"></div>' ); var evobar_height = jQuery( '#evo_toolbar' ).height(); jQuery( '#screen_mask' ).css({ top: evobar_height }); jQuery( '#screen_mask' ).fadeTo(1,0.5).fadeIn(200); jQuery( '#overlay_page' ).html( the_html ).addClass( 'overlay_page_active_transparent' ); jQuery( '#close_button' ).bind( 'click', closeUserReportForm ); // Close antispam popup if Escape key is pressed: var keycode_esc = 27; jQuery(document).keyup(function(e) { if( e.keyCode == keycode_esc ) { closeUserReportForm(); } } ); } // This is called to close the antispam ban overlay page function closeUserReportForm() { jQuery( '#overlay_page' ).hide(); jQuery( '.action_messages').remove(); jQuery( '#server_messages' ).insertBefore( '.first_payload_block' ); jQuery( '#overlay_page' ).remove(); jQuery( '#screen_mask' ).remove(); return false; } </script> <?php }
ORDER BY uf_varchar')); exit(0); // Exit here in order to don't display the AJAX debug info after JSON formatted data break; case 'get_widget_login_hidden_fields': // get the loginform crumb, the password encryption salt, and the Session ID $pwd_salt = $Session->get('core.pwd_salt'); if (empty($pwd_salt)) { // Session salt is not generated yet, needs to generate $pwd_salt = generate_random_key(64); $Session->set('core.pwd_salt', $pwd_salt, 86400); $Session->dbsave(); // save now, in case there's an error later, and not saving it would prevent the user from logging in. } // display result to return echo get_crumb('loginform') . ' ' . $pwd_salt . ' ' . $Session->ID; break; case 'get_userfields_criteria': // Get fieldset for users filter by Specific criteria $Form = new Form(); $Form->switch_layout('blockspan'); echo '<br />'; $Form->output = false; $criteria_input = $Form->text('criteria_value[]', '', 17, '', '', 50); $criteria_input .= get_icon('add', 'imgtag', array('rel' => 'add_criteria')); $Form->output = true; global $user_fields_empty_name; $user_fields_empty_name = T_('Select...'); $Form->select('criteria_type[]', '', 'callback_options_user_new_fields', T_('Specific criteria'), $criteria_input); break; case 'get_regions_option_list':
/** * Load goals on changing of category */ function echo_onchange_goal_cat() { global $blog; ?> <script type="text/javascript"> jQuery( '#goal_cat_ID' ).change( function() { jQuery( '#goal_ID' ).next().find( 'img' ).show(); var cat_ID = jQuery( this ).val(); jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: 'action=get_goals&cat_id=' + cat_ID + '&blogid=<?php echo $blog; ?> &crumb_itemgoal=<?php echo get_crumb('itemgoal'); ?> ', success: function( result ) { jQuery( '#goal_ID' ).html( ajax_debug_clear( result ) ).next().find( 'img' ).hide(); } } ); } ); </script> <?php }
type: 'POST', url: '<?php echo $htsrv_url; ?> anon_async.php', data: { 'blogid': <?php echo '\'' . $Blog->ID . '\''; ?> , 'commentid': id, 'type': type, 'vote': vote, 'action': 'set_comment_vote', 'crumb_comment': <?php echo '\'' . get_crumb('comment') . '\''; ?> , }, success: function(result) { if( color != '' ) { // Revert back color fadeIn( divid, color ); } jQuery('#vote_'+type+'_'+id).after( ajax_debug_clear( result ) ); jQuery('#vote_'+type+'_'+id).remove(); } }); }
/** * Handle collections module htsrv actions */ function handle_htsrv_action() { global $demo_mode, $current_User, $DB, $Session, $Messages; global $UserSettings, $samedomain_htsrv_url; if (!is_logged_in()) { // user must be logged in bad_request_die($this->T_('You are not logged in.')); } // Init the objects we want to work on. $action = param_action(true); // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('collections_' . $action); switch ($action) { case 'unlink': // Unlink a file from a LinkOwner ( Item, Comment ) object, and delete that file if it's not linked to any other object $link_ID = param('link_ID', 'integer', true); $redirect_to = param('redirect_to', 'url', ''); $LinkCache =& get_LinkCache(); $edited_Link =& $LinkCache->get_by_ID($link_ID, false); if (!$edited_Link) { // the edited Link object doesn't exists $Messages->add(sprintf(T_('Requested «%s» object does not exist any longer.'), T_('Link')), 'error'); header_redirect(); } // We have a link, get the LinkOwner it is attached to: $LinkOwner =& $edited_Link->get_LinkOwner(); $linked_File =& $edited_Link->get_File(); // Load the blog we're in: $Blog =& $LinkOwner->get_Blog(); set_working_blog($Blog->ID); // Check permission: $LinkOwner->check_perm('edit', true); $confirmed = param('confirmed', 'integer', 0); if ($confirmed) { // Unlink File from Item: $edited_Link->dbdelete(true); unset($edited_Link); $Messages->add($LinkOwner->translate('Link has been deleted from $ownerTitle$.'), 'success'); if ($current_User->check_perm('files', 'edit')) { // current User has permission to edit/delete files $file_name = $linked_File->get_name(); // Get number of objects where this file is attahced to // TODO: attila>this must be handled with a different function $file_links = get_file_links($linked_File->ID, array('separator' => '<br />')); $links_count = strlen($file_links) > 0 ? substr_count($file_links, '<br />') + 1 : 0; if ($links_count > 0) { // File is linked to other objects $Messages->add(sprintf(T_('File %s is still linked to %d other objects'), $file_name, $links_count), 'note'); } else { // File is not linked to other objects if ($linked_File->unlink()) { // File removed successful ( removed from db and from storage device also ) $Messages->add(sprintf(T_('File %s has been deleted.'), $file_name), 'success'); } else { // Could not completly remove the file $Messages->add(sprintf(T_('File %s could not be deleted.'), $file_name), 'error'); } } } } else { // Display confirm unlink/delete message $delete_url = $samedomain_htsrv_url . 'action.php?mname=collections&action=unlink&link_ID=' . $edited_Link->ID . '&confirmed=1&crumb_collections_unlink=' . get_crumb('collections_unlink'); $ok_button = '<span class="linkbutton"><a href="' . $delete_url . '">' . T_('I am sure!') . '!</a></span>'; $cancel_button = '<span class="linkbutton"><a href="' . $redirect_to . '">CANCEL</a></span>'; $msg = sprintf(T_('You are about to unlink and delete the attached file from %s path.'), $linked_File->get_root_and_rel_path()); $msg .= '<br />' . T_('This CANNOT be undone!') . '<br />' . T_('Are you sure?') . '<br /><br />' . $ok_button . "\t" . $cancel_button; $Messages->add($msg, 'error'); } header_redirect($redirect_to); break; case 'isubs_update': // Subscribe/Unsubscribe user on the selected item if ($demo_mode && $current_User->ID <= 3) { // don't allow default users profile change on demo mode bad_request_die('Demo mode: you can\'t edit the admin and demo users profile!<br />[<a href="javascript:history.go(-1)">' . T_('Back to profile') . '</a>]'); } // Get params $item_ID = param('p', 'integer', true); $notify = param('notify', 'integer', 0); if ($notify < 0 || $notify > 1) { // Invalid notify param. It should be 0 for unsubscribe and 1 for subscribe. $Messages->add('Invalid params!', 'error'); } if (!is_email($current_User->get('email'))) { // user doesn't have a valid email address $Messages->add(T_('Your email address is invalid. Please set your email address first.'), 'error'); } if ($Messages->has_errors()) { // errors detected header_redirect(); // already exited here } if (set_user_isubscription($current_User->ID, $item_ID, $notify)) { if ($notify == 0) { $Messages->add(T_('You have successfully unsubscribed.'), 'success'); } else { $Messages->add(T_('You have successfully subscribed to notifications.'), 'success'); } } else { $Messages->add(T_('Could not subscribe to notifications.'), 'error'); } header_redirect(); break; // already exited here } }
die('Please, do not access this page directly.'); } /** * @global Plugin */ global $edit_Plugin; /** * @global Plugins_admin */ global $admin_Plugins; global $edited_plugin_name, $edited_plugin_shortdesc, $edited_plugin_priority, $edited_plugin_code; global $admin_url; load_funcs('plugins/_plugin.funcs.php'); $Form = new Form(NULL, 'pluginsettings_checkchanges'); // Restore defaults button: $Form->global_icon(T_('Restore defaults'), 'reload', regenerate_url('action,plugin_class', 'action=default_settings&plugin_ID=' . $edit_Plugin->ID . '&crumb_plugin=' . get_crumb('plugin')), T_('Restore defaults'), 5, 4, array('onclick' => 'if (!confirm(\'' . TS_('Are you sure you want to restore the default settings? This cannot be undone!') . '\')) { cancelClick(event); }')); // Info button: $Form->global_icon(T_('Display info'), 'info', regenerate_url('action,plugin_class', 'action=info&plugin_class=' . $edit_Plugin->classname)); // Close button: $Form->global_icon(T_('Cancel edit!'), 'close', regenerate_url()); $Form->begin_form('fform', '', array('onsubmit' => 'var es=this.elements; for( var i=0; i < es.length; i++ ) { es[i].disabled=false; };')); $Form->add_crumb('plugin'); $Form->hidden_ctrl(); $Form->hidden('plugin_ID', $edit_Plugin->ID); // --------------------------- INFO --------------------------- $Form->begin_fieldset(T_('Plugin info'), array('class' => 'clear')); // Name: $Form->text_input('edited_plugin_name', $edited_plugin_name, 25, T_('Name'), '', array('maxlength' => 255)); // Desc: $Form->text_input('edited_plugin_shortdesc', $edited_plugin_shortdesc, 50, T_('Short desc'), '', array('maxlength' => 255)); // Links to external manual (dh> has been removed from form's global_icons before by fp, but is very useful IMHO):
echo $dummy_fields['pwd']; ?> " placeholder="<?php echo T_('Password'); ?> " id="pwd" value="" /></label> <input type="submit" id="logsub" name="submit" value="<?php echo T_('Login'); ?> " /> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?> "/> <input type="hidden" value="<?php echo get_crumb('loginform'); ?> " name="crumb_loginform" /> <input type="hidden" value="login" name="login_action[login]" /> <input type="hidden" value="<?php echo (int) use_in_skin_login(); ?> " name="inskin" /> <a href="javascript:return false;"><img class="head-close" src="<?php echo $Skin->get_url(); ?> img/head-close.png" alt="close" /></a> </form> </div> </div>
die('Please, do not access this page directly.'); } load_class('items/model/_itemtype.class.php', 'ItemType'); /** * @var Itemtype */ global $edited_Itemtype; // Determine if we are creating or updating... global $action; $creating = is_create_action($action); $Form = new Form(NULL, 'itemtype_checkchanges'); if ($edited_Itemtype->ID > 0) { $default_ids = ItemType::get_default_ids(); if (!$edited_Itemtype->is_special() && !in_array($edited_Itemtype->ID, $default_ids)) { // Allow delete post type only if it is not default of blogs $Form->global_icon(T_('Delete this Post Type!'), 'delete', regenerate_url('action', 'action=delete&crumb_itemtype=' . get_crumb('itemtype'))); } } $Form->global_icon(T_('Cancel editing!'), 'close', regenerate_url('action,ityp_ID')); $Form->begin_form('fform', $edited_Itemtype->ID > 0 ? T_('Edit post type') : T_('New post type')); $Form->add_crumb('itemtype'); $Form->hiddens_by_key(get_memorized('action' . ($creating ? ',ityp_ID' : ''))); // (this allows to come back to the right list order & page) $Form->begin_fieldset($creating ? T_('New Post Type') . get_manual_link('item-type-form') : T_('Post type') . get_manual_link('item-type-form')); if ($creating) { $Form->text_input('new_ityp_ID', get_param('new_ityp_ID'), 8, T_('ID'), '', array('maxlength' => 10, 'required' => true)); } else { $Form->hidden('ityp_ID', $edited_Itemtype->ID); } if ($edited_Itemtype->is_special()) { // Don't edit a name of special post types
/** * Add a crumb to the current form * * Use this for all forms leading to DATA CHANGING actions * (anything other than info retrieval), for example: * -search forms don't need this * -create, update, delete actions definitely need this * -change order, change status and more subtle actions also need this * * @param string crumb name */ function add_crumb($crumb_name) { $this->hidden('crumb_' . $crumb_name, get_crumb($crumb_name)); }
/** * Initialize JavaScript for AJAX changing of an accept status of organizations for each user */ function echo_user_organization_js() { global $current_User; if (!$current_User->check_perm('users', 'edit')) { // Only admins can change an accept status of organizations return; } ?> <script type="text/javascript"> jQuery( document ).on( 'click', 'span[rel^=org_status_]', function() { // Change an accept status of organization var this_obj = jQuery( this ); var params = '<?php global $b2evo_icons_type; echo empty($b2evo_icons_type) ? '' : '&b2evo_icons_type=' . $b2evo_icons_type; ?> '; jQuery.ajax( { type: 'POST', url: '<?php echo get_samedomain_htsrv_url(); ?> async.php', data: 'action=change_user_org_status&status=' + this_obj.attr( 'rel' ) + '&crumb_userorg=<?php echo get_crumb('userorg'); ?> ' + params, success: function( result ) { this_obj.after( ajax_debug_clear( result ) ).remove(); } } ); } ); </script> <?php }