/** * Generate category line when it has children * * @param Chapter generic category we want to display * @param int level of the category in the recursive tree * @return string HTML */ function cat_line($Chapter, $level) { global $line_class, $result_fadeout, $permission_to_edit, $current_User, $Settings; global $GenericCategoryCache; $line_class = $line_class == 'even' ? 'odd' : 'even'; $r = '<tr id="tr-' . $Chapter->ID . '"class="' . $line_class . (isset($result_fadeout[$GenericCategoryCache->dbIDname]) && in_array($Chapter->ID, $result_fadeout[$GenericCategoryCache->dbIDname]) ? ' fadeout-ffff00' : '') . '"> <td class="firstcol shrinkwrap">' . $Chapter->ID . ' </td>'; if ($permission_to_edit) { // We have permission permission to edit: $edit_url = regenerate_url('action,' . $Chapter->dbIDname, $Chapter->dbIDname . '=' . $Chapter->ID . '&action=edit'); $r .= '<td> <strong style="padding-left: ' . $level . 'em;"><a href="' . $edit_url . '" title="' . T_('Edit...') . '">' . $Chapter->dget('name') . '</a></strong> </td>'; } else { $r .= '<td> <strong style="padding-left: ' . $level . 'em;">' . $Chapter->dget('name') . '</strong> </td>'; } $r .= '<td>' . $Chapter->dget('urlname') . '</td>'; $r .= '<td class="lastcol shrinkwrap">'; if ($permission_to_edit) { // We have permission permission to edit, so display action column: $r .= action_icon(T_('New...'), 'new', regenerate_url('action,cat_ID,cat_parent_ID', 'cat_parent_ID=' . $Chapter->ID . '&action=new')) . action_icon(T_('Edit...'), 'edit', $edit_url); if ($Settings->get('allow_moving_chapters')) { // If moving cats between blogs is allowed: $r .= action_icon(T_('Move to a different blog...'), 'file_move', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=move'), T_('Move')); } $r .= action_icon(T_('Delete...'), 'delete', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=delete')); } $r .= '</td>'; $r .= '</tr>'; return $r; }
/** * Get actions links for IP range * * @param integer IP range ID * @param string Current tab value * @return string HTML links to edit and delete IP range */ function antispam_ipranges_actions($aipr_ID, $tab_param) { global $admin_url; // A link to edit IP range $r = action_icon(T_('Edit this IP range...'), 'properties', $admin_url . '?ctrl=antispam' . $tab_param . '&tab3=ipranges&iprange_ID=' . $aipr_ID . '&action=iprange_edit'); // A link to delete IP range $r .= action_icon(T_('Delete this IP range!'), 'delete', regenerate_url('iprange_ID,action', 'iprange_ID=' . $aipr_ID . '&action=iprange_delete&' . url_crumb('iprange'))); return $r; }
/** * Callback to build possible actions depending on item type id * */ function get_actions_for_itemtype($id) { global $reserved_ids; $action = action_icon(T_('Duplicate this item type...'), 'copy', regenerate_url('action', 'ptyp_ID=' . $id . '&action=new')); if ($id < $reserved_ids[0] || $id > $reserved_ids[1]) { // not reserved id $action = action_icon(T_('Edit this item type...'), 'edit', regenerate_url('action', 'ptyp_ID=' . $id . '&action=edit')) . $action . action_icon(T_('Delete this item type!'), 'delete', regenerate_url('action', 'ptyp_ID=' . $id . '&action=delete&' . url_crumb('itemtype') . '')); } return $action; }
function edit_actions($ID) { global $locked_IDs, $GenericElementCache; $r = action_icon(T_('Duplicate...'), 'copy', regenerate_url('action,' . $GenericElementCache->dbIDname, $GenericElementCache->dbIDname . '=' . $ID . '&action=copy')); if (empty($locked_IDs) || !in_array($ID, $locked_IDs)) { // This element is NOT locked: $r = action_icon(T_('Edit...'), 'edit', regenerate_url('action,' . $GenericElementCache->dbIDname, $GenericElementCache->dbIDname . '=' . $ID . '&action=edit')) . $r . action_icon(T_('Delete!'), 'delete', regenerate_url('action,' . $GenericElementCache->dbIDname, $GenericElementCache->dbIDname . '=' . $ID . '&action=delete')); } return $r; }
function file_actions($link_ID) { global $current_File, $edited_Item, $current_User; $title = T_('Locate this file!'); $r = $current_File->get_linkedit_link('&fm_mode=link_item&item_ID=' . $edited_Item->ID, get_icon('locate', 'imgtag', array('title' => $title)), $title); if ($current_User->check_perm('item', 'edit', false, $edited_Item)) { // Check that we have permission to edit item: $r .= action_icon(T_('Delete this link!'), 'unlink', regenerate_url('action', 'link_ID=' . $link_ID . '&action=unlink')); } return $r; }
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; }
/** * Callback to build possible actions depending on post type id * */ function get_actions_for_itemtype($id) { global $default_ids; $action = action_icon(T_('Duplicate this Post Type...'), 'copy', regenerate_url('action', 'ityp_ID=' . $id . '&action=new')); if (!ItemType::is_reserved($id)) { // Edit all post types except of not reserved post type $action = action_icon(T_('Edit this Post Type...'), 'edit', regenerate_url('action', 'ityp_ID=' . $id . '&action=edit')) . $action; } if (!ItemType::is_special($id) && !in_array($id, $default_ids)) { // Delete only the not reserved and not default post types $action .= action_icon(T_('Delete this Post Type!'), 'delete', regenerate_url('action', 'ityp_ID=' . $id . '&action=delete&' . url_crumb('itemtype') . '')); } return $action; }
function curr_td_actions($curr_enabled, $curr_ID) { global $dispatcher; $r = ''; if ($curr_enabled == true) { $r .= action_icon(T_('Disable the currency!'), 'deactivate', regenerate_url('action', 'action=disable_currency&curr_ID=' . $curr_ID . '&' . url_crumb('currency'))); } else { $r .= action_icon(T_('Enable the currency!'), 'activate', regenerate_url('action', 'action=enable_currency&curr_ID=' . $curr_ID . '&' . url_crumb('currency'))); } $r .= action_icon(T_('Edit this currency...'), 'edit', regenerate_url('action', 'curr_ID=' . $curr_ID . '&action=edit')); $r .= action_icon(T_('Duplicate this currency...'), 'copy', regenerate_url('action', 'curr_ID=' . $curr_ID . '&action=new')); $r .= action_icon(T_('Delete this currency!'), 'delete', regenerate_url('action', 'curr_ID=' . $curr_ID . '&action=delete&' . url_crumb('currency'))); return $r; }
function grp_actions(&$row) { global $usedgroups, $Settings, $current_User; $r = ''; if ($current_User->check_perm('users', 'edit', false)) { $r = action_icon(T_('Edit this group...'), 'edit', regenerate_url('ctrl,action', 'ctrl=groups&action=edit&grp_ID=' . $row->grp_ID)); $r .= action_icon(T_('Duplicate this group...'), 'copy', regenerate_url('ctrl,action', 'ctrl=groups&action=new&grp_ID=' . $row->grp_ID)); if ($row->grp_ID != 1 && $row->grp_ID != $Settings->get('newusers_grp_ID') && !in_array($row->grp_ID, $usedgroups)) { // delete $r .= action_icon(T_('Delete this group!'), 'delete', regenerate_url('ctrl,action', 'ctrl=groups&action=delete&grp_ID=' . $row->grp_ID . '&' . url_crumb('group'))); } else { $r .= get_icon('delete', 'noimg'); } } return $r; }
/** * Generate category line when it has children * * @param GenericCategory generic category we want to display * @param int level of the category in the recursive tree * @return string HTML */ function cat_line($GenericCategory, $level) { global $line_class, $result_fadeout, $permission_to_edit, $current_User; $line_class = $line_class == 'even' ? 'odd' : 'even'; $r = '<tr id="tr-' . $GenericCategory->ID . '"class="' . $line_class . (in_array($GenericCategory->ID, $result_fadeout) ? ' fadeout-ffff00' : '') . '"> <td class="firstcol shrinkwrap">' . $GenericCategory->ID . ' </td>'; if ($permission_to_edit) { // We have permission permission to edit, so display action column: $edit_url = regenerate_url('action,' . $GenericCategory->dbIDname, $GenericCategory->dbIDname . '=' . $GenericCategory->ID . '&action=edit'); $r .= '<td> <label style="padding-left: ' . $level . 'em;"><a href="' . $edit_url . '" title="' . T_('Edit...') . '">' . $GenericCategory->name . '</a></label> </td> <td class="lastcol shrinkwrap">' . action_icon(T_('New...'), 'new', regenerate_url('action,' . $GenericCategory->dbIDname . ',' . $GenericCategory->dbprefix . 'parent_ID', $GenericCategory->dbprefix . 'parent_ID=' . $GenericCategory->ID . '&action=new')) . action_icon(T_('Edit...'), 'edit', $edit_url) . action_icon(T_('Delete...'), 'delete', regenerate_url('action,' . $GenericCategory->dbIDname, $GenericCategory->dbIDname . '=' . $GenericCategory->ID . '&action=delete&' . url_crumb('element'))) . ' </td>'; } else { $r .= '<td class="lastcol"> <label style="padding-left: ' . $level . 'em;">' . $GenericCategory->name . '</label> </td>'; } $r .= '</tr>'; return $r; }
// Determine if we are creating or updating... $creating = is_create_action($action); $Form = new Form(NULL, 'form'); $close_url = get_chapter_redirect_url(get_param('redirect_page'), $edited_Chapter->parent_ID, $edited_Chapter->ID); $Form->global_icon(T_('Cancel editing!'), 'close', $close_url); $Form->begin_form('fform', $creating ? T_('New category') : T_('Category')); $Form->add_crumb('element'); $Form->hidden('action', $creating ? 'create' : 'update'); $Form->hiddens_by_key(get_memorized('action')); $Form->begin_fieldset(T_('Properties')); // We're essentially double checking here... $edited_Blog =& $edited_Chapter->get_Blog(); $move = ''; if ($Settings->get('allow_moving_chapters') && !$creating) { // If moving cats between blogs is allowed: $move = ' ' . action_icon(T_('Move to a different blog...'), 'file_move', regenerate_url('action,cat_ID', 'cat_ID=' . $edited_Chapter->ID . '&action=move'), T_('Move')); } $Form->info(T_('Blog'), $edited_Blog->get_maxlen_name() . $move); $Form->select_input_options('cat_parent_ID', $GenericCategoryCache->recurse_select($edited_Chapter->parent_ID, $subset_ID, true, NULL, 0, array($edited_Chapter->ID)), T_('Parent category')); $Form->text_input('cat_name', $edited_Chapter->name, 40, T_('Name'), '', array('required' => true, 'maxlength' => 255)); $Form->text_input('cat_urlname', $edited_Chapter->urlname, 40, T_('URL "slug"'), T_('Used for clean URLs. Must be unique.'), array('maxlength' => 255)); $Form->text_input('cat_description', $edited_Chapter->description, 40, T_('Description'), T_('May be used as a title tag and/or meta description.'), array('maxlength' => 255)); if ($Settings->get('chapter_ordering') == 'manual') { $Form->text_input('cat_order', $edited_Chapter->order, 5, T_('Order'), T_('For manual ordering of the categories.'), array('maxlength' => 11)); } $Form->checkbox_input('cat_meta', $edited_Chapter->meta, T_('Meta category'), array('note' => T_('If you check this box you will not be able to put any posts into this category.'))); $Form->checkbox_input('cat_lock', $edited_Chapter->lock, T_('Locked category'), array('note' => T_('Check this to lock all posts under this category. (Note: for posts with multiple categories, the post is only locked if *all* its categories are locked.)'))); $Form->end_fieldset(); if ($creating) { $Form->end_form(array(array('submit', 'submit', T_('Record'), 'SaveButton'), array('reset', '', T_('Reset'), 'ResetButton'))); } else {
function file_actions($link_ID) { /** * @var File */ global $current_File; global $edited_Item, $current_User; $r = ''; if (isset($current_File)) { $title = T_('Locate this file!'); $r = $current_File->get_linkedit_link($edited_Item->ID, get_icon('locate', 'imgtag', array('title' => $title)), $title) . ' '; } if ($current_User->check_perm('item', 'edit', false, $edited_Item)) { // Check that we have permission to edit item: $r .= action_icon(T_('Delete this link!'), 'unlink', regenerate_url('p,itm_ID,action', "link_ID={$link_ID}&action=unlink")); } return $r; }
function rgn_td_actions($rgn_enabled, $rgn_ID) { global $dispatcher; $r = ''; if ($rgn_enabled == true) { $r .= action_icon(T_('Disable the region!'), 'deactivate', regenerate_url('action', 'action=disable_region&rgn_ID=' . $rgn_ID . '&' . url_crumb('region'))); } else { $r .= action_icon(T_('Enable the region!'), 'activate', regenerate_url('action', 'action=enable_region&rgn_ID=' . $rgn_ID . '&' . url_crumb('region'))); } $r .= action_icon(T_('Edit this region...'), 'edit', regenerate_url('action', 'rgn_ID=' . $rgn_ID . '&action=edit')); $r .= action_icon(T_('Duplicate this region...'), 'copy', regenerate_url('action', 'rgn_ID=' . $rgn_ID . '&action=new')); $r .= action_icon(T_('Delete this region!'), 'delete', regenerate_url('action', 'rgn_ID=' . $rgn_ID . '&action=delete&' . url_crumb('region'))); return $r; }
/** * Template function: display content of comment * * @param string Output format, see {@link format_to_output()} * @param boolean Add ban url action icon after each url or not * @param boolean show comment attachments * @param array attachment display params */ function content($format = 'htmlbody', $ban_urls = false, $show_attachments = true, $params = array()) { global $current_User; global $Plugins; // Make sure we are not missing any param: $params = array_merge(array('before_image' => '<div class="image_block">', 'before_image_legend' => '<div class="image_legend">', 'after_image_legend' => '</div>', 'after_image' => '</div>', 'image_size' => 'fit-400x320', 'image_text' => '', 'attachments_mode' => 'read', 'attachments_view_text' => ''), $params); $attachments = array(); if ($show_attachments) { if (empty($this->ID) && isset($this->checked_attachments)) { // PREVIEW $attachment_ids = explode(',', $this->checked_attachments); $FileCache =& get_FileCache(); foreach ($attachment_ids as $ID) { $File = $FileCache->get_by_ID($ID, false, false); if ($File != NULL) { $attachments[] = $File; } } } else { // Get links $LinkCache =& get_LinkCache(); $commentLinks = $LinkCache->get_by_comment_ID($this->ID); if (!empty($commentLinks)) { foreach ($commentLinks as $Link) { $File = $Link->get_File(); $attachments[] = $File; } } } } $images_is_attached = false; foreach ($attachments as $index => $attachment) { $r = ''; $params['File'] = $attachment; $params['data'] =& $r; if (count($Plugins->trigger_event_first_true('RenderCommentAttachment', $params)) != 0) { echo $r; unset($attachments[$index]); continue; } if ($attachment->is_image()) { if ($params['attachments_mode'] == 'view') { // Only preview attachments $image_link_rel = ''; $image_link_to = ''; } else { // Read attachments $image_link_rel = 'lightbox[c' . $this->ID . ']'; $image_link_to = 'original'; } echo $attachment->get_tag($params['before_image'], $params['before_image_legend'], $params['after_image_legend'], $params['after_image'], $params['image_size'], $image_link_to, T_('Posted by ') . $this->get_author_name(), $image_link_rel); unset($attachments[$index]); $images_is_attached = true; } } if ($images_is_attached && $params['image_text'] != '') { // Display info text below pictures echo $params['image_text']; } if ($ban_urls) { // add ban icons if user has edit permission for this comment $ban_urls = $current_User->check_perm('comment!CURSTATUS', 'edit', false, $this); } if ($ban_urls) { // ban urls and user has permission echo add_ban_icons($this->get_content($format)); } else { // don't ban urls echo $this->get_content($format); } if (isset($attachments)) { // show not image attachments $after_docs = ''; if (count($attachments) > 0) { echo '<br /><b>' . T_('Attachments:') . '</b>'; echo '<ul class="bFiles">'; $after_docs = '</ul>'; } foreach ($attachments as $doc_File) { if ($params['attachments_mode'] == 'view') { // Only preview attachments $attachment_download_link = ''; $attachment_name = $doc_File->get_type(); } else { // Read attachments $attachment_download_link = action_icon(T_('Download file'), 'download', $doc_File->get_url(), '', 5) . ' '; $attachment_name = $doc_File->get_view_link($doc_File->get_name()); } echo '<li>'; echo $attachment_download_link; echo $attachment_name; echo ' (' . bytesreadable($doc_File->get_size()) . ')'; if (!empty($params['attachments_view_text'])) { echo $params['attachments_view_text']; } echo '</li>'; } echo $after_docs; } }
/** * Generate a link to a online help resource. * testing the concept of online help (aka webhelp). * this function should be relocated somewhere better if it is taken onboard by the project * * @todo replace [?] with icon, * @todo write url suffix dynamically based on topic and language * * QUESTION: launch new window with javascript maybe? * @param string Topic * The topic should be in a format like [\w]+(/[\w]+)*, e.g features/online_help. * @param string link text, leave it NULL to get link with manual icon * @return string */ function get_manual_link($topic, $link_text = NULL) { global $Settings, $current_locale, $app_shortname, $app_version; if ($Settings->get('webhelp_enabled')) { // $manual_url = 'http://manual.b2evolution.net/redirect/'.str_replace(' ','_',strtolower($topic)).'?lang='.$current_locale.'&app='.$app_shortname.'&version='.$app_version; // fp> TODO: this below is a temmporary hack while we work on the new manual: $manual_url = 'http://b2evolution.net/man/' . str_replace('_', '-', strtolower($topic)); if ($link_text == NULL) { $webhelp_link = action_icon(T_('Open relevant page in online manual'), 'manual', $manual_url, T_('Manual'), 5, 1, array('target' => '_blank', 'style' => 'vertical-align:top')); } else { $webhelp_link = '<a href="' . $manual_url . '" target = "_blank">' . $link_text . '</a>'; } return ' ' . $webhelp_link; } else { return ''; } }
/** * PHP */ $block_item_Widget->title = 'PHP'; $block_item_Widget->disp_template_replaced('block_start'); // User ID: list($uid, $uname, $running_as) = system_check_process_user(); init_system_check('PHP running as USER:'******'note'); // Group ID: list($gid, $gname, $running_as) = system_check_process_group(); init_system_check('PHP running as GROUP:', $running_as); disp_system_check('note'); // PHP version $phpinfo_url = '?ctrl=tools&action=view_phpinfo&' . url_crumb('tools'); $phpinfo_link = action_icon(T_('View PHP info'), 'info', $phpinfo_url, '', 5, '', array('target' => '_blank', 'onclick' => 'return pop_up_window( \'' . $phpinfo_url . '\', \'phpinfo\', 650 )')); init_system_check('PHP version', $system_stats['php_version'] . ' ' . $phpinfo_link); if (version_compare($system_stats['php_version'], $required_php_version['application'], '<')) { disp_system_check('error', T_('This version is too old. b2evolution will not run correctly. You must ask your host to upgrade PHP before you can run b2evolution.')); } elseif (version_compare($system_stats['php_version'], '5.2', '<')) { disp_system_check('warning', T_('This version is old. b2evolution may run but some features may fail. You should ask your host to upgrade PHP before running b2evolution.') . '<br />' . T_('PHP 5.2 or greater is recommended for maximum security, especially for "httpOnly" cookies support.')); } else { disp_system_check('ok'); } // register_globals? init_system_check('PHP register_globals', $system_stats['php_reg_globals'] ? T_('On') : T_('Off')); if ($system_stats['php_reg_globals']) { disp_system_check('warning', $facilitate_exploits . ' ' . sprintf($change_ini, 'register_globals = Off')); } else { disp_system_check('ok'); }
$email = utf8_strtolower($email); $SQL->WHERE_and('emret_address LIKE ' . $DB->quote($email)); $count_SQL->WHERE_and('emret_address LIKE ' . $DB->quote($email)); } $Results = new Results($SQL->get(), 'emret_', 'D', $UserSettings->get('results_per_page'), $count_SQL->get()); $Results->title = T_('Returned emails') . get_manual_link('email-returned'); /** * Callback to add filters on top of the result set * * @param Form */ function filter_email_return(&$Form) { global $datestart, $datestop, $email; $Form->date_input('datestartinput', $datestart, T_('From date')); $Form->date_input('datestopinput', $datestop, T_('To date')); $Form->text_input('email', $email, 40, T_('Email')); } $Results->filter_area = array('callback' => 'filter_email_return', 'presets' => array('all' => array(T_('All'), $admin_url . '?ctrl=email&tab=return'))); $Results->cols[] = array('th' => T_('ID'), 'order' => 'emret_ID', 'th_class' => 'shrinkwrap', 'td_class' => 'right', 'td' => '$emret_ID$'); $Results->cols[] = array('th' => T_('Date Time'), 'order' => 'emret_timestamp', 'default_dir' => 'D', 'th_class' => 'shrinkwrap', 'td_class' => 'timestamp compact_data', 'td' => '%mysql2localedatetime_spans( #emret_timestamp#, "M-d" )%'); function emret_address_col($emret_address) { return '<a href="' . regenerate_url('email,action,emret_ID', 'email=' . $emret_address) . '">' . $emret_address . '</a>'; } $Results->cols[] = array('th' => T_('Address'), 'order' => 'emret_address', 'td' => '%emret_address_col( #emret_address# )%', 'th_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Err Type'), 'order' => 'emret_errtype', 'td' => '%dre_decode_error_type( #emret_errtype# )%', 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap'); $Results->cols[] = array('th' => T_('Error'), 'order' => 'emret_errormsg', 'td' => '<a href="' . $admin_url . '?ctrl=email&tab=return&emret_ID=$emret_ID$">%htmlspecialchars( #emret_errormsg# )%</a>'); $Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap', 'td' => action_icon(T_('View this email...'), 'magnifier', $admin_url . '?ctrl=email&tab=return&emret_ID=$emret_ID$') . action_icon(T_('Go to users list with this email address'), 'play', $admin_url . '?ctrl=users&filter=new&keywords=$emret_address$')); // Display results: $Results->display();
/** * Generate category line when it has children * * @param object Chapter we want to display * @param integer Level of the category in the recursive tree * @return string HTML */ function cat_line($Chapter, $level) { global $line_class, $permission_to_edit, $current_User, $Settings; global $ChapterCache, $current_default_cat_ID; global $number_of_posts_in_cat; global $Session; $result_fadeout = $Session->get('fadeout_array'); $line_class = $line_class == 'even' ? 'odd' : 'even'; // ID $r = '<tr id="tr-' . $Chapter->ID . '"class="' . $line_class . ' chapter_parent_' . ($Chapter->parent_ID ? $Chapter->parent_ID : '0') . (isset($result_fadeout) && in_array($Chapter->ID, $result_fadeout) ? ' fadeout-ffff00' : '') . '"> <td class="firstcol shrinkwrap">' . $Chapter->ID . ' </td>'; // Default if ($current_default_cat_ID == $Chapter->ID) { $makedef_icon = get_icon('enabled', 'imgtag', array('title' => format_to_output(T_('This is the default category'), 'htmlattr'))); } else { $makedef_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=make_default&' . url_crumb('element')); $makedef_title = format_to_output(T_('Click to make this the default category'), 'htmlattr'); $makedef_icon = '<a href="' . $makedef_url . '" title="' . $makedef_title . '">' . get_icon('disabled', 'imgtag', array('title' => $makedef_title)) . '</a>'; } $r .= '<td class="center">' . $makedef_icon . '</td>'; // Name if ($permission_to_edit) { // We have permission permission to edit: $edit_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=edit'); $r .= '<td> <strong style="padding-left: ' . $level . 'em;"><a href="' . $edit_url . '" title="' . T_('Edit...') . '">' . $Chapter->dget('name') . '</a></strong> </td>'; } else { $r .= '<td> <strong style="padding-left: ' . $level . 'em;">' . $Chapter->dget('name') . '</strong> </td>'; } // URL "slug" $edit_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=edit'); $r .= '<td><a href="' . htmlspecialchars($Chapter->get_permanent_url()) . '">' . $Chapter->dget('urlname') . '</a></td>'; // Order if ($Chapter->get_parent_subcat_ordering() == 'manual') { // Manual ordering $r .= '<td class="center cat_order_edit" rel="' . $Chapter->ID . '">' . '<a href="#">' . ($Chapter->get('order') === NULL ? '-' : $Chapter->dget('order')) . '</a>' . '</td>'; } else { // Alphabetic ordering $r .= '<td class="center">' . T_('Alphabetic') . '</td>'; } if ($permission_to_edit) { // We have permission permission to edit, so display these columns: if ($Chapter->meta) { $makemeta_icon = 'enabled'; $makemeta_title = format_to_output(T_('Click to revert this from meta category'), 'htmlattr'); $action = 'unset_meta'; } else { $makemeta_icon = 'disabled'; $makemeta_title = format_to_output(T_('Click to make this as meta category'), 'htmlattr'); $action = 'set_meta'; } // Meta $makemeta_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=' . $action . '&' . url_crumb('element')); $r .= '<td class="center"><a href="' . $makemeta_url . '" title="' . $makemeta_title . '">' . get_icon($makemeta_icon, 'imgtag', array('title' => $makemeta_title)) . '</a></td>'; // Lock if ($Chapter->lock) { $makelock_icon = 'file_not_allowed'; $makelock_title = format_to_output(T_('Unlock category'), 'htmlattr'); $action = 'unlock'; } else { $makelock_icon = 'file_allowed'; $makelock_title = format_to_output(T_('Lock category'), 'htmlattr'); $action = 'lock'; } $makelock_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=' . $action . '&' . url_crumb('element')); $r .= '<td class="center"><a href="' . $makelock_url . '" title="' . $makelock_title . '">' . get_icon($makelock_icon, 'imgtag', array('title' => $makelock_title)) . '</a></td>'; } // Posts if (isset($number_of_posts_in_cat[$Chapter->ID])) { $r .= '<td class="center">' . (int) $number_of_posts_in_cat[$Chapter->ID] . '</td>'; } else { // no posts in this category $r .= '<td class="center"> - </td>'; } // Actions $r .= '<td class="lastcol shrinkwrap">'; if ($permission_to_edit) { // We have permission permission to edit, so display action column: $r .= action_icon(T_('Edit...'), 'edit', $edit_url); if ($Settings->get('allow_moving_chapters')) { // If moving cats between blogs is allowed: $r .= action_icon(T_('Move to a different blog...'), 'file_move', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=move'), T_('Move')); } $r .= action_icon(T_('New...'), 'new', regenerate_url('action,cat_ID,cat_parent_ID', 'cat_parent_ID=' . $Chapter->ID . '&action=new')) . action_icon(T_('Delete...'), 'delete', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&action=delete&' . url_crumb('element'))); } $r .= '</td>'; $r .= '</tr>'; return $r; }
{ 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();
if (!$user_profile_only) { // echo user edit action icons $Widget = new Widget(); echo_user_actions($Widget, $edited_User, 'edit'); echo '<span class="floatright">' . $Widget->gen_global_icons() . '</span>'; } echo '<div>' . get_usertab_header($edited_User, $user_tab, $current_User->ID == $edited_User->ID ? T_('My Activity') : T_('User Activity')) . '</div>'; // Display IP address from where this user was created echo '<div style="margin-top:25px;font-weight:bold;"><span>' . T_('User created from IP') . ': ' . int2ip($UserSettings->get('created_fromIPv4', $edited_User->ID)) . '</span></div>'; /**** Reports from edited user ****/ user_reports_results_block(array('edited_User' => $edited_User)); evo_flush(); /**** Blogs owned by the user ****/ blogs_results_block(array('edited_User' => $edited_User)); evo_flush(); /**** Posts created by the user ****/ items_created_results_block(array('edited_User' => $edited_User)); evo_flush(); /**** Posts edited by the user ****/ items_edited_results_block(array('edited_User' => $edited_User)); evo_flush(); /**** Comments posted by the user ****/ comments_results_block(array('edited_User' => $edited_User)); evo_flush(); /**** Private messages sent by the user ****/ threads_results_block(array('edited_User' => $edited_User)); evo_flush(); if ($current_User->ID != $edited_User->ID && $edited_User->ID != 1) { // User can NOT delete admin and own account echo '<div style="margin-top:25px;">' . action_icon(T_('Delete User and All his contributions'), 'delete', '?ctrl=user&user_tab=activity&action=delete_all_userdata&user_ID=' . $edited_User->ID . '&' . url_crumb('user'), ' ' . T_('Delete User and All his contributions'), 3, 4) . '</div>'; }
/** * Get the manual page link for the requested cron job, given by the key * * @param string job key * @return string Link to manual page of cron job task */ function cron_job_manual_link($job_key) { $help_config = get_cron_jobs_config('help', $job_key); if (empty($help_config)) { // There was no 'help' topic defined for this job return ''; } if ($help_config == '#') { // The 'help' topic is set to '#', use the default 'task-' + job_key return get_manual_link('task-' . $job_key); } if (is_url($help_config)) { // This cron job help topic is an url return action_icon(T_('Open relevant page in online manual'), 'manual', $help_config, T_('Manual'), 5, 1, array('target' => '_blank', 'style' => 'vertical-align:top')); } return get_manual_link($help_config); }
foreach ($uploadedFiles as $uploadedFile) { $success_msg = sprintf(T_('The file «%s» has been successfully uploaded to the server.'), $uploadedFile->dget('name')); // Allow to insert/link new upload into currently edited link object: if ($mode == 'upload' && !empty($link_object_ID) && !empty($link_type)) { // The filemanager has been opened from a link owner object, offer to insert an img tag into original object. $LinkOwner = get_link_owner($link_type, $link_object_ID); // TODO: Add plugin hook to allow generating JS insert code(s) $img_tag = format_to_output($uploadedFile->get_tag(), 'formvalue'); if ($uploadedFile->is_image()) { $link_msg = $LinkOwner->translate('Link this image to your owner'); $link_note = T_('recommended - allows automatic resizing'); } else { $link_msg = $LinkOwner->translate('Link this file to your owner'); $link_note = $LinkOwner->translate('The file will be linked for download at the end of the owner'); } $success_msg .= '<ul>' . '<li>' . action_icon(T_('Link this file!'), 'link', regenerate_url('fm_selected,ctrl', 'ctrl=files&action=link_inpost&fm_selected[]=' . rawurlencode($uploadedFile->get_rdfp_rel_path()) . '&' . url_crumb('file')), ' ' . $link_msg, 5, 5, array('target' => $iframe_name)) . ' (' . $link_note . ')</li>' . '<li>' . T_('or') . ' <a href="#" onclick="if( window.focus && window.opener ){' . 'window.opener.focus(); textarea_wrap_selection( window.opener.document.getElementById(\'' . $LinkOwner->type . 'form_post_content\'), \'' . format_to_output($uploadedFile->get_tag(), 'formvalue') . '\', \'\', 1, window.opener.document ); } return false;">' . $LinkOwner->translate('Insert the following code snippet into your owner') . '</a> : <input type="text" value="' . $img_tag . '" size="60" /></li>' . '</ul>'; } $Messages->add($success_msg, 'success'); } } if ($upload_quickmode && !empty($failedFiles)) { // Transmit file error to next page! $Messages->add($failedFiles[0], 'error'); unset($failedFiles); } if (empty($failedFiles) && empty($renamedFiles)) { // quick mode or no failed files, Go back to Browsing // header_redirect( $dispatcher.'?ctrl=files&root='.$fm_FileRoot->ID.'&path='.rawurlencode($path) ); header_redirect(regenerate_url('ctrl', 'ctrl=files', '', '&')); } }
function ctry_td_actions($ctry_enabled, $ctry_ID) { $r = ''; $redirect_ctrl = param('ctrl', 'string', 'countries'); if ($ctry_enabled == true) { $r .= action_icon(T_('Disable the country!'), 'deactivate', regenerate_url('ctrl,action', 'ctrl=countries&action=disable_country&ctry_ID=' . $ctry_ID . '&redirect_ctrl=' . $redirect_ctrl . '&' . url_crumb('country'))); } else { $r .= action_icon(T_('Enable the country!'), 'activate', regenerate_url('ctrl,action', 'ctrl=countries&action=enable_country&ctry_ID=' . $ctry_ID . '&redirect_ctrl=' . $redirect_ctrl . '&' . url_crumb('country'))); } $r .= action_icon(T_('Edit this country...'), 'edit', regenerate_url('ctrl,action', 'ctrl=countries&ctry_ID=' . $ctry_ID . '&action=edit')); $r .= action_icon(T_('Duplicate this country...'), 'copy', regenerate_url('ctrl,action', 'ctrl=countries&ctry_ID=' . $ctry_ID . '&action=new')); $r .= action_icon(T_('Delete this country!'), 'delete', regenerate_url('ctrl,action', 'ctrl=countries&ctry_ID=' . $ctry_ID . '&action=delete&' . url_crumb('country'))); return $r; }
// Filter list: $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'), 'statuses' => $user_modeartion_statuses, 'user_perm' => 'moderate', 'post_statuses' => array('published', 'community', 'protected'), 'order' => 'DESC', 'comments' => 30)); // Set param prefix for URLs $param_prefix = 'cmnt_fullview_'; if (!empty($CommentList->param_prefix)) { $param_prefix = $CommentList->param_prefix; } // Get ready for display (runs the query): $CommentList->display_init(); } if ($user_perm_moderate_cmt && $CommentList->result_num_rows) { // We have comments awaiting moderation load_funcs('comments/model/_comment_js.funcs.php'); $nb_blocks_displayed++; $opentrash_link = get_opentrash_link(true, false, array('class' => 'btn btn-default')); $refresh_link = '<span class="floatright">' . action_icon(T_('Refresh comment list'), 'refresh', $admin_url . '?blog=' . $blog, ' ' . T_('Refresh'), 3, 4, array('onclick' => 'startRefreshComments( \'' . request_from() . '\' ); return false;', 'class' => 'btn btn-default')) . '</span> '; $show_statuses_param = $param_prefix . 'show_statuses[]=' . implode('&' . $param_prefix . 'show_statuses[]=', $user_modeartion_statuses); $block_item_Widget->title = $refresh_link . $opentrash_link . T_('Comments awaiting moderation') . ' <a href="' . $admin_url . '?ctrl=comments&blog=' . $Blog->ID . '&' . $show_statuses_param . '" style="text-decoration:none">' . '<span id="badge" class="badge badge-important">' . $CommentList->get_total_rows() . '</span></a>' . get_manual_link('collection-dashboard'); echo '<div class="evo_content_block">'; echo '<div id="comments_block" class="dashboard_comments_block">'; $block_item_Widget->disp_template_replaced('block_start'); echo '<div id="comments_container">'; // GET COMMENTS AWAITING MODERATION (the code generation is shared with the AJAX callback): show_comments_awaiting_moderation($Blog->ID, $CommentList); echo '</div>'; $block_item_Widget->disp_template_raw('block_end'); echo '</div>'; echo '</div>'; } /* * RECENT POSTS awaiting moderation
function contacts_groups($user_ID) { global $current_User, $DB, $cache_user_contacts_groups; if (!is_array($cache_user_contacts_groups)) { // Execute only first time to init cache $cache_user_contacts_groups = array(); // Get contacts of current user $groups_SQL = new SQL(); $groups_SQL->SELECT('cgr_ID AS ID, cgu_user_ID AS user_ID, cgr_name AS name'); $groups_SQL->FROM('T_messaging__contact_groupusers'); $groups_SQL->FROM_add('LEFT JOIN T_messaging__contact_groups ON cgu_cgr_ID = cgr_ID'); $groups_SQL->WHERE('cgr_user_ID = ' . $current_User->ID); $groups_SQL->ORDER_BY('cgr_name'); $groups = $DB->get_results($groups_SQL->get()); $remove_link = url_add_param(get_dispctrl_url('contacts'), 'action=remove_user&view=contacts&' . url_crumb('messaging_contacts')); foreach ($groups as $group) { // Init cache for groups for each contact of current user $group_name = $group->name . action_icon(T_('Remove user from this group'), 'remove', url_add_param($remove_link, 'user_ID=' . $group->user_ID . '&group_ID=' . $group->ID)); if (isset($cache_user_contacts_groups[$group->user_ID])) { // nth group of this user $cache_user_contacts_groups[$group->user_ID] .= '<br />' . $group_name; } else { // first group of this user $cache_user_contacts_groups[$group->user_ID] = $group_name; } } } if (isset($cache_user_contacts_groups[$user_ID])) { // user has groups echo $cache_user_contacts_groups[$user_ID]; } }
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings) { global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames; $row = array(); $filter = $filterinfo->filter; // Filter name if (!empty($filternames[$filter])) { $row[] = $filternames[$filter]; } else { $row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>'; } // Disable/off/on $select = html_select::make_popup_form(action_url($filter, 'setstate'), 'newstate', $activechoices, 'active' . basename($filter), $filterinfo->active); $select->nothinglabel = false; $select->form->button->text = get_string('save', 'admin'); $row[] = $OUTPUT->select($select); // Re-order $updown = ''; $spacer = '<img src="' . $OUTPUT->old_icon_url('spacer') . '" class="iconsmall" alt="" /> '; if ($filterinfo->active != TEXTFILTER_DISABLED) { if (!$isfirstrow) { $updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up')); } else { $updown .= $spacer; } if (!$islastactive) { $updown .= action_icon(action_url($filter, 'down'), 'down', get_string('down')); } else { $updown .= $spacer; } } $row[] = $updown; // Apply to strings. $select = html_select::make_popup_form(action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, 'applyto' . basename($filter), $applytostrings); $select->nothinglabel = false; $select->disabled = $filterinfo->active == TEXTFILTER_DISABLED; $select->form->button->text = get_string('save', 'admin'); $row[] = $OUTPUT->select($select); // Settings link, if required if (filter_has_global_settings($filter)) { $row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . str_replace('/', '', $filter) . '">' . get_string('settings') . '</a>'; } else { $row[] = ''; } // Delete if (substr($filter, 0, 4) != 'mod/') { $row[] = '<a href="' . action_url($filter, 'delete') . '">' . get_string('delete') . '</a>'; } else { $row[] = ''; } return $row; }
/** * @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 $table_id = str_replace(' ', '_', $container); // fp> Using the container name which has special chars is a bad idea. Counter would be better $Table->global_icon(T_('Add a widget...'), 'new', regenerate_url('', 'action=new&container=' . rawurlencode($container)), T_('Add widget') . ' »', 3, 4, array('id' => 'add_new_' . $table_id)); $Table->cols = array(array('th' => T_('En'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap'), array('th' => T_('Widget')), array('th' => T_('Type')), array('th' => T_('Move'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap'), array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap')); //enable fadeouts here $Table->display_init(NULL, array('fadeouts' => true)); // add ID for jQuery // TODO: fp> Awfully dirty. This should be handled by the Table object $Table->params['list_start'] = str_replace('<table', '<table id="' . $table_id . '"', $Table->params['list_start']); /* if( $legend_suffix ) { // add jQuery no-drop -- fp> what do we need this one for? $Table->params['head_title'] = str_replace( 'class="grouped"', 'class="grouped no-drop"', $Table->params['head_title'] ); } */ $Table->display_list_start(); // TITLE / COLUMN HEADERS: $Table->display_head(); // BODY START: $Table->display_body_start(); /** * @var WidgetCache */ $WidgetCache =& get_WidgetCache(); $Widget_array =& $WidgetCache->get_by_coll_container($Blog->ID, $container); if (empty($Widget_array)) { // TODO: cleanup $Table->display_line_start(true); $Table->display_col_start(array('colspan' => 5)); echo '<span class="new_widget">' . T_('There is no widget in this container yet.') . '</span>'; $Table->display_col_end(); $Table->display_line_end(); } else { $widget_count = 0; foreach ($Widget_array as $ComponentWidget) { $widget_count++; $enabled = $ComponentWidget->get('enabled'); $fadeout_id = $Session->get('fadeout_id'); if (isset($fadeout_id) && $ComponentWidget->ID == $fadeout_id) { $fadeout = true; $Session->delete('fadeout_id'); } else { $fadeout = false; } $Table->display_line_start(false, $fadeout); $Table->display_col_start(); if ($enabled) { // Indicator for the JS UI: echo '<span class="widget_is_enabled">'; echo get_icon('enabled', 'imgtag', array('title' => T_('The widget is enabled.'))); echo '</span>'; } else { echo get_icon('disabled', 'imgtag', array('title' => T_('The widget is disabled.'))); } $Table->display_col_end(); $Table->display_col_start(); $ComponentWidget->init_display(array()); echo '<a href="' . regenerate_url('blog', 'action=edit&wi_ID=' . $ComponentWidget->ID) . '" class="widget_name">' . $ComponentWidget->get_desc_for_list() . '</a>'; $Table->display_col_end(); // Note: this is totally useless, but we need more cols for the screen to feel "right": $Table->display_col_start(); echo $ComponentWidget->type; $Table->display_col_end(); // Move $Table->display_col_start(); //echo $ComponentWidget->order.' '; if ($widget_count > 1) { echo action_icon(T_('Move up!'), 'move_up', regenerate_url('blog', 'action=move_up&wi_ID=' . $ComponentWidget->ID . '&' . url_crumb('widget'))); } else { echo get_icon('nomove', 'imgtag', array('class' => 'action_icon')); } if ($widget_count < count($Widget_array)) { echo action_icon(T_('Move down!'), 'move_down', regenerate_url('blog', 'action=move_down&wi_ID=' . $ComponentWidget->ID . '&' . url_crumb('widget'))); } else { echo get_icon('nomove', 'imgtag', array('class' => 'action_icon')); } $Table->display_col_end(); // Actions $Table->display_col_start(); if ($enabled) { echo action_icon(T_('Disable this widget!'), 'deactivate', regenerate_url('blog', 'action=toggle&wi_ID=' . $ComponentWidget->ID . '&' . url_crumb('widget'))); } else { echo action_icon(T_('Enable this widget!'), 'activate', regenerate_url('blog', 'action=toggle&wi_ID=' . $ComponentWidget->ID . '&' . url_crumb('widget'))); } echo '<span class="edit_icon_hook">' . action_icon(T_('Edit widget settings!'), 'edit', regenerate_url('blog', 'action=edit&wi_ID=' . $ComponentWidget->ID)) . '</span>'; echo '<span class="delete_icon_hook">' . action_icon(T_('Remove this widget!'), 'delete', regenerate_url('blog', 'action=delete&wi_ID=' . $ComponentWidget->ID . '&' . url_crumb('widget'))) . '</span>'; $Table->display_col_end(); $Table->display_line_end(); } } // BODY END: $Table->display_body_end(); $Table->display_list_end(); }
/** * Generate a title for the current list, depending on its filtering params * * @todo cleanup some displays * @todo implement HMS part of YMDHMS * * @return array List of titles to display, which are escaped for HTML display * (dh> only checked this for 'authors'/?authors=, where the output was not escaped) */ function get_filter_titles($ignore = array(), $params = array()) { global $month, $disp_detail; $params = array_merge(array('category_text' => T_('Category') . ': ', 'categories_text' => T_('Categories') . ': ', 'categories_nor_text' => T_('All but '), 'tag_text' => T_('Tag') . ': ', 'tags_text' => T_('Tags') . ': ', 'author_text' => T_('Author') . ': ', 'authors_text' => T_('Authors') . ': ', 'authors_nor_text' => T_('All authors except') . ': ', 'visibility_text' => T_('Visibility') . ': ', 'keyword_text' => T_('Keyword') . ': ', 'keywords_text' => T_('Keywords') . ': ', 'keywords_exact_text' => T_('Exact match') . ' ', 'status_text' => T_('Status') . ': ', 'statuses_text' => T_('Statuses') . ': ', 'archives_text' => T_('Archives for') . ': ', 'assignes_text' => T_('Assigned to') . ': ', 'group_mask' => '$group_title$$filter_items$', 'filter_mask' => '"$filter_name$"', 'filter_mask_nogroup' => '"$filter_name$"', 'before_items' => '', 'after_items' => '', 'separator_and' => ' ' . T_('and') . ' ', 'separator_or' => ' ' . T_('or') . ' ', 'separator_nor' => ' ' . T_('or') . ' ', 'separator_comma' => ', ', 'display_category' => true, 'display_archive' => true, 'display_keyword' => true, 'display_tag' => true, 'display_author' => true, 'display_assignee' => true, 'display_locale' => true, 'display_status' => true, 'display_visibility' => true, 'display_time' => true, 'display_limit' => true), $params); if (empty($this->filters)) { // Filters have no been set before, we'll use the default filterset: // echo ' setting default filterset '; $this->set_filters($this->default_filters); } $title_array = array(); if ($this->single_post) { // We have requested a specific post: // Should be in first position $Item =& $this->get_by_idx(0); if (is_null($Item)) { $title_array[] = T_('Invalid request'); } else { $title_array[] = $Item->get_titletag(); } return $title_array; } // Check if the filter mask has an icon to clear the filter item $clear_icon = strpos($params['filter_mask'], '$clear_icon$') !== false; $filter_classes = array('green'); $filter_class_i = 0; if (strpos($params['filter_mask'], '$filter_class$') !== false) { // Initialize array with available classes for filter items $filter_classes = array('green', 'yellow', 'orange', 'red', 'magenta', 'blue'); } // CATEGORIES: if ($params['display_category']) { if (!empty($this->filters['cat_array'])) { // We have requested specific categories... $cat_names = array(); $ChapterCache =& get_ChapterCache(); $catsel_param = get_param('catsel'); foreach ($this->filters['cat_array'] as $cat_ID) { if (($tmp_Chapter =& $ChapterCache->get_by_ID($cat_ID, false)) !== false) { // It is almost never meaningful to die over an invalid cat when generating title $cat_clear_url = regenerate_url((empty($catsel_param) ? 'cat=' : 'catsel=') . $cat_ID); if ($disp_detail == 'posts-subcat' || $disp_detail == 'posts-cat') { // Remove category url from $ReqPath when we use the cat url instead of cat ID $cat_clear_url = str_replace('/' . $tmp_Chapter->get_url_path(), '', $cat_clear_url); } $cat_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', $cat_clear_url) : ''; $cat_names[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['category_text'], $tmp_Chapter->name, $cat_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } } $filter_class_i++; if ($this->filters['cat_modifier'] == '*') { // Categories with "AND" condition $cat_names_string = implode($params['separator_and'], $cat_names); } elseif ($this->filters['cat_modifier'] == '-') { // Categories with "NOR" condition $cat_names_string = implode($params['separator_nor'], $cat_names); } else { // Categories with "OR" condition $cat_names_string = implode($params['separator_or'], $cat_names); } if (!empty($cat_names_string)) { if ($this->filters['cat_modifier'] == '-') { // Categories with "NOR" condition $cat_names_string = $params['categories_nor_text'] . $cat_names_string; $params['category_text'] = $params['categories_text']; } $title_array['cats'] = str_replace(array('$group_title$', '$filter_items$'), count($this->filters['cat_array']) > 1 ? array($params['categories_text'], $params['before_items'] . $cat_names_string . $params['after_items']) : array($params['category_text'], $cat_names_string), $params['group_mask']); } } } // ARCHIVE TIMESLOT: if ($params['display_archive']) { if (!empty($this->filters['ymdhms'])) { // We have asked for a specific timeframe: $my_year = substr($this->filters['ymdhms'], 0, 4); if (strlen($this->filters['ymdhms']) > 4) { // We have requested a month too: $my_month = T_($month[substr($this->filters['ymdhms'], 4, 2)]); } else { $my_month = ''; } // Requested a day? $my_day = substr($this->filters['ymdhms'], 6, 2); $arch = $my_month . ' ' . $my_year; if (!empty($my_day)) { // We also want to display a day $arch .= ', ' . $my_day; } if (!empty($this->filters['week']) || $this->filters['week'] === 0) { // We also want to display a week number $arch .= ', ' . T_('week') . ' ' . $this->filters['week']; } $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; $arch_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'm')) : ''; $arch = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['archives_text'], $arch, $arch_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); $title_array['ymdhms'] = str_replace(array('$group_title$', '$filter_items$'), array($params['archives_text'], $arch), $params['group_mask']); $filter_class_i++; } } // KEYWORDS: if ($params['display_keyword']) { if (!empty($this->filters['keywords'])) { if ($this->filters['phrase'] == 'OR' || $this->filters['phrase'] == 'AND') { // Search by each keyword $keywords = trim(preg_replace('/("|, *)/', ' ', $this->filters['keywords'])); $keywords = explode(' ', $keywords); } else { // Exact match (Single keyword) $keywords = array($this->filters['keywords']); } $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; $keyword_names = array(); foreach ($keywords as $keyword) { $word_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 's=' . $keyword)) : ''; $keyword_names[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['keyword_text'], $keyword, $word_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } $filter_class_i++; $keywords = ($this->filters['exact'] ? $params['keywords_exact_text'] : '') . implode($this->filters['phrase'] == 'OR' ? $params['separator_or'] : $params['separator_and'], $keyword_names); $title_array[] = str_replace(array('$group_title$', '$filter_items$'), count($keyword_names) > 1 ? array($params['keywords_text'], $params['before_items'] . $keywords . $params['after_items']) : array($params['keyword_text'], $keywords), $params['group_mask']); } } // TAGS: if ($params['display_tag']) { if (!empty($this->filters['tags'])) { $tags = explode(',', $this->filters['tags']); $tag_names = array(); $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; foreach ($tags as $tag) { $tag_clear_url = regenerate_url($this->param_prefix . 'tag=' . $tag); if ($disp_detail == 'posts-tag') { // Remove tag url from $ReqPath when we use tag url instead of tag ID $tag_clear_url = str_replace('/' . $tag . ':', '', $tag_clear_url); } $tag_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', $tag_clear_url) : ''; $tag_names[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['tag_text'], $tag, $tag_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } $filter_class_i++; $tags = implode($params['separator_comma'], $tag_names); $title_array[] = str_replace(array('$group_title$', '$filter_items$'), count($tag_names) > 1 ? array($params['tags_text'], $params['before_items'] . $tags . $params['after_items']) : array($params['tag_text'], $tags), $params['group_mask']); } } // AUTHORS: if ($params['display_author']) { if (!empty($this->filters['authors']) || !empty($this->filters['authors_login'])) { $authors = trim($this->filters['authors'] . ',' . get_users_IDs_by_logins($this->filters['authors_login']), ','); $exclude_authors = false; if (substr($authors, 0, 1) == '-') { // Authors are excluded $authors = substr($authors, 1); $exclude_authors = true; } $authors = preg_split('~\\s*,\\s*~', $authors, -1, PREG_SPLIT_NO_EMPTY); $author_names = array(); if ($authors) { $UserCache =& get_UserCache(); $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; foreach ($authors as $author_ID) { if ($tmp_User = $UserCache->get_by_ID($author_ID, false, false)) { $user_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'author=' . $author_ID)) : ''; $author_names[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['author_text'], $tmp_User->get('login'), $user_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } } $filter_class_i++; } if (count($author_names) > 0) { // Display info of filter by authors if ($exclude_authors) { // Exclude authors $author_names_string = $params['authors_nor_text'] . implode($params['separator_nor'], $author_names); } else { // Filter by authors $author_names_string = implode($params['separator_comma'], $author_names); } $title_array[] = str_replace(array('$group_title$', '$filter_items$'), count($author_names) > 1 ? array($params['authors_text'], $params['before_items'] . $author_names_string . $params['after_items']) : array($params['author_text'], $author_names_string), $params['group_mask']); } } } // ASSIGNEES: if ($params['display_assignee']) { if (!empty($this->filters['assignees']) || !empty($this->filters['assignees_login'])) { $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; if ($this->filters['assignees'] == '-') { $user_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'assgn')) : ''; $title_array[] = str_replace(array('$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Not assigned'), $user_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask_nogroup']); } else { $assignees = trim($this->filters['assignees'] . ',' . get_users_IDs_by_logins($this->filters['assignees_login']), ','); $assignees = preg_split('~\\s*,\\s*~', $assignees, -1, PREG_SPLIT_NO_EMPTY); $assignees_names = array(); if ($assignees) { $UserCache =& get_UserCache(); foreach ($assignees as $user_ID) { if ($tmp_User =& $UserCache->get_by_ID($user_ID, false, false)) { $user_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'assgn=' . $user_ID)) : ''; $assignees_names[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['assignes_text'], $tmp_User->get_identity_link(array('link_text' => 'name')), $user_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } } } $title_array[] = str_replace(array('$group_title$', '$filter_items$'), count($assignees_names) > 1 ? array($params['assignes_text'], $params['before_items'] . implode($params['separator_comma'], $assignees_names) . $params['after_items']) : array($params['assignes_text'], implode($params['separator_comma'], $assignees_names)), $params['group_mask']); } $filter_class_i++; } } // LOCALE: if ($params['display_locale']) { if ($this->filters['lc'] != 'all') { $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; $user_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'lc')) : ''; $loc = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Locale') . ': ', $this->filters['lc'], $user_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); $title_array[] = str_replace(array('$group_title$', '$filter_items$'), array(T_('Locale') . ': ', $loc), $params['group_mask']); $filter_class_i++; } } // EXTRA STATUSES: if ($params['display_status']) { if (!empty($this->filters['statuses'])) { $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; if ($this->filters['statuses'] == '-') { $status_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'status=-')) : ''; $title_array[] = str_replace(array('$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Without status'), $status_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask_nogroup']); } else { $status_IDs = explode(',', $this->filters['statuses']); $ItemStatusCache =& get_ItemStatusCache(); $statuses = array(); foreach ($status_IDs as $status_ID) { if ($ItemStatus =& $ItemStatusCache->get_by_ID($status_ID)) { $status_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'status=' . $status_ID)) : ''; $statuses[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['status_text'], $ItemStatus->get_name(), $status_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } } $title_array[] = str_replace(array('$group_title$', '$filter_items$'), count($statuses) > 1 ? array($params['statuses_text'], $params['before_items'] . implode($params['separator_comma'], $statuses) . $params['after_items']) : array($params['status_text'], implode($params['separator_comma'], $statuses)), $params['group_mask']); } $filter_class_i++; } } // VISIBILITY (SHOW STATUSES): if ($params['display_visibility']) { if (!in_array('visibility', $ignore)) { $post_statuses = get_visibility_statuses(); if (count($this->filters['visibility_array']) != count($post_statuses)) { // Display it only when visibility filter is changed $status_titles = array(); $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; foreach ($this->filters['visibility_array'] as $status) { $vis_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'show_statuses=' . $status)) : ''; $status_titles[] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array($params['visibility_text'], $post_statuses[$status], $vis_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } $filter_class_i++; $title_array[] = str_replace(array('$group_title$', '$filter_items$'), count($status_titles) > 1 ? array($params['visibility_text'], $params['before_items'] . implode($params['separator_comma'], $status_titles) . $params['after_items']) : array($params['visibility_text'], implode($params['separator_comma'], $status_titles)), $params['group_mask']); } } } if ($params['display_time']) { // START AT: if (!empty($this->filters['ymdhms_min']) || !empty($this->filters['ts_min'])) { $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; if (!empty($this->filters['ymdhms_min'])) { $time_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'dstart')) : ''; $title_array['ts_min'] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Start at') . ': ', date2mysql($this->filters['ymdhms_min']), $time_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } else { if ($this->filters['ts_min'] == 'now') { $time_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'show_future')) : ''; $title_array['ts_min'] = str_replace(array('$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Hide past'), $time_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask_nogroup']); } else { $time_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'show_future')) : ''; $title_array['ts_min'] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Start at') . ': ', date2mysql($this->filters['ts_min']), $time_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } } $filter_class_i++; } // STOP AT: if (!empty($this->filters['ymdhms_max']) || !empty($this->filters['ts_max'])) { $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; if (!empty($this->filters['ymdhms_max'])) { $time_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'dstop')) : ''; $title_array['ts_max'] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Stop at') . ': ', date2mysql($this->filters['ymdhms_max']), $time_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } else { if ($this->filters['ts_max'] == 'now') { if (!in_array('hide_future', $ignore)) { $time_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'show_past')) : ''; $title_array['ts_max'] = str_replace(array('$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Hide future'), $time_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask_nogroup']); } } else { $time_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'show_past')) : ''; $title_array['ts_max'] = str_replace(array('$group_title$', '$filter_name$', '$clear_icon$', '$filter_class$'), array(T_('Stop at') . ': ', date2mysql($this->filters['ts_max']), $time_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask']); } } $filter_class_i++; } } // LIMIT TO: if ($params['display_limit']) { if ($this->single_post) { // Single post: no paging required! } elseif (!empty($this->filters['ymdhms'])) { // no restriction if we request a month... some permalinks may point to the archive! } elseif ($this->filters['unit'] == 'posts' || $this->filters['unit'] == 'all') { // We're going to page, so there's no real limit here... } elseif ($this->filters['unit'] == 'days') { // We are going to limit to x days: // echo 'LIMIT DAYS '; $filter_class_i = $filter_class_i > count($filter_classes) - 1 ? 0 : $filter_class_i; if (empty($this->filters['ymdhms_min'])) { // We have no start date, we'll display the last x days: if (!empty($this->filters['keywords']) || !empty($this->filters['cat_array']) || !empty($this->filters['authors'])) { // We are in DAYS mode but we can't restrict on these! (TODO: ?) } else { // We are going to limit to LAST x days: // TODO: rename 'posts' to 'limit' $unit_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'unit')) : ''; $title_array['posts'] = str_replace(array('$filter_name$', '$clear_icon$', '$filter_class$'), array(sprintf(T_('Limited to last %d days'), $this->limit), $unit_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask_nogroup']); } } else { // We have a start date, we'll display x days starting from that point: $unit_clear_icon = $clear_icon ? action_icon(T_('Remove this filter'), 'remove', regenerate_url($this->param_prefix . 'unit')) : ''; $title_array['posts'] = str_replace(array('$filter_name$', '$clear_icon$', '$filter_class$'), array(sprintf(T_('Limited to %d days'), $this->limit), $unit_clear_icon, $filter_classes[$filter_class_i]), $params['filter_mask_nogroup']); } $filter_class_i++; } else { debug_die('Unhandled LIMITING mode in ItemList:' . $this->filters['unit'] . ' (paged mode is obsolete)'); } } return $title_array; }
} // 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');
} else { $Form->hidden('disp', $disp); $Form->hidden('action', $action); } $Form->add_crumb('user'); $Form->hidden('user_tab', param('user_tab_from', 'string', 'avatar')); $Form->hidden('user_ID', isset($edited_User) ? $edited_User->ID : $current_User->ID); $Form->hidden('file_ID', $cropped_File->ID); $Form->hidden('image_crop_data', ''); if (isset($Blog)) { $Form->hidden('blog', $Blog->ID); } $close_icon = ''; if ($display_mode == 'js') { // Display a close link for popup window $close_icon = action_icon(T_('Close this window'), 'close', '', '', 0, 0, array('id' => 'close_button', 'class' => 'floatright')); } $Form->begin_fieldset(T_('Crop profile picture') . $close_icon, array('class' => 'fieldset clear', 'id' => 'image_crop')); $cropped_image_tag = $cropped_File->get_tag('', '', '', '', 'original', ''); echo '<p class="crop_button top">'; $Form->button(array('submit', 'actionArray[crop]', T_('Crop'), 'SaveButton btn-primary')); echo '</p>'; echo '<div id="image_crop_block"' . (!is_admin_page() && $display_mode != 'js' ? ' class="short_width"' : '') . '><div>'; // Main image echo '<div id="target_cropped_image">' . $cropped_image_tag . '</div>'; echo '</div><div>'; // Check if we should display big preview images, Hide them on small screens: $display_big_preview = (empty($image_width) || $image_width > 400) && (empty($image_height) || $image_height > 400); // Preview thumbnails echo '<div class="preview_cropped_images' . (!$display_big_preview ? ' only_small_preview' : '') . '" style="display:none">'; if ($display_big_preview) {