Пример #1
0
function GetXMLTreeProfile($xmlloc)
{
    if (file_exists($xmlloc)) {
        $data = implode('', file($xmlloc));
    } else {
        $fp = fopen($xmlloc, 'r');
        $data = fread($fp, 100000000);
        fclose($fp);
    }
    $data = preg_replace("/<knows>.*<\\/knows>/is", "", $data);
    $parser = xml_parser_create('UTF-8');
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
    xml_parse_into_struct($parser, $data, $vals, $index);
    xml_parser_free($parser);
    $code = xml_get_error_code($parser);
    if ($code != XML_ERROR_NONE) {
        global $messages;
        $messages[] = gettext("XML error: ") . xml_error_string($code);
    }
    $tree = array();
    $i = 0;
    if (isset($vals[$i]['attributes'])) {
        $tree[$vals[$i]['tag']][]['ATTRIBUTES'] = $vals[$i]['attributes'];
        $index = count($tree[$vals[$i]['tag']]) - 1;
        $tree[$vals[$i]['tag']][$index] = array_merge($tree[$vals[$i]['tag']][$index], GetChildren($vals, $i));
    } else {
        $tree[$vals[$i]['tag']][] = GetChildren($vals, $i);
    }
    return $tree;
}
Пример #2
0
 public function data($message = '')
 {
     if (!is_string($message)) {
         return Error::set(lang('Error', 'stringParameter', '1.(message)'));
     }
     return gettext($message);
 }
Пример #3
0
 public function __construct($name, $title, $link = null, $icon = null)
 {
     // If we have a link; we're actually an <a class='btn'>
     if (isset($link)) {
         $this->_attributes['href'] = $link;
         $this->_tagName = 'a';
         $this->addClass('btn-default');
         unset($this->_attributes['type']);
         if (isset($icon)) {
             $this->_attributes['icon'] = $icon;
         }
     } else {
         if (isset($icon)) {
             $this->_tagSelfClosing = false;
             $this->_tagName = 'button';
             $this->_attributes['value'] = gettext($title);
             $this->_attributes['icon'] = $icon;
         } else {
             $this->_tagSelfClosing = true;
             $this->_attributes['value'] = gettext($title);
             $this->addClass('btn-primary');
         }
     }
     parent::__construct($name, $title, null);
     if (isset($link)) {
         unset($this->_attributes['name']);
     }
 }
Пример #4
0
 function getOptionsSupported()
 {
     $MapTypes = array();
     // order matters here because the first allowed map is selected if the 'gmap_starting_map' is not allowed
     if (getOption('gmap_map_hybrid')) {
         $MapTypes[gettext('Hybrid')] = 'HYBRID';
     }
     if (getOption('gmap_map_roadmap')) {
         $MapTypes[gettext('Map')] = 'ROADMAP';
     }
     if (getOption('gmap_map_satellite')) {
         $MapTypes[gettext('Satellite')] = 'SATELLITE';
     }
     if (getOption('gmap_map_terrain')) {
         $MapTypes[gettext('Terrain')] = 'TERRAIN';
     }
     $defaultMap = getOption('gmap_starting_map');
     if (array_search($defaultMap, $MapTypes) === false) {
         // the starting map is not allowed, pick a new one
         $temp = $MapTypes;
         $defaultMap = array_shift($temp);
         setOption('gmap_starting_map', $defaultMap);
     }
     return array(gettext('Allowed maps') => array('key' => 'gmap_allowed_maps', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'order' => 1, 'checkboxes' => array(gettext('Hybrid') => 'gmap_map_hybrid', gettext('Map') => 'gmap_map_roadmap', gettext('Satellite') => 'gmap_map_satellite', gettext('Terrain') => 'gmap_map_terrain'), 'desc' => gettext('Select the map types that are allowed.')), gettext('Initial map display selection') => array('key' => 'gmap_starting_map', 'type' => OPTION_TYPE_SELECTOR, 'order' => 2, 'selections' => $MapTypes, 'desc' => gettext('Select the initial type of map to display.')), gettext('Map display') => array('key' => 'gmap_display', 'type' => OPTION_TYPE_SELECTOR, 'order' => 3, 'selections' => array(gettext('show') => 'show', gettext('hide') => 'hide', gettext('colorbox') => 'colorbox'), 'desc' => gettext('Select <em>hide</em> to initially hide the map. Select <em>colorbox</em> for the map to display in a colorbox. Select <em>show</em> and the map will display when the page loads.')), gettext('Map controls') => array('key' => 'gmap_control_type', 'type' => OPTION_TYPE_RADIO, 'order' => 4, 'buttons' => array(gettext('None') => 'none', gettext('Default') => 'DEFAULT', gettext('Dropdown') => 'DROPDOWN_MENU', gettext('Horizontal') => 'HORIZONTAL_BAR'), 'desc' => gettext('Display options for the Map type control.')), gettext('Zoom controls') => array('key' => 'gmap_zoom_size', 'type' => OPTION_TYPE_RADIO, 'order' => 5, 'buttons' => array(gettext('Small') => 'SMALL', gettext('Default') => 'DEFAULT', gettext('Large') => 'LARGE'), 'desc' => gettext('Display options for the Zoom control.')), gettext('Max zoom level') => array('key' => 'gmap_cluster_max_zoom', 'type' => OPTION_TYPE_NUMBER, 'order' => 6, 'desc' => gettext('The max zoom level for clustering pictures on map.')), gettext('Map dimensions—width') => array('key' => 'gmap_width', 'type' => OPTION_TYPE_NUMBER, 'order' => 7, 'desc' => gettext('The default width of the map.')), gettext('Map dimensions—height') => array('key' => 'gmap_height', 'type' => OPTION_TYPE_NUMBER, 'order' => 8, 'desc' => gettext('The default height of the map.')), gettext('Map sessions') => array('key' => 'gmap_sessions', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 9, 'desc' => gettext('If checked GoogleMaps will use sessions to pass map data for the <em>colorbox</em> display option. We recommend this option be selected. It protects against reference forgery security attacks and mitigates problems with data exceeding the allowed by some browsers.')));
 }
