예제 #1
0
 function view()
 {
     global $_CONF, $_TABLES;
     $retval = '';
     $sql = "SELECT L.tag_id, L.tag, COUNT(m.tag_id) AS cnt, L.hits " . "FROM {$_TABLES['tag_list']} AS L " . "LEFT JOIN {$_TABLES['tag_map']} AS m " . "ON L.tag_id = m.tag_id " . "GROUP BY m.tag_id " . "ORDER BY cnt DESC, tag";
     $result = DB_query($sql);
     if (DB_error()) {
         return $retval . '<p>' . TAG_str('db_error') . '</p>';
     } else {
         if (DB_numRows($result) == 0) {
             return $retval . '<p>' . TAG_str('no_tag') . '</p>';
         }
     }
     $T = new Template($_CONF['path'] . 'plugins/tag/templates');
     $T->set_file('stats', 'admin_stats.thtml');
     $T->set_var('xhtml', XHTML);
     $T->set_var('this_script', COM_buildURL($_CONF['site_admin_url'] . '/plugins/tag/index.php'));
     $T->set_var('lang_desc_admin_stats', TAG_str('desc_admin_stats'));
     $T->set_var('lang_lbl_tag', TAG_str('lbl_tag'));
     $T->set_var('lang_lbl_count', TAG_str('lbl_count'));
     $T->set_var('lang_lbl_hit_count', TAG_str('lbl_hit_count'));
     $T->set_var('lang_delete_checked', TAG_str('delete_checked'));
     $T->set_var('lang_ban_checked', TAG_str('ban_checked'));
     $sw = 1;
     $body = '';
     while (($A = DB_fetchArray($result)) !== false) {
         $tag_id = $A['tag_id'];
         $body .= '<tr class="pluginRow' . $sw . '">' . '<td><input id="tag' . TAG_escape($tag_id) . '" name="tag_ids[]" ' . 'type="checkbox" value="' . TAG_escape($A['tag_id']) . '"' . XHTML . '><label for="tag' . TAG_escape($tag_id) . '">' . TAG_escape($A['tag']) . '</label></td>' . '<td style="text-align: right;">' . TAG_escape($A['cnt']) . '</td><td style="text-align: right;">' . TAG_escape($A['hits']) . '</td></tr>' . LB;
         $sw = $sw == 1 ? 2 : 1;
     }
     $T->set_var('body', $body);
     $T->parse('output', 'stats');
     $retval = $T->finish($T->get_var('output'));
     return $retval;
 }
예제 #2
0
 function view()
 {
     global $_CONF, $_TABLES;
     $body = '';
     $T = new Template($_CONF['path'] . 'plugins/tag/templates');
     $T->set_file('badword', 'admin_badword.thtml');
     $T->set_var('xhtml', XHTML);
     $T->set_var('this_script', COM_buildURL($_CONF['site_admin_url'] . '/plugins/tag/index.php'));
     $T->set_var('lang_desc_admin_badword', TAG_str('desc_admin_badword'));
     $T->set_var('lang_add', TAG_str('add'));
     $T->set_var('lang_lbl_tag', TAG_str('lbl_tag'));
     $T->set_var('lang_delete_checked', TAG_str('delete_checked'));
     $sql = "SELECT * FROM {$_TABLES['tag_badwords']}";
     $result = DB_query($sql);
     if (DB_error()) {
         return $retval . '<p>' . TAG_str('db_error') . '</p>';
     } else {
         if (DB_numRows($result) == 0) {
             $T->set_var('msg', '<p>' . TAG_str('no_badword') . '</p>');
         } else {
             $sw = 1;
             while (($A = DB_fetchArray($result)) !== false) {
                 $word = TAG_escape($A['badword']);
                 $body .= '<tr><td>' . '<input id="' . $word . '" name="words[]" type="checkbox" ' . 'value="' . $word . '"><label for="' . $word . '">' . $word . '</label></td></tr>' . LB;
                 $sw = $sw == 1 ? 2 : 1;
             }
         }
     }
     $T->set_var('body', $body);
     $T->parse('output', 'badword');
     $retval = $T->finish($T->get_var('output'));
     return $retval;
 }
