function MAPS_getListField_maps_displayOverlaysToAdd($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $LANG_MAPS_1, $_MAPS_CONF;
    switch ($fieldname) {
        case "edit":
            $edit_url = '#';
            $retval = COM_createLink($icon_arr['disabled'], $edit_url, array('class' => 'add', 'id' => $A['oid'], 'mid' => $A['mid'], 'title' => $LANG_MAPS_1['add_overlay']));
            break;
        case "o_name":
            $overlay_image = $_MAPS_CONF['path_overlay_images'] . $A['o_image'];
            if (is_file($overlay_image)) {
                $retval = COM_getTooltip($A['o_name'], '<img src="' . $_MAPS_CONF['site_url'] . '/timthumb.php?src=' . $_MAPS_CONF['images_overlay_url'] . $A['o_image'] . '&amp;w=200&amp;q=70&amp;zc=1" alt="" />', '', $A['o_name'], $template = 'help');
            } else {
                $retval = $A['o_name'];
            }
            break;
        default:
            $retval = stripslashes($fieldvalue);
            break;
    }
    return $retval;
}
示例#2
0
文件: index.php 项目: ivywe/maps
/**
*   Get an individual field for the maps screen.
*
*   @param  string  $fieldname  Name of field (from the array, not the db)
*   @param  mixed   $fieldvalue Value of the field
*   @param  array   $A          Array of all fields from the database
*   @param  array   $icon_arr   System icon array
*   @param  object  $EntryList  This entry list object
*   @return string              HTML for field display in the table
*/
function plugin_getListField_maps($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $_CONF, $LANG_ADMIN, $LANG_STATIC, $_TABLES, $_MAPS_CONF;
    switch ($fieldname) {
        case "edit":
            $retval = COM_createLink($icon_arr['edit'], "{$_CONF['site_admin_url']}/plugins/maps/map_edit.php?mode=edit&amp;mid={$A['mid']}");
            break;
        case "name":
            $map_title = stripslashes($A['name']);
            $url = $_MAPS_CONF['site_url'] . '/index.php?mode=map&amp;mid=' . $A['mid'];
            $link = COM_createLink($map_title, $url, array('title' => $LANG_MAPS_1['title_display']));
            if ($A['description'] != '') {
                $retval = COM_getTooltip($A['name'], $A['description'], $url, $A['name'], 'help');
            } else {
                $retval = $link;
            }
            break;
        case "id":
            $retval = $A['mid'];
            break;
        case "active":
            if ($fieldvalue == 1) {
                $retval = '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/green_dot.gif" alt="" valign="center">';
            } else {
                $retval = '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/red_dot.gif" alt="">';
            }
            break;
        case "hidden":
            if ($fieldvalue == 0) {
                $retval = '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/green_dot.gif" alt="">';
            } else {
                $retval = '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/red_dot.gif" alt="">';
            }
            break;
        default:
            $retval = stripslashes($fieldvalue);
            break;
    }
    return $retval;
}
示例#3
0
/**
 * used to display the entries for the list of uninstalled plugins, in admin/plugins.php
 *
 * @param  string $fieldName
 * @param  string $fieldValue
 * @param  array  $A
 * @param  array  $icon_arr
 * @param  string $selected
 * @return string
 */