Пример #5
0
function zenphoto_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo, $html = false)
{
    $headers = sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n";
    if (count($cc_addresses) > 0) {
        $cclist = '';
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $cclist .= ',' . $cc_mail;
        }
        $headers .= 'Cc: ' . substr($cclist, 1) . "\n";
    }
    if ($replyTo) {
        $headers .= 'Reply-To: ' . array_shift($replyTo) . "\n";
    }
    $result = true;
    foreach ($email_list as $to_mail) {
        $result = $result && utf8::send_mail($to_mail, $subject, $message, $headers, '', $html);
    }
    if (!$result) {
        if (!empty($msg)) {
            $msg .= '<br />';
        }
        $msg .= sprintf(gettext('<code>zenphoto_sendmail</code> failed to send <em>%s</em> to one or more recipients.'), $subject);
    }
    return $msg;
}
Пример #6
0
 function __construct($steam_object = FALSE)
 {
     self::$PATH = PATH_EXTENSIONS . "units_extern/";
     self::$DISPLAY_NAME = gettext("External Resource");
     self::$DISPLAY_DESCRIPTION = gettext("You can use this unit type for providing external web resources in an course. In the preferences of this unit you can specify an external web link that will thereafter be accessable as unit content.");
     parent::__construct(PATH_EXTENSIONS . "units_extern.xml", $steam_object);
 }
