Esempio n. 1
0
function fncDisplay()
{
    global $_CONF;
    global $LANG_ASSIST_ADMIN;
    global $_ASSIST_CONF;
    global $_DB_dbms;
    $retval = "";
    $pi_name = "assist";
    $tmplfld = assist_templatePath('admin', 'default', $pi_name);
    $T = new Template($tmplfld);
    $lang = COM_getLanguageName();
    $path = $_CONF['site_admin_url'] . '/plugins/assist/docs/';
    //$path = 'docs/';
    if (!file_exists($path . $lang . '/')) {
        $lang = 'japanese';
        //'english';
    }
    $document_url = $path . $lang . '/';
    $T->set_file('admin', 'information.thtml');
    $T->set_var('pi_name', $pi_name);
    $T->set_var('version', $_ASSIST_CONF['version']);
    $T->set_var('dbms', $_DB_dbms);
    $T->set_var('dbversion', DB_getVersion());
    $T->set_var('php_os', PHP_OS);
    $T->set_var('phpversion', phpversion());
    if ($_CONF['facebook_consumer_key'] == "") {
        $T->set_var('fbid', $LANG_ASSIST_ADMIN['err_fbid']);
    } else {
        $T->set_var('fbid', $_CONF['facebook_consumer_key']);
    }
    $T->set_var('piname', $LANG_ASSIST_ADMIN['piname']);
    $T->set_var('about_thispage', $LANG_ASSIST_ADMIN['about_admin_information']);
    $T->set_var('lang_document', $LANG_ASSIST_ADMIN['document']);
    $T->set_var('document_url', $document_url);
    $T->set_var('online', $LANG_ASSIST_ADMIN['online']);
    $T->set_var('lang_configuration', $LANG_ASSIST_ADMIN['configuration']);
    $T->set_var('lang_autotags', $LANG_ASSIST_ADMIN['autotags']);
    $T->set_var('lang_templatesetvar', $LANG_ASSIST_ADMIN['templatesetvar']);
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Esempio n. 2
0
function fncDisplay()
{
    global $_CONF;
    global $LANG_ADMIN;
    global $LANG_DATABOX_ADMIN;
    global $LANG_DATABOX_INFORMATION_HELP;
    global $_DATABOX_CONF;
    $retval = "";
    $pi_name = "databox";
    $menu_arr[] = array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']);
    $function = "plugin_geticon_" . $pi_name;
    $icon = $function();
    $retval .= ADMIN_createMenu($menu_arr, $LANG_DATABOX_ADMIN['about_admin_information'], $icon);
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $T = new Template($tmplfld);
    $lang = COM_getLanguageName();
    $path = 'admin/plugins/databox/docs/';
    if (!file_exists($_CONF['path_html'] . $path . $lang . '/')) {
        $lang = 'japanese';
        //'english';
    }
    $document_url = $_CONF['site_url'] . '/' . $path . $lang . '/';
    $T->set_file('admin', 'information.thtml');
    $T->set_var('pi_name', $pi_name);
    $T->set_var('version', $_DATABOX_CONF['version']);
    $T->set_var('piname', $LANG_DATABOX_ADMIN['piname']);
    $T->set_var('lang_document', $LANG_DATABOX_ADMIN['document']);
    $T->set_var('document_url', $document_url);
    $T->set_var('online', $LANG_DATABOX_ADMIN['online']);
    $T->set_var('lang_configuration', $LANG_DATABOX_ADMIN['configuration']);
    $T->set_var('lang_autotags', $LANG_DATABOX_ADMIN['autotags']);
    $T->set_var('lang_templatesetvars', $LANG_DATABOX_ADMIN['templatesetvars']);
    $T->set_var('lang_install', $LANG_DATABOX_ADMIN['install']);
    $T->set_var('lang_autotags', $LANG_DATABOX_ADMIN['autotags']);
    $T->set_var('lang_files', $LANG_DATABOX_ADMIN['files']);
    $T->set_var('lang_tables', $LANG_DATABOX_ADMIN['tables']);
    $T->set_var('lang_input', $LANG_DATABOX_ADMIN['input']);
    $T->set_var('site_url', $_CONF['site_url']);
    $T->set_var('site_admin_url', $_CONF['site_admin_url']);
    $T->parse('output', 'admin');
    $retval .= $T->finish($T->get_var('output'));
    return $retval;
}
Esempio n. 3
0
    if ($pwdRoot > 0) {
        $retval .= '<li>' . sprintf($LANG_SECTEST['fix_password'], $pwdRoot) . '</li>';
        $failed_tests++;
    } else {
        $retval .= '<li>' . $LANG_SECTEST['password_okay'] . '</li>';
    }
    return $retval;
}
// MAIN
$display = COM_siteHeader('menu', $LANG_SECTEST['sectest']);
$display .= COM_startBlock($LANG_SECTEST['results']);
$url = urlToCheck();
if (!empty($url)) {
    $display .= '<ol>';
    if (strpos($_SERVER['PHP_SELF'], 'public_html') !== false) {
        $doclang = COM_getLanguageName();
        $docs = 'docs/' . $doclang . '/install.html';
        if (file_exists($_CONF['path_html'] . $docs)) {
            $instUrl = $_CONF['site_url'] . '/' . $docs;
        } else {
            $instUrl = $_CONF['site_url'] . '/docs/english/install.html';
        }
        $instUrl .= '#public_html';
        $display .= '<li>' . sprintf($LANG_SECTEST['public_html'], COM_createLink($LANG_SECTEST['installation'], $instUrl)) . '</li>' . LB;
        $failed_tests++;
    }
    $display .= checkInstallDir();
    $urls = array(array('db-config.php', 'db-config.php'), array('logs/error.log', 'logs ' . $LANG_SECTEST['directory']), array('plugins/staticpages/functions.inc', 'plugins ' . $LANG_SECTEST['directory']), array('system/lib-security.php', 'system ' . $LANG_SECTEST['directory']));
    foreach ($urls as $tocheck) {
        $display .= doTest($url, $tocheck[0], $tocheck[1]);
    }
Esempio n. 4
0
/**
* Prints administration menu
*
* This will return the administration menu items that the user has
* sufficient rights to -- Admin Block on the left side.
*
* @param        string      $help       Help file to show
* @param        string      $title      Menu Title
* @param        string      $position   Side being shown on 'left', 'right' or blank.
* @see function COM_userMenu
*
*/
function COM_adminMenu($help = '', $title = '', $position = '')
{
    global $_TABLES, $_CONF, $_CONF_FT, $LANG01, $LANG_ADMIN, $_BLOCK_TEMPLATE, $_DB_dbms, $config;
    $retval = '';
    if (COM_isAnonUser()) {
        return $retval;
    }
    $plugin_options = PLG_getAdminOptions();
    $num_plugins = count($plugin_options);
    if (SEC_isModerator() or SEC_hasRights('story.edit,block.edit,topic.edit,user.edit,plugin.edit,user.mail,syndication.edit', 'OR') or $num_plugins > 0 or SEC_hasConfigAcess()) {
        // what's our current URL?
        $thisUrl = COM_getCurrentURL();
        $adminmenu = COM_newTemplate($_CONF['path_layout']);
        if (isset($_BLOCK_TEMPLATE['adminoption'])) {
            $templates = explode(',', $_BLOCK_TEMPLATE['adminoption']);
            $adminmenu->set_file(array('option' => $templates[0], 'current' => $templates[1]));
        } else {
            $adminmenu->set_file(array('option' => 'adminoption.thtml', 'current' => 'adminoption_off.thtml'));
        }
        $adminmenu->set_var('block_name', str_replace('_', '-', 'admin_block'));
        if (empty($title)) {
            $title = DB_getItem($_TABLES['blocks'], 'title', "name = 'admin_block'");
        }
        $retval .= COM_startBlock($title, $help, COM_getBlockTemplate('admin_block', 'header', $position));
        $topicsql = '';
        if (SEC_isModerator() || SEC_hasRights('story.edit')) {
            $tresult = DB_query("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
            $trows = DB_numRows($tresult);
            if ($trows > 0) {
                $tids = array();
                for ($i = 0; $i < $trows; $i++) {
                    $T = DB_fetchArray($tresult);
                    $tids[] = $T['tid'];
                }
                if (count($tids) > 0) {
                    $topicsql = " (tid IN ('" . implode("','", $tids) . "'))";
                }
            }
        }
        $modnum = 0;
        if (SEC_hasRights('story.edit,story.moderate', 'OR') || $_CONF['commentsubmission'] == 1 && SEC_hasRights('comment.moderate') || $_CONF['usersubmission'] == 1 && SEC_hasRights('user.edit,user.delete')) {
            if (SEC_hasRights('story.moderate')) {
                if (empty($topicsql)) {
                    $modnum += DB_count($_TABLES['storysubmission']);
                } else {
                    $sresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['storysubmission']} WHERE" . $topicsql);
                    $S = DB_fetchArray($sresult);
                    $modnum += $S['count'];
                }
            }
            if ($_CONF['listdraftstories'] == 1 && SEC_hasRights('story.edit')) {
                $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (draft_flag = 1)";
                if (!empty($topicsql)) {
                    $sql .= ' AND' . $topicsql;
                }
                $result = DB_query($sql . COM_getPermSQL('AND', 0, 3));
                $A = DB_fetchArray($result);
                $modnum += $A['count'];
            }
            if ($_CONF['commentsubmission'] == 1 && SEC_hasRights('comment.moderate')) {
                $modnum += DB_count($_TABLES['commentsubmissions']);
            }
            if ($_CONF['usersubmission'] == 1) {
                if (SEC_hasRights('user.edit') && SEC_hasRights('user.delete')) {
                    $modnum += DB_count($_TABLES['users'], 'status', '2');
                }
            }
        }
        if (SEC_hasConfigAcess()) {
            $url = $_CONF['site_admin_url'] . '/configuration.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[129]);
            $adminmenu->set_var('option_count', count($config->_get_groups()));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[129]] = $menu_item;
        }
        // now handle submissions for plugins
        $modnum += PLG_getSubmissionCount();
        if (SEC_hasRights('story.edit')) {
            $url = $_CONF['site_admin_url'] . '/story.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[11]);
            if (empty($topicsql)) {
                $numstories = DB_count($_TABLES['stories']);
            } else {
                $nresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE" . $topicsql . COM_getPermSql('AND'));
                $N = DB_fetchArray($nresult);
                $numstories = $N['count'];
            }
            $adminmenu->set_var('option_count', COM_numberFormat($numstories));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[11]] = $menu_item;
        }
        if (SEC_hasRights('block.edit')) {
            $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['blocks']}" . COM_getPermSql());
            list($count) = DB_fetchArray($result);
            $url = $_CONF['site_admin_url'] . '/block.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[12]);
            $adminmenu->set_var('option_count', COM_numberFormat($count));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[12]] = $menu_item;
        }
        if (SEC_hasRights('topic.edit')) {
            $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['topics']}" . COM_getPermSql());
            list($count) = DB_fetchArray($result);
            $url = $_CONF['site_admin_url'] . '/topic.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[13]);
            $adminmenu->set_var('option_count', COM_numberFormat($count));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[13]] = $menu_item;
        }
        if (SEC_hasRights('user.edit')) {
            $url = $_CONF['site_admin_url'] . '/user.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[17]);
            $active_users = DB_count($_TABLES['users'], 'status', USER_ACCOUNT_ACTIVE);
            $adminmenu->set_var('option_count', COM_numberFormat($active_users - 1));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[17]] = $menu_item;
        }
        if (SEC_hasRights('group.edit')) {
            if (SEC_inGroup('Root')) {
                $grpFilter = '';
            } else {
                $thisUsersGroups = SEC_getUserGroups();
                $grpFilter = 'WHERE (grp_id IN (' . implode(',', $thisUsersGroups) . '))';
            }
            $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['groups']} {$grpFilter};");
            $A = DB_fetchArray($result);
            $url = $_CONF['site_admin_url'] . '/group.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[96]);
            $adminmenu->set_var('option_count', COM_numberFormat($A['count']));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[96]] = $menu_item;
        }
        if (SEC_hasRights('user.mail')) {
            $url = $_CONF['site_admin_url'] . '/mail.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[105]);
            $adminmenu->set_var('option_count', $LANG_ADMIN['na']);
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[105]] = $menu_item;
        }
        if ($_CONF['backend'] == 1 && SEC_hasRights('syndication.edit')) {
            $url = $_CONF['site_admin_url'] . '/syndication.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[38]);
            $count = COM_numberFormat(DB_count($_TABLES['syndication']));
            $adminmenu->set_var('option_count', $count);
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[38]] = $menu_item;
        }
        if (($_CONF['trackback_enabled'] || $_CONF['pingback_enabled'] || $_CONF['ping_enabled']) && SEC_hasRights('story.ping')) {
            $url = $_CONF['site_admin_url'] . '/trackback.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[116]);
            if ($_CONF['ping_enabled']) {
                $count = COM_numberFormat(DB_count($_TABLES['pingservice']));
                $adminmenu->set_var('option_count', $count);
            } else {
                $adminmenu->set_var('option_count', $LANG_ADMIN['na']);
            }
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[116]] = $menu_item;
        }
        if (SEC_hasRights('plugin.edit')) {
            $url = $_CONF['site_admin_url'] . '/plugins.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[77]);
            $adminmenu->set_var('option_count', COM_numberFormat(DB_count($_TABLES['plugins'], 'pi_enabled', 1)));
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[77]] = $menu_item;
        }
        // This will show the admin options for all installed plugins (if any)
        for ($i = 0; $i < $num_plugins; $i++) {
            $plg = current($plugin_options);
            $adminmenu->set_var('option_url', $plg->adminurl);
            $adminmenu->set_var('option_label', $plg->adminlabel);
            if (isset($plg->numsubmissions) && is_numeric($plg->numsubmissions)) {
                $adminmenu->set_var('option_count', COM_numberFormat($plg->numsubmissions));
            } elseif (!empty($plg->numsubmissions)) {
                $adminmenu->set_var('option_count', $plg->numsubmissions);
            } else {
                $adminmenu->set_var('option_count', $LANG_ADMIN['na']);
            }
            $menu_item = $adminmenu->parse('item', $thisUrl == $plg->adminurl ? 'current' : 'option', true);
            $link_array[$plg->adminlabel] = $menu_item;
            next($plugin_options);
        }
        if ($_CONF['allow_mysqldump'] == 1 and $_DB_dbms == 'mysql' and SEC_inGroup('Root')) {
            $url = $_CONF['site_admin_url'] . '/database.php';
            $adminmenu->set_var('option_url', $url);
            $adminmenu->set_var('option_label', $LANG01[103]);
            $adminmenu->set_var('option_count', $LANG_ADMIN['na']);
            $menu_item = $adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option');
            $link_array[$LANG01[103]] = $menu_item;
        }
        if ($_CONF['link_documentation'] == 1) {
            $doclang = COM_getLanguageName();
            $docs = 'docs/' . $doclang . '/index.html';
            if (file_exists($_CONF['path_html'] . $docs)) {
                $adminmenu->set_var('option_url', $_CONF['site_url'] . '/' . $docs);
            } else {
                $adminmenu->set_var('option_url', $_CONF['site_url'] . '/docs/english/index.html');
            }
            $adminmenu->set_var('option_label', $LANG01[113]);
            $adminmenu->set_var('option_count', $LANG_ADMIN['na']);
            $menu_item = $adminmenu->parse('item', 'option');
            $link_array[$LANG01[113]] = $menu_item;
        }
        if ($_CONF['link_versionchecker'] == 1 and SEC_inGroup('Root')) {
            $adminmenu->set_var('option_url', 'http://www.geeklog.net/versionchecker.php?version=' . VERSION);
            $adminmenu->set_var('option_label', $LANG01[107]);
            $adminmenu->set_var('option_count', VERSION);
            $menu_item = $adminmenu->parse('item', 'option');
            $link_array[$LANG01[107]] = $menu_item;
        }
        if ($_CONF['sort_admin']) {
            uksort($link_array, 'strcasecmp');
        }
        $url = $_CONF['site_admin_url'] . '/moderation.php';
        $adminmenu->set_var('option_url', $url);
        $adminmenu->set_var('option_label', $LANG01[10]);
        $adminmenu->set_var('option_count', COM_numberFormat($modnum));
        $menu_item = $adminmenu->finish($adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option'));
        $link_array = array($menu_item) + $link_array;
        foreach ($link_array as $link) {
            $retval .= $link;
        }
        $retval .= COM_endBlock(COM_getBlockTemplate('admin_block', 'footer', $position));
    }
    return $retval;
}
Esempio n. 5
0
/**
* Get URL of the help file (trackback.html)
*
* @return   string  full URL of trackback.html
*
*/
function getHelpUrl()
{
    global $_CONF;
    $retval = '';
    $doclang = COM_getLanguageName();
    $docs = 'docs/' . $doclang . '/trackback.html';
    if (file_exists($_CONF['path_html'] . $docs)) {
        $retval = $_CONF['site_url'] . '/' . $docs;
    } else {
        $retval = $_CONF['site_url'] . '/docs/english/trackback.html';
    }
    return $retval;
}
Esempio n. 6
0
 /**
  * Helper function: Set the URL to the help section for a config option
  *
  * @param    string  $t          Template
  * @param    string  $group      'Core' or plugin name
  * @param    string  $option     name of the config option
  *
  */
 function _set_ConfigHelp(&$t, $group, $option)
 {
     static $docUrl;
     if (!isset($docUrl)) {
         $docUrl = array();
     }
     $retval = '';
     $configtext = PLG_getConfigTooltip($group, $option);
     if (empty($configtext)) {
         if ($group == 'Core') {
             $configtext = NULL;
             if (!empty($GLOBALS['_CONF']['site_url']) && !empty($GLOBALS['_CONF']['path_html'])) {
                 $baseUrl = $GLOBALS['_CONF']['site_url'];
                 $doclang = COM_getLanguageName();
                 $cfg = 'docs/' . $doclang . '/config.html';
                 if (file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
                     $url = $baseUrl . '/' . $cfg;
                 } else {
                     $url = $baseUrl . '/docs/english/config.html';
                 }
             } else {
                 $url = 'http://www.geeklog.net/docs/english/config.html';
             }
             $docUrl['Core'] = $url;
         } else {
             // plugin
             $docUrl[$group] = PLG_getDocumentationUrl($group, 'config');
         }
         $descUrl = $docUrl[$group];
         if (!empty($descUrl)) {
             if (strpos($descUrl, '#') === false) {
                 $descUrl .= '#desc_' . $option;
             }
             $t->set_var('doc_url', $descUrl);
             // Does hack need to be used?
             if (gettype($configtext) == "NULL") {
                 $t->set_var('doc_link', '(<a href="' . $descUrl . '" target="help" class="tooltip">?</a>)');
             } else {
                 $t->set_var('doc_link', '(<a href="' . $descUrl . '" target="help">?</a>)');
             }
         }
     } else {
         $t->set_var('doc_url', '');
         $retval = "(" . COM_getTooltip("?", $configtext, '', $option, 'information') . ")";
         $t->set_var('doc_link', $retval);
     }
 }