예제 #3
0
$T->set_file('page', 'index.thtml');
$T->set_var('xhtml', XHTML);
// Lang vars
$lang_vars = array('tag_list');
foreach ($lang_vars as $lang_var) {
    $T->set_var('lang_' . $lang_var, TAG_str($lang_var));
}
// Tag cloud
$T->set_var('tag_cloud', TAG_getTagCloud($_TAG_CONF['max_tag_cloud'], false));
// Other tags
if ($tag !== '') {
    $tag = TAG_normalize($tag);
    $tag_id = TAG_getTagId($tag);
    if ($tag_id !== FALSE) {
        TAG_increaseHitCount($tag_id);
        $text = $tag;
        if ($_TAG_CONF['replace_underscore'] === TRUE) {
            $text = str_replace('_', ' ', $text);
        }
        $T->set_var('selected_tag', sprintf($LANG_TAG['selected_tag'], TAG_escape($text)));
    }
    $T->set_var('tagged_items', $tag !== '' ? TAG_getTaggedItems($tag) : '');
}
$T->parse('output', 'page');
$content = $T->finish($T->get_var('output'));
if (is_callable('COM_createHTMLDocument')) {
    $display = COM_createHTMLDocument($content);
} else {
    $display = COM_siteHeader() . $content . COM_siteFooter();
}
COM_output($display);
예제 #4
0
        }
        if ($url === '') {
            continue;
        }
        $item .= $url . '">' . TAG_escape($title) . '</a></li>' . LB;
        $tag_menu[] = $item;
    }
}
if (count($tag_menu) > 0) {
    $tag_menu = '<ol>' . LB . implode(LB, $tag_menu) . LB . '</ol>' . LB;
} else {
    $tag_menu = TAG_str('no_item');
}
$tags = array_map('TAG_getTagName', $tags);
if ($_TAG_CONF['replace_underscore'] === TRUE) {
    $temp = array();
    foreach ($tags as $tag) {
        $temp[] = str_replace('_', ' ', $tag);
    }
    $tags = $temp;
}
$T->set_var('title', TAG_escape(sprintf($LANG_TAG['menu_title'], implode(', ', $tags))));
$T->set_var('tag_menu', $tag_menu);
$T->parse('output', 'page');
$content = $T->finish($T->get_var('output'));
if (is_callable('COM_createHTMLDocument')) {
    $display = COM_createHTMLDocument($content);
} else {
    $display = COM_siteHeader() . $content . COM_siteFooter();
}
COM_output($display);
예제 #5
0
 function _subView(&$nodes, &$node, $level, &$sw)
 {
     global $_CONF;
     $this_script = $_CONF['site_admin_url'] . '/plugins/tag/index.php';
     $retval = '<tr><td>' . str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level) . TAG_escape($node['menu_name']) . '</td><td>';
     $retval .= $node['parent_id'] == 0 ? TAG_str('no_parent') : TAG_escape($nodes[$node['parent_id']]['menu_name']);
     $retval .= '</td><td>' . TAG_escape(implode(', ', array_map('TAG_getTagName', $node['tag_ids']))) . '</td><td style="text-align: center;">' . TAG_escape($node['dsp_order']) . '</td>';
     $add_link = $this_script . '?cmd=menuconfig&amp;action=add&amp;pid=' . $node['menu_id'];
     $edit_link = $this_script . '?cmd=menuconfig&amp;action=edit&amp;id=' . $node['menu_id'] . '&amp;pid=' . $node['parent_id'];
     $delete_link = $this_script . '?cmd=menuconfig&amp;action=delete&amp;id=' . $node['menu_id'];
     $up_link = $this_script . '?cmd=menuconfig&amp;action=doEdit&amp;id=' . $node['menu_id'] . '&amp;dir=up';
     $down_link = $this_script . '?cmd=menuconfig&amp;action=doEdit&amp;id=' . $node['menu_id'] . '&amp;dir=down';
     $retval .= '<td style="text-align: center;"><a href="' . $edit_link . '">' . TAG_str('edit') . '</a>&nbsp;&nbsp;<a href="' . $delete_link . '">' . TAG_str('delete') . '</a>&nbsp;&nbsp;' . '<a href="' . $add_link . '">' . TAG_str('add_child') . '</a>&nbsp;&nbsp;<a href="' . $up_link . '">' . TAG_str('order_up') . '</a>&nbsp;&nbsp;<a href="' . $down_link . '">' . TAG_str('order_down') . '</a></td></tr>' . LB;
     $sw = $sw == 1 ? 2 : 1;
     if (count($node['child']) > 0) {
         foreach ($node['child'] as $child_id) {
             $retval .= $this->_subView($nodes, $nodes[$child_id], $level + 1, $sw);
         }
     }
     return $retval;
 }
예제 #6
0
/**
* Gets tag list
*
*/
function getTagList($tags)
{
    global $_PLUGINS, $_CONF, $_TABLES, $_TAG_CONF;
    if (!in_array('tag', $_PLUGINS)) {
        return '';
    }
    $temp = str_replace(' ', "','", $tags);
    $sql_tag_list = "('" . $temp . "') ";
    $sql = "SELECT t.tag " . "FROM {$_TABLES['tag_map']} AS m " . "LEFT JOIN {$_TABLES['tag_list']} AS t ON t.tag_id = m.tag_id " . "WHERE t.tag IN " . $sql_tag_list . "AND m.type = 'downloads' " . "GROUP BY t.tag_id " . "ORDER BY t.tag ASC";
    $result = DB_query($sql);
    if (DB_error()) {
        return '';
    }
    $retval = '';
    while ($A = DB_fetchArray($result)) {
        $title = $A['tag'];
        $rel = rawurlencode($title);
        if ($_TAG_CONF['replace_underscore'] == true) {
            $title = str_replace('_', ' ', $title);
        }
        $title = TAG_escape($title);
        $url = COM_buildURL($_CONF['site_url'] . '/tag/index.php?tag=' . $rel);
        $retval .= COM_createLink($title, $url, array('rel' => $title)) . ', ' . LB;
    }
    $retval = rtrim($retval, ", \r\n");
    return $retval;
}