Пример #7
0
function sitemap_printAvailableSitemaps()
{
    $cachefolder = SERVERPATH . '/' . STATIC_CACHE_FOLDER . '/sitemap/';
    $dirs = array_diff(scandir($cachefolder), array('.', '..', '.DS_Store', 'Thumbs.db', '.htaccess', '.svn'));
    echo '<h2>' . gettext('Available sitemap files:') . '</h2>';
    if (!$dirs) {
        echo '<p>' . gettext('No sitemap files available.') . '</p>';
    } else {
        echo '<ol>';
        foreach ($dirs as $dir) {
            $filemtime = filemtime($cachefolder . $dir);
            $lastchange = date('Y-m-d H:m:s', $filemtime);
            ?>
			<li><a target="_blank" href="<?php 
            echo FULLWEBPATH . '/' . STATIC_CACHE_FOLDER;
            ?>
/sitemap/<?php 
            echo $dir;
            ?>
"><?php 
            echo $dir;
            ?>
</a> (<small><?php 
            echo $lastchange;
            ?>
)</small>
			</li>
			<?php 
        }
        echo '</ol>';
    }
}
Пример #8
0
function printNews($side)
{
    $pos = zp_filter_slot('admin_overview', 'comment_form_print10Most') !== false;
    if ($pos && $side == 'left' || !$pos && $side == 'right') {
        if ($connected = is_connected()) {
            require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
        }
        ?>
		<div class="box" id="overview-news">
		<h2 class="h2_bordered"><?php 
        echo gettext("News from Zenphoto.org");
        ?>
</h2>
		<?php 
        if ($connected) {
            echo RSS_Display("http://www.zenphoto.org/index.php?rss-news&withimages", 5);
        } else {
            ?>
			<ul>
				<li><?php 
            echo gettext('A connection to <em>Zenphoto.org</em> could not be established.');
            ?>
				</li>
			</ul>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
    return $side;
}
Пример #9
0
function newsclient_pagesetup()
{
    // register links --
    global $profile_id;
    global $PAGE;
    global $CFG;
    $page_owner = $profile_id;
    if (isloggedin() && $CFG->your_resources_enabled) {
        if (defined("context") && context == "resources" && $page_owner == $_SESSION['userid']) {
            $PAGE->menu[] = array('name' => 'resources', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/feeds/\" class=\"selected\" >" . gettext("Your Resources") . '</a></li>');
        } else {
            $PAGE->menu[] = array('name' => 'resources', 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/feeds/\" >" . gettext("Your Resources") . '</a></li>');
        }
        $rss_username = run("users:id_to_name", $page_owner);
    }
    if (defined("context") && context == "resources" && $CFG->your_resources_enabled) {
        if ($page_owner != -1) {
            if (run("permissions:check", "rss") && logged_on && $page_owner == $_SESSION['userid']) {
                $PAGE->menu_sub[] = array('name' => 'newsfeed:subscription', 'html' => a_hrefg($CFG->wwwroot . $_SESSION['username'] . "/feeds/", gettext("Feeds")));
                $PAGE->menu_sub[] = array('name' => 'newsfeed:subscription:publish:blog', 'html' => a_hrefg($CFG->wwwroot . "_rss/blog.php?page_owner=" . $_SESSION['userid'], gettext("Publish to blog")));
            }
            $PAGE->menu_sub[] = array('name' => 'newsclient', 'html' => a_hrefg($CFG->wwwroot . $rss_username . "/feeds/all/", gettext("View aggregator")));
        }
        $PAGE->menu_sub[] = array('name' => 'feed', 'html' => a_hrefg($CFG->wwwroot . "_rss/popular.php", gettext("Popular Feeds")));
        /*
        $PAGE->menu_sub[] = array( 'name' => 'feed',
                                   'html' => a_hrefg( $CFG->wwwroot."help/feeds_help.php", 
                                                      "Page help"));
        */
    }
}
Пример #10
0
    protected function _getInput()
    {
        $element = parent::_getInput();
        $options = '';
        foreach ($this->_values as $value => $name) {
            // Things can get weird if we have mixed types
            $sval = $this->_value;
            if (gettype($value) == "integer" && gettype($sval) == "string") {
                $value = strval($value);
            }
            if (isset($this->_attributes['multiple'])) {
                $selected = in_array($value, (array) $sval);
            } else {
                $selected = $sval == $value;
            }
            if (!empty(trim($name)) || is_numeric($name)) {
                $name_str = htmlspecialchars(gettext($name));
            } else {
                // Fixes HTML5 validation: Element option without attribute label must not be empty
                $name_str = "&nbsp;";
            }
            $options .= '<option value="' . htmlspecialchars($value) . '"' . ($selected ? ' selected' : '') . '>' . $name_str . '</option>';
        }
        return <<<EOT
\t{$element}
\t\t{$options}
\t</select>
EOT;
    }
Пример #11
0
function pseudo_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses)
{
    global $_zp_UTF8;
    $filename = str_replace(array('<', '>', ':', '"' . '/' . '\\', '|', '?', '*'), '_', $subject);
    $path = dirname(dirname(__FILE__)) . '/' . DATA_FOLDER . '/' . $filename . '.txt';
    $f = fopen($path, 'w');
    fwrite($f, str_pad('*', 49, '-') . "\n");
    $tolist = '';
    foreach ($email_list as $to) {
        $tolist .= ',' . $to;
    }
    fwrite($f, sprintf(gettext('To: %s'), substr($tolist, 1)) . "\n");
    fwrite($f, sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n");
    if (count($cc_addresses) > 0) {
        $cclist = '';
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $cclist .= ',' . $cc_mail;
        }
        fwrite($f, sprintf(gettext('Cc: %s'), substr($cclist, 1)) . "\n");
    }
    fwrite($f, sprintf(gettext('Subject: %s'), $subject) . "\n");
    fwrite($f, str_pad('*', 49, '-') . "\n");
    fwrite($f, $message . "\n");
    fclose($f);
    clearstatcache();
    return $msg;
}
Пример #12
0
    public function __toString()
    {
        $element = parent::__toString();
        $title = htmlspecialchars(gettext($this->_title));
        $body = implode('', $this->_groups);
        $hdricon = "";
        $bodyclass = '<div class="panel-body">';
        if ($this->_collapsible & COLLAPSIBLE) {
            $hdricon = '<span class="widget-heading-icon">' . '<a data-toggle="collapse" href="#' . $this->_attributes['id'] . '_panel-body">' . '<i class="fa fa-plus-circle"></i>' . '</a>' . '</span>';
            $bodyclass = '<div id="' . $this->_attributes['id'] . '_panel-body" class="panel-body collapse ';
            if ($this->_collapsible & SEC_CLOSED) {
                $bodyclass .= 'out">';
            } else {
                $bodyclass .= 'in">';
            }
        }
        return <<<EOT
\t{$element}
\t\t<div class="panel-heading">
\t\t\t<h2 class="panel-title">{$title}{$hdricon}</h2>
\t\t</div>
\t\t{$bodyclass}
\t\t\t{$body}
\t\t</div>
\t</div>
EOT;
    }
Пример #13
0
/**
 * Prints out the links for login/out, register formular if asked
 */
function printLoginZone()
{
    if (!zp_loggedin() && (function_exists('printUserLogin_out') || function_exists('printUserLogin_out') || function_exists('printRegistrationForm'))) {
        $multi = 0;
        echo '<div id="loginout" class=" push_5 grid_10">';
        if (zp_loggedin() && function_exists('printUserLogin_out')) {
            printUserLogin_out('', '', false);
            $multi++;
        }
        if (!zp_loggedin() && function_exists('printUserLogin_out')) {
            if ($multi) {
                echo ' - ';
            }
            printCustomPageURL(gettext('Login'), 'login', '', '');
            $multi++;
        }
        if (!zp_loggedin() && function_exists('printRegistrationForm')) {
            if ($multi) {
                echo ' - ';
            }
            printCustomPageURL(gettext('Register for this site'), 'register', '', '');
        }
        echo '</div>';
    }
}
Пример #14
0
function print_states($tracker)
{
    global $rulescnt;
    $rulesid = "";
    $bytes = 0;
    $states = 0;
    $packets = 0;
    $evaluations = 0;
    $stcreations = 0;
    $rules = get_pf_rules($rulescnt, $tracker);
    if (is_array($rules)) {
        foreach ($rules as $rule) {
            $bytes += $rule['bytes'];
            $states += $rule['states'];
            $packets += $rule['packets'];
            $evaluations += $rule['evaluations'];
            $stcreations += $rule['state creations'];
            if (strlen($rulesid) > 0) {
                $rulesid .= ",";
            }
            $rulesid .= "{$rule['id']}";
        }
    }
    printf("<a href=\"diag_dump_states.php?ruleid=%s\" data-toggle=\"popover\" data-trigger=\"hover focus\" title=\"%s\" ", $rulesid, gettext("States details"));
    printf("data-content=\"evaluations: %s<br>packets: %s<br>bytes: %s<br>states: %s<br>state creations: %s\" data-html=\"true\">", format_number($evaluations), format_number($packets), format_bytes($bytes), format_number($states), format_number($stcreations));
    printf("%d/%s</a><br>", format_number($states), format_bytes($bytes));
}
Пример #15
0
function RunFreeQuery()
{
    global $cnInfoCentral;
    global $aRowClass;
    global $rsQueryResults;
    global $sSQL;
    global $iQueryID;
    //Run the SQL
    $rsQueryResults = RunQuery($sSQL);
    if (mysql_error() != "") {
        echo gettext("An error occured: ") . mysql_errno() . "--" . mysql_error();
    } else {
        $sRowClass = "RowColorA";
        echo "<table align=\"center\" cellpadding=\"5\" cellspacing=\"0\">";
        echo "<tr class=\"" . $sRowClass . "\">";
        //Loop through the fields and write the header row
        for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
            echo "<td align=\"center\"><b>" . mysql_field_name($rsQueryResults, $iCount) . "</b></td>";
        }
        echo "</tr>";
        //Loop through the recordsert
        while ($aRow = mysql_fetch_array($rsQueryResults)) {
            $sRowClass = AlternateRowStyle($sRowClass);
            echo "<tr class=\"" . $sRowClass . "\">";
            //Loop through the fields and write each one
            for ($iCount = 0; $iCount < mysql_num_fields($rsQueryResults); $iCount++) {
                echo "<td align=\"center\">" . $aRow[$iCount] . "</td>";
            }
            echo "</tr>";
        }
        echo "</table>";
        echo "<br><p class=\"ShadedBox\" style=\"border-style: solid; margin-left: 50px; margin-right: 50 px; border-width: 1px;\"><span class=\"SmallText\">" . str_replace(Chr(13), "<br>", htmlspecialchars($sSQL)) . "</span></p>";
    }
}
Пример #16
0
 function getOptionsSupported()
 {
     global $_zp_gallery, $_zp_images_classes, $mysetoptions;
     $dir = opendir($albumdir = $_zp_gallery->getAlbumDir());
     $albums = array();
     while ($dirname = readdir($dir)) {
         if (is_dir($albumdir . $dirname) && substr($dirname, 0, 1) != '.' || hasDynamicAlbumSuffix($dirname)) {
             $albums[] = filesystemToInternal($dirname);
         }
     }
     closedir($dir);
     $albums = array_unique($albums);
     natcasesort($albums);
     $lista = array();
     foreach ($albums as $album) {
         $lista[$album] = 'filter_file_searches_albums_' . $album;
     }
     $list = array_keys($_zp_images_classes);
     natcasesort($list);
     $listi = array();
     foreach ($list as $suffix) {
         $listi[$suffix] = 'filter_file_searches_images_' . $suffix;
     }
     return array(gettext('Albums') => array('key' => 'filter_file_searches_albums', 'type' => OPTION_TYPE_CHECKBOX_UL, 'checkboxes' => $lista, 'desc' => gettext("Check album names to be ignored.")), gettext('Images') => array('key' => 'filter_file_searches_images', 'type' => OPTION_TYPE_CHECKBOX_UL, 'checkboxes' => $listi, 'desc' => gettext('Check image suffixes to be ignored.')));
 }
