function smn_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false)
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS;
    $field = '<select name="' . smn_output_string($name) . '"';
    if (smn_not_null($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    if (empty($default) && (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name]) || isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name]))) {
        if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {
            $default = stripslashes($HTTP_GET_VARS[$name]);
        } elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {
            $default = stripslashes($HTTP_POST_VARS[$name]);
        }
    }
    for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
        $field .= '<option value="' . smn_output_string($values[$i]['id']) . '"';
        if ($default == $values[$i]['id']) {
            $field .= ' SELECTED';
        }
        $field .= '>' . smn_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</option>';
    }
    $field .= '</select>';
    if ($required == true) {
        $field .= TEXT_FIELD_REQUIRED;
    }
    return $field;
}
Example #2
0
function smn_output_string_protected($string)
{
    return smn_output_string($string, false, true);
}
Example #3
0
function smn_create_sort_heading($sortby, $colnum, $heading)
{
    global $PHP_SELF;
    $sort_prefix = '';
    $sort_suffix = '';
    if ($sortby) {
        $sort_prefix = '<a href="' . smn_href_link(basename($PHP_SELF), smn_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=' . $colnum . ($sortby == $colnum . 'a' ? 'd' : 'a')) . '" title="' . smn_output_string(TEXT_SORT_PRODUCTS . ($sortby == $colnum . 'd' || substr($sortby, 0, 1) != $colnum ? TEXT_ASCENDINGLY : TEXT_DESCENDINGLY) . TEXT_BY . $heading) . '" class="productListing-heading">';
        $sort_suffix = (substr($sortby, 0, 1) == $colnum ? substr($sortby, 1, 1) == 'a' ? '+' : '-' : '') . '</a>';
    }
    return $sort_prefix . $heading . $sort_suffix;
}
Example #4
0
 function tableBox($contents, $direct_output = false)
 {
     $tableBox_string = '<table border="' . smn_output_string($this->table_border) . '" width="' . smn_output_string($this->table_width) . '" cellspacing="' . smn_output_string($this->table_cellspacing) . '" cellpadding="' . smn_output_string($this->table_cellpadding) . '"';
     if (smn_not_null($this->table_parameters)) {
         $tableBox_string .= ' ' . $this->table_parameters;
     }
     $tableBox_string .= '>' . "\n";
     for ($i = 0, $n = sizeof($contents); $i < $n; $i++) {
         if (isset($contents[$i]['form']) && smn_not_null($contents[$i]['form'])) {
             $tableBox_string .= $contents[$i]['form'] . "\n";
         }
         $tableBox_string .= '  <tr';
         if (smn_not_null($this->table_row_parameters)) {
             $tableBox_string .= ' ' . $this->table_row_parameters;
         }
         if (isset($contents[$i]['params']) && smn_not_null($contents[$i]['params'])) {
             $tableBox_string .= ' ' . $contents[$i]['params'];
         }
         $tableBox_string .= '>' . "\n";
         if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
             for ($x = 0, $n2 = sizeof($contents[$i]); $x < $n2; $x++) {
                 if (isset($contents[$i][$x]['text']) && smn_not_null($contents[$i][$x]['text'])) {
                     $tableBox_string .= '    <td';
                     if (isset($contents[$i][$x]['align']) && smn_not_null($contents[$i][$x]['align'])) {
                         $tableBox_string .= ' align="' . smn_output_string($contents[$i][$x]['align']) . '"';
                     }
                     if (isset($contents[$i][$x]['params']) && smn_not_null($contents[$i][$x]['params'])) {
                         $tableBox_string .= ' ' . $contents[$i][$x]['params'];
                     } elseif (smn_not_null($this->table_data_parameters)) {
                         $tableBox_string .= ' ' . $this->table_data_parameters;
                     }
                     $tableBox_string .= '>';
                     if (isset($contents[$i][$x]['form']) && smn_not_null($contents[$i][$x]['form'])) {
                         $tableBox_string .= $contents[$i][$x]['form'];
                     }
                     $tableBox_string .= $contents[$i][$x]['text'];
                     if (isset($contents[$i][$x]['form']) && smn_not_null($contents[$i][$x]['form'])) {
                         $tableBox_string .= '</form>';
                     }
                     $tableBox_string .= '</td>' . "\n";
                 }
             }
         } else {
             $tableBox_string .= '    <td';
             if (isset($contents[$i]['align']) && smn_not_null($contents[$i]['align'])) {
                 $tableBox_string .= ' align="' . smn_output_string($contents[$i]['align']) . '"';
             }
             if (isset($contents[$i]['params']) && smn_not_null($contents[$i]['params'])) {
                 $tableBox_string .= ' ' . $contents[$i]['params'];
             } elseif (smn_not_null($this->table_data_parameters)) {
                 $tableBox_string .= ' ' . $this->table_data_parameters;
             }
             $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
         }
         $tableBox_string .= '  </tr>' . "\n";
         if (isset($contents[$i]['form']) && smn_not_null($contents[$i]['form'])) {
             $tableBox_string .= '</form>' . "\n";
         }
     }
     $tableBox_string .= '</table>' . "\n";
     if ($direct_output == true) {
         echo $tableBox_string;
     }
     return $tableBox_string;
 }