Esempio n. 7
0
/**
* Prints the command & control block at the top
*
* @param    string  $token  CSRF token
* @return   string          HTML for the C&C block
* @todo The moderation items should be displayed with the help of ul/li
* instead of div's. 
*
*/
function commandcontrol($token)
{
    global $_CONF, $_TABLES, $LANG01, $LANG29, $LANG_LOGVIEW, $_IMAGE_TYPE, $_DB_dbms;
    $retval = '';
    $admin_templates = new Template($_CONF['path_layout'] . 'admin/moderation');
    $admin_templates->set_file(array('cc' => 'moderation.thtml', 'ccrow' => 'ccrow.thtml', 'ccitem' => 'ccitem.thtml'));
    $admin_templates->set_var('xhtml', XHTML);
    $admin_templates->set_var('layout_url', $_CONF['layout_url']);
    $admin_templates->set_var('site_url', $_CONF['site_url']);
    $admin_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $retval .= COM_startBlock('Geeklog ' . VERSION . ' -- ' . $LANG29[34], '', COM_getBlockTemplate('_admin_block', 'header'));
    $showTrackbackIcon = ($_CONF['trackback_enabled'] || $_CONF['pingback_enabled'] || $_CONF['ping_enabled']) && SEC_hasRights('story.ping');
    $cc_arr = array(array('condition' => SEC_hasRights('story.edit'), 'url' => $_CONF['site_admin_url'] . '/story.php', 'lang' => $LANG01[11], 'image' => '/images/icons/story.'), array('condition' => SEC_hasRights('block.edit'), 'url' => $_CONF['site_admin_url'] . '/block.php', 'lang' => $LANG01[12], 'image' => '/images/icons/block.'), array('condition' => SEC_hasRights('topic.edit'), 'url' => $_CONF['site_admin_url'] . '/topic.php', 'lang' => $LANG01[13], 'image' => '/images/icons/topic.'), array('condition' => SEC_hasRights('user.edit'), 'url' => $_CONF['site_admin_url'] . '/user.php', 'lang' => $LANG01[17], 'image' => '/images/icons/user.'), array('condition' => SEC_hasRights('group.edit'), 'url' => $_CONF['site_admin_url'] . '/group.php', 'lang' => $LANG01[96], 'image' => '/images/icons/group.'), array('condition' => SEC_hasRights('user.mail'), 'url' => $_CONF['site_admin_url'] . '/mail.php', 'lang' => $LANG01[105], 'image' => '/images/icons/mail.'), array('condition' => SEC_hasRights('syndication.edit'), 'url' => $_CONF['site_admin_url'] . '/syndication.php', 'lang' => $LANG01[38], 'image' => '/images/icons/syndication.'), array('condition' => $showTrackbackIcon, 'url' => $_CONF['site_admin_url'] . '/trackback.php', 'lang' => $LANG01[116], 'image' => '/images/icons/trackback.'), array('condition' => SEC_hasRights('plugin.edit'), 'url' => $_CONF['site_admin_url'] . '/plugins.php', 'lang' => $LANG01[98], 'image' => '/images/icons/plugins.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/logview.php', 'lang' => $LANG_LOGVIEW['logview'], 'image' => '/images/icons/logview.'));
    $admin_templates->set_var('cc_icon_width', floor(100 / ICONS_PER_ROW));
    for ($i = 0; $i < count($cc_arr); $i++) {
        if ($cc_arr[$i]['condition']) {
            $item = render_cc_item($admin_templates, $cc_arr[$i]['url'], $_CONF['layout_url'] . $cc_arr[$i]['image'] . $_IMAGE_TYPE, $cc_arr[$i]['lang']);
            $items[$cc_arr[$i]['lang']] = $item;
        }
    }
    // now add the plugins
    $plugins = PLG_getCCOptions();
    for ($i = 0; $i < count($plugins); $i++) {
        $cur_plugin = current($plugins);
        $item = render_cc_item($admin_templates, $cur_plugin->adminurl, $cur_plugin->plugin_image, $cur_plugin->adminlabel);
        $items[$cur_plugin->adminlabel] = $item;
        next($plugins);
    }
    // and finally, add the remaining admin items
    $docsUrl = $_CONF['site_url'] . '/docs/english/index.html';
    if ($_CONF['link_documentation'] == 1) {
        $doclang = COM_getLanguageName();
        $docs = 'docs/' . $doclang . '/index.html';
        if (file_exists($_CONF['path_html'] . $docs)) {
            $docsUrl = $_CONF['site_url'] . '/' . $docs;
        }
    }
    $cc_arr = array(array('condition' => $_CONF['allow_mysqldump'] == 1 && $_DB_dbms == 'mysql' && SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/database.php', 'lang' => $LANG01[103], 'image' => '/images/icons/database.'), array('condition' => $_CONF['link_documentation'] == 1, 'url' => $docsUrl, 'lang' => $LANG01[113], 'image' => '/images/icons/docs.'), array('condition' => SEC_inGroup('Root') && $_CONF['link_versionchecker'] == 1, 'url' => 'http://www.geeklog.net/versionchecker.php?version=' . VERSION, 'lang' => $LANG01[107], 'image' => '/images/icons/versioncheck.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/configuration.php', 'lang' => $LANG01[129], 'image' => '/images/icons/configuration.'));
    for ($i = 0; $i < count($cc_arr); $i++) {
        if ($cc_arr[$i]['condition']) {
            $item = render_cc_item($admin_templates, $cc_arr[$i]['url'], $_CONF['layout_url'] . $cc_arr[$i]['image'] . $_IMAGE_TYPE, $cc_arr[$i]['lang']);
            $items[$cc_arr[$i]['lang']] = $item;
        }
    }
    if ($_CONF['sort_admin']) {
        uksort($items, 'strcasecmp');
    }
    // logout is always the last entry
    $item = render_cc_item($admin_templates, $_CONF['site_url'] . '/users.php?mode=logout', $_CONF['layout_url'] . '/images/icons/logout.' . $_IMAGE_TYPE, $LANG01[35]);
    $items[$LANG01[35]] = $item;
    reset($items);
    $cols = 0;
    $cc_main_options = '';
    foreach ($items as $key => $val) {
        $cc_main_options .= $val . LB;
        $cols++;
        if ($cols == ICONS_PER_ROW) {
            $admin_templates->set_var('cc_main_options', $cc_main_options);
            $admin_templates->parse('cc_rows', 'ccrow', true);
            $admin_templates->clear_var('cc_main_options');
            $cc_main_options = '';
            $cols = 0;
        }
    }
    if ($cols > 0) {
        // "flush out" any unrendered entries
        $admin_templates->set_var('cc_main_options', $cc_main_options);
        $admin_templates->parse('cc_rows', 'ccrow', true);
        $admin_templates->clear_var('cc_main_options');
    }
    $retval .= $admin_templates->finish($admin_templates->parse('output', 'cc'));
    $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    if (SEC_hasRights('story.moderate')) {
        $retval .= itemlist('story', $token);
    }
    if ($_CONF['listdraftstories'] == 1) {
        if (SEC_hasRights('story.edit')) {
            $retval .= draftlist($token);
        }
    }
    if ($_CONF['commentsubmission'] == 1) {
        if (SEC_hasRights('comment.moderate')) {
            $retval .= itemlist('comment', $token);
        }
    }
    if ($_CONF['usersubmission'] == 1) {
        if (SEC_hasRights('user.edit') && SEC_hasRights('user.delete')) {
            $retval .= userlist($token);
        }
    }
    $retval .= PLG_showModerationList($token);
    return $retval;
}
Esempio n. 8
0
/**
* Prints Command and Control Page or Administration Menu Block
*
* This will return the command and control items or administration menu items that
* the user has sufficient rights to -- Admin Block on the left side.
*
* @param        string      $adminMenu  True if admin menu, false if command and control page
* @param        string      $help       Help file to show (admin menu only)
* @param        string      $title      Menu Title (admin menu only)
* @param        string      $position   Side being shown on 'left', 'right' or blank. (admin menu only)
* @see function COM_adminMenu
*
*/
function COM_commandControl($adminMenu = false, $help = '', $title = '', $position = '')
{
    global $_CONF, $_CONF_FT, $_TABLES, $LANG01, $LANG29, $LANG_LOGVIEW, $LANG_ENVCHECK, $LANG_ADMIN, $_IMAGE_TYPE, $_DB_dbms, $config;
    $retval = '';
    if ($adminMenu) {
        // what's our current URL?
        $thisUrl = COM_getCurrentURL();
        // Figure out topics sql since used in a few places
        $topicsql = '';
        if (SEC_isModerator() || SEC_hasRights('story.edit')) {
            $tresult = DB_query("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
            $trows = DB_numRows($tresult);
            if ($trows > 0) {
                $tids = array();
                for ($i = 0; $i < $trows; $i++) {
                    $T = DB_fetchArray($tresult);
                    $tids[] = $T['tid'];
                }
                if (count($tids) > 0) {
                    $topicsql = " AND (ta.tid IN ('" . implode("','", $tids) . "'))";
                }
            }
        }
        // Template Stuff
        $adminmenu = COM_newTemplate($_CONF['path_layout']);
        if (isset($_BLOCK_TEMPLATE['adminnavigation'])) {
            $adminmenu->set_file('adminnavigation', $_BLOCK_TEMPLATE['adminnavigation']);
        } else {
            $adminmenu->set_file('adminnavigation', 'adminnavigation.thtml');
        }
        $blocks = array('option', 'current', 'group', 'count');
        foreach ($blocks as $block) {
            $adminmenu->set_block('adminnavigation', $block);
        }
        $adminmenu->set_var('block_name', str_replace('_', '-', 'admin_block'));
        if (empty($title)) {
            $title = DB_getItem($_TABLES['blocks'], 'title', "name = 'admin_block'");
        }
        $retval .= COM_startBlock($title, $help, COM_getBlockTemplate('admin_block', 'header', $position));
        // Allow anything not in the blocks but in the rest of the template file to be displayed
        $retval .= $adminmenu->parse('item', 'adminnavigation', true);
        // Add Command and Control Link
        $url = $_CONF['site_admin_url'] . '/index.php';
        $adminmenu->set_var('option_url', $url);
        $adminmenu->set_var('option_label', $LANG01[14]);
        $adminmenu->set_var('option_count', $LANG_ADMIN['na']);
        $retval .= $adminmenu->finish($adminmenu->parse('item', $thisUrl == $url ? 'current' : 'option'));
        // Get any plugin items
        $plugins = PLG_getAdminOptions();
    } else {
        // this defines the amount of icons displayed next to another in the CC-block
        define('ICONS_PER_ROW', 6);
        // Template Stuff
        $admin_templates = COM_newTemplate($_CONF['path_layout'] . 'admin');
        $admin_templates->set_file(array('cc' => 'commandcontrol.thtml'));
        $blocks = array('ccgroup', 'ccrow', 'ccitem');
        foreach ($blocks as $block) {
            $admin_templates->set_block('cc', $block);
        }
        $retval .= COM_startBlock('Geeklog ' . VERSION . ' -- ' . $LANG29[34], '', COM_getBlockTemplate('_admin_block', 'header'));
        // Get any plugin items
        $plugins = PLG_getCCOptions();
    }
    $cc_core = array();
    $cc_plugins = array();
    $cc_tools = array();
    $cc_users = array();
    for ($i = 0; $i < count($plugins); $i++) {
        $cur_plugin = current($plugins);
        if ($adminMenu) {
            $item = array('condition' => SEC_hasRights('story.edit'), 'url' => $cur_plugin->adminurl, 'lang' => $cur_plugin->adminlabel, 'num' => $cur_plugin->numsubmissions);
        } else {
            $item = array('condition' => SEC_hasRights('story.edit'), 'url' => $cur_plugin->adminurl, 'lang' => $cur_plugin->adminlabel, 'image' => $cur_plugin->plugin_image);
        }
        switch ($cur_plugin->admingroup) {
            case 'core':
                $cc_core[] = $item;
                break;
            case 'tools':
                $cc_tools[] = $item;
                break;
            case 'users':
                $cc_users[] = $item;
                break;
            default:
                $cc_plugins[] = $item;
                break;
        }
        next($plugins);
    }
    // Command & Control Group Layout
    $ccgroups = array('core', 'plugins', 'tools', 'users');
    foreach ($ccgroups as $ccgroup) {
        // Clear a few things before starting group
        $cc_arr = array();
        $items = array();
        if (!$adminMenu) {
            $admin_templates->clear_var('cc_rows');
            $admin_templates->set_var('cc_icon_width', floor(100 / ICONS_PER_ROW));
        }
        switch ($ccgroup) {
            // Core - Blocks, Content Syndication, Stories, Topics, Submissions, Trackbacks
            case 'core':
                $showTrackbackIcon = ($_CONF['trackback_enabled'] || $_CONF['pingback_enabled'] || $_CONF['ping_enabled']) && SEC_hasRights('story.ping');
                // Count stuff for admin menu
                $blockcount = 0;
                $topiccount = 0;
                $storycount = 0;
                $submissioncount = 0;
                $syndicationcount = 0;
                $trackbackcount = $LANG_ADMIN['na'];
                if ($adminMenu) {
                    // Find num of blocks
                    $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['blocks']}" . COM_getPermSql());
                    list($blockcount) = DB_fetchArray($result);
                    // Find num of topics
                    $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['topics']}" . COM_getPermSql());
                    list($topiccount) = DB_fetchArray($result);
                    // Find num of stories
                    if (SEC_hasRights('story.edit')) {
                        if (empty($topicsql)) {
                            $storycount = DB_count($_TABLES['stories']);
                        } else {
                            $nresult = DB_query("SELECT COUNT(DISTINCT sid) AS count FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'article' AND ta.id = sid " . $topicsql . COM_getPermSql('AND'));
                            $N = DB_fetchArray($nresult);
                            $storycount = $N['count'];
                        }
                    }
                    // Find num of submissions
                    if (SEC_hasRights('story.edit,story.moderate', 'OR') || $_CONF['commentsubmission'] == 1 && SEC_hasRights('comment.moderate') || $_CONF['usersubmission'] == 1 && SEC_hasRights('user.edit,user.delete')) {
                        if (SEC_hasRights('story.moderate')) {
                            if (empty($topicsql)) {
                                $submissioncount += DB_count($_TABLES['storysubmission']);
                            } else {
                                $sql = "SELECT COUNT(DISTINCT sid) AS count FROM {$_TABLES['storysubmission']}, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'article' AND ta.id = sid " . $topicsql;
                                $sresult = DB_query($sql);
                                $S = DB_fetchArray($sresult);
                                $submissioncount += $S['count'];
                            }
                        }
                        if ($_CONF['listdraftstories'] == 1 && SEC_hasRights('story.edit')) {
                            $sql = "SELECT COUNT(DISTINCT sid) AS count FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta WHERE ta.type = 'article' AND ta.id = sid AND draft_flag = 1";
                            if (!empty($topicsql)) {
                                $sql .= $topicsql;
                            }
                            $result = DB_query($sql . COM_getPermSQL('AND', 0, 3));
                            $A = DB_fetchArray($result);
                            $submissioncount += $A['count'];
                        }
                        if ($_CONF['commentsubmission'] == 1 && SEC_hasRights('comment.moderate')) {
                            $submissioncount += DB_count($_TABLES['commentsubmissions']);
                        }
                        if ($_CONF['usersubmission'] == 1) {
                            if (SEC_hasRights('user.edit') && SEC_hasRights('user.delete')) {
                                $submissioncount += DB_count($_TABLES['users'], 'status', '2');
                            }
                        }
                    }
                    // now handle submissions for plugins
                    $submissioncount += PLG_getSubmissionCount();
                    // Find num of syndication
                    if ($_CONF['backend'] == 1 && SEC_hasRights('syndication.edit')) {
                        $syndicationcount = COM_numberFormat(DB_count($_TABLES['syndication']));
                    }
                    // Find num of trackback
                    if ($_CONF['ping_enabled'] && SEC_hasRights('story.ping')) {
                        $trackbackcount = COM_numberFormat(DB_count($_TABLES['pingservice']));
                    }
                }
                $cc_arr = array(array('condition' => SEC_hasRights('topic.edit'), 'url' => $_CONF['site_admin_url'] . '/topic.php', 'lang' => $LANG01[13], 'num' => COM_numberFormat($topiccount), 'image' => $_CONF['layout_url'] . '/images/icons/topic.' . $_IMAGE_TYPE), array('condition' => SEC_hasRights('block.edit'), 'url' => $_CONF['site_admin_url'] . '/block.php', 'lang' => $LANG01[12], 'num' => COM_numberFormat($blockcount), 'image' => $_CONF['layout_url'] . '/images/icons/block.' . $_IMAGE_TYPE), array('condition' => SEC_hasRights('story.edit'), 'url' => $_CONF['site_admin_url'] . '/story.php', 'lang' => $LANG01[11], 'num' => COM_numberFormat($storycount), 'image' => $_CONF['layout_url'] . '/images/icons/story.' . $_IMAGE_TYPE), array('condition' => SEC_hasModerationAccess(), 'url' => $_CONF['site_admin_url'] . '/moderation.php', 'lang' => $LANG01[10], 'num' => COM_numberFormat($submissioncount), 'image' => $_CONF['layout_url'] . '/images/icons/moderation.' . $_IMAGE_TYPE), array('condition' => SEC_hasRights('syndication.edit'), 'url' => $_CONF['site_admin_url'] . '/syndication.php', 'lang' => $LANG01[38], 'num' => $syndicationcount, 'image' => $_CONF['layout_url'] . '/images/icons/syndication.' . $_IMAGE_TYPE), array('condition' => $showTrackbackIcon, 'url' => $_CONF['site_admin_url'] . '/trackback.php', 'lang' => $LANG01[116], 'num' => $trackbackcount, 'image' => $_CONF['layout_url'] . '/images/icons/trackback.' . $_IMAGE_TYPE));
                // Merge any items that belong to this group from plugins
                $cc_arr = array_merge($cc_arr, $cc_core);
                break;
                // Plugins - All ungrouped plugins
            // Plugins - All ungrouped plugins
            case 'plugins':
                $cc_arr = $cc_plugins;
                break;
                // Tools - Db backups, Clear cache, Log Viewer, GL Version Test, Plugins, Configuration, Documentation, SPAM-X Plugin
            // Tools - Db backups, Clear cache, Log Viewer, GL Version Test, Plugins, Configuration, Documentation, SPAM-X Plugin
            case 'tools':
                $docsUrl = $_CONF['site_url'] . '/docs/english/index.html';
                if ($_CONF['link_documentation'] == 1) {
                    $doclang = COM_getLanguageName();
                    $docs = 'docs/' . $doclang . '/index.html';
                    if (file_exists($_CONF['path_html'] . $docs)) {
                        $docsUrl = $_CONF['site_url'] . '/' . $docs;
                    }
                }
                $pluginscount = 0;
                if ($adminMenu) {
                    // Find num of plugins
                    if (SEC_hasRights('plugin.edit')) {
                        $pluginscount = COM_numberFormat(DB_count($_TABLES['plugins'], 'pi_enabled', 1));
                    }
                }
                $cc_arr = array(array('condition' => SEC_hasRights($_CONF_FT, 'OR'), 'url' => $_CONF['site_admin_url'] . '/configuration.php', 'lang' => $LANG01[129], 'num' => count($config->_get_groups()), 'image' => $_CONF['layout_url'] . '/images/icons/configuration.' . $_IMAGE_TYPE), array('condition' => $_CONF['link_documentation'] == 1, 'url' => $docsUrl, 'lang' => $LANG01[113], 'image' => $_CONF['layout_url'] . '/images/icons/docs.' . $_IMAGE_TYPE), array('condition' => SEC_inGroup('Root') && $_CONF['link_versionchecker'] == 1, 'url' => 'http://www.geeklog.net/versionchecker.php?version=' . VERSION, 'lang' => $LANG01[107], 'num' => VERSION, 'image' => $_CONF['layout_url'] . '/images/icons/versioncheck.' . $_IMAGE_TYPE), array('condition' => SEC_hasRights('plugin.edit'), 'url' => $_CONF['site_admin_url'] . '/plugins.php', 'lang' => $LANG01[98], 'num' => $pluginscount, 'image' => $_CONF['layout_url'] . '/images/icons/plugins.' . $_IMAGE_TYPE), array('condition' => $_CONF['allow_mysqldump'] == 1 && $_DB_dbms == 'mysql' && SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/database.php', 'lang' => $LANG01[103], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/database.' . $_IMAGE_TYPE), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/clearctl.php', 'lang' => $LANG01['ctl'], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/ctl.' . $_IMAGE_TYPE), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/envcheck.php', 'lang' => $LANG_ENVCHECK['env_check'], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/envcheck.' . $_IMAGE_TYPE), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/logviewer.php', 'lang' => $LANG_LOGVIEW['log_viewer'], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/log_viewer.' . $_IMAGE_TYPE), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_url'] . '/filemanager/index.php?Type=Root', 'lang' => $LANG01['filemanager'], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/filemanager.' . $_IMAGE_TYPE, 'target' => '_blank'), array('condition' => true, 'url' => $_CONF['site_url'] . '/users.php?mode=logout', 'lang' => $LANG01[35], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/logout.' . $_IMAGE_TYPE));
                // Merge any items that belong to this group from plugins
                $cc_arr = array_merge($cc_arr, $cc_tools);
                break;
                // Users - Groups, Users, Mail Users
            // Users - Groups, Users, Mail Users
            case 'users':
                $groupcount = 0;
                $usercount = 0;
                if ($adminMenu) {
                    // Find num of groups
                    if (SEC_inGroup('Root')) {
                        $grpFilter = '';
                    } else {
                        $thisUsersGroups = SEC_getUserGroups();
                        $grpFilter = 'WHERE (grp_id IN (' . implode(',', $thisUsersGroups) . '))';
                    }
                    $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['groups']} {$grpFilter};");
                    $A = DB_fetchArray($result);
                    $groupcount = $A['count'];
                    // Find num of users
                    $usercount = DB_count($_TABLES['users'], 'status', USER_ACCOUNT_ACTIVE) - 1;
                }
                $cc_arr = array(array('condition' => SEC_hasRights('group.edit'), 'url' => $_CONF['site_admin_url'] . '/group.php', 'lang' => $LANG01[96], 'num' => COM_numberFormat($groupcount), 'image' => $_CONF['layout_url'] . '/images/icons/group.' . $_IMAGE_TYPE), array('condition' => SEC_hasRights('user.edit'), 'url' => $_CONF['site_admin_url'] . '/user.php', 'lang' => $LANG01[17], 'num' => COM_numberFormat($usercount), 'image' => $_CONF['layout_url'] . '/images/icons/user.' . $_IMAGE_TYPE), array('condition' => SEC_hasRights('user.mail'), 'url' => $_CONF['site_admin_url'] . '/mail.php', 'lang' => $LANG01[105], 'num' => '', 'image' => $_CONF['layout_url'] . '/images/icons/mail.' . $_IMAGE_TYPE));
                // Merge any items that belong to this group from plugins
                $cc_arr = array_merge($cc_arr, $cc_users);
                break;
        }
        for ($i = 0; $i < count($cc_arr); $i++) {
            if ($cc_arr[$i]['condition']) {
                if ($adminMenu) {
                    // Add Command and Control Link
                    $adminmenu->set_var('option_url', $cc_arr[$i]['url']);
                    $adminmenu->set_var('option_label', $cc_arr[$i]['lang']);
                    if (!empty($cc_arr[$i]['num'])) {
                        $adminmenu->set_var('option_count', $cc_arr[$i]['num']);
                        $adminmenu->set_var('display_count', $adminmenu->parse('item', 'count'));
                    }
                    $adminmenu->set_var('branch_spaces', '&nbsp;&nbsp;&nbsp;');
                    if (isset($cc_arr[$i]['target'])) {
                        $adminmenu->set_var('target', ' target="' . $cc_arr[$i]['target'] . '"');
                    } else {
                        $adminmenu->set_var('target', '');
                    }
                    $item = $adminmenu->finish($adminmenu->parse('item', $thisUrl == $cc_arr[$i]['url'] ? 'current' : 'option'));
                    $adminmenu->clear_var('display_count');
                    // incase set before
                } else {
                    if (!empty($cc_arr[$i]['url'])) {
                        $admin_templates->set_var('page_url', $cc_arr[$i]['url']);
                        $admin_templates->set_var('page_image', $cc_arr[$i]['image']);
                        $admin_templates->set_var('option_label', $cc_arr[$i]['lang']);
                        $admin_templates->set_var('cell_width', (int) (100 / ICONS_PER_ROW) . '%');
                        if (isset($cc_arr[$i]['target'])) {
                            $admin_templates->set_var('target', ' target="' . $cc_arr[$i]['target'] . '"');
                        } else {
                            $admin_templates->set_var('target', '');
                        }
                        $item = $admin_templates->parse('cc_main_options', 'ccitem', false);
                    }
                }
                $items[$cc_arr[$i]['lang']] = $item;
            }
        }
        if ($_CONF['sort_admin']) {
            uksort($items, 'strcasecmp');
        }
        if (!empty($items)) {
            // Add Group Label now
            if ($adminMenu) {
                $adminmenu->set_var('group_label', $LANG29[$ccgroup]);
                $retval .= $adminmenu->finish($adminmenu->parse('item', 'group'));
            } else {
                $admin_templates->set_var('lang_group', $LANG29[$ccgroup]);
            }
            // Add items now
            reset($items);
            $cols = 0;
            $cc_main_options = '';
            foreach ($items as $key => $val) {
                if ($adminMenu) {
                    $retval .= $val;
                } else {
                    $cc_main_options .= $val . LB;
                    $cols++;
                    if ($cols == ICONS_PER_ROW) {
                        $admin_templates->set_var('cc_main_options', $cc_main_options);
                        $admin_templates->parse('cc_rows', 'ccrow', true);
                        $admin_templates->clear_var('cc_main_options');
                        $cc_main_options = '';
                        $cols = 0;
                    }
                }
            }
            if (!$adminMenu) {
                if ($cols > 0) {
                    // "flush out" any unrendered entries
                    $admin_templates->set_var('cc_main_options', $cc_main_options);
                    $admin_templates->parse('cc_rows', 'ccrow', true);
                    $admin_templates->clear_var('cc_main_options');
                }
                $admin_templates->parse('cc_groups', 'ccgroup', true);
            }
        }
    }
    if ($adminMenu) {
        $retval .= COM_endBlock(COM_getBlockTemplate('admin_block', 'footer', $position));
    } else {
        $retval .= $admin_templates->finish($admin_templates->parse('output', 'cc'));
        $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
    }
    return $retval;
}
Esempio n. 9
0
function getAdminMenu()
{
    global $_SP_CONF, $_USER, $_TABLES, $LANG01, $LANG_MB01, $LANG_LOGO, $LANG_AM, $LANG_SOCIAL, $LANG29, $_CONF, $_DB_dbms, $_GROUPS, $config;
    $item_array = array();
    if (!COM_isAnonUser()) {
        $plugin_options = PLG_getAdminOptions();
        $num_plugins = count($plugin_options);
        if (SEC_isModerator() or SEC_hasRights('story.edit,block.edit,topic.edit,user.edit,plugin.edit,user.mail,syndication.edit,social.admin', 'OR') or $num_plugins > 0) {
            // what's our current URL?
            $elementUrl = COM_getCurrentURL();
            $topicsql = '';
            if (SEC_isModerator() || SEC_hasRights('story.edit')) {
                $tresult = DB_query("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
                $trows = DB_numRows($tresult);
                if ($trows > 0) {
                    $tids = array();
                    for ($i = 0; $i < $trows; $i++) {
                        $T = DB_fetchArray($tresult);
                        $tids[] = $T['tid'];
                    }
                    if (sizeof($tids) > 0) {
                        $topicsql = " (tid IN ('" . implode("','", $tids) . "'))";
                    }
                }
            }
            $modnum = 0;
            if (SEC_hasRights('story.edit,story.moderate', 'OR') || $_CONF['usersubmission'] == 1 && SEC_hasRights('user.edit,user.delete')) {
                if (SEC_hasRights('story.moderate')) {
                    if (empty($topicsql)) {
                        $modnum += DB_count($_TABLES['storysubmission']);
                    } else {
                        $sresult = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['storysubmission']} WHERE" . $topicsql);
                        $S = DB_fetchArray($sresult);
                        $modnum += $S['count'];
                    }
                }
                if ($_CONF['listdraftstories'] == 1 && SEC_hasRights('story.edit')) {
                    $sql = "SELECT COUNT(*) AS count FROM {$_TABLES['stories']} WHERE (draft_flag = 1)";
                    if (!empty($topicsql)) {
                        $sql .= ' AND' . $topicsql;
                    }
                    $result = DB_query($sql . COM_getPermSQL('AND', 0, 3));
                    $A = DB_fetchArray($result);
                    $modnum += $A['count'];
                }
                if ($_CONF['usersubmission'] == 1) {
                    if (SEC_hasRights('user.edit') && SEC_hasRights('user.delete')) {
                        $modnum += DB_count($_TABLES['users'], 'status', '2');
                    }
                }
            }
            // now handle submissions for plugins
            $modnum += PLG_getSubmissionCount();
            if (SEC_hasRights('story.edit')) {
                $url = $_CONF['site_admin_url'] . '/story.php';
                $label = $LANG01[11];
                if (empty($topicsql)) {
                    $numstories = DB_count($_TABLES['stories']);
                } else {
                    $nresult = DB_query("SELECT COUNT(*) AS count from {$_TABLES['stories']} WHERE" . $topicsql . COM_getPermSql('AND'));
                    $N = DB_fetchArray($nresult);
                    $numstories = $N['count'];
                }
                $label .= ' (' . COM_numberFormat($numstories) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('block.edit')) {
                $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['blocks']}" . COM_getPermSql());
                list($count) = DB_fetchArray($result);
                $url = $_CONF['site_admin_url'] . '/block.php';
                $label = $LANG01[12] . ' (' . COM_numberFormat($count) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('autotag.admin')) {
                $url = $_CONF['site_admin_url'] . '/autotag.php';
                $label = $LANG_AM['title'];
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/clearctl.php';
                $label = $LANG01['ctl'];
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/menu.php';
                $label = $LANG_MB01['menu_builder'];
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/logo.php';
                $label = $LANG_LOGO['logo_admin'];
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('topic.edit')) {
                $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['topics']}" . COM_getPermSql());
                list($count) = DB_fetchArray($result);
                $url = $_CONF['site_admin_url'] . '/topic.php';
                $label = $LANG01[13] . ' (' . COM_numberFormat($count) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('user.edit')) {
                $url = $_CONF['site_admin_url'] . '/user.php';
                $label = $LANG01[17] . ' (' . COM_numberFormat(DB_count($_TABLES['users']) - 1) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('group.edit')) {
                if (SEC_inGroup('Root')) {
                    $grpFilter = '';
                } else {
                    $elementUsersGroups = SEC_getUserGroups();
                    $grpFilter = 'WHERE (grp_id IN (' . implode(',', $elementUsersGroups) . '))';
                }
                $result = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['groups']} {$grpFilter};");
                $A = DB_fetchArray($result);
                $url = $_CONF['site_admin_url'] . '/group.php';
                $label = $LANG01[96] . ' (' . COM_numberFormat($A['count']) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('social.admin')) {
                $url = $_CONF['site_admin_url'] . '/social.php';
                $label = $LANG_SOCIAL['label'];
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/envcheck.php';
                $label = $LANG01['env_check'];
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('user.mail')) {
                $url = $_CONF['site_admin_url'] . '/mail.php';
                $label = $LANG01[105] . ' (N/A)';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if ($_CONF['backend'] == 1 && SEC_hasRights('syndication.edit')) {
                $url = $_CONF['site_admin_url'] . '/syndication.php';
                $label = $LANG01[38] . ' (' . COM_numberFormat(DB_count($_TABLES['syndication'])) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (($_CONF['trackback_enabled'] || $_CONF['pingback_enabled'] || $_CONF['ping_enabled']) && SEC_hasRights('story.ping')) {
                $url = $_CONF['site_admin_url'] . '/trackback.php';
                $label = $LANG01[116] . ' (' . COM_numberFormat(DB_count($_TABLES['pingservice'])) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_hasRights('plugin.edit')) {
                $url = $_CONF['site_admin_url'] . '/plugins.php';
                $label = $LANG01[77] . ' (' . COM_numberFormat(DB_count($_TABLES['plugins'])) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/configuration.php';
                $label = $LANG01[129] . ' (' . COM_numberFormat(count($config->_get_groups())) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            // This will show the admin options for all installed plugins (if any)
            for ($i = 0; $i < $num_plugins; $i++) {
                $plg = current($plugin_options);
                $url = $plg->adminurl;
                $label = $plg->adminlabel;
                if (empty($plg->numsubmissions)) {
                    $label .= '';
                } else {
                    $label .= ' (' . COM_numberFormat($plg->numsubmissions) . ')';
                }
                $item_array[] = array('label' => $label, 'url' => $url);
                next($plugin_options);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/database.php';
                $label = $LANG01[103] . '';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/logview.php';
                $label = $LANG01['logview'] . '';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if ($_CONF['link_documentation'] == 1) {
                $doclang = COM_getLanguageName();
                if (@file_exists($_CONF['path_html'] . 'docs/' . $doclang . '/index.html')) {
                    $docUrl = $_CONF['site_url'] . '/docs/' . $doclang . '/index.html';
                } else {
                    $docUrl = $_CONF['site_url'] . '/docs/english/index.html';
                }
                $url = $docUrl;
                $label = $LANG01[113] . '';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_inGroup('Root')) {
                $url = $_CONF['site_admin_url'] . '/vercheck.php';
                $label = $LANG01[107] . ' (' . GVERSION . PATCHLEVEL . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if (SEC_isModerator()) {
                $url = $_CONF['site_admin_url'] . '/moderation.php';
                $label = $LANG01[10] . ' (' . COM_numberFormat($modnum) . ')';
                $item_array[] = array('label' => $label, 'url' => $url);
            }
            if ($_CONF['sort_admin']) {
                usort($item_array, '_mb_cmp');
            }
            $url = $_CONF['site_admin_url'] . '/index.php';
            $label = $LANG29[34];
            $cc_item = array('label' => $LANG29[34], 'url' => $url);
            $item_array = array_merge(array($cc_item), $item_array);
        }
    }
    return $item_array;
}
Esempio n. 10
0
 /**
  * Helper function: Get the URL to the help section for a config option
  *
  * @param    string  $group      'Core' or plugin name
  * @param    string  $option     name of the config option
  * @return   string              full URL to help or empty string
  *
  */
 function _get_ConfigHelp($group, $option)
 {
     global $_CONF;
     static $coreUrl;
     $retval = '';
     $descUrl = '';
     $doclang = COM_getLanguageName();
     if ($group == 'Core') {
         if (isset($coreUrl)) {
             $descUrl = $coreUrl;
         } elseif (!empty($GLOBALS['_CONF']['site_url']) && !empty($GLOBALS['_CONF']['path_html'])) {
             $baseUrl = $GLOBALS['_CONF']['site_url'];
             $cfg = 'docs/' . $doclang . '/config.html';
             if (@file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
                 $descUrl = $baseUrl . '/' . $cfg;
             } else {
                 $descUrl = $baseUrl . '/docs/english/config.html';
             }
             $coreUrl = $descUrl;
         } else {
             $descUrl = 'http://www.glfusion.org/docs/english/config.html';
         }
         if (!empty($descUrl)) {
             $helpUrl = $descUrl . '#desc_' . $option;
         }
         $retval = '<a href="#" onclick="popupWindow(\'' . $helpUrl . '\', \'Help\', 640, 480, 1)" class="toolbar"><img src="' . $_CONF['layout_url'] . '/images/button_help.png" alt=""' . XHTML . '></a>';
     } else {
         list($doc_url, $popuptype) = PLG_getConfigElementHelp($group, $option, $doclang);
         if ($doc_url != '') {
             if ($popuptype == 2) {
                 $retval = '<a href="' . $doc_url . '" onclick="window.open(this.href);return false;" class="toolbar"><img src="' . $_CONF['layout_url'] . '/images/button_help.png" alt=""' . XHTML . '></a>';
             } else {
                 $retval = '<a href="#" onclick="popupWindow(\'' . $doc_url . '\', \'Help\', 640, 480, 1)" class="toolbar"><img src="' . $_CONF['layout_url'] . '/images/button_help.png" alt=""' . XHTML . '></a>';
             }
         } else {
             if (@file_exists($_CONF['path_html'] . 'docs/' . $doclang . '/' . $group . '.html')) {
                 $baseUrl = $GLOBALS['_CONF']['site_url'];
                 $descUrl = $baseUrl . '/docs/' . $doclang . '/' . $group . '.html#desc_' . $option;
                 $retval = '<a href="#" onclick="popupWindow(\'' . $descUrl . '\', \'Help\', 640, 480, 1)" class="toolbar"><img src="' . $_CONF['layout_url'] . '/images/button_help.png" alt=""' . XHTML . '></a>';
             } else {
                 $retval = '';
             }
         }
     }
     return $retval;
 }
Esempio n. 11
0
 /**
  * Helper function: Get the URL to the help section for a config option
  *
  * @param    string  $group      'Core' or plugin name
  * @param    string  $option     name of the config option
  * @return   string              full URL to help or empty string
  *
  */
 function _get_ConfigHelp($group, $option)
 {
     static $coreUrl;
     $retval = '';
     $descUrl = '';
     if ($group == 'Core') {
         if (isset($coreUrl)) {
             $descUrl = $coreUrl;
         } elseif (!empty($GLOBALS['_CONF']['site_url']) && !empty($GLOBALS['_CONF']['path_html'])) {
             $baseUrl = $GLOBALS['_CONF']['site_url'];
             $doclang = COM_getLanguageName();
             $cfg = 'docs/' . $doclang . '/config.html';
             if (file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
                 $descUrl = $baseUrl . '/' . $cfg;
             } else {
                 $descUrl = $baseUrl . '/docs/english/config.html';
             }
             $coreUrl = $descUrl;
         } else {
             $descUrl = 'http://www.geeklog.net/docs/english/config.html';
         }
     } else {
         $descUrl = PLG_getDocumentationUrl($group, 'config');
     }
     if (!empty($descUrl)) {
         $retval = $descUrl . '#desc_' . $option;
     }
     return $retval;
 }
Esempio n. 12
0
function LIB_Edit($pi_name, $id, $edt_flg, $msg = '', $errmsg = "", $mode = "edit")
{
    global $_CONF;
    global $_TABLES;
    global $LANG_ADMIN;
    global $MESSAGE;
    global $LANG_ACCESS;
    global $_USER;
    $box_conf = "_" . strtoupper($pi_name) . "_CONF";
    global ${$box_conf};
    $box_conf = ${$box_conf};
    $lang_box_admin = "LANG_" . strtoupper($pi_name) . "_ADMIN";
    global ${$lang_box_admin};
    $lang_box_admin = ${$lang_box_admin};
    $lang_box = "LANG_" . strtoupper($pi_name);
    global ${$lang_box};
    $lang_box = ${$lang_box};
    $lang_box_noyes = "LANG_" . strtoupper($pi_name) . "_NOYES";
    global ${$lang_box_noyes};
    $lang_box_noyes = ${$lang_box_noyes};
    $lang_box_type = "LANG_" . strtoupper($pi_name) . "_TYPE";
    global ${$lang_box_type};
    $lang_box_type = ${$lang_box_type};
    $lang_box_allow_display = "LANG_" . strtoupper($pi_name) . "_ALLOW_DISPLAY";
    global ${$lang_box_allow_display};
    $lang_box_allow_display = ${$lang_box_allow_display};
    $lang_box_allow_edit = "LANG_" . strtoupper($pi_name) . "_ALLOW_EDIT";
    global ${$lang_box_allow_edit};
    $lang_box_allow_edit = ${$lang_box_allow_edit};
    $lang_box_textcheck = "LANG_" . strtoupper($pi_name) . "_TEXTCHECK";
    global ${$lang_box_textcheck};
    $lang_box_textcheck = ${$lang_box_textcheck};
    $lang_box_textconv = "LANG_" . strtoupper($pi_name) . "_TEXTCONV";
    global ${$lang_box_textconv};
    $lang_box_textconv = ${$lang_box_textconv};
    $table = $_TABLES[strtoupper($pi_name) . '_def_field'];
    //        $cur_year = date( 'Y' );
    //        $year_startoffset=1990 - $cur_year +1;
    //        $year_endoffset=0;
    $retval = '';
    $delflg = false;
    //メッセージ表示
    if (!empty($msg)) {
        $retval .= COM_showMessage($msg, $pi_name);
        $retval .= $errmsg;
        // clean 'em up
        $name = COM_applyFilter($_POST['name']);
        $templatesetvar = COM_applyFilter($_POST['templatesetvar']);
        $type = COM_applyFilter($_POST['type']);
        $description = COM_applyFilter($_POST['description']);
        $allow_display = COM_applyFilter($_POST['allow_display'], true);
        $allow_edit = COM_applyFilter($_POST['allow_edit'], true);
        $textcheck = COM_applyFilter($_POST['textcheck'], true);
        $textconv = COM_applyFilter($_POST['textconv'], true);
        $searchtarget = COM_applyFilter($_POST['searchtarget'], true);
        $initial_value = COM_applyFilter($_POST['initial_value']);
        $range_start = COM_applyFilter($_POST['range_start']);
        $range_end = COM_applyFilter($_POST['range_end']);
        $dfid = COM_applyFilter($_POST['dfid'], true);
        $selection = COM_applyFilter($_POST['selection']);
        $selectlist = COM_applyFilter($_POST['selectlist']);
        $checkrequried = COM_applyFilter($_POST['checkrequried']);
        $size = COM_applyFilter($_POST['size'], true);
        $maxlength = COM_applyFilter($_POST['maxlength'], true);
        $rows = COM_applyFilter($_POST['rows'], true);
        $br = COM_applyFilter($_POST['br'], true);
        $orderno = COM_applyFilter($_POST['orderno']);
        $uuid = $_USER['uid'];
    } else {
        if (empty($id)) {
            $id = 0;
            $name = "";
            $templatesetvar = "";
            $description = "";
            $allow_display = "";
            $allow_edit = "";
            $textcheck = "";
            $textconv = "";
            $searchtarget = "";
            $initial_value = "";
            $range_start = "";
            $range_end = "";
            $dfid = 0;
            $type = "";
            $selection = "";
            $selectlist = "";
            $checkrequried = "";
            $size = 60;
            $maxlength = 500;
            $rows = 3;
            $br = 0;
            $orderno = "";
            $uuid = 0;
            $udatetime = "";
            //"";
        } else {
            $sql = "SELECT ";
            $sql .= " *";
            $sql .= " ,UNIX_TIMESTAMP(udatetime) AS udatetime_un" . LB;
            $sql .= " FROM ";
            $sql .= $table;
            $sql .= " WHERE ";
            $sql .= " field_id = {$id}";
            $result = DB_query($sql);
            $A = DB_fetchArray($result);
            $name = COM_stripslashes($A['name']);
            $templatesetvar = COM_stripslashes($A['templatesetvar']);
            $description = $A['description'];
            //COM_stripslashes($A['description']);
            $allow_edit = COM_stripslashes($A['allow_edit']);
            $allow_display = COM_stripslashes($A['allow_display']);
            $textcheck = COM_stripslashes($A['textcheck']);
            $textconv = COM_stripslashes($A['textconv']);
            $searchtarget = COM_stripslashes($A['searchtarget']);
            $initial_value = COM_stripslashes($A['initial_value']);
            $range_start = COM_stripslashes($A['range_start']);
            $range_end = COM_stripslashes($A['range_end']);
            $dfid = COM_stripslashes($A['dfid']);
            $type = COM_stripslashes($A['type']);
            $selection = COM_stripslashes($A['selection']);
            $selectlist = COM_stripslashes($A['selectlist']);
            $checkrequried = COM_stripslashes($A['checkrequried']);
            $size = COM_stripslashes($A['size']);
            $maxlength = COM_stripslashes($A['maxlength']);
            $rows = COM_stripslashes($A['rows']);
            $br = COM_stripslashes($A['br']);
            $orderno = COM_stripslashes($A['orderno']);
            $uuid = COM_stripslashes($A['uuid']);
            $wary = COM_getUserDateTimeFormat(COM_stripslashes($A['udatetime_un']));
            $udatetime = $wary[0];
            if ($edt_flg == FALSE) {
                $delflg = true;
            }
        }
    }
    if ($mode === "copy") {
        $id = 0;
        //作成日付
        $created = 0;
        //
        $delflg = false;
    }
    $tmplfld = DATABOX_templatePath('admin', 'default', $pi_name);
    $templates = new Template($tmplfld);
    $templates->set_file('editor', "field_editor.thtml");
    //--
    $templates->set_var('about_thispage', $lang_box_admin['about_admin_field']);
    $templates->set_var('lang_must', $lang_box_admin['must']);
    $templates->set_var('site_url', $_CONF['site_url']);
    $templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $token = SEC_createToken();
    $retval .= SEC_getTokenExpiryNotice($token);
    $templates->set_var('gltoken_name', CSRF_TOKEN);
    $templates->set_var('gltoken', $token);
    $templates->set_var('xhtml', XHTML);
    $templates->set_var('script', THIS_SCRIPT);
    //
    $templates->set_var('lang_link_admin', $lang_box_admin['link_admin']);
    $templates->set_var('lang_link_admin_top', $lang_box_admin['link_admin_top']);
    //id
    $templates->set_var('lang_field_id', $lang_box_admin['field_id']);
    $templates->set_var('id', $id);
    //document link
    $lang = COM_getLanguageName();
    $path = 'admin/plugins/' . strtolower($pi_name) . '/docs/';
    if (!file_exists($_CONF['path_html'] . $path . $lang . '/')) {
        $lang = 'japanese';
        //'english';
    }
    $document_url = $_CONF['site_url'] . '/' . $path . $lang . '/';
    $templates->set_var('document_url', $document_url);
    $templates->set_var('lang_document', $LANG_DATABOX_ADMIN['document']);
    //名前&テンプレート変数&説明
    $templates->set_var('lang_name', $lang_box_admin['name']);
    $templates->set_var('name', $name);
    $templates->set_var('lang_templatesetvar', $lang_box_admin['templatesetvar']);
    $templates->set_var('templatesetvar', $templatesetvar);
    $templates->set_var('lang_description', $lang_box_admin['description']);
    $templates->set_var('description', $description);
    $templates->set_var('lang_allow_display', $lang_box_admin['allow_display']);
    $list_allow_display = DATABOX_getoptionlistary($lang_box_allow_display, "allow_display", $allow_display, $pi_name);
    $templates->set_var('list_allow_display', $list_allow_display);
    $templates->set_var('lang_allow_edit', $lang_box_admin['allow_edit']);
    $list_allow_edit = DATABOX_getoptionlistary($lang_box_allow_edit, "allow_edit", $allow_edit, $pi_name);
    $templates->set_var('list_allow_edit', $list_allow_edit);
    //textcheck
    $templates->set_var('lang_textcheck', $lang_box_admin['textcheck']);
    $list_textcheck = DATABOX_getoptionlistary($lang_box_textcheck, "textcheck", $textcheck, $pi_name);
    $templates->set_var('list_textcheck', $list_textcheck);
    //textconv
    $templates->set_var('lang_textconv', $lang_box_admin['textconv']);
    $list_textconv = DATABOX_getoptionlistary($lang_box_textconv, "textconv", $textconv, $pi_name);
    $templates->set_var('list_textconv', $list_textconv);
    //searchtarget
    $templates->set_var('lang_searchtarget', $lang_box_admin['searchtarget']);
    $list_searchtarget = DATABOX_getradiolist($lang_box_noyes, "searchtarget", $searchtarget);
    $templates->set_var('list_searchtarget', $list_searchtarget);
    //初期値 範囲 日時フォーマット initial value range dfid
    $templates->set_var('lang_initial_value', $lang_box_admin['initial_value']);
    $templates->set_var('help_initial_value', $lang_box_admin['help_initial_value']);
    $templates->set_var('initial_value', $initial_value);
    $templates->set_var('lang_range', $lang_box_admin['range']);
    $templates->set_var('help_range', $lang_box_admin['help_range']);
    $templates->set_var('range_start', $range_start);
    $templates->set_var('range_end', $range_end);
    $templates->set_var('lang_dfid', $lang_box_admin['dfid']);
    $templates->set_var('help_dfid', $lang_box_admin['help_dfid']);
    //$list_dfid=DATABOX_getoptionlistary ($lang_box_textcheck,"textcheck",$textcheck,$pi_name);
    $list_dfid = '<select id="dfid" name="dfid">' . LB . COM_optionList($_TABLES['dateformats'], 'dfid,description', $dfid) . '</select>';
    $templates->set_var('list_dfid', $list_dfid);
    //type
    $templates->set_var('lang_type', $lang_box_admin['type']);
    $list_type = DATABOX_getoptionlistary($lang_box_type, "type", $type, $pi_name);
    $templates->set_var('list_type', $list_type);
    //checkrequried
    $templates->set_var('lang_checkrequried', $lang_box_admin['checkrequried']);
    $list_checkrequried = DATABOX_getradiolist($lang_box_noyes, "checkrequried", $checkrequried);
    $templates->set_var('list_checkrequried', $list_checkrequried);
    //size maxlength rows br
    $templates->set_var('lang_size', $lang_box_admin['size']);
    $templates->set_var('size', $size);
    $templates->set_var('lang_maxlength', $lang_box_admin['maxlength']);
    $templates->set_var('maxlength', $maxlength);
    $templates->set_var('lang_rows', $lang_box_admin['rows']);
    $templates->set_var('rows', $rows);
    $templates->set_var('lang_br', $lang_box_admin['br']);
    $templates->set_var('help_br', $lang_box_admin['help_br']);
    $templates->set_var('br', $br);
    //selection
    $templates->set_var('lang_selection', $lang_box_admin['selection']);
    $templates->set_var('selection', $selection);
    //selectlist
    $templates->set_var('lang_selectlist', $lang_box_admin['selectlist']);
    $list_selectlist = DATABOX_getoptionlist("selectlist", $selectlist, 0, $pi_name);
    $templates->set_var('list_selectlist', $list_selectlist);
    //順序
    $templates->set_var('lang_orderno', $lang_box_admin['orderno']);
    $templates->set_var('orderno', $orderno);
    //保存日時
    $templates->set_var('lang_udatetime', $lang_box_admin['udatetime']);
    $templates->set_var('udatetime', $udatetime);
    $templates->set_var('lang_uuid', $lang_box_admin['uuid']);
    $templates->set_var('uuid', $uuid);
    // SAVE、CANCEL ボタン
    $templates->set_var('lang_save', $LANG_ADMIN['save']);
    $templates->set_var('lang_cancel', $LANG_ADMIN['cancel']);
    $templates->set_var('lang_preview', $LANG_ADMIN['preview']);
    //delete_option
    if ($delflg) {
        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode"%s>';
        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
        $templates->set_var('delete_option', sprintf($delbutton, $jsconfirm));
        //
        $templates->set_var('lang_delete_help', $lang_box_admin['delete_help_field']);
    }
    //
    $templates->parse('output', 'editor');
    $retval .= $templates->finish($templates->get_var('output'));
    return $retval;
}
Esempio n. 13
0
 /**
  * Helper function: Set the URL to the help section for a config option
  *
  * @param    Template $t      Template object
  * @param    string   $group  'Core' or plugin name
  * @param    string   $option name of the config option
  */
 private function _set_ConfigHelp(&$t, $group, $option)
 {
     global $_SCRIPTS;
     static $docUrl;
     if (!isset($docUrl)) {
         $docUrl = array();
     }
     $configText = PLG_getConfigTooltip($group, $option);
     if (empty($configText)) {
         if ($group === 'Core') {
             $configText = null;
         }
         if (empty($docUrl[$group])) {
             if ($group === 'Core') {
                 if (!empty($GLOBALS['_CONF']['site_url']) && !empty($GLOBALS['_CONF']['path_html'])) {
                     $baseUrl = $GLOBALS['_CONF']['site_url'];
                     $docLang = COM_getLanguageName();
                     $cfg = 'docs/' . $docLang . '/config.html';
                     if (file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
                         $url = $baseUrl . '/' . $cfg;
                     } else {
                         $url = $baseUrl . '/docs/english/config.html';
                     }
                 } else {
                     $url = 'https://www.geeklog.net/docs/english/config.html';
                 }
                 $docUrl['Core'] = $url;
             } else {
                 // plugin
                 $docUrl[$group] = PLG_getDocumentationUrl($group, 'config');
             }
             $_SCRIPTS->setJavaScript('var glConfigDocUrl = "' . $docUrl[$group] . '";', true);
         }
         $descUrl = $docUrl[$group];
         if (!empty($descUrl)) {
             if (strpos($descUrl, '#') === false) {
                 $descUrl .= '#desc_' . $option;
             }
             $t->set_var('doc_url', $descUrl);
             if ($this->flag_version_2 == true) {
                 // Does hack need to be used?
                 if (gettype($configText) == "NULL") {
                     $t->set_var('doc_link', '(<a href="javascript:void(0);" id="desc_' . $option . '" class="tooltip">?</a>)');
                 } else {
                     $t->set_var('doc_link', '(<a href="javascript:void(0);" id="desc_' . $option . '">?</a>)');
                 }
             } else {
                 // Does hack need to be used?
                 if (gettype($configText) == "NULL") {
                     $t->set_var('doc_link', '(<a href="' . $descUrl . '" target="help" class="tooltip">?</a>)');
                 } else {
                     $t->set_var('doc_link', '(<a href="' . $descUrl . '" target="help">?</a>)');
                 }
             }
         }
     } else {
         $t->set_var('doc_url', '');
         $retval = "(" . COM_getTooltip("?", $configText, '', $option, 'information') . ")";
         $t->set_var('doc_link', $retval);
     }
 }
Esempio n. 14
0
/**
* Prints the command & control block at the top
*
* TODO: The moderation items should be displayed with the help of <ul><li>
* instead of div's.
*
*/
function commandcontrol()
{
    global $_CONF, $_TABLES, $LANG01, $LANG_MB01, $LANG_AM, $LANG_LOGO, $LANG29, $LANG_LOGVIEW, $_IMAGE_TYPE, $_DB_dbms;
    $retval = '';
    $admin_templates = new Template($_CONF['path_layout'] . 'admin/moderation');
    $admin_templates->set_file(array('cc' => 'moderation.thtml', 'ccrow' => 'ccrow.thtml', 'ccitem' => 'ccitem.thtml'));
    $admin_templates->set_var('site_admin_url', $_CONF['site_admin_url']);
    $admin_templates->set_var('title', 'glFusion ' . GVERSION . PATCHLEVEL . ' -- ' . $LANG29[34]);
    $retval .= '<h2>glFusion ' . GVERSION . PATCHLEVEL . ' -- ' . $LANG29[34] . '</h2>';
    $showTrackbackIcon = ($_CONF['trackback_enabled'] || $_CONF['pingback_enabled'] || $_CONF['ping_enabled']) && SEC_hasRights('story.ping');
    $cc_arr = array(array('condition' => SEC_hasRights('story.edit'), 'url' => $_CONF['site_admin_url'] . '/story.php', 'lang' => $LANG01[11], 'image' => '/images/icons/story.'), array('condition' => SEC_hasRights('block.edit'), 'url' => $_CONF['site_admin_url'] . '/block.php', 'lang' => $LANG01[12], 'image' => '/images/icons/block.'), array('condition' => SEC_hasRights('topic.edit'), 'url' => $_CONF['site_admin_url'] . '/topic.php', 'lang' => $LANG01[13], 'image' => '/images/icons/topic.'), array('condition' => SEC_hasRights('user.edit'), 'url' => $_CONF['site_admin_url'] . '/user.php', 'lang' => $LANG01[17], 'image' => '/images/icons/user.'), array('condition' => SEC_hasRights('group.edit'), 'url' => $_CONF['site_admin_url'] . '/group.php', 'lang' => $LANG01[96], 'image' => '/images/icons/group.'), array('condition' => SEC_hasRights('user.mail'), 'url' => $_CONF['site_admin_url'] . '/mail.php', 'lang' => $LANG01[105], 'image' => '/images/icons/mail.'), array('condition' => SEC_hasRights('syndication.edit'), 'url' => $_CONF['site_admin_url'] . '/syndication.php', 'lang' => $LANG01[38], 'image' => '/images/icons/syndication.'), array('condition' => $showTrackbackIcon, 'url' => $_CONF['site_admin_url'] . '/trackback.php', 'lang' => $LANG01[116], 'image' => '/images/icons/trackback.'), array('condition' => SEC_hasRights('plugin.edit'), 'url' => $_CONF['site_admin_url'] . '/plugins.php', 'lang' => $LANG01[98], 'image' => '/images/icons/plugins.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/clearctl.php', 'lang' => $LANG01['ctl'], 'image' => '/images/icons/ctl.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/envcheck.php', 'lang' => $LANG01['env_check'], 'image' => '/images/icons/envcheck.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/logview.php', 'lang' => $LANG_LOGVIEW['logview'], 'image' => '/images/icons/logview.'), array('condition' => SEC_hasRights('menu.admin'), 'url' => $_CONF['site_admin_url'] . '/menu.php', 'lang' => $LANG_MB01['menu_builder'], 'image' => '/images/icons/menubuilder.'), array('condition' => SEC_hasRights('logo.admin'), 'url' => $_CONF['site_admin_url'] . '/logo.php', 'lang' => $LANG_LOGO['logo_admin'], 'image' => '/images/icons/logo.'), array('condition' => SEC_hasRights('autotag.admin'), 'url' => $_CONF['site_admin_url'] . '/autotag.php', 'lang' => $LANG_AM['title'], 'image' => '/images/icons/autotag.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/sfs.php', 'lang' => 'SFS User Check', 'image' => '/images/icons/sfs.'));
    $admin_templates->set_var('cc_icon_width', floor(100 / ICONS_PER_ROW));
    for ($i = 0; $i < count($cc_arr); $i++) {
        if ($cc_arr[$i]['condition']) {
            $item = render_cc_item($admin_templates, $cc_arr[$i]['url'], $_CONF['layout_url'] . $cc_arr[$i]['image'] . $_IMAGE_TYPE, $cc_arr[$i]['lang']);
            $items[$cc_arr[$i]['lang']] = $item;
        }
    }
    // now add the plugins
    $plugins = PLG_getCCOptions();
    for ($i = 0; $i < count($plugins); $i++) {
        $cur_plugin = current($plugins);
        $item = render_cc_item($admin_templates, $cur_plugin->adminurl, $cur_plugin->plugin_image, $cur_plugin->adminlabel);
        $items[$cur_plugin->adminlabel] = $item;
        next($plugins);
    }
    // and finally, add the remaining admin items
    $doclang = COM_getLanguageName();
    if (@file_exists($_CONF['path_html'] . 'docs/' . $doclang . '/index.html')) {
        $docUrl = $_CONF['site_url'] . '/docs/' . $doclang . '/index.html';
    } else {
        $docUrl = $_CONF['site_url'] . '/docs/english/index.html';
    }
    $cc_arr = array(array('condition' => $_CONF['allow_mysqldump'] == 1 && $_DB_dbms == 'mysql' && SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/database.php', 'lang' => $LANG01[103], 'image' => '/images/icons/database.'), array('condition' => $_CONF['link_documentation'] == 1, 'url' => $docUrl, 'lang' => $LANG01[113], 'image' => '/images/icons/docs.'), array('condition' => SEC_inGroup('Root') && $_CONF['link_versionchecker'] == 1, 'url' => $_CONF['site_admin_url'] . '/vercheck.php', 'lang' => $LANG01[107], 'image' => '/images/icons/versioncheck.'), array('condition' => SEC_inGroup('Root'), 'url' => $_CONF['site_admin_url'] . '/configuration.php', 'lang' => $LANG01[129], 'image' => '/images/icons/configuration.'), array('condition' => SEC_isModerator(), 'url' => $_CONF['site_admin_url'] . '/moderation.php', 'lang' => $LANG01[10], 'image' => '/images/icons/moderation.'));
    for ($i = 0; $i < count($cc_arr); $i++) {
        if ($cc_arr[$i]['condition']) {
            $item = render_cc_item($admin_templates, $cc_arr[$i]['url'], $_CONF['layout_url'] . $cc_arr[$i]['image'] . $_IMAGE_TYPE, $cc_arr[$i]['lang']);
            $items[$cc_arr[$i]['lang']] = $item;
        }
    }
    if ($_CONF['sort_admin']) {
        uksort($items, 'strcasecmp');
    }
    // logout is always the last entry
    $item = render_cc_item($admin_templates, $_CONF['site_url'] . '/users.php?mode=logout', $_CONF['layout_url'] . '/images/icons/logout.' . $_IMAGE_TYPE, $LANG01[35]);
    $items[$LANG01[35]] = $item;
    reset($items);
    $cols = 0;
    $cc_main_options = '';
    foreach ($items as $key => $val) {
        $cc_main_options .= $val . LB;
        $cols++;
        if ($cols == ICONS_PER_ROW) {
            $admin_templates->set_var('cc_main_options', $cc_main_options);
            $admin_templates->parse('cc_rows', 'ccrow', true);
            $admin_templates->clear_var('cc_main_options');
            $cc_main_options = '';
            $cols = 0;
        }
    }
    if ($cols > 0) {
        // "flush out" any unrendered entries
        $admin_templates->set_var('cc_main_options', $cc_main_options);
        $admin_templates->parse('cc_rows', 'ccrow', true);
        $admin_templates->clear_var('cc_main_options');
    }
    $retval .= $admin_templates->finish($admin_templates->parse('output', 'cc'));
    return $retval;
}
Esempio n. 15
0
 /**
  * Helper function: Get the URL to the help section for a config option
  *
  * @param    string  $group      'Core' or plugin name
  * @param    string  $option     name of the config option
  * @return   string              full URL to help or empty string
  *
  */
 function _get_ConfigHelp($group, $option)
 {
     static $docUrl;
     if (!isset($docUrl)) {
         $docUrl = array();
     }
     $retval = '';
     if (!isset($docUrl[$group])) {
         if ($group == 'Core') {
             if (!empty($GLOBALS['_CONF']['site_url']) && !empty($GLOBALS['_CONF']['path_html'])) {
                 $baseUrl = $GLOBALS['_CONF']['site_url'];
                 $doclang = COM_getLanguageName();
                 $cfg = 'docs/' . $doclang . '/config.html';
                 if (file_exists($GLOBALS['_CONF']['path_html'] . $cfg)) {
                     $url = $baseUrl . '/' . $cfg;
                 } else {
                     $url = $baseUrl . '/docs/english/config.html';
                 }
             } else {
                 $url = 'http://www.geeklog.net/docs/english/config.html';
             }
             $docUrl['Core'] = $url;
         } else {
             // plugin
             $docUrl[$group] = PLG_getDocumentationUrl($group, 'config');
         }
     }
     $retval = $docUrl[$group];
     if (!empty($retval)) {
         if (strpos($retval, '#') === false) {
             $retval .= '#desc_' . $option;
         }
     }
     return $retval;
 }