Пример #17
0
    function process_button($transactionID = 0, $key= "") {
		global $order, $currencies, $currency;

		$my_currency = strtoupper(BASE_CURRENCY);

		if (!in_array($my_currency, $this->paypal_allowed_currencies)) {
			$my_currency = 'USD';
		}
		$currencyObject = new currencies();
		$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
					 tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
					 tep_draw_hidden_field('item_name', gettext('Payment for ').STORE_NAME) .
					 tep_draw_hidden_field('rm', '2') .
//					 tep_draw_hidden_field('bn', 'Credits_BuyNow_WPS_'.substr($order->customer['country'],0,2)) .
//					 tep_draw_hidden_field('country', substr($order->customer['country'],0,2)) .
					 tep_draw_hidden_field('lc', LANG) .
					 tep_draw_hidden_field('charset', 'UTF-8') .
					 tep_draw_hidden_field('email', $order->customer['email_address']) .
					 tep_draw_hidden_field('no_shipping', '1') .
					 tep_draw_hidden_field('PHPSESSID', session_id()) .
					 tep_draw_hidden_field('amount', number_format($order->info['total'], $currencyObject->get_decimal_places($my_currency))) .
//					 tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencyObject->get_value($my_currency), $currencyObject->get_decimal_places($my_currency))) .
					 tep_draw_hidden_field('currency_code', $my_currency) .
					 tep_draw_hidden_field('notify_url', tep_href_link("checkout_process.php?transactionID=".$transactionID."&sess_id=".session_id()."&key=".$key, '', 'SSL')) .
					 tep_draw_hidden_field('return', tep_href_link("userinfo.php", '', 'SSL')) .
					 tep_draw_hidden_field('cbt', gettext('Return to ').STORE_NAME) .
					 tep_draw_hidden_field('cancel_return', tep_href_link("userinfo.php", '', 'SSL'));

		return $process_button_string;
    }
 public function block_formContent($context, array $blocks = array())
 {
     // line 3
     echo "    <div class=\"form-group required\">\n        <label for=\"codigo\">";
     // line 4
     echo gettext("Código");
     echo "</label>\n        <input id=\"codigo\" type=\"text\" name=\"codigo\" class=\"form-control\" value=\"";
     // line 5
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["model"]) ? $context["model"] : null, "codigo", array()), "html", null, true);
     echo "\" maxlength=\"10\" />\n    </div>\n    <div class=\"form-group required\">\n        <label for=\"nome\">";
     // line 8
     echo gettext("Nome");
     echo "</label>\n        <input id=\"nome\" type=\"text\" name=\"nome\" class=\"form-control\" value=\"";
     // line 9
     echo twig_escape_filter($this->env, $this->getAttribute(isset($context["model"]) ? $context["model"] : null, "nome", array()), "html", null, true);
     echo "\" maxlength=\"50\" />\n    </div>\n    <div class=\"form-group required\">\n        <label for=\"grupo\">";
     // line 12
     echo gettext("Grupo");
     echo "</label>\n        <select id=\"grupo\" name=\"grupo_id\" class=\"form-control\">\n            <option value=\"\">";
     // line 14
     echo gettext("Selecione");
     echo "</option>\n            ";
     // line 15
     $context['_parent'] = $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["grupos"]) ? $context["grupos"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
         // line 16
         echo "            <option value=\"";
         echo twig_escape_filter($this->env, $this->getAttribute($context["item"], "id", array()), "html", null, true);
         echo "\" ";
         if ($this->getAttribute($context["item"], "id", array()) == $this->getAttribute($this->getAttribute(isset($context["model"]) ? $context["model"] : null, "grupo", array()), "id", array())) {
             echo "selected=\"selected\"";
         }
         echo ">";
         echo twig_escape_filter($this->env, $context["item"], "html", null, true);
         echo "</option>\n            ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 18
     echo "        </select>\n    </div>\n    <div class=\"form-group required\">\n        <label for=\"status\">Status</label>\n        <select id=\"status\" name=\"status\" class=\"form-control\">\n            <option value=\"\">";
     // line 23
     echo gettext("Selecione");
     echo "</option>\n            <option value=\"1\" ";
     // line 24
     if ($this->getAttribute(isset($context["model"]) ? $context["model"] : null, "status", array()) == 1) {
         echo "selected=\"selected\"";
     }
     echo ">";
     echo gettext("Ativo");
     echo "</option>\n            <option value=\"0\" ";
     // line 25
     if ($this->getAttribute(isset($context["model"]) ? $context["model"] : null, "status", array()) == "0") {
         echo "selected=\"selected\"";
     }
     echo ">";
     echo gettext("Inativo");
     echo "</option>\n        </select>\n    </div>\n";
 }