function ADMIN_getListField_newplugins($fieldName, $fieldValue, $A, $icon_arr, $selected = '')
{
    global $_CONF, $LANG32;
    switch ($fieldName) {
        case 'info_uninstalled':
            $retval = COM_createLink($icon_arr['info'], "{$_CONF['site_admin_url']}/plugins.php?mode=info_uninstalled&amp;pi_name={$A['pi_name']}", array('title' => $LANG32[13]));
            break;
        case 'pi_version':
            $params = PLG_getParams($A['pi_name']);
            $retval = $params['info']['pi_version'];
            break;
        case 'pi_dependencies':
            if (PLG_checkDependencies($A['pi_name'])) {
                $retval = COM_getTooltip($LANG32[51], PLG_printDependencies($A['pi_name'], $A['pi_gl_version']));
            } else {
                $style = "display: inline; color: #a00; border-bottom: 1px dotted #a00;";
                $retval = COM_getTooltip("<b class='notbold' style='{$style}'>{$LANG32[52]}</b>", PLG_printDependencies($A['pi_name'], $A['pi_gl_version']));
            }
            break;
        case 'install_link':
            if (PLG_checkDependencies($A['pi_name'])) {
                $retval = COM_createLink($icon_arr['install'], $A['install_link'], array('title' => $LANG32[62]));
            } else {
                $retval = str_replace('<img ', '<img title="' . $LANG32[63] . '" ', $icon_arr['unavailable']);
            }
            break;
        default:
            $retval = $fieldValue;
            break;
    }
    return $retval;
}
示例#4
0
/**
* Returns what HTML is allowed in content
*
* Returns what HTML tags the system allows to be used inside content.
* You can modify this by changing $_CONF['user_html'] in the configuration
* (for admins, see also $_CONF['admin_html']).
*
* @param    string  $permissions        comma-separated list of rights which identify the current user as an "Admin"
* @param    boolean $list_only          true = return only the list of HTML tags
* @param    boolean $filter_html_flag   0 = returns allowed all html tags, 1 = returns allowed HTML tags only, 2 = returns No HTML Tags Allowed (this is used by plugins if they have a config that overrides Geeklogs filter html settings or do not have a post mode)
* @return   string                  HTML <div>/<span> enclosed string
* @see      function COM_checkHTML
* @todo     Bugs: The list always includes the [code], [raw], and [page_break]
*           tags when story.* permissions are required, even when those tags
*           are not actually available (e.g. in comments on stories).
*
*/
function COM_allowedHTML($permissions = 'story.edit', $list_only = false, $filter_html_flag = 1)
{
    global $_CONF, $_PLUGINS, $LANG01;
    $retval = '';
    $has_skiphtmlfilterPermissions = SEC_hasRights('htmlfilter.skip');
    if ($has_skiphtmlfilterPermissions || isset($_CONF['skip_html_filter_for_root']) && $_CONF['skip_html_filter_for_root'] == 1 && SEC_inGroup('Root') || $filter_html_flag == 0) {
        if (!$list_only) {
            $retval .= '<span class="warningsmall">' . $LANG01[123] . ',</span> ';
        }
        $retval .= '<div dir="ltr" class="warningsmall">';
    } elseif ($filter_html_flag == 2) {
        if (!$list_only) {
            $retval .= '<span class="warningsmall">' . $LANG01[131] . ',</span> ';
        }
        $retval .= '<div dir="ltr" class="warningsmall">';
    } else {
        if (!$list_only) {
            $retval .= '<span class="warningsmall">' . $LANG01[31] . '</span> ';
        }
        if (empty($permissions) || !SEC_hasRights($permissions) || empty($_CONF['admin_html'])) {
            $html = $_CONF['user_html'];
        } else {
            $html = array_merge_recursive($_CONF['user_html'], $_CONF['admin_html']);
        }
        $retval .= '<div dir="ltr" class="warningsmall">';
        foreach ($html as $tag => $attr) {
            $retval .= '&lt;' . $tag . '&gt;, ';
        }
    }
    $with_story_perms = false;
    $perms = explode(',', $permissions);
    foreach ($perms as $p) {
        if (substr($p, 0, 6) == 'story.') {
            $with_story_perms = true;
            break;
        }
    }
    if ($with_story_perms) {
        $retval .= '[code], [raw], ';
        if ($_CONF['allow_page_breaks'] == 1) {
            $retval .= '[page_break], ';
        }
    }
    // List autotags user has permission to use (with descriptions)
    $autotags = array_keys(PLG_collectTags('permission'));
    $description = array_flip(PLG_collectTags('description'));
    $done_once = false;
    $comma = '';
    foreach ($autotags as $tag) {
        if ($done_once) {
            $comma = ', ';
        }
        if (!empty($description[$tag])) {
            $retval .= $comma . COM_getTooltip('[' . $tag . ':]', $description[$tag], '', $LANG01[132], 'information');
        } else {
            $retval .= $comma . '[' . $tag . ':]';
        }
        $done_once = true;
    }
    $retval .= '</div>';
    return $retval;
    return $retval;
}
示例#5
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);
     }
 }
