/** * Get ready for displaying the skin. * * This may register some CSS or JS... */ function display_init() { // call parent: parent::display_init(); // We pass NO params. This gives up the default Skins API v5 behavior. add_js_headline('var touch_skin_switch_confirm_text = "' . TS_('Switch to regular view? \\n \\n You can switch back again in the footer.') . '";'); $this->require_js('js/core.js'); require_js('navigation.js', 'blog'); }
function tagitem_edit_actions($Item) { global $current_User, $edited_ItemTag; // Display the edit icon if current user has the rights: $r = $Item->get_edit_link(array('before' => '', 'after' => ' ', 'text' => get_icon('edit'), 'title' => '#', 'class' => '')); if ($current_User->check_perm('item_post!CURSTATUS', 'edit', false, $Item)) { // Display the unlink icon if current user has the rights: $r .= action_icon(T_('Unlink this tag from post!'), 'unlink', regenerate_url('tag_ID,action,tag_filter', 'tag_ID=' . $edited_ItemTag->ID . '&item_ID=' . $Item->ID . '&action=unlink&' . url_crumb('tag')), NULL, NULL, NULL, array('onclick' => 'return confirm(\'' . format_to_output(sprintf(TS_('Are you sure you want to remove the tag "%s" from "%s"?'), $edited_ItemTag->dget('name'), $Item->dget('title')) . '\');', 'htmlattr'))); } return $r; }
* @param string the form name * @param string the checkbox(es) element(s) name * @param string number/name of the checkall set to use. Defaults to 0 and is needed when there are several "checkall-sets" on one page. */ $toggleCheckboxes_script = "\n\t\t\t\tfunction toggleCheckboxes(the_form, the_elements, set_name )\n\t\t\t\t{\n\t\t\t\t\tif( typeof set_name == 'undefined' )\n\t\t\t\t\t{\n\t\t\t\t\t\tset_name = 0;\n\t\t\t\t\t}\n\t\t\t\t\tif( allchecked[set_name] ) allchecked[set_name] = false;\n\t\t\t\t\telse allchecked[set_name] = true;\n\n\t\t\t\t\tvar elems = document.forms[the_form].elements[the_elements];\n\t\t\t\t\tif( !elems )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tvar elems_cnt = (typeof(elems.length) != 'undefined') ? elems.length : 0;\n\t\t\t\t\tif (elems_cnt)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (var i = 0; i < elems_cnt; i++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\telems[i].checked = allchecked[nr];\n\t\t\t\t\t\t} // end for\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\telems.checked = allchecked[nr];\n\t\t\t\t\t}\n\t\t\t\t\tsetcheckallspan( set_name );\n\t\t\t\t}\n"; add_headline($toggleCheckboxes_script); break; } // --- general functions ---------------- /** * replaces the text of the checkall-html-ID for set_name * * @param integer|string number or name of the checkall "set" to use * @param boolean force setting to true/false */ $setcheckallspan_script = "\n\t\t\tfunction setcheckallspan( set_name, set )\n\t\t\t{\n\t\t\t\tif( typeof(allchecked[set_name]) == 'undefined' || typeof(set) != 'undefined' )\n\t\t\t\t{ // init\n\t\t\t\t\tallchecked[set_name] = set;\n\t\t\t\t}\n\n\t\t\t\tif( allchecked[set_name] )\n\t\t\t\t{\n\t\t\t\t\tvar replace = document.createTextNode('" . TS_('uncheck all') . "');\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar replace = document.createTextNode('" . TS_('check all') . "');\n\t\t\t\t}\n\n\t\t\t\tif( document.getElementById( idprefix+'_'+String(set_name) ) )\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById( idprefix+'_'+String(set_name) ).replaceChild(replace, document.getElementById( idprefix+'_'+String(set_name) ).firstChild);\n\t\t\t\t}\n\t\t\t\t//else alert('no element with id '+idprefix+'_'+String(set_name));\n\t\t\t}\n"; add_headline($setcheckallspan_script); /** * inits the checkall functionality. * * @param string the prefix of the IDs where the '(un)check all' text should be set * @param boolean initial state of the text (if there is no checkbox with ID htmlid + '_state_' + nr) */ $initcheckall_script = <<<JS \t\t\tfunction initcheckall( htmlid, init ) \t\t\t{ \t\t\t\t// initialize array \t\t\t\tallchecked = Array(); \t\t\t\tidprefix = typeof(htmlid) == 'undefined' ? 'checkallspan' : htmlid; \t\t\t\tfor( var lform = 0; lform < document.forms.length; lform++ )
/** * Get all links where file is used * * @param integer File ID * @param array Params * @return string The links to that posts, comments and users where the file is used */ function get_file_links($file_ID, $params = array()) { global $DB, $current_User, $baseurl, $admin_url; $params = array_merge(array('separator' => '<br />', 'post_prefix' => T_('Post') . ' - ', 'comment_prefix' => T_('Comment on') . ' - ', 'user_prefix' => T_('Profile picture') . ' - ', 'current_link_ID' => 0, 'current_before' => '<b>', 'current_after' => '</b>'), $params); // Create result array $attached_to = array(); // Get all links with posts and comments $links_SQL = new SQL(); $links_SQL->SELECT('link_ID, link_itm_ID, link_cmt_ID, link_usr_ID'); $links_SQL->FROM('T_links'); $links_SQL->WHERE('link_file_ID = ' . $DB->quote($file_ID)); $links = $DB->get_results($links_SQL->get()); if (!empty($links)) { // File is linked with some posts or comments $ItemCache =& get_ItemCache(); $CommentCache =& get_CommentCache(); $UserCache =& get_UserCache(); $LinkCache =& get_LinkCache(); foreach ($links as $link) { $link_object_ID = 0; $r = ''; if ($params['current_link_ID'] == $link->link_ID) { $r .= $params['current_before']; } if (!empty($link->link_itm_ID)) { // File is linked to a post if ($Item =& $ItemCache->get_by_ID($link->link_itm_ID, false)) { $Blog = $Item->get_Blog(); if ($current_User->check_perm('item_post!CURSTATUS', 'view', false, $Item)) { // Current user can edit the linked post $r .= $params['post_prefix'] . '<a href="' . url_add_param($admin_url, 'ctrl=items&blog=' . $Blog->ID . '&p=' . $link->link_itm_ID) . '">' . $Item->get('title') . '</a>'; } else { // No access to edit the linked post $r .= $params['post_prefix'] . $Item->get('title'); } $link_object_ID = $link->link_itm_ID; } } elseif (!empty($link->link_cmt_ID)) { // File is linked to a comment if ($Comment =& $CommentCache->get_by_ID($link->link_cmt_ID, false)) { $Item = $Comment->get_Item(); if ($current_User->check_perm('comment!CURSTATUS', 'moderate', false, $Comment)) { // Current user can edit the linked Comment $r .= $params['comment_prefix'] . '<a href="' . url_add_param($admin_url, 'ctrl=comments&action=edit&comment_ID=' . $link->link_cmt_ID) . '">' . $Item->get('title') . '</a>'; } else { // No access to edit the linked Comment $r .= $params['comment_prefix'] . $Item->get('title'); } $link_object_ID = $link->link_cmt_ID; } } elseif (!empty($link->link_usr_ID)) { // File is linked to user if ($User =& $UserCache->get_by_ID($link->link_usr_ID, false)) { if ($current_User->ID != $User->ID && !$current_User->check_perm('users', 'view')) { // No permission to view other users in admin form $r .= $params['user_prefix'] . '<a href="' . url_add_param($baseurl, 'disp=user&user_ID=' . $User->ID) . '">' . $User->login . '</a>'; } else { // Build a link to display a user in admin form $r .= $params['user_prefix'] . '<a href="?ctrl=user&user_tab=profile&user_ID=' . $User->ID . '">' . $User->login . '</a>'; } $link_object_ID = $link->link_usr_ID; } } if (!empty($link_object_ID)) { // Action icon to unlink file from object if (($edited_Link =& $LinkCache->get_by_ID($link->link_ID, false, false)) !== false && ($LinkOwner =& $edited_Link->get_LinkOwner()) !== false && $LinkOwner->check_perm('edit', false)) { // Allow to unlink only if current user has an permission $r .= ' ' . action_icon(T_('Delete this link!'), 'unlink', $admin_url . '?ctrl=links&link_ID=' . $link->link_ID . '&link_type=item&link_object_ID=' . $link->link_usr_ID . '&action=unlink&redirect_to=' . rawurlencode(regenerate_url('blog', '', '', '&')) . '&' . url_crumb('link'), NULL, NULL, NULL, array('onclick' => 'return confirm(\'' . TS_('Are you sure want to unlink this file?') . '\');')); } } if ($params['current_link_ID'] == $link->link_ID) { $r .= $params['current_after']; } if (!empty($r)) { $attached_to[] = $r; } } } return implode($params['separator'], $attached_to); }
// Generate available blogs list: $AdminUI->set_coll_list_params('blog_ismember', 'view', array('ctrl' => 'items', 'filter' => 'restore')); switch ($action) { case 'edit': case 'edit_switchtab': // this gets set as action by JS, when we switch tabs // this gets set as action by JS, when we switch tabs case 'update_edit': case 'update': // on error // on error case 'update_publish': // on error if ($current_User->check_perm('item_post!CURSTATUS', 'delete', false, $edited_Item)) { // User has permissions to delete this post $AdminUI->global_icon(T_('Delete this post'), 'delete', '?ctrl=items&action=delete&post_ID=' . $edited_Item->ID . '&' . url_crumb('item'), ' ' . T_('Delete'), 4, 3, array('onclick' => 'return confirm(\'' . TS_('You are about to delete this post!\\nThis cannot be undone!') . '\')', 'style' => 'margin-right: 3ex;')); } $AdminUI->global_icon(T_('Permanent link to full entry'), 'permalink', $edited_Item->get_permanent_url(), ' ' . T_('Permalink'), 4, 3, array('style' => 'margin-right: 3ex')); break; } $AdminUI->global_icon(T_('Cancel editing!'), 'close', $redirect_to, T_('Cancel'), 4, 2); init_tokeninput_js(); break; case 'new_mass': $AdminUI->set_coll_list_params('blog_post_statuses', 'edit', array('ctrl' => 'items', 'action' => 'new'), NULL, '', 'return b2edit_reload( document.getElementById(\'item_checkchanges\'), \'' . $dispatcher . '\', %s )'); // We don't check the following earlier, because we want the blog switching buttons to be available: if (!blog_has_cats($blog)) { $error_message = T_('Since this blog has no categories, you cannot post into it.'); if ($current_User->check_perm('blog_cats', 'edit', false, $blog)) { // If current user has a permission to create a category global $admin_url;
$Form->hidden('tab3', 'tools'); $Form->hidden('tool', 'bankruptcy'); $Form->begin_form('fform', T_('Declare comment spam bankruptcy...')); if (isset($delete_bankruptcy_blogs) && $delete_bankruptcy_blogs) { $Form->begin_fieldset(T_('Deleting log')); antispam_bankruptcy_delete($bankruptcy_blogs_IDs, $comment_status); $Form->end_fieldset(); } $visibility_statuses = get_visibility_statuses('', array()); $Form->begin_fieldset(T_('Filter comments by status')); $Form->select_input_array('comment_status', $comment_status, $visibility_statuses, T_('Look at comments with status'), ''); $Form->buttons(array(array('submit', 'actionArray[bankruptcy_filter]', T_('Filter')))); $Form->end_fieldset(); $Form->begin_fieldset(T_('Select blogs')); $blogs_list = antispam_bankruptcy_blogs($comment_status); if (empty($blogs_list)) { // No blogs echo '<p>' . sprintf(T_('No comments found with status %s...'), $visibility_statuses[$comment_status]) . '</p>'; } else { // Print blogs list foreach ($blogs_list as $blog) { echo '<p><input type="checkbox" name="bankruptcy_blogs[]" value="' . $blog->blog_ID . '" id="bankruptcy_blog_' . $blog->blog_ID . '" /> '; echo '<label for="bankruptcy_blog_' . $blog->blog_ID . '">' . $blog->blog_name . ' (' . sprintf(T_('<b>%s</b> comments with status %s'), $blog->comments_count, $visibility_statuses[$comment_status]) . ')</label></p>'; } } $Form->end_fieldset(); $buttons = array(); if (!empty($blogs_list)) { $buttons[] = array('submit', 'actionArray[bankruptcy_delete]', sprintf(T_('Delete ALL comments with status %s from the selected blogs!'), $visibility_statuses[$comment_status]), 'RedButton', "return confirm('" . sprintf(TS_('ALL comments with status %s\\nincluding NON spam\\nwill be deleted from the selected blogs.\\nThis cannot be undone!\\nAre you sure?'), $visibility_statuses[$comment_status]) . "')"); } $Form->end_form($buttons);
} ); $input.bind( 'blur', function() { var revert_changes = false; var td_obj = jQuery( this ).parent(); if( td_obj.attr( 'rel' ) != jQuery( this ).val() ) { // Value was changed, ask about saving // fp>yura: please explain where and when this happens: // yura>fp: 1. Go to in backoffice "Manual BLOG > Contents > Manual Pages" like this url: /admin.php?ctrl=items&tab=manual&filter=restore&blog=6 // 2. Click on the cell of the column "Order", You will see the input to change an order // 3. Change to other value // 4. Click outside input(to init event "blur") - and this message will be appeared if( confirm( '<?php echo TS_('Do you want discard your changes for this order field?'); ?> ' ) ) { revert_changes = true; } } else { revert_changes = true; } if( revert_changes ) { // Revert the changed value td_obj.html( td_obj.attr( 'rel' ) ); }
/** * Displays button for deleting the Comment if user has proper rights * * @param string to display before link * @param string to display after link * @param string link text * @param string link title * @param string class name * @param boolean true to make this a button instead of a link * @param string glue between url params * @param boolean save context? * @param boolean true if create AJAX button * @param string confirmation text * @param string Redirect url */ function delete_link($before = ' ', $after = ' ', $text = '#', $title = '#', $class = '', $button = false, $glue = '&', $save_context = true, $ajax_button = false, $confirm_text = '#', $redirect_to = NULL) { global $current_User, $admin_url; if (!is_logged_in(false)) { return false; } if (empty($this->ID)) { // Happens in Preview return false; } $this->get_Item(); if (!$current_User->check_perm('comment!CURSTATUS', 'delete', false, $this)) { // If User has no permission to delete a comments: return false; } if ($text == '#') { // Use icon+text as default, if not displayed as button (otherwise just the text) $text = $this->status == 'trash' ? T_('Delete!') : T_('Recycle!'); if (!$button) { $text = get_icon('delete') . ' ' . $text; } else { $text = $text; } } if ($title == '#') { $title = $this->status == 'trash' ? T_('Delete this comment') : T_('Recycle this comment'); } $url = $admin_url . '?ctrl=comments' . $glue . 'action=delete' . $glue . 'comment_ID=' . $this->ID . $glue . url_crumb('comment'); if ($save_context) { if ($redirect_to != NULL) { $url .= $glue . 'redirect_to=' . $redirect_to; } else { $url .= $glue . 'redirect_to=' . rawurlencode(regenerate_url('', 'filter=restore', '', '&')); } } echo $before; if ($ajax_button && $this->status != 'trash') { echo '<a href="' . $url . '" onclick="deleteComment(' . $this->ID . '); return false;" title="' . $title . '"'; if (!empty($class)) { echo ' class="' . $class . '"'; } echo '>' . $text . '</a>'; } else { // JS confirm is required only when the comment is not in the recycle bin yet $display_js_confirm = $this->status == 'trash'; if ($display_js_confirm && $confirm_text == '#') { // Set js confirm text on comment delete action $confirm_text = TS_('You are about to delete this comment!\\nThis cannot be undone!'); } if ($button) { // Display as button echo '<input type="button"'; echo ' value="' . $text . '" title="' . $title . '"'; if ($display_js_confirm) { echo ' onclick="if ( confirm(\'' . $confirm_text . '\') ) { document.location.href=\'' . $url . '\' }"'; } if (!empty($class)) { echo ' class="' . $class . '"'; } echo '/>'; } else { // Display as link echo '<a href="' . $url . '" title="' . $title . '"'; if ($display_js_confirm) { echo ' onclick="return confirm(\'' . $confirm_text . '\')"'; } if (!empty($class)) { echo ' class="' . $class . '"'; } echo '>' . $text . '</a>'; } } echo $after; return true; }
/** * Return link to check/uncheck all permission in a row * * @param object db row * @param string the prefix of the db row: 'bloguser_' or 'bloggroup_' * @return string the link element */ function perm_check_all($row, $prefix) { global $permission_to_change_admin; $row_id_coll = get_id_coll_from_prefix($prefix); if (!$permission_to_change_admin && $row->{$prefix . 'perm_admin'}) { return ' '; } $row_id_value = $row->{$row_id_coll}; return '<a href="javascript:toggleall_perm(document.getElementById(\'blogperm_checkchanges\'), ' . $row_id_value . ' );setcheckallspan(' . $row_id_value . ');" title="' . TS_('(un)selects all checkboxes using Javascript') . '"> <span id="checkallspan_' . $row_id_value . '">' . TS_('(un)check all') . '</span> </a>'; }
function perm_check_all($row) { global $permission_to_change_admin; if (!$permission_to_change_admin && $row->bloggroup_perm_admin) { return ' '; } return '<a href="javascript:toggleall_wide(document.getElementById(\'blogperm_checkchanges\'), ' . $row->grp_ID . ' );merge_from_wide( document.getElementById(\'blogperm_checkchanges\'), ' . $row->grp_ID . ' ); setcheckallspan(' . $row->grp_ID . ');" title="' . TS_('(un)selects all checkboxes using Javascript') . '"> <span id="checkallspan_' . $row->grp_ID . '">' . TS_('(un)check all') . '</span> </a>'; }
ob_start(); // UserSettings: $plugin_user_settings = $loop_Plugin->GetDefaultUserSettings($tmp_params = array('for_editing' => true, 'user_ID' => $edited_User->ID)); if (is_array($plugin_user_settings)) { foreach ($plugin_user_settings as $l_name => $l_meta) { // Display form field for this setting: autoform_display_field($l_name, $l_meta, $Form, 'UserSettings', $loop_Plugin, $edited_User); } } // fp> what's a use case for this event? (I soooo want to nuke it...) $Plugins->call_method($loop_Plugin->ID, 'PluginUserSettingsEditDisplayAfter', $tmp_params = array('Form' => &$Form, 'User' => $edited_User)); $has_contents = strlen(ob_get_contents()); $Form->end_fieldset(); if ($has_contents) { ob_end_flush(); ob_end_flush(); } else { // No content, discard output buffers: ob_end_clean(); ob_end_clean(); } } } /*************** Buttons **************/ if ($action != 'view') { // Edit buttons $Form->buttons(array(array('', 'actionArray[update]', T_('Save !'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton'), array('type' => 'submit', 'name' => 'actionArray[default_settings]', 'value' => T_('Restore defaults'), 'class' => 'ResetButton', 'onclick' => "return confirm('" . TS_('This will reset all your user settings.') . '\\n' . TS_('This cannot be undone.') . '\\n' . TS_('Are you sure?') . "');"))); } $Form->end_form(); // End payload block: $this->disp_payload_end();
/** * Output Javascript for tags autocompletion. * @todo dh> a more facebook like widget would be: http://plugins.jquery.com/project/facelist * "ListBuilder" is being planned for jQuery UI: http://wiki.jqueryui.com/ListBuilder * * @param array Tags */ function echo_autocomplete_tags($tags = array()) { global $htsrv_url; // Initialize an array to pre-fill the tags input $prefilled_tags = array(); if (!empty($tags)) { foreach ($tags as $tag_name) { $prefilled_tags[] = array('id' => $tag_name, 'title' => $tag_name); } } //echo <<<EOD ?> <script type="text/javascript"> (function($){ jQuery(function() { jQuery( '#item_tags' ).tokenInput( '<?php echo $htsrv_url . 'async.php?action=get_tags'; ?> ', { theme: 'facebook', queryParam: 'term', propertyToSearch: 'title', tokenValue: 'title', preventDuplicates: true, prePopulate: <?php echo evo_json_encode($prefilled_tags); ?> , hintText: '<?php echo TS_('Type in a tag'); ?> ', noResultsText: '<?php echo TS_('No results'); ?> ', searchingText: '<?php echo TS_('Searching...'); ?> ' } ); }); })(jQuery); </script> <?php //EOD; }
/** * Display Toolbar * * @param object Blog */ function DisplayCodeToolbar($Blog = NULL, $params = array()) { global $Hit; if ($Hit->is_lynx()) { // let's deactivate toolbar on Lynx, because they don't work there. return false; } if (empty($Blog)) { // Use FALSE by default because we don't have the settings for Message $text_styles_enabled = false; $links_enabled = false; $images_enabled = false; } else { // Get plugin setting values depending on Blog $text_styles_enabled = $this->get_coll_setting('text_styles', $Blog); $links_enabled = $this->get_coll_setting('links', $Blog); $images_enabled = $this->get_coll_setting('images', $Blog); } // Load js to work with textarea require_js('functions.js', 'blog', true, true); ?> <script type="text/javascript"> //<![CDATA[ var markdown_btns = new Array(); var markdown_open_tags = new Array(); function markdown_btn( id, text, title, tag_start, tag_end, style, open, grp_pos ) { this.id = id; // used to name the toolbar button this.text = text; // label on button this.title = title; // title this.tag_start = tag_start; // open tag this.tag_end = tag_end; // close tag this.style = style; // style on button this.open = open; // set to -1 if tag does not need to be closed this.grp_pos = grp_pos; // position in the group, e.g. 'last' } <?php if ($text_styles_enabled) { // Show thess buttons only when plugin setting "Italic & Bold styles" is enabled ?> markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_bold','bold', '<?php echo TS_('Bold'); ?> ', '**','**', 'font-weight:bold' ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_italic','italic', '<?php echo TS_('Italic'); ?> ', '*','*', 'font-style:italic', -1, 'last' ); <?php } if ($links_enabled) { // Show this button only when plugin setting "Links" is enabled ?> markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_link', 'link','<?php echo TS_('Link'); ?> ', '','', 'text-decoration:underline', -1<?php echo !$images_enabled ? ', \'last\'' : ''; ?> ); <?php } if ($images_enabled) { // Show this button only when plugin setting "Images" is enabled ?> markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_img', 'img','<?php echo TS_('Image'); ?> ', '','', '', -1, 'last' ); <?php } ?> markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_h1','H1', '<?php echo TS_('Header 1'); ?> ', '\n# ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_h1','H2', '<?php echo TS_('Header 2'); ?> ', '\n## ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_h1','H3', '<?php echo TS_('Header 3'); ?> ', '\n### ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_h1','H4', '<?php echo TS_('Header 4'); ?> ', '\n#### ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_h1','H5', '<?php echo TS_('Header 5'); ?> ', '\n##### ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_h1','H6', '<?php echo TS_('Header 6'); ?> ', '\n###### ','', '', -1, 'last' ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_li','li', '<?php echo TS_('Unordered list item'); ?> ', '\n* ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_ol','ol', '<?php echo TS_('Ordered list item'); ?> ', '\n1. ','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_li','blockquote', '<?php echo TS_('Blockquote'); ?> ', '\n> ','', '', -1, 'last' ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_codespan','codespan', '<?php echo TS_('Codespan'); ?> ', '`','`', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_preblock','preblock', '<?php echo TS_('Preformatted code block'); ?> ', '\n\t','', '', -1, 'last' ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_codeblock','codeblock', '<?php echo TS_('Highlighted code block'); ?> ', '\n```\n','\n```\n', '', -1, 'last' ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_hr','hr', '<?php echo TS_('Horizontal Rule'); ?> ', '\n---\n','', '', -1 ); markdown_btns[markdown_btns.length] = new markdown_btn( 'mrkdwn_br','<br>', '<?php echo TS_('Line Break'); ?> ', ' \n','', '', -1 ); function markdown_show_btn( button, i ) { if( button.id == 'mrkdwn_img' ) { // Image document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" title="' + button.title + '" style="' + button.style + '" class="<?php echo $this->get_template('toolbar_button_class'); ?> " data-func="markdown_insert_lnkimg|b2evoCanvas|img" value="' + button.text + '" />'); } else if( button.id == 'mrkdwn_link' ) { // Link document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" title="' + button.title + '" style="' + button.style + '" class="<?php echo $this->get_template('toolbar_button_class'); ?> " data-func="markdown_insert_lnkimg|b2evoCanvas" value="' + button.text + '" />'); } else { // Normal buttons: document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" title="' + button.title + '" style="' + button.style + '" class="<?php echo $this->get_template('toolbar_button_class'); ?> " data-func="markdown_insert_tag|b2evoCanvas|'+i+'" value="' + button.text + '" />'); } } // Memorize a new open tag function markdown_add_tag( button ) { if( markdown_btns[button].tag_end != '' ) { markdown_open_tags[markdown_open_tags.length] = button; document.getElementById( markdown_btns[button].id ).value = '/' + document.getElementById( markdown_btns[button].id ).value; } } // Forget about an open tag function markdown_remove_tag( button ) { for( i = 0; i < markdown_open_tags.length; i++ ) { if( markdown_open_tags[i] == button ) { markdown_open_tags.splice( i, 1 ); document.getElementById( markdown_btns[button].id ).value = document.getElementById( markdown_btns[button].id ).value.replace( '/', '' ); } } } function markdown_check_open_tags( button ) { var tag = 0; for( i = 0; i < markdown_open_tags.length; i++ ) { if( markdown_open_tags[i] == button ) { tag++; } } if( tag > 0 ) { return true; // tag found } else { return false; // tag not found } } function markdown_close_all_tags() { var count = markdown_open_tags.length; for( o = 0; o < count; o++ ) { markdown_insert_tag( b2evoCanvas, markdown_open_tags[markdown_open_tags.length - 1] ); } } function markdown_toolbar( title ) { document.write( '<?php echo $this->get_template('toolbar_title_before'); ?> ' + title + '<?php echo $this->get_template('toolbar_title_after'); ?> ' ); document.write( '<?php echo $this->get_template('toolbar_group_before'); ?> ' ); for( var i = 0; i < markdown_btns.length; i++ ) { markdown_show_btn( markdown_btns[i], i ); if( markdown_btns[i].grp_pos == 'last' && i > 0 && i < markdown_btns.length - 1 ) { // Separator between groups document.write( '<?php echo $this->get_template('toolbar_group_after') . $this->get_template('toolbar_group_before'); ?> ' ); } } document.write( '<?php echo $this->get_template('toolbar_group_after') . $this->get_template('toolbar_group_before'); ?> ' ); document.write( '<input type="button" id="mrkdwn_close" class="<?php echo $this->get_template('toolbar_button_class'); ?> " data-func="markdown_close_all_tags" title="<?php echo format_to_output(T_('Close all tags'), 'htmlattr'); ?> " value="X" />' ); document.write( '<?php echo $this->get_template('toolbar_group_after'); ?> ' ); } function markdown_insert_tag( field, i ) { // we need to know if something is selected. // First, ask plugins, then try IE and Mozilla. var sel_text = b2evo_Callbacks.trigger_callback( "get_selected_text_for_" + field.id ); var focus_when_finished = false; // used for IE if( sel_text == null ) { // detect selection: //IE support if( document.selection ) { field.focus(); var sel = document.selection.createRange(); sel_text = sel.text; focus_when_finished = true; } //MOZILLA/NETSCAPE support else if( field.selectionStart || field.selectionStart == '0' ) { var startPos = field.selectionStart; var endPos = field.selectionEnd; sel_text = ( startPos != endPos ); } } if( sel_text ) { // some text selected textarea_wrap_selection( field, markdown_btns[i].tag_start, markdown_btns[i].tag_end, 0 ); } else { if( !markdown_check_open_tags(i) || markdown_btns[i].tag_end == '' ) { textarea_wrap_selection( field, markdown_btns[i].tag_start, '', 0 ); markdown_add_tag(i); } else { textarea_wrap_selection( field, '', markdown_btns[i].tag_end, 0 ); markdown_remove_tag(i); } } if( focus_when_finished ) { field.focus(); } } function markdown_insert_lnkimg( field, type ) { var url = prompt( '<?php echo TS_('URL'); ?> :', 'http://' ); if( url ) { url = '[' + prompt('<?php echo TS_('Text'); ?> :', '') + ']' + '(' + url; var title = prompt( '<?php echo TS_('Title'); ?> :', '' ); if( title != '' ) { url += ' "' + title + '"'; } url += ')'; if( typeof( type ) != 'undefined' && type == 'img' ) { // for <img> tag url = '!' + url; } textarea_wrap_selection( field, url, '', 1 ); } } //]]> </script><?php echo $this->get_template('toolbar_before', array('$toolbar_class$' => $this->code . '_toolbar')); ?> <script type="text/javascript">markdown_toolbar( '<?php echo T_('Markdown') . ': '; ?> ' );</script><?php echo $this->get_template('toolbar_after'); return true; }
function td_file_duplicates_path($File, $file_root_type, $file_root_ID, $file_path) { if (is_object($File)) { // Check if File object is correct global $current_User; $r = $File->get_view_link() . ' ' . $File->get_target_icon(); if ($current_User->check_perm('files', 'edit_allowed', false, $File->get_FileRoot())) { // Allow to delete a file only if current user has an access global $admin_url; $r .= action_icon(T_('Delete'), 'file_delete', url_add_param($File->get_linkedit_url(), 'action=delete&confirmed=1&fm_selected[]=' . rawurlencode($File->get_rdfp_rel_path()) . '&redirect_to=' . rawurlencode(regenerate_url('blog', '', '', '&')) . '&' . url_crumb('file')), NULL, NULL, NULL, array('onclick' => 'return confirm(\'' . TS_('Are you sure want to delete this file?') . '\');')); } return $r; } else { // Broken File object if (empty($file_path)) { // No file data exist in DB return T_('File no longer exists on disk.'); } else { // Display file info from DB return $file_root_type . '_' . $file_root_ID . ':' . $file_path; } } }
$fuzzy++; } } // $all=$translated+$fuzzy+$untranslated; echo "\n\t" . '<td class="center">' . $all . '</td>'; $percent_done = $all > 0 ? round(($translated - $fuzzy / 2) / $all * 100) : 0; $color = sprintf('%02x%02x00', 255 - round($percent_done * 2.55), round($percent_done * 2.55)); echo "\n\t<td class=\"center\" style=\"background-color:#" . $color . "\">" . $percent_done . " %</td>"; } if ($current_User->check_perm('options', 'edit') && $allow_po_extraction) { // Translator options: if (is_file($po_file)) { echo "\n\t" . '<td class="lastcol">[<a href="' . $pagenow . '?ctrl=locales&action=extract&edit_locale=' . $lkey . ($loc_transinfo ? '&loc_transinfo=1' : '') . '" title="' . T_('Extract .po file into b2evo-format') . '">' . T_('Extract') . '</a>]</td>'; } } } // show message file percentage/extraction echo '</tr>'; } echo '</table>'; if ($current_User->check_perm('options', 'edit')) { echo '<p class="center"><a href="' . $pagenow . '?ctrl=locales&action=edit' . ($loc_transinfo ? '&loc_transinfo=1' : '') . '&edit_locale=_new_">' . get_icon('new') . ' ' . T_('Create new locale') . '</a></p>'; if (isset($l_atleastonefromdb)) { echo '<p class="center"><a href="' . $pagenow . '?ctrl=locales&action=reset' . ($loc_transinfo ? '&loc_transinfo=1' : '') . '" onclick="return confirm(\'' . TS_('Are you sure you want to reset?') . '\')">' . get_icon('delete') . ' ' . T_('Reset to defaults (delete database table)') . '</a></p>'; } } $Form->end_fieldset(); if ($current_User->check_perm('options', 'edit')) { $Form->end_form(array(array('submit', '', T_('Save !'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton'))); } }
{ return true; } window.parent.focus(); textarea_wrap_selection( window.parent.document.getElementById("itemform_post_content"), snippet, '', 1, window.parent.document ); return true; } } // Display a message to inform user after file was linked to object jQuery( document ).ready( function() { jQuery( document ).on( 'click', 'a.link_file', function() { jQuery( this ).parent().append( '<div class="green"><?php echo TS_('The file has been linked.'); ?> </div>' ); } ); } ); // --> </script> <?php if ($fm_highlight) { // we want to highlight a file (e.g. via "Locate this file!"), scroll there and do the success fade ?> <script type="text/javascript"> jQuery( function() { var fm_hl = jQuery("#fm_highlighted"); if( fm_hl.length ) {
{ static $aspm_sources = NULL; if ($aspm_sources === NULL) { /** * the antispam sources * @var array * @static */ $aspm_sources = array('local' => T_('Local'), 'reported' => T_('Reported'), 'central' => T_('Central')); } return $aspm_sources[$row->aspm_source]; } $Results->cols[] = array('th' => T_('Source'), 'order' => 'aspm_source', 'td' => '%antispam_source2({row})%'); // Check if we need to display more: if ($current_User->check_perm('spamblacklist', 'edit')) { // User can edit, spamlist: add controls to output columns: // Add CHECK to 1st column: $Results->cols[0]['td'] = action_icon(TS_('Allow keyword back (Remove it from the blacklist)'), 'allowback', '?ctrl=antispam&action=remove&hit_ID=$aspm_ID$&' . url_crumb('antispam')) . $Results->cols[0]['td']; // Add a column for actions: function antispam_actions(&$row) { $output = ''; if ($row->aspm_source == 'local') { $output .= '[<a href="' . regenerate_url('action,keyword', 'action=report&keyword=' . rawurlencode($row->aspm_string)) . '&' . url_crumb('antispam') . '" title="' . T_('Report abuse to centralized ban blacklist!') . '">' . T_('Report') . '</a>]'; } return $output . '[<a href="' . regenerate_url('action,keyword', 'action=ban&keyword=' . rawurlencode($row->aspm_string)) . '&' . url_crumb('antispam') . '" title="' . T_('Check hit-logs and comments for this keyword!') . '">' . T_('Re-check') . '</a>]'; } $Results->cols[] = array('th' => T_('Actions'), 'td' => '%antispam_actions({row})%'); } // Display results: $Results->display();
function display_level($user_level, $user_ID) { $r = ''; if ($user_level > 0) { $r .= action_icon(TS_('Decrease user level'), 'decrease', regenerate_url('action', 'action=promote&prom=down&user_ID=' . $user_ID)); } else { $r .= get_icon('decrease', 'noimg'); } $r .= sprintf('<code>% 2d </code>', $user_level); if ($user_level < 10) { $r .= action_icon(TS_('Increase user level'), 'increase', regenerate_url('action', 'action=promote&prom=up&user_ID=' . $user_ID)); } else { $r .= get_icon('increase', 'noimg'); } return $r; }
/** * */ global $Plugins; global $mode, $month, $tab, $redirect_to, $comment_content; $Form = new Form(NULL, 'comment_checkchanges', 'post'); $link_attribs = array('style' => 'margin-right: 3ex;'); // Avoid misclicks by all means! if ($current_User->check_perm('blog_post!draft', 'edit', false, $Blog->ID)) { $Form->global_icon(T_('Elevate this comment into a post'), 'elevate', '?ctrl=comments&action=elevate&comment_ID=' . $edited_Comment->ID . '&' . url_crumb('comment'), T_('Elevate into a post'), 4, 3, $link_attribs); } $delete_url = '?ctrl=comments&action=delete&comment_ID=' . $edited_Comment->ID . '&' . url_crumb('comment'); if ($edited_Comment->status == 'trash') { $delete_title = T_('Delete this comment'); $delete_text = T_('delete'); $link_attribs['onclick'] = 'return confirm(\'' . TS_('You are about to delete this comment!\\nThis cannot be undone!') . '\')'; } else { $delete_title = T_('Recycle this comment'); $delete_text = T_('recycle'); } $Form->global_icon($delete_title, 'recycle', $delete_url, $delete_text, 4, 3, $link_attribs); $Form->global_icon(T_('Cancel editing!'), 'close', str_replace('&', '&', $redirect_to), T_('cancel'), 4, 1); $Form->begin_form('eform'); $Form->add_crumb('comment'); $Form->hidden('ctrl', 'comments'); $Form->hidden('redirect_to', $redirect_to); $Form->hidden('comment_ID', $edited_Comment->ID); ?> <div class="row">
* @copyright (c)2003-2013 by Francois Planque - {@link http://fplanque.com/}. * * @license http://b2evolution.net/about/license.html GNU General Public License (GPL) * * @package admin * * @version $Id: _widget_list.view.php 3328 2013-03-26 11:44:11Z yura $ */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $Blog; global $container_Widget_array; global $container_list; if ($current_User->check_perm('options', 'edit', false)) { echo '<div class="floatright small">' . action_icon(TS_('Reload containers!'), 'reload', '?ctrl=widgets&blog=' . $Blog->ID . '&action=reload&' . url_crumb('widget'), T_('Reload containers!')) . '</div>'; } // Load widgets for current collection: $WidgetCache =& get_WidgetCache(); $container_Widget_array =& $WidgetCache->get_by_coll_ID($Blog->ID); /** * @param string Title of the container. This gets passed to T_()! * @param string Suffix of legend */ function display_container($container, $legend_suffix = '') { global $Blog; global $Session; $Table = new Table(); $Table->title = '<span class="container_name">' . T_($container) . '</span>' . $legend_suffix; // Table ID - fp> needs to be handled cleanly by Table object
*/ $Results->cols[] = array('th' => T_('Login'), 'order' => 'user_login', 'td' => '%get_user_identity_link( #user_login# )%'); $Results->cols[] = array('th' => T_('L'), 'order' => 'user_level', 'td' => '$user_level$', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Is<br />member'), 'th_class' => 'checkright', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'ismember\', \'' . TS_('Permission to read members posts') . '\', \'checkallspan_state_$user_ID$\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Post statuses'), 'th_class' => 'checkright', 'td' => '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'published\', \'' . TS_('Permission to post into this blog with published status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'community\', \'' . TS_('Permission to post into this blog with community status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'protected\', \'' . TS_('Permission to post into this blog with members status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'private\', \'' . TS_('Permission to post into this blog with private status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'review\', \'' . TS_('Permission to post into this blog with review status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'draft\', \'' . TS_('Permission to post into this blog with draft status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'deprecated\', \'' . TS_('Permission to post into this blog with deprecated status') . '\', \'post\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'redirected\', \'' . TS_('Permission to post into this blog with redirected status') . '\', \'post\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Post types'), 'th_class' => 'checkright', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_page\', \'' . TS_('Permission to create pages') . '\' )%' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_intro\', \'' . TS_('Permission to create intro posts (Intro-* post types)') . '\' )%' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_podcast\', \'' . TS_('Permission to create podcast episodes') . '\' )%' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_sidebar\', \'' . TS_('Permission to create sidebar links') . '\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Edit posts<br />/user level'), 'th_class' => 'checkright', 'default_dir' => 'D', 'td' => '%coll_perm_edit( {row}, \'bloguser_\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Delete<br />posts'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_delpost', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_delpost\', \'' . TS_('Permission to delete posts in this blog') . '\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Edit<br />TS'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_edit_ts', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_edit_ts\', \'' . TS_('Permission to edit timestamp on posts and comments in this blog') . '\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Comment<br />statuses'), 'th_class' => 'checkright', 'td' => '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'published\', \'' . TS_('Permission to comment into this blog with published status') . '\', \'comment\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'community\', \'' . TS_('Permission to comment into this blog with community status') . '\', \'comment\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'protected\', \'' . TS_('Permission to comment into this blog with members status') . '\', \'comment\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'private\', \'' . TS_('Permission to comment into this blog with private status') . '\', \'comment\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'review\', \'' . TS_('Permission to comment into this blog with review status') . '\', \'comment\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'draft\', \'' . TS_('Permission to comment into this blog with draft status') . '\', \'comment\' )%' . '%coll_perm_status_checkbox( {row}, \'bloguser_\', \'deprecated\', \'' . TS_('Permission to comment into this blog with deprecated status') . '\', \'comment\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Edit cmts<br />/user level'), 'th_class' => 'checkright', 'default_dir' => 'D', 'td' => '%coll_perm_edit_cmt( {row}, \'bloguser_\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => T_('Delete<br />commts'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_delcmts', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_delcmts\', \'' . TS_('Permission to delete comments on this blog') . '\' )% ' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_recycle_owncmts\', \'' . TS_('Permission to recycle comments on their own posts') . '\' )% ' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_vote_spam_cmts\', \'' . TS_('Permission to give a spam vote on any comment') . '\' )% ', 'td_class' => 'center'); $Results->cols[] = array('th_group' => T_('Edit blog settings'), 'th' => T_('Cats'), 'th_title' => T_('Categories'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_cats', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_cats\', \'' . TS_('Permission to edit categories for this blog') . '\' )%', 'td_class' => 'center'); $Results->cols[] = array('th_group' => T_('Edit blog settings'), 'th' => T_('Feat.'), 'th_title' => T_('Features'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_properties', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_properties\', \'' . TS_('Permission to edit blog features') . '\' )%', 'td_class' => 'center'); $Results->cols[] = array('th_group' => T_('Edit blog settings'), 'th' => T_('Adv.'), 'th_title' => T_('Advanced/Administrative blog properties'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_admin', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_admin\', \'' . TS_('Permission to edit advanced/administrative blog properties') . '\' )%', 'td_class' => 'center'); // Media Directory: $Results->cols[] = array('th' => T_('Media<br />Dir'), 'th_class' => 'checkright', 'order' => 'bloguser_perm_media_upload', 'default_dir' => 'D', 'td' => '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_media_upload\', \'' . TS_('Permission to upload into blog\'s media folder') . '\' )%' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_media_browse\', \'' . TS_('Permission to browse blog\'s media folder') . '\' )%' . '%coll_perm_checkbox( {row}, \'bloguser_\', \'perm_media_change\', \'' . TS_('Permission to change the blog\'s media folder content') . '\' )%', 'td_class' => 'center'); $Results->cols[] = array('th' => ' ', 'td' => '%perm_check_all( {row}, \'bloguser_\' )%', 'td_class' => 'center'); $Results->display(); echo '</div>'; // Permission note: // fp> TODO: link echo '<p class="note center">' . T_('Note: General group permissions may further restrict or extend any media folder permissions defined here.') . '</p>'; $Form->end_fieldset(); // Make a hidden list of all displayed users: $user_IDs = array(); foreach ($Results->rows as $row) { $user_IDs[] = $row->user_ID; } $Form->hidden('user_IDs', implode(',', $user_IDs)); $Form->end_form(array(array('submit', 'actionArray[update]', T_('Update'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton')));
/** * Builds the form field * * @param string the class to use for the form tag * @param string title to display on top of the form * @param array Additional params to the form element. See {@link $_common_params}. * These may override class members. * @return mixed true (if output) or the generated HTML if not outputting */ function begin_form($form_class = NULL, $form_title = '', $form_params = array()) { global $use_strict; if ($use_strict) { unset($form_params['target']); } // target isn't valid for XHTML Strict $this->handle_common_params($form_params, NULL); if (!empty($this->form_name)) { $form_params['id'] = $this->form_name; } // Set non-mandatory attributes if given in $form_params if (!isset($form_params['enctype']) && !empty($this->enctype)) { $form_params['enctype'] = $this->enctype; } if (!isset($form_params['class']) && !empty($form_class)) { $form_params['class'] = $form_class; } // Append bootstrap class $form_params['class'] = (empty($form_params['class']) ? '' : $form_params['class'] . ' ') . $this->formclass; if (!isset($form_params['method'])) { $form_params['method'] = $this->form_method; } if (!isset($form_params['action'])) { $form_params['action'] = $this->form_action; } if (!empty($form_params['bozo_start_modified'])) { $bozo_start_modified = true; unset($form_params['bozo_start_modified']); } unset($form_params['disp_edit_categories']); unset($form_params['edit_form_params']); unset($form_params['skin_form_params']); if (isset($form_params['title'])) { // Additional title when $form_title has html tags. It is used for js confirmation message on leave the changed form. $clear_title = $form_params['title']; unset($form_params['title']); } if (isset($form_params['formstart_class'])) { // CSS class for formstart tag $formstart_class = $form_params['formstart_class']; unset($form_params['formstart_class']); } if ($this->form_type == 'div') { // Use <div> tag instead of <form> unset($form_params['action']); unset($form_params['method']); unset($form_params['enctype']); $r = "\n\n<div" . get_field_attribs_as_string($form_params) . ">\n"; } else { // Standard form $r = "\n\n<form" . get_field_attribs_as_string($form_params) . ">\n"; } // $r .= '<div>'; // for XHTML (dh> removed 'style="display:inline"' because it's buggy with FireFox 1.0.x, at least at the "Write" admin page; see http://forums.b2evolution.net/viewtopic.php?t=10130) // fp> inline was needed for inline forms like the DELETE confirmation. // fp> why does XHTML require all forms to have an embedded DIV? if (isset($formstart_class)) { $r .= str_replace('$formstart_class$', $formstart_class, $this->formstart); } else { $r .= $this->formstart; } if (empty($form_title)) { if (empty($this->global_icons)) { // No title, no icons: $r .= $this->replace_vars($this->no_title_no_icons_fmt); } else { // No title, but there are icons: $r .= $this->replace_vars($this->no_title_fmt); } } else { // Title and icons: $this->title = $form_title; $r .= $this->replace_vars($this->title_fmt); } if ($this->form_type == 'form') { // Initialization of javascript vars used to create parent_child select lists // fp>yura: TODO: does this make sense to add it to every form?? $r .= '<script type="text/javascript"> var nb_dynamicSelects = 0; var tab_dynamicSelects = Array(); </script>'; } global $UserSettings; if (isset($UserSettings) && $UserSettings->get('control_form_abortions') && preg_match('#^(.*)_checkchanges#', $this->form_name)) { // This form will trigger the bozo validator, preset a localized bozo confirm message: $r .= '<script type="text/javascript"> if( typeof bozo == "object" ) { // If Bozo validator is active: bozo.confirm_mess = \''; $js_form_title = trim(strip_tags(empty($clear_title) ? empty($this->title) ? '' : $this->title : $clear_title)); if (empty($js_form_title)) { // No form title: $r .= TS_('You have modified this form but you haven\'t submitted it yet.\\nYou are about to lose your edits.\\nAre you sure?'); } else { // with form title: $r .= sprintf(TS_('You have modified the form \\"%s\\"\\nbut you haven\'t submitted it yet.\\nYou are about to lose your edits.\\nAre you sure?'), $js_form_title); } $r .= '\';'; if (!empty($bozo_start_modified)) { $r .= ' // Update number of changes for this form: bozo.tab_changes["' . $this->form_name . '"] = 1; // Update Total # of changes: bozo.nb_changes++; '; } $r .= ' } </script>'; } return $this->display_or_return($r); }
$Form->hidden($hidden_input['name'], $hidden_input['value']); } } $Form->combo_box('group', param('group_combo', 'string', ''), get_contacts_groups_options(param('group', 'string', '-1'), false), $multi_action_icon . T_('Add all selected contacts to this group'), array('new_field_size' => '8')); $Form->buttons(array(array('submit', 'actionArray[add_group]', T_('Add'), 'SaveButton btn-primary btn-sm'))); echo '</span>'; if (isset($group_filtered)) { // Contacts list is filtered by group echo '<div id="edit_group_contacts" style="white-space:normal">'; $Form->hidden('group_ID', $group_filtered->ID); echo '<p class="center">' . sprintf(T_('Selected group: <b>%s</b>'), $group_filtered->name) . '</p>'; echo '<input id="send_group_recipients" type="button" onclick="location.href=\'' . $module_contacts_list_params['recipients_link'] . '&group_ID=' . $group_filtered->ID . '\'" value="' . sprintf($module_contacts_list_params['title_group'], $group_filtered->count_users, $group_filtered->name) . '" style="margin: 1ex 0" /><br />'; $Form->text_input('name', $group_filtered->name, 20, T_('Rename this group to')); $Form->button_input(array('name' => 'actionArray[rename_group]', 'value' => T_('Rename'), 'class' => 'SaveButton')); echo ' <b class="nowrap" style="padding-top:1em;line-height:32px">' . T_('or') . ' '; $Form->button_input(array('name' => 'actionArray[delete_group]', 'value' => T_('Delete this group'), 'class' => 'SaveButton', 'onclick' => 'return confirm("' . TS_('Are you sure want to delete this group?') . '")')); echo '</b>'; echo '</div>'; } $Form->end_form(); $Form->switch_layout(NULL); ?> <script type="text/javascript"> jQuery( '#send_selected_recipients' ).click( function() { // Add selected users to this link var recipients_param = ''; var recipients = get_selected_users(); if( recipients.length > 0 ) { recipients_param = '&recipients=' + recipients; }
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 } ?> jQuery( 'input[name=import_type]' ).click( function() { // Show/Hide checkbox to delete files if( jQuery( this ).val() == 'replace' ) { jQuery( '#checkbox_delete_files' ).show(); }
} if ($bbcode_plugin_is_enabled && $Item->can_comment(NULL)) { // Display button to quote this post echo '<a href="' . $Item->get_permanent_url() . '?mode=quote&qp=' . $Item->ID . '#form_p' . $Item->ID . '" title="' . T_('Reply with quote') . '" class="roundbutton_text floatleft quote_button">' . get_icon('comments', 'imgtag', array('title' => T_('Reply with quote'))) . T_('Quote') . '</a>'; } echo '</div>'; // List all tags attached to this topic: $Item->tags(array('before' => '<span class="topic_tags">' . T_('Tags') . ': ', 'after' => '</span>', 'separator' => ', ')); echo '<div class="floatright">'; $Item->edit_link(array('before' => ' ', 'after' => '', 'title' => T_('Edit this topic'), 'text' => '#', 'class' => 'roundbutton_text')); echo ' <span class="roundbutton_group">'; // Set redirect after publish to the same category view of the items permanent url $redirect_after_publish = $Item->add_navigation_param($Item->get_permanent_url(), 'same_category', $current_cat); $Item->next_status_link(array('before' => ' ', 'class' => 'roundbutton_text', 'post_navigation' => 'same_category', 'nav_target' => $current_cat), true); $Item->next_status_link(array('class' => 'roundbutton_text', 'before_text' => '', 'post_navigation' => 'same_category', 'nav_target' => $current_cat), false); $Item->delete_link('', '', '#', T_('Delete this topic'), 'roundbutton_text', false, '#', TS_('You are about to delete this post!\\nThis cannot be undone!'), get_caturl($current_cat)); echo '</span>'; echo '</div>'; ?> </td> </tr> <?php if (!$Item->can_see_comments(true) || $preview) { // If comments are disabled for this post we should close the <table> tag that was opened above for post content // Otherwise this tag will be closed below by 'comment_list_end' echo '</table>'; } ?> <?php $Item->locale_temp_switch();
* * @package admin */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $current_User; $current_User->check_perm('blogs', 'editall', true); param_action('emptytrash', true); $SQL = new SQL(); $SQL->SELECT('DISTINCT(blog_ID), blog_name, count(comment_ID) as comments_number'); // select target_title for sorting $SQL->FROM('T_blogs LEFT OUTER JOIN T_categories ON blog_ID = cat_blog_ID'); $SQL->FROM_add('LEFT OUTER JOIN T_items__item ON cat_ID = post_main_cat_ID'); $SQL->FROM_add('LEFT OUTER JOIN T_comments ON post_ID = comment_item_ID'); $SQL->WHERE('comment_status = "trash"'); $SQL->GROUP_BY('blog_ID'); $count_SQL = new SQL(); $count_SQL->SELECT('COUNT( comment_ID )'); $count_SQL->FROM('T_comments'); $count_SQL->WHERE('comment_status = "trash"'); // Create result set: $Results = new Results($SQL->get(), 'emptytrash_', '', NULL, $count_SQL->get()); $Results->title = T_('Comment recycle bins') . ' (' . $Results->get_total_rows() . ')'; $Results->cols[] = array('th' => T_('Blog ID'), 'th_class' => 'shrinkwrap', 'order' => 'blog_ID', 'td' => '$blog_ID$', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Blog name'), 'order' => 'blog_name', 'td' => '$blog_name$'); $Results->cols[] = array('th' => T_('Comments in recycle bin'), 'th_class' => 'shrinkwrap', 'order' => 'comments_number', 'td' => '$comments_number$', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => action_icon(TS_('Empty blog\'s recycle bin'), 'recycle_empty', regenerate_url('action', 'blog_ID=$blog_ID$&action=trash_delete') . '&' . url_crumb('comment'))); $Results->global_icon(T_('Cancel empty recycle bin'), 'close', regenerate_url('action', 'action=list&filter=reset'), 3, 4); echo '<p>[<a href="' . regenerate_url('action,blog_ID', 'action=trash_delete') . '&' . url_crumb('comment') . '">' . T_('Empty all blogs\' recycle bin') . '</a>]</p>'; $Results->display();
/** * Display Toolbar */ function DisplayCodeToolbar() { global $Hit; if ($Hit->is_lynx()) { // let's deactivate toolbar on Lynx, because they don't work there. return false; } // Load js to work with textarea require_js('functions.js', 'blog', true, true); ?> <script type="text/javascript"> //<![CDATA[ var widescroll_buttons = new Array(); function widescroll_button( id, text, tag_open, tag_close, title, style ) { this.id = id; // used to name the toolbar button this.text = text; // label on button this.tag_open = tag_open; // tag code to insert this.tag_close = tag_close; // tag code to insert this.title = title; // title this.style = style; // style on button } widescroll_buttons[widescroll_buttons.length] = new widescroll_button( 'widescroll', 'wide scroll', '<div class="wide_scroll">', '</div>', '<?php echo TS_('Teaser break'); ?> ', '' ); function widescroll_toolbar( title ) { document.write( '<?php echo $this->get_template('toolbar_title_before'); ?> ' + title + '<?php echo $this->get_template('toolbar_title_after'); ?> ' ); document.write( '<?php echo $this->get_template('toolbar_group_before'); ?> ' ); for( var i = 0; i < widescroll_buttons.length; i++ ) { var button = widescroll_buttons[i]; document.write( '<input type="button" id="' + button.id + '" title="' + button.title + '"' + ( typeof( button.style ) != 'undefined' ? ' style="' + button.style + '"' : '' ) + ' class="<?php echo $this->get_template('toolbar_button_class'); ?> " data-func="widescroll_insert_tag|b2evoCanvas|'+i+'" value="' + button.text + '" />' ); } document.write( '<?php echo $this->get_template('toolbar_group_after'); ?> ' ); } function widescroll_insert_tag( canvas_field, i ) { if( typeof( tinyMCE ) != 'undefined' && typeof( tinyMCE.activeEditor ) != 'undefined' && tinyMCE.activeEditor ) { // tinyMCE plugin is active now, we should focus cursor to the edit area tinyMCE.execCommand( 'mceFocus', false, tinyMCE.activeEditor.id ); } // Insert tag text in area textarea_wrap_selection( canvas_field, widescroll_buttons[i].tag_open, widescroll_buttons[i].tag_close, 0 ); } //]]> </script><?php echo $this->get_template('toolbar_before', array('$toolbar_class$' => $this->code . '_toolbar')); ?> <script type="text/javascript">widescroll_toolbar( '<?php echo TS_('Wide scroll:'); ?> ' );</script><?php echo $this->get_template('toolbar_after'); return true; }
function display_login_validator($params = array()) { global $rsc_url, $dummy_fields; $params = array_merge(array('login-id' => $dummy_fields['login']), $params); echo '<script type="text/javascript"> var login_icon_load = \'<img src="' . $rsc_url . 'img/ajax-loader.gif" alt="' . TS_('Loading...') . '" title="' . TS_('Loading...') . '" style="margin:2px 0 0 5px" align="top" />\'; var login_icon_available = \'' . get_icon('allowback', 'imgtag', array('title' => TS_('This username is available.'))) . '\'; var login_icon_exists = \'' . get_icon('xross', 'imgtag', array('title' => TS_('This username is already in use. Please choose another one.'))) . '\'; var login_text_empty = \'' . TS_('Choose an username.') . '\'; var login_text_available = \'' . TS_('This username is available.') . '\'; var login_text_exists = \'' . TS_('This username is already in use. Please choose another one.') . '\'; jQuery( "#register_form #' . $params['login-id'] . '" ).change( function() { // Validate if username is available var note_Obj = jQuery( this ).next().next(); if( jQuery( this ).val() == "" ) { // Login is empty jQuery( "#login_status" ).html( "" ); note_Obj.html( login_text_empty ).attr( "class", "notes" ); } else { // Validate login jQuery( "#login_status" ).html( login_icon_load ); jQuery.ajax( { type: "POST", url: "' . get_samedomain_htsrv_url() . 'anon_async.php", data: "action=validate_login&login="******"exists" ) { // Login already exists jQuery( "#login_status" ).html( login_icon_exists ); note_Obj.html( login_text_exists ).attr( "class", "notes red" ); } else { // Login is available jQuery( "#login_status" ).html( login_icon_available ); note_Obj.html( login_text_available ).attr( "class", "notes green" ); } } } ); } } ); </script>'; }
} // Create result set: $SQL = new SQL(); $SQL->SELECT('T_skins__skin.*, COUNT( DISTINCT( cset_coll_ID ) ) AS nb_blogs'); $SQL->FROM('T_skins__skin LEFT JOIN T_coll_settings ON skin_ID = cset_value AND ( cset_name = "normal_skin_ID" OR cset_name = "mobile_skin_ID" OR cset_name = "tablet_skin_ID" )'); $SQL->GROUP_BY('skin_ID'); $CountSQL = new SQL(); $CountSQL->SELECT('COUNT( * )'); $CountSQL->FROM('T_skins__skin'); $Results = new Results($SQL->get(), 'skin_', '', NULL, $CountSQL->get()); $Results->Cache =& get_SkinCache(); $Results->title = T_('Installed skins') . get_manual_link('installed_skins'); if ($current_User->check_perm('options', 'edit', false)) { // We have permission to modify: $Results->cols[] = array('th' => T_('Name'), 'order' => 'skin_name', 'td' => '<strong><a href="' . regenerate_url('', 'skin_ID=$skin_ID$&action=edit') . '" title="' . TS_('Edit skin properties...') . '">$skin_name$</a></strong>'); } else { // We have NO permission to modify: $Results->cols[] = array('th' => T_('Name'), 'order' => 'skin_name', 'td' => '<strong>$skin_name$</strong>'); } $Results->cols[] = array('th' => T_('Skin type'), 'order' => 'skin_type', 'td_class' => 'center', 'td' => '$skin_type$'); $Results->cols[] = array('th' => T_('Blogs'), 'order' => 'nb_blogs', 'th_class' => 'shrinkwrap', 'td_class' => 'center', 'td' => '~conditional( (#nb_blogs# > 0), #nb_blogs#, \' \' )~'); $Results->cols[] = array('th' => T_('Skin Folder'), 'order' => 'skin_folder', 'td' => '$skin_folder$'); if ($current_User->check_perm('options', 'edit', false)) { // We have permission to modify: $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => action_icon(TS_('Edit skin properties...'), 'properties', '%regenerate_url( \'\', \'skin_ID=$skin_ID$&action=edit\')%') . action_icon(TS_('Reload containers!'), 'reload', '%regenerate_url( \'\', \'skin_ID=$skin_ID$&action=reload&' . url_crumb('skin') . '\')%') . '~conditional( #nb_blogs# < 1, \'' . action_icon(TS_('Uninstall this skin!'), 'delete', '%regenerate_url( \'\', \'skin_ID=$skin_ID$&action=delete&' . url_crumb('skin') . '\')%') . '\', \'' . get_icon('delete', 'noimg') . '\' )~'); $Results->global_icon(T_('Install new skin...'), 'new', regenerate_url('action,blog', 'action=new'), T_('Install new'), 3, 4); } // $fadeout_array = array( 'skin_ID' => array(6) ); $fadeout_array = NULL; $Results->display(NULL, 'session');
// We want file properties on the upload form: ?> appendLabelAndInputElements( newLI, '<?php echo TS_('Filename on server (optional)'); ?> :', false, 'input', 'uploadfile_name[]', '50', '80', 'text', '' ); appendLabelAndInputElements( newLI, '<?php echo TS_('Long title'); ?> :', true, 'input', 'uploadfile_title[]', '50', '255', 'text', 'large' ); appendLabelAndInputElements( newLI, '<?php echo TS_('Alternative text (useful for images)'); ?> :', true, 'input', 'uploadfile_alt[]', '50', '255', 'text', 'large' ); appendLabelAndInputElements( newLI, '<?php echo TS_('Caption/Description of the file'); ?> :', true, 'textarea', 'uploadfile_desc[]', '38', '3', '', 'large' ); <?php } ?> } // --> </script> <?php // Begin payload block: $this->disp_payload_begin(); $Form =& new Form(NULL, 'fm_upload_checkchanges', 'post', 'none', 'multipart/form-data'); $Form->begin_form('fform'); $Form->hidden_ctrl();