Пример #19
0
function get_cmd()
{
    if ($_REQUEST['cmd'] == 'mailq') {
        #exec("/usr/local/bin/mailq" . escapeshellarg('^'.$m.$j." ".$hour.".*".$grep)." /var/log/maillog", $lists);
        exec(POSTFIX_LOCALBASE . "/bin/mailq", $mailq);
        print '<table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0">';
        print '<tr><td colspan="6" valign="top" class="listtopic">' . gettext($_REQUEST['cmd'] . " Results") . '</td></tr>';
        print '<tr><td class="listlr"><strong>SID</strong></td>';
        print '<td class="listlr"><strong>size</strong></td>';
        print '<td class="listlr"><strong>date</strong></td>';
        print '<td class="listlr"><strong>sender</strong></td>';
        print '<td class="listlr"><strong>info</strong></td>';
        print '<td class="listlr"><strong>Recipient </strong></td></tr>';
        #print '<table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0">';
        $td = '<td valign="top" class="listlr">';
        $sid = "";
        foreach ($mailq as $line) {
            if (preg_match("/-Queue ID- --Size--/", $line, $matches)) {
                print "";
            } elseif (preg_match("/(\\w+)\\s+(\\d+)\\s+(\\w+\\s+\\w+\\s+\\d+\\s+\\d+:\\d+:\\d+)\\s+(.*)/", $line, $matches)) {
                print '<tr>' . $td . $matches[1] . '</td>' . $td . $matches[2] . '</td>' . $td . $matches[3] . '</td>' . $td . $matches[4];
                $sid = $matches[1];
            } elseif (preg_match("/(\\s+|)(\\W\\w+.*)/", $line, $matches) && $sid != "") {
                print $td . $matches[2] . '</td>';
            } elseif (preg_match("/\\s+(\\w+.*)/", $line, $matches) && $sid != "") {
                print $td . $matches[1] . '</td></tr>';
                $sid = "";
            }
        }
        print '</table>';
    }
    if ($_REQUEST['cmd'] == 'qshape') {
        if ($_REQUEST['qshape'] != "") {
            exec(POSTFIX_LOCALBASE . "/bin/qshape -" . preg_replace("/\\W/", "", $_REQUEST['type']) . " " . preg_replace("/\\W/", "", $_REQUEST['qshape']), $qshape);
        } else {
            exec(POSTFIX_LOCALBASE . "/bin/qshape", $qshape);
        }
        print '<table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0">';
        print '<tr><td colspan="12" valign="top" class="listtopic">' . gettext($_REQUEST['cmd'] . " Results") . '</td></tr>';
        $td = '<td valign="top" class="listlr">';
        $sid = "";
        foreach ($qshape as $line) {
            if (preg_match("/\\s+(T\\s.*)/", $line, $matches)) {
                print '<tr><td class="listlr"></td>';
                foreach (explode(" ", preg_replace("/\\s+/", " ", $matches[1])) as $count) {
                    print '<td class="listlr"><strong>' . $count . '</strong></td>';
                }
                print "</tr>";
            } else {
                print "<tr>";
                $line = preg_replace("/^\\s+/", "", $line);
                $line = preg_replace("/\\s+/", " ", $line);
                foreach (explode(" ", $line) as $count) {
                    print '<td class="listlr"><strong>' . $count . '</strong></td>';
                }
                print "</tr>";
            }
        }
    }
}
Пример #20
0
/**
 * check if gateway_item can be deleted
 * @param int $id sequence item in $a_gateways
 * @param array $a_gateways gateway list
 * @param array $input_errors input errors
 * @return bool has errors
 */