示例#6
0
文件: index.php 项目: ivywe/forum
 }
 if ($record['uid'] > 1) {
     $firstposterName = COM_getDisplayName($record['uid']);
 } else {
     $firstposterName = $record['name'];
 }
 $topicinfo = "<b>{$LANG_GF01['STARTEDBY']} {$firstposterName}, {$firstdate}</b><br" . XHTML . ">";
 $lastpostinfo = stripBBCode($lastpostinfo);
 // Simple function to strip out bbcode so tooltips display better
 $lastpostinfo = strip_tags(COM_truncate($record['comment'], $CONF_FORUM['contentinfo_numchars'], '...'));
 $lastpostinfo = htmlspecialchars($lastpostinfo);
 // Escape things like " so it displays properly in tooltip
 $topicinfo .= str_replace(LB, "<br" . XHTML . ">", forum_mb_wordwrap($lastpostinfo, $CONF_FORUM['linkinfo_width'], LB));
 if (function_exists('COM_getTooltip')) {
     $topiclink = "viewtopic.php?showtopic={$record['id']}";
     $tooltip_subject = COM_getTooltip($subject, $topicinfo, $topiclink);
     //$subject = '';
     $topiclisting->set_var('tooltip_subject', $tooltip_subject);
 }
 $topiclisting->set_var('topicinfo', $topicinfo);
 $topiclisting->parse('folderimg', $folderimg);
 $topiclisting->set_var('topic_id', $record['id']);
 $topiclisting->set_var('subject', $subject);
 $topiclisting->set_var('fullsubject', $record['subject']);
 $topiclisting->set_var('gotomsg', $gotomsg);
 $topiclisting->set_var('displaypageslink', $displaypageslink);
 $topiclisting->set_var('showuserlink', $showuserlink);
 $topiclisting->set_var('lastposter', $lastposter);
 $topiclisting->set_var('LANG_lastpost', $LANG_GF02['msg188']);
 $topiclisting->set_var('moved', $moved);
 $topiclisting->set_var('views', $record['views']);