function can_delete_gateway_item($id, $a_gateways, &$input_errors)
{
    global $config;
    if (!isset($a_gateways[$id])) {
        return false;
    }
    if (isset($config['gateways']['gateway_group'])) {
        foreach ($config['gateways']['gateway_group'] as $group) {
            foreach ($group['item'] as $item) {
                $items = explode("|", $item);
                if ($items[0] == $a_gateways[$id]['name']) {
                    $input_errors[] = sprintf(gettext("Gateway '%s' cannot be deleted because it is in use on Gateway Group '%s'"), $a_gateways[$id]['name'], $group['name']);
                    break;
                }
            }
        }
    }
    if (isset($config['staticroutes']['route'])) {
        foreach ($config['staticroutes']['route'] as $route) {
            if ($route['gateway'] == $a_gateways[$id]['name']) {
                $input_errors[] = sprintf(gettext("Gateway '%s' cannot be deleted because it is in use on Static Route '%s'"), $a_gateways[$id]['name'], $route['network']);
                break;
            }
        }
    }
    if (isset($input_errors) && count($input_errors) > 0) {
        return false;
    }
    return true;
}
Пример #21
0
 function getOptionsSupported()
 {
     $configs_zenpage = getTinyMCE4ConfigFiles('zenpage');
     $configs_zenphoto = getTinyMCE4ConfigFiles('zenphoto');
     $options = array(gettext('Text editor configuration - Zenphoto') => array('key' => 'tinymce4_zenphoto', 'type' => OPTION_TYPE_SELECTOR, 'order' => 0, 'selections' => $configs_zenphoto, 'null_selection' => gettext('Disabled'), 'desc' => gettext('Applies to <em>admin</em> editable text other than for Zenpage pages and news articles.')), gettext('Text editor configuration - Zenpage') => array('key' => 'tinymce4_zenpage', 'type' => OPTION_TYPE_SELECTOR, 'order' => 0, 'selections' => $configs_zenpage, 'null_selection' => gettext('Disabled'), 'desc' => gettext('Applies to editing on the Zenpage <em>pages</em> and <em>news</em> tabs.')), gettext('Custom image size') => array('key' => 'tinymce_tinyzenpage_customimagesize', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext("Predefined size (px) for custom size images included using tinyZenpage.")), gettext('Custom image size') => array('key' => 'tinymce_tinyzenpage_customimagesize', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext("Predefined size (px) for custom size images included using tinyZenpage.")), gettext('Custom thumb crop - size') => array('key' => 'tinymce_tinyzenpage_customthumb_size', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext("Predefined size (px) for custom cropped thumb images included using tinyZenpage.")), gettext('Custom thumb crop - width') => array('key' => 'tinymce_tinyzenpage_customthumb_cropwidth', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext("Predefined crop width (%) for custom cropped thumb  images included using tinyZenpage.")), gettext('Custom thumb crop - height') => array('key' => 'tinymce_tinyzenpage_customthumb_cropheight', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext("Predefined crop height (%) for custom cropped thumb images included using tinyZenpage.")));
     return $options;
 }
Пример #22
0
function stat_block($summary, $stat, $num)
{
    global $g, $gotlines, $fields;
    uasort($summary[$stat], 'cmp');
    print "<table width=\"200\" cellpadding=\"3\" cellspacing=\"0\" border=\"1\" summary=\"source destination ip\">";
    print "<tr><th colspan=\"2\">{$fields[$stat]} " . gettext("data") . "</th></tr>";
    $k = array_keys($summary[$stat]);
    $total = 0;
    $numentries = 0;
    for ($i = 0; $i < $num; $i++) {
        if ($k[$i]) {
            $total += $summary[$stat][$k[$i]];
            $numentries++;
            $outstr = $k[$i];
            if (is_ipaddr($outstr)) {
                $outstr = "<a href=\"diag_dns.php?host={$outstr}\" title=\"" . gettext("Reverse Resolve with DNS") . "\"><img border=\"0\" src=\"/themes/{$g['theme']}/images/icons/icon_log.gif\" alt=\"log\" /></a> {$outstr}";
            } elseif (substr_count($outstr, '/') == 1) {
                list($proto, $port) = explode('/', $outstr);
                $service = getservbyport($port, strtolower($proto));
                if ($service) {
                    $outstr .= ": {$service}";
                }
            }
            print "<tr><td>{$outstr}</td><td width=\"50\" align=\"right\">{$summary[$stat][$k[$i]]}</td></tr>";
        }
    }
    $leftover = $gotlines - $total;
    if ($leftover > 0) {
        print "<tr><td>Other</td><td width=\"50\" align=\"right\">{$leftover}</td></tr>";
    }
    print "</table>";
}
Пример #23
0
 function handleOption($option, $currentValue)
 {
     if ($option == "zenpage_homepage") {
         $unpublishedpages = query_full_array("SELECT titlelink FROM " . prefix('pages') . " WHERE `show` != 1 ORDER by `sort_order`");
         if (empty($unpublishedpages)) {
             echo gettext("No unpublished pages available");
             // clear option if no unpublished pages are available or have been published meanwhile
             // so that the normal gallery index appears and no page is accidentally set if set to unpublished again.
             setOption("zenpage_homepage", "none", true);
         } else {
             echo '<input type="hidden" name="' . CUSTOM_OPTION_PREFIX . 'selector-zenpage_homepage" value="0" />' . "\n";
             echo '<select id="' . $option . '" name="zenpage_homepage">' . "\n";
             if ($currentValue === "none") {
                 $selected = " selected = 'selected'";
             } else {
                 $selected = "";
             }
             echo "<option{$selected}>" . gettext("none") . "</option>";
             foreach ($unpublishedpages as $page) {
                 if ($currentValue === $page["titlelink"]) {
                     $selected = " selected = 'selected'";
                 } else {
                     $selected = "";
                 }
                 echo "<option{$selected}>" . $page["titlelink"] . "</option>";
             }
             echo "</select>\n";
         }
     }
 }
Пример #24
0
function create_cmd_output(&$action, &$a_mount, &$fullname)
{
    $cmdout = CMDOUT_PARA_WOHINT;
    ob_end_flush();
    $retvalue = <<<EOD
{$cmdout}

EOD;
    /* Get the id of the mount array entry. */
    $id = array_search_ex($fullname, $a_mount, "fullname");
    /* Get the mount data. */
    $mount = $a_mount[$id];
    switch ($action) {
        case "mount":
            $diskinit_str = gettext("Mounting '{$fullname}'...") . "<br />";
            $result = disks_mount_fullname($fullname);
            break;
        case "umount":
            $diskinit_str = gettext("Umounting '{$fullname}'...") . "<br />";
            $result = disks_umount_fullname($fullname);
            break;
    }
    /* Display result */
    0 == $result ? $diskinit_str .= gettext("Successful") : ($diskinit_str .= gettext("Failed"));
    $retvalue .= <<<EOD
              <div id="ismounted_out" style="font-family: Courier, monospace; font-size: small;">
              <pre style="font-family: Courier, monospace; font-size: small; font-style: italic;">{$diskinit_str}</pre>
              </div>

EOD;
    return $retvalue;
}
Пример #25
0
/**
 * Execute a given sql command string
 *
 * Completely general function - it just runs some SQL and reports success.
 *
 * @uses $db
 * @param string $command The sql string you wish to be executed.
 * @param bool $feedback Set this argument to true if the results generated should be printed. Default is true.
 * @return string
 */