示例#7
0
function MONITOR_getListField_plugins($fieldname, $fieldvalue, $A, $icon_arr, $token)
{
    global $_CONF, $_MONITOR_CONF, $LANG_ADMIN, $LANG32, $_TABLES, $ready_plugins, $LANG_MONITOR_1;
    $retval = '';
    switch ($fieldname) {
        case 'pi_name':
            $retval = MONITOR_get_pluginname($A['pi_name']);
            break;
        case 'pi_version':
            $plugin_code_version = PLG_chkVersion($A['pi_name']);
            if (empty($plugin_code_version)) {
                $code_version = $LANG_ADMIN['na'];
            } else {
                $code_version = $plugin_code_version;
            }
            $pi_installed_version = $A['pi_version'];
            if (empty($plugin_code_version) || $pi_installed_version == $code_version) {
                $retval = $pi_installed_version;
            } else {
                $retval = "{$LANG32[37]}: {$pi_installed_version},&nbsp;{$LANG32[36]}: {$plugin_code_version}";
                if ($A['pi_enabled'] == 1) {
                    $retval .= " <b>{$LANG32[38]}</b>";
                    $csrftok = '&amp;' . CSRF_TOKEN . '=' . $token;
                    $style = 'style="vertical-align: middle;"';
                    $img = $_CONF['layout_url'] . '/images/update.png';
                    $img = "<img {$style} alt=\"[" . $LANG32[38] . "]\" src=\"{$img}\"" . XHTML . ">";
                    $url = $_CONF['site_admin_url'] . '/plugins.php?mode=updatethisplugin&amp;pi_name=' . $A['pi_name'] . $csrftok;
                    $retval .= COM_CreateLink($img, $url, array('title' => $LANG32[42]));
                }
            }
            break;
        case 'pi_dependencies':
            if (PLG_checkDependencies($A['pi_name'])) {
                $retval = COM_getTooltip($LANG32[51], PLG_printDependencies($A['pi_name'], $A['pi_gl_version']));
            } else {
                $style = "display: inline; color: #a00; border-bottom: 1px dotted #a00;";
                $retval = COM_getTooltip("<b class='notbold' style='{$style}'>{$LANG32[52]}</b>", PLG_printDependencies($A['pi_name'], $A['pi_gl_version']));
            }
            break;
        case 'pi_update':
            if (!PLG_checkDependencies($A['pi_name'])) {
                $retval = str_replace('<img ', '<img title="' . $LANG32[64] . '" ', $icon_arr['warning']);
            } else {
                $available = false;
                // plugin in repository
                $dependencie = true;
                $not_present = false;
                if ($A['pi_enabled'] == 1) {
                    $title = '';
                    $link = '';
                    $plugin = $A['pi_name'];
                    if (in_array($plugin, $ready_plugins)) {
                        //Check if plugin is in repo
                        $url = GITHUB_REPOSITORY . $plugin . '/releases';
                        //Get last release for this plugin
                        $releases = MONITOR_curlRequestOnGitApi($url);
                        $tag = $releases[0]['tag_name'];
                        if ($tag != '') {
                            $available = true;
                        }
                        //Is release newer
                        $installed_version = DB_getItem($_TABLES['plugins'], 'pi_version', "pi_name = '{$plugin}'");
                        if ($tag != '' && 'v' . $installed_version != $tag) {
                            $update = true;
                            $autoinstall_url = 'https://raw.githubusercontent.com/' . $_MONITOR_CONF['repository'] . '/' . $plugin . '/' . $tag . '/autoinstall.php';
                            $ch = curl_init();
                            curl_setopt($ch, CURLOPT_URL, $autoinstall_url);
                            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                            $data = curl_exec($ch);
                            curl_close($ch);
                            //Get infos from plugin
                            $data = preg_replace('/\\s+/', '', $data);
                            $gl_version = MONITOR_extract_unit($data, "pi_gl_version'=>'", "',");
                            //Geeklog dependencie
                            if (COM_versionCompare(VERSION, $gl_version, '>=')) {
                                $title = $LANG_MONITOR_1['update_to'] . ' ' . $tag;
                                $link = $_CONF['site_admin_url'] . "/plugins/monitor/index.php?action=update_plugin&amp;plugin={$plugin}";
                            } else {
                                $dependencie = false;
                                $title = $LANG_MONITOR_1['need_upgrade'] . $gl_version . '+ ' . $LANG_MONITOR_1['before_update'] . ' ' . $plugin . ' ' . $tag;
                                $link = "https://www.geeklog.net";
                            }
                        } else {
                            if ($tag == '') {
                                // The plugin is not available in this repo
                                $update = false;
                                if (is_string($releases['message'])) {
                                    $title = $releases['message'];
                                    $link = $releases['documentation_url'];
                                } else {
                                    $title = $LANG_MONITOR_1['not_available'];
                                    $link = "https://github.com/{$_MONITOR_CONF['repository']}";
                                }
                            } else {
                                // The plugin is up to date
                                $update = false;
                            }
                        }
                    } else {
                        $update = false;
                        //Ask plugin author to change this :)
                        $title = $LANG_MONITOR_1['ask_author'];
                        $link = DB_getItem($_TABLES['plugins'], 'pi_homepage', "pi_name = '{$plugin}'");
                    }
                } else {
                    $title = 'Update this plugin';
                    $link = '';
                    $update = true;
                    if (!file_exists($_CONF['path'] . 'plugins/' . $A['pi_name'] . '/functions.inc')) {
                        $not_present = true;
                    }
                }
                if ($not_present) {
                    $retval = str_replace('<img ', '<img title="' . $LANG32[64] . '" ', $icon_arr['unavailable']);
                } else {
                    $sorting = '';
                    $csrftoken = '&amp;' . CSRF_TOKEN . '=' . $token;
                    if (!empty($_GET['order']) && !empty($_GET['direction'])) {
                        // Remember how the list was sorted
                        $ord = trim($_GET['order']);
                        $dir = trim($_GET['direction']);
                        $old = trim($_GET['prevorder']);
                        $sorting = "&amp;order={$ord}&amp;direction={$dir}&amp;prevorder={$old}";
                    }
                    //Icons in update coloumn
                    if (!$update && in_array($plugin, $ready_plugins) && $available) {
                        $retval = str_replace('<img ', $LANG_MONITOR_1['up_to_date'] . ' <img title="' . $LANG_MONITOR_1['up_to_date'] . '" ', $icon_arr['enabled']);
                        $retval = $icon_arr['enabled'] . ' ' . $LANG_MONITOR_1['up_to_date'];
                    } else {
                        if (!$update && in_array($plugin, $ready_plugins) && !$available) {
                            $retval = COM_createLink($icon_arr['info'] . ' ' . $title, $link . $sorting, array('title' => ''));
                        } else {
                            if (!$update && !in_array($plugin, $ready_plugins)) {
                                $retval = COM_createLink($icon_arr['disabled'] . ' ' . $title, $link . $sorting, array('title' => ''));
                            } else {
                                if (!$update) {
                                    $retval = str_replace('<img ', '<img title="' . $LANG_MONITOR_1['no_update'] . '" ', $icon_arr['disabled']);
                                } else {
                                    if ($dependencie == false) {
                                        $retval = COM_createLink($icon_arr['warning'] . ' ' . $title, $link . $sorting, array('title' => ''));
                                    } else {
                                        $retval = COM_createLink($icon_arr['info'] . ' ' . $title, $link . $sorting, array('title' => ''));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            break;
        default:
            $retval = $fieldvalue;
            break;
    }
    return $retval;
}
示例#8
0
/**
* Returns what autotag is allowed in content
*
* Returns what autotags the system allows to be used inside content.
*
* @param    boolean  $list_only         true = return only the list of HTML tags
* @param    array    $allowed_tags      Array of allowed special tags ('code', 'raw', 'page_break' ...)
* @return   string                      HTML <div>/<span> enclosed string
* @see      function COM_checkHTML
*
*/
function COM_allowedAutotags($list_only = false, $allowed_tags = '')
{
    global $LANG01;
    $retval = '';
    if (!$list_only) {
        $retval .= '<span class="warningsmall">' . $LANG01[140] . '</span>';
    }
    $list = '';
    if (is_array($allowed_tags)) {
        foreach ($allowed_tags as $tag) {
            $list .= '&#91;' . $tag . '&#93;&nbsp;, ';
        }
    }
    // List autotags user has permission to use (with descriptions)
    $autotags = array_keys(PLG_collectTags('permission'));
    $description = array_flip(PLG_collectTags('description'));
    foreach ($autotags as $tag) {
        if (!empty($description[$tag])) {
            $desc = str_replace(array('[', ']'), array('&#91;', '&#93;'), $description[$tag]);
            $list .= COM_getTooltip('&#91;' . $tag . ':&#93;', $desc, '', $LANG01[132], 'information') . ', ';
        } else {
            $list .= '&#91;' . $tag . ':&#93;&nbsp;, ';
        }
    }
    $list = rtrim($list, ', ');
    if (!empty($list)) {
        $retval .= '<div class="warningsmall">' . $list . '</div>';
    }
    $retval = '<div dir="ltr" class="allowed_autotags">' . $retval . '</div>';
    return $retval;
}
示例#9
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);
     }
 }
示例#10
0
/**
*   Get an individual field for the overlays screen.
*
*   @param  string  $fieldname  Name of field (from the array, not the db)
*   @param  mixed   $fieldvalue Value of the field
*   @param  array   $A          Array of all fields from the database
*   @param  array   $icon_arr   System icon array
*   @param  object  $EntryList  This entry list object
*   @return string              HTML for field display in the table
*/
function MAPS_getListField_overlays($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $_CONF, $_MAPS_CONF, $LANG_ADMIN, $LANG_STATIC, $_TABLES;
    $token = SEC_createToken();
    switch ($fieldname) {
        case "edit":
            $retval = COM_createLink($icon_arr['edit'], "{$_CONF['site_admin_url']}/plugins/maps/overlay_edit.php?mode=edit&amp;oid={$A['oid']}");
            break;
        case "o_name":
            $overlay_image = $_MAPS_CONF['path_overlay_images'] . $A['o_image'];
            if (is_file($overlay_image)) {
                $retval = COM_getTooltip($A['o_name'], '<img src="' . $_MAPS_CONF['site_url'] . '/timthumb.php?src=' . $_MAPS_CONF['images_overlay_url'] . $A['o_image'] . '&amp;w=200&amp;q=70&amp;zc=1" alt="" />', '', $A['o_name'], $template = 'help');
            } else {
                $retval = $A['o_name'];
            }
            break;
        case 'move':
            $csrftoken = '&amp;' . CSRF_TOKEN . '=' . $token;
            $retval .= "<a href=\"{$_CONF['site_admin_url']}/plugins/maps/overlays.php?op=move&amp;oid={$A['oid']}&amp;where=up{$csrftoken}\" alt=\"{$LANG21[58]}\"" . XHTML . ">" . "<img src=\"{$_CONF['layout_url']}/images/admin/up.png\"></a> " . "<a href=\"{$_CONF['site_admin_url']}/plugins/maps/overlays.php?op=move&amp;oid={$A['oid']}&amp;where=dn{$csrftoken}\" alt=\"{$LANG21[57]}\"" . XHTML . ">" . "<img src=\"{$_CONF['layout_url']}/images/admin/down.png\"></a> " . "</a>";
            break;
        case "o_active":
            if ($fieldvalue == 1) {
                $retval = '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/green_dot.gif" alt="" valign="center">';
            } else {
                $retval = '<img src="' . $_CONF['site_admin_url'] . '/plugins/maps/images/red_dot.gif" alt="">';
            }
            break;
        default:
            $retval = $fieldvalue;
            break;
    }
    return $retval;
}
示例#11
0
/**
*   Get an individual field for the shippers screen.
*
*   @param  string  $fieldname  Name of field (from the array, not the db)
*   @param  mixed   $fieldvalue Value of the field
*   @param  array   $A          Array of all fields from the database
*   @param  array   $icon_arr   System icon array
*   @param  object  $EntryList  This entry list object
*   @return string              HTML for field display in the table
*/
function PAYPAL_getListField_shipperServices($fieldname, $fieldvalue, $A, $icon_arr)
{
    global $_CONF, $LANG_ADMIN, $LANG_STATIC, $_TABLES, $_PAY_CONF;
    switch ($fieldname) {
        case "edit":
            $edit_url = $_CONF['site_admin_url'] . '/plugins/paypal/index.php?mode=shipping&amp;op=edit_shipper&amp;shipper_service_id=' . $A['shipper_service_id'];
            $retval = COM_createLink($icon_arr['edit'], $edit_url);
            break;
        case "shipper_service_service":
            if ($A['shipper_service_description'] != '') {
                $retval = COM_getTooltip($A['shipper_service_service'], $A['shipper_service_description'], '', '', 'information');
                break;
            }
        default:
            $retval = stripslashes($fieldvalue);
            break;
    }
    return $retval;
}
/**
* Display latest forum posts in the center block.
*
* @param   where   int      where the block will be displayed (0..2)
* @param   page    int      page number
* @param   topic   string   topic ID
* @return          string   HTML for the center blcok (can be empty)
*/
function CUSTOM_centerblock_forum($limit = '')
{
    global $_CONF, $_USER, $_TABLES, $LANG_GF01, $CONF_FORUM;
    global $LANG_GF02, $mode, $order;
    //$TIMER = new timerobject();
    //$TIMER->startTimer();
    //$exectime = $TIMER->stopTimer();
    if ($CONF_FORUM['installed_version'] < 2.6) {
        return;
    }
    if ($CONF_FORUM['registration_required'] && $_USER['uid'] < 2) {
        return;
    }
    $retval = '';
    $cb_enable = $CONF_FORUM['show_centerblock'];
    $cb_where = $CONF_FORUM['centerblock_where'];
    // If enabled only for homepage and this is not page 1 or a topic page,
    // then set disable flag
    if ($CONF_FORUM['centerblock_homepage'] == 1 and ($page > 1 or !empty($topic))) {
        $cb_enable = 0;
    } elseif ($CONF_FORUM['centerblock_homepage'] == 0 and $page > 1) {
        $cb_where = 1;
        // Top of Page
    }
    // Check if there are no featured articles in this topic
    // and if so then place it at the top of the page
    if (!empty($topic)) {
        $fromsql = ", {$_TABLES['topic_assignments']} ta";
        $wheresql = "WHERE ta.id = sid AND ta.tid='{$topic}' AND featured > 0";
    } else {
        $fromsql = '';
        $wheresql = 'WHERE featured = 1';
    }
    $query = DB_query("SELECT COUNT(*) AS count FROM {$_TABLES['stories']} {$fromsql} {$wheresql}");
    $result = DB_fetchArray($query);
    if ($result['count'] == 0 and $cb_where == 2) {
        $cb_where = 1;
    }
    $block = new Template($_CONF['path'] . 'system/custom/forum');
    $block->set_file(array('block' => 'centerblock.thtml', 'record' => 'centerblock_displayline.thtml'));
    $block->set_var('xhtml', XHTML);
    $block->set_var('phpself', $_CONF['site_url'] . '/index.php');
    $block->set_var('startblock', COM_startBlock($LANG_GF02['msg170']));
    $block->set_var('endblock', COM_endBlock());
    $block->set_var('site_url', $_CONF['site_url']);
    $block->set_var('layout_url', $CONF_FORUM['layout_url']);
    $block->set_var('LANG_title', $LANG_GF02['msg170']);
    $block->set_var('LANG_FORUM', $LANG_GF01['FORUM']);
    $block->set_var('LANG_TOPIC', $LANG_GF01['TOPIC']);
    $block->set_var('LANG_LASTPOST', $LANG_GF01['LASTPOST']);
    $block->set_var('LANG_viewlastpost', $LANG_GF02['msg160']);
    $block->set_var('LANG_forumjump', $LANG_GF02['msg195']);
    $groups = array();
    $usergroups = SEC_getUserGroups();
    foreach ($usergroups as $group) {
        $groups[] = $group;
    }
    $grouplist = implode(',', $groups);
    if ($limit != '') {
        $CONF_FORUM['centerblock_numposts'] = $limit;
    }
    $sql = "SELECT a.id, a.forum, a.name, a.date, a.lastupdated, a.last_reply_rec, a.subject, ";
    $sql .= "a.comment, a.uid, a.name, a.pid, a.replies, a.views, b.forum_name  ";
    $sql .= "FROM {$_TABLES['forum_topic']} a ";
    $sql .= "LEFT JOIN {$_TABLES['forum_forums']} b ON a.forum=b.forum_id ";
    $sql .= "WHERE pid=0 AND b.grp_id IN ({$grouplist}) AND b.no_newposts = 0 ";
    $sql .= "ORDER BY lastupdated DESC LIMIT {$CONF_FORUM['centerblock_numposts']}";
    $result = DB_query($sql);
    if (DB_numRows($result) == 0) {
        return;
    }
    $f_tooltip = function_exists('COM_getTooltip');
    $cssid = 0;
    while ($A = DB_fetchArray($result)) {
        //        $fullsubject = "{$A['subject']}\n{$LANG_GF01['POSTEDBY']}:{$A['name']}{$LANG_GF01['VIEWS']}:{$A['views']}, {$LANG_GF01['REPLIES']}:{$A['replies']}";
        $fullsubject = "{$LANG_GF01['POSTEDBY']}:{$A['name']}{$LANG_GF01['VIEWS']}:{$A['views']}";
        if (strlen($A['subject']) > $CONF_FORUM['cb_subject_size']) {
            $A['subject'] = COM_truncate($A['subject'], $CONF_FORUM['cb_subject_size'], '...');
        }
        if ($CONF_FORUM['allow_user_dateformat']) {
            $firstdate = COM_getUserDateTimeFormat($A['date']);
            $firstdate = $firstdate[0];
            $lastdate = COM_getUserDateTimeFormat($A['lastupdated']);
            $lastdate = $lastdate[0];
        } else {
            $firstdate = strftime($CONF_FORUM['default_Datetime_format'], $A['date']);
            $lastdate = strftime($CONF_FORUM['default_Datetime_format'], $A['lastupdated']);
        }
        if ($A['uid'] > 1) {
            $topicinfo = COM_getDisplayName($A['uid']);
            //$topicinfo .= sprintf($LANG_GF01['LASTREPLYBY'],COM_getDisplayName($A['uid']));
        } else {
            $topicinfo = "{$A['name']}";
        }
        //        $topicinfo .= "{$firstdate} " . " {$LANG_GF01['VIEWS']}:{$A['views']}, {$LANG_GF01['REPLIES']}:{$A['replies']}</span>";
        //        $topicinfo .= "{$firstdate} " . " {$LANG_GF01['VIEWS']}:{$A['views']}"."</span>";
        if (empty($A['last_reply_rec']) or $A['last_reply_rec'] < 1) {
            $lastid = $A['id'];
            $lastcomment = $A['comment'];
        } else {
            $qlreply = DB_query("SELECT id,uid,name,comment FROM {$_TABLES['forum_topic']} WHERE id={$A['last_reply_rec']}");
            $B = DB_fetchArray($qlreply);
            $lastid = $B['id'];
            $lastcomment = $B['comment'];
            if ($B['uid'] > 1) {
                $lastpostuser = sprintf("%s", COM_getDisplayName($B['uid']));
            } else {
                $lastpostuser = sprintf("%s", $B['name']);
            }
        }
        $lastpostinfo = strip_tags(COM_truncate($lastcomment, $CONF_FORUM['contentinfo_numchars'], '...'));
        $lastpostinfo = str_replace(LB, "<br" . XHTML . ">", forum_mb_wordwrap($lastpostinfo, $CONF_FORUM['linkinfo_width'], LB));
        $cssid = $cssid == 1 ? 2 : 1;
        $f_tooltip = 0;
        if ($f_tooltip) {
            $lastpostlink = "{$_CONF['site_url']}/forum/viewtopic.php?showtopic={$A['id']}&amp;lastpost=true#{$lastid}";
            $block->set_var('tooltip_date', COM_getTooltip($lastdate, $lastpostinfo, $lastpostlink));
            $topiclink = "{$_CONF['site_url']}/forum/viewtopic.php?showtopic={$A['id']}";
            $block->set_var('tooltip_topic_subject', COM_getTooltip($A['subject'], $topicinfo, $topiclink));
        } else {
            $block->set_var('lastpostinfo', $lastpostinfo);
            $block->set_var('topicinfo', $topicinfo);
            $block->set_var('date', $firstdate);
            $block->set_var('lastdate', $lastdate);
            $block->set_var('topic_subject', $A['subject']);
        }
        $block->set_var('lastpostuser', $lastpostuser);
        $block->set_var('lastpostid', $lastid);
        $block->set_var('cssid', $cssid);
        $block->set_var('img_dir', $CONF_FORUM['imgset']);
        $block->set_var('forum_id', $A['forum']);
        $block->set_var('forum_name', $A['forum_name']);
        $block->set_var('topic_id', $A['id']);
        $block->set_var('fullsubject', $fullsubject);
        $block->set_var('views', $A['views']);
        $block->set_var('replies', $A['replies']);
        $block->set_var('posts', $A['replies'] + 1);
        $block->set_var('lastpostby', $A['name']);
        $block->parse('block_records', 'record', true);
    }
    $block->parse('output', 'block');
    $retval .= $block->finish($block->get_var('output'));
    //$exectime = $TIMER->stopTimer();
    //COM_errorLog("Centerblock Execution Time: $exectime seconds");
    return $retval;
}