function execute_sql($command, $feedback = true)
{
    /// Completely general function - it just runs some SQL and reports success.
    global $db, $CFG;
    $olddebug = $db->debug;
    if (!$feedback) {
        $db->debug = false;
    }
    if (defined('ELGG_PERFDB')) {
        global $PERF;
        $PERF->dbqueries++;
    }
    $result = $db->Execute($command);
    $db->debug = $olddebug;
    if ($result) {
        if ($feedback) {
            notify(gettext('Success'), 'notifysuccess');
        }
        return true;
    } else {
        if ($feedback) {
            echo '<p><span class="error">' . gettext('Error') . '</span></p>';
        }
        if (!empty($CFG->dblogerror)) {
            $debug = debug_backtrace();
            foreach ($debug as $d) {
                if (strpos($d['file'], 'datalib') === false) {
                    error_log("SQL " . $db->ErrorMsg() . " in {$d['file']} on line {$d['line']}. STATEMENT:  {$command}");
                    break;
                }
            }
        }
        return false;
    }
}
Пример #26
0
 static function admin_tabs($tabs)
 {
     global $_zp_current_admin_obj;
     if (zp_loggedin(ADMIN_RIGHTS) && $_zp_current_admin_obj->getID()) {
         if (isset($tabs['users']['subtabs'])) {
             $subtabs = $tabs['users']['subtabs'];
         } else {
             $subtabs = array(gettext('users') => 'admin-users.php?page=users&tab=users');
         }
         $subtabs[gettext("access")] = PLUGIN_FOLDER . '/accessThreshold/admin_tab.php?page=users&tab=access';
         ksort($subtabs, SORT_LOCALE_STRING);
         $tabs['users'] = array('text' => gettext("admin"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-users.php?page=users&tab=users', 'subtabs' => $subtabs, 'default' => 'users');
     }
     return $tabs;
     if (zp_loggedin(ADMIN_RIGHTS)) {
         if (!isset($tabs['development'])) {
             $tabs['development'] = array('text' => gettext("development"), 'subtabs' => NULL);
         }
         $tabs['development']['subtabs'][gettext("accessThreshold")] = PLUGIN_FOLDER . '/accessThreshold/admin_tab.php?page=development&tab=accessThreshold';
         $named = array_flip($tabs['development']['subtabs']);
         natcasesort($named);
         $tabs['development']['subtabs'] = $named = array_flip($named);
         $link = array_shift($named);
         if (strpos($link, '/') !== 0) {
             // zp_core relative
             $tabs['development']['link'] = WEBPATH . '/' . ZENFOLDER . '/' . $link;
         } else {
             $tabs['development']['link'] = WEBPATH . $link;
         }
     }
     return $tabs;
 }
Пример #27
0
function CreateAG($db, $ag_name, $ag_desc)
{
    $sql = "INSERT INTO acid_ag (ag_name, ag_desc) VALUES ('" . $ag_name . "','" . $ag_desc . "');";
    $db->baseExecute($sql, -1, -1, false);
    if ($db->baseErrorMessage() != "") {
        FatalError(gettext("Error Inserting new AG"));
    }
    $ag_id = $db->baseInsertID();
    /* The following code is a kludge and can cause errors.  Since it is not possible
     * to determine the last insert ID of the AG, we requery the DB to ascertain the ID
     * by matching on the ag_name and ag_desc.  -- rdd (1/23/2001)
     *
     * Modified code to only run the kludge if the dbtype is postgres.  Created a function
     * to use the actual insertid function if available and return -1 if no -- srh (02/01/2001)
     *
     * Transaction support is neccessary to get this absolutely correct, because using
     * an insert_id might break in a multi-user environment.  -- rdd (02/07/2001)
     */
    if ($ag_id == -1) {
        $tmp_sql = "SELECT ag_id FROM acid_ag WHERE ag_name='" . $ag_name . "' AND " . "ag_desc='" . $ag_desc . "'";
        if ($db->DB_type == "mssql") {
            $tmp_sql = "SELECT ag_id FROM acid_ag WHERE ag_name='" . $ag_name . "' AND " . "ag_desc LIKE '" . MssqlKludgeValue($ag_desc) . "'";
        }
        $tmp_result = $db->baseExecute($tmp_sql);
        $myrow = $tmp_result->baseFetchRow();
        $ag_id = $myrow[0];
        $tmp_result->baseFreeRows();
    }
    return $ag_id;
}
 protected function doDisplay(array $context, array $blocks = array())
 {
     // line 1
     $context['_parent'] = $context;
     $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["relatorio"]) ? $context["relatorio"] : null, "dados", array()));
     foreach ($context['_seq'] as $context["_key"] => $context["dado"]) {
         // line 2
         echo "<div class=\"header\">\n    <h2>";
         // line 3
         echo twig_escape_filter($this->env, $this->getAttribute($context["dado"], "cargo", array()), "html", null, true);
         echo "</h2>\n</div>\n<table class=\"table table-striped\">\n    <thead>\n        <tr>\n            <th>";
         // line 8
         echo gettext("Módulos");
         echo "</th>\n        </tr>\n    </thead>\n    <tbody>\n        ";
         // line 12
         $context['_parent'] = $context;
         $context['_seq'] = twig_ensure_traversable($this->getAttribute($context["dado"], "permissoes", array()));
         foreach ($context['_seq'] as $context["_key"] => $context["permissao"]) {
             // line 13
             echo "        <tr>\n            <td>";
             // line 14
             echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute($context["permissao"], "modulo", array()), "nome", array()), "html", null, true);
             echo "</td>\n        </tr>\n        ";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['permissao'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 17
         echo "    </tbody>\n</table>\n";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['_key'], $context['dado'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
 }
Пример #29
0
function gettext_with_context($translated_text, $text, $context, $domain)
{
    if ($domain == 'pressbooks') {
        $translated_text = gettext($translated_text, $text, $domain);
    }
    return $translated_text;
}
Пример #30
0
 function getOptionsSupported()
 {
     $MapTypes = array();
     // order matters here because the first allowed map is selected if the 'gmaps_starting_map' is not allowed
     if (getOption('gmaps_maptype_map')) {
         $MapTypes[gettext('Map')] = 'G_NORMAL_MAP';
     }
     if (getOption('gmaps_maptype_hyb')) {
         $MapTypes[gettext('Hybrid')] = 'G_HYBRID_MAP';
     }
     if (getOption('gmaps_maptype_sat')) {
         $MapTypes[gettext('Satellite')] = 'G_SATELLITE_MAP';
     }
     if (getOption('gmaps_maptype_P')) {
         $MapTypes[gettext('Terrain')] = 'G_PHYSICAL_MAP';
     }
     if (getOption('gmaps_maptype_3D')) {
         $MapTypes[gettext('Google Earth')] = 'G_SATELLITE_3D_MAP';
     }
     $defaultmap = getOption('gmaps_starting_map');
     if (array_search($defaultmap, $MapTypes) === false) {
         // the starting map is not allowed, pick a new one
         $temp = $MapTypes;
         $defaultmap = array_shift($temp);
         setOption('gmaps_starting_map', $defaultmap);
     }
     return array(gettext('Google Maps API key') => array('key' => 'gmaps_apikey', 'type' => 0, 'desc' => gettext('If you are going to be using Google Maps, <a	href="http://www.google.com/apis/maps/signup.html" target="_blank">get an API key</a> and enter it here.')), gettext('All album points') => array('key' => 'gmaps_show_all_album_points', 'type' => 1, 'desc' => gettext('Controls which image points are shown on an album page. Check to show points for all images in the album. If not checked points are shown only for those images whose thumbs are on the page.')), gettext('Map dimensions—width') => array('key' => 'gmaps_width', 'type' => 0, 'desc' => gettext('The default width of the map.')), gettext('Map dimensions—height') => array('key' => 'gmaps_height', 'type' => 0, 'desc' => gettext('The default height of the map.')), gettext('Allowed maps') => array('key' => 'gmaps_allowed_maps', 'type' => 6, 'checkboxes' => array(gettext('Map') => 'gmaps_maptype_map', gettext('Satellite') => 'gmaps_maptype_sat', gettext('Hybrid') => 'gmaps_maptype_hyb', gettext('Terrain') => 'gmaps_maptype_P', gettext('Google Earth') => 'gmaps_maptype_3D'), 'desc' => gettext('Select the map types that are allowed.')), gettext('Map type selector') => array('key' => 'gmaps_control_maptype', 'type' => 4, 'buttons' => array(gettext('Buttons') => 1, gettext('List') => 2), 'desc' => gettext('Use buttons or list for the map type selector.')), gettext('Map controls') => array('key' => 'gmaps_control', 'type' => 4, 'buttons' => array(gettext('None') => 'None', gettext('Small') => 'Small', gettext('Large') => 'Large'), 'desc' => gettext('Select the kind of map controls.')), gettext('Map background') => array('key' => 'gmaps_background', 'type' => 0, 'desc' => gettext('Set the map background color to match the one of your theme. (Use the same <em>color</em> values as in your CSS background statements.)')), gettext('Initial map display selection') => array('key' => 'gmaps_starting_map', 'type' => 5, 'selections' => $MapTypes, 'desc' => gettext('Select the initial type of map to display. <br /><strong>Note:</strong> If <code>Google Earth</code> is selected the <em>toggle</em> function which initially hides the map is ignored. The browser <em>Google Earth Plugin</em> does not initialize properly when the map is hidden.')));
 }