Ejemplo n.º 1
0
 function outputPlain($class)
 {
     $message = false;
     for ($i = 0, $n = sizeof($this->messages); $i < $n; $i++) {
         if ($this->messages[$i]['class'] == $class) {
             $message = osc_output_string($this->messages[$i]['message']);
             break;
         }
     }
     return $message;
 }
Ejemplo n.º 2
0
function osc_draw_select_menu($name, $values, $default = null, $parameters = null)
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS;
    $group = false;
    if (isset($HTTP_GET_VARS[$name])) {
        $default = $HTTP_GET_VARS[$name];
    } elseif (isset($HTTP_POST_VARS[$name])) {
        $default = $HTTP_POST_VARS[$name];
    }
    $field = '<select name="' . osc_output_string($name) . '"';
    if (strpos($parameters, 'id=') === false) {
        $field .= ' id="' . osc_output_string($name) . '"';
    }
    if (!empty($parameters)) {
        $field .= ' ' . $parameters;
    }
    $field .= '>';
    for ($i = 0, $n = count($values); $i < $n; $i++) {
        if (isset($values[$i]['group'])) {
            if ($group != $values[$i]['group']) {
                $group = $values[$i]['group'];
                $field .= '<optgroup label="' . osc_output_string($values[$i]['group']) . '">';
            }
        }
        $field .= '<option value="' . osc_output_string($values[$i]['id']) . '"';
        if (isset($default) && (!is_array($default) && (string) $default == (string) $values[$i]['id'] || is_array($default) && in_array($values[$i]['id'], $default))) {
            $field .= ' selected="selected"';
        }
        if (isset($values[$i]['params'])) {
            $field .= ' ' . $values[$i]['params'];
        }
        $field .= '>' . osc_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</option>';
        if ($group !== false && ($group != $values[$i]['group'] || !isset($values[$i + 1]))) {
            $group = false;
            $field .= '</optgroup>';
        }
    }
    $field .= '</select>';
    return $field;
}
Ejemplo n.º 3
0
function osc_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null, $class = null)
{
    static $button_counter = 1;
    $types = array('submit', 'button', 'reset');
    if (!isset($params['type'])) {
        $params['type'] = 'submit';
    }
    if (!in_array($params['type'], $types)) {
        $params['type'] = 'submit';
    }
    if ($params['type'] == 'submit' && isset($link)) {
        $params['type'] = 'button';
    }
    if (!isset($priority)) {
        $priority = 'secondary';
    }
    $button = '';
    if ($params['type'] == 'button' && isset($link)) {
        $button .= '<a id="tdb' . $button_counter . '" href="' . $link . '"';
        if (isset($params['newwindow'])) {
            $button .= ' target="_blank"';
        }
    } else {
        $button .= '<button id="tdb' . $button_counter . '" type="' . osc_output_string($params['type']) . '"';
    }
    if (isset($params['params'])) {
        $button .= ' ' . $params['params'];
    }
    $button .= ' class="btn ';
    $button .= isset($class) ? $class : 'btn-default';
    $button .= '"';
    $button .= '>' . $title;
    if ($params['type'] == 'button' && isset($link)) {
        $button .= '</a>';
    } else {
        $button .= '</button>';
    }
    $button .= '<script>$("#tdb' . $button_counter . '").button(';
    $args = array();
    if (isset($icon)) {
        if (!isset($params['iconpos'])) {
            $params['iconpos'] = 'left';
        }
        if ($params['iconpos'] == 'left') {
            $args[] = 'icons:{primary:"ui-icon-' . $icon . '"}';
        } else {
            $args[] = 'icons:{secondary:"ui-icon-' . $icon . '"}';
        }
    }
    if (empty($title)) {
        $args[] = 'text:false';
    }
    if (!empty($args)) {
        $button .= '{' . implode(',', $args) . '}';
    }
    $button .= ').addClass("ui-priority-' . $priority . '");</script>';
    $button_counter++;
    return $button;
}
Ejemplo n.º 4
0
function osc_draw_button($params)
{
    static $button_counter = 1;
    $types = array('submit', 'button', 'reset');
    if (!isset($params['type'])) {
        $params['type'] = 'submit';
    }
    if (!in_array($params['type'], $types)) {
        $params['type'] = 'submit';
    }
    if ($params['type'] == 'submit' && isset($params['href'])) {
        $params['type'] = 'button';
    }
    $button = '<button id="button' . $button_counter . '" type="' . osc_output_string($params['type']) . '"';
    if (isset($params['href'])) {
        if (isset($params['newwindow'])) {
            $button .= ' onclick="window.open(\'' . $params['href'] . '\');"';
        } else {
            $button .= ' onclick="document.location.href=\'' . $params['href'] . '\';"';
        }
    }
    if (isset($params['params'])) {
        $button .= ' ' . $params['params'];
    }
    $button .= '>' . $params['title'] . '</button><script>$("#button' . $button_counter . '").button(';
    if (isset($params['icon'])) {
        if (!isset($params['iconpos'])) {
            $params['iconpos'] = 'left';
        }
        if ($params['iconpos'] == 'left') {
            $button .= '{icons:{primary:"ui-icon-' . $params['icon'] . '"}}';
        } else {
            $button .= '{icons:{secondary:"ui-icon-' . $params['icon'] . '"}}';
        }
    }
    $button .= ')';
    if (isset($params['priority'])) {
        $button .= '.addClass("ui-priority-' . $params['priority'] . '")';
    }
    $button .= ';</script>';
    $button_counter++;
    return $button;
}
Ejemplo n.º 5
0
function osc_draw_button($params)
{
    $types = array('submit', 'button', 'reset');
    if (!isset($params['type'])) {
        $params['type'] = 'submit';
    }
    if (!in_array($params['type'], $types)) {
        $params['type'] = 'submit';
    }
    if ($params['type'] == 'submit' && isset($params['href'])) {
        $params['type'] = 'button';
    }
    $class = 'fg-button';
    if (isset($params['radius'])) {
        if ($params['radius'] == 'left') {
            $class = 'fg-button-left';
        } elseif ($params['radius'] == 'right') {
            $class = 'fg-button-right';
        }
    }
    $button = '<button type="' . osc_output_string($params['type']) . '"';
    if (isset($params['href'])) {
        $button .= ' onclick="document.location.href=\'' . $params['href'] . '\';"';
    }
    $button .= ' class="' . $class . '';
    if (isset($params['icon'])) {
        if (!isset($params['iconpos'])) {
            $params['iconpos'] = 'left';
        }
        $button .= ' fg-button-icon-' . $params['iconpos'];
    }
    if (isset($params['priority'])) {
        $button .= ' ui-priority-' . $params['priority'];
    }
    $button .= ' ui-state-default"';
    if (isset($params['params'])) {
        $button .= ' ' . $params['params'];
    }
    $button .= '>';
    if (isset($params['icon'])) {
        $button .= '<span class="ui-icon ui-icon-' . $params['icon'] . '"></span>';
    }
    $button .= $params['title'] . '</button>';
    return $button;
}
Ejemplo n.º 6
0
/**
 * Outputs a label for form field elements
 *
 * @param string $text The text to use as the form field label
 * @param string $for The ID of the form field element to assign the label to
 * @param string $access_key The access key to use for the form field element
 * @param bool $required A flag to show if the form field element requires input or not
 * @access public
 */
function osc_draw_label($text, $for, $access_key = null, $required = false)
{
    if (!is_bool($required)) {
        $required = false;
    }
    return '<label' . (!empty($for) ? ' for="' . osc_output_string($for) . '"' : '') . (!empty($access_key) ? ' accesskey="' . osc_output_string($access_key) . '"' : '') . '>' . osc_output_string($text) . ($required === true ? '<em>*</em>' : '') . '</label>';
}
Ejemplo n.º 7
0
 /**
  * Get the messages belonging to a group. The messages are separated by a new
  * line character.
  *
  * @param string $group The name of the group to get the messages from
  * @access public
  */
 public function getRaw($group)
 {
     $result = false;
     if ($this->exists($group)) {
         $result = '';
         foreach ($this->_data[$group] as $message) {
             $result .= osc_output_string($message['text']) . "\n";
         }
         unset($this->_data[$group]);
     }
     return $result;
 }
Ejemplo n.º 8
0
 /**
  * Return an internal URL address.
  *
  * @param string $site The Site to link to. Default: The currently used Site.
  * @param string $application The Site Application to link to. Default: The currently used Site Application.
  * @param string $parameters Parameters to add to the link. Example: key1=value1&key2=value2
  * @param string $connection The type of connection to use for the link. Values: NONSSL, SSL, AUTO. Default: NONSSL.
  * @param bool $add_session_id Add the session ID to the link. Default: True.
  * @param bool $search_engine_safe Use search engine safe URLs. Default: True.
  * @return string The URL address.
  */
 public static function getLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
 {
     if (empty($site)) {
         $site = self::getSite();
     }
     if (empty($application) && $site == self::getSite()) {
         $application = self::getSiteApplication();
     }
     if (!in_array($connection, array('NONSSL', 'SSL', 'AUTO'))) {
         $connection = 'NONSSL';
     }
     if (!is_bool($add_session_id)) {
         $add_session_id = true;
     }
     if (!is_bool($search_engine_safe)) {
         $search_engine_safe = true;
     }
     if ($connection == 'AUTO') {
         if (self::getRequestType() == 'SSL' && ENABLE_SSL === true) {
             $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
         } else {
             $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
         }
     } elseif ($connection == 'SSL' && ENABLE_SSL === true) {
         $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
     } else {
         $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
     }
     $link .= OSCOM_BOOTSTRAP_FILE . '?';
     if ($site != self::getDefaultSite()) {
         $link .= $site . '&';
     }
     if (!empty($application)) {
         $link .= $application . '&';
     }
     if (!empty($parameters)) {
         $link .= $parameters . '&';
     }
     if ($add_session_id === true && Registry::exists('Session') && Registry::get('Session')->hasStarted() && SERVICE_SESSION_FORCE_COOKIE_USAGE == '-1') {
         if (strlen(SID) > 0) {
             $_sid = SID;
         } elseif (self::getRequestType() == 'NONSSL' && $connection == 'SSL' && ENABLE_SSL === true || self::getRequestType() == 'SSL' && $connection != 'SSL') {
             if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
                 $_sid = Registry::get('Session')->getName() . '=' . Registry::get('Session')->getID();
             }
         }
     }
     if (isset($_sid)) {
         $link .= osc_output_string($_sid);
     }
     while (substr($link, -1) == '&' || substr($link, -1) == '?') {
         $link = substr($link, 0, -1);
     }
     if ($search_engine_safe === true && Registry::exists('osC_Services') && Registry::get('osC_Services')->isStarted('sefu')) {
         $link = str_replace(array('?', '&', '='), array('/', '/', ','), $link);
     }
     return $link;
 }
Ejemplo n.º 9
0
 /**
  * Get the messages belonging to a group. The messages are separated by a new
  * line character.
  *
  * @param string $group The name of the group to get the messages from
  * @access public
  */
 public function getRaw($group = null)
 {
     if (empty($group)) {
         $group = OSCOM::getSiteApplication();
     }
     $result = false;
     if ($this->exists($group)) {
         $result = '';
         foreach ($this->_data[$group] as $message) {
             $result .= osc_output_string($message['text']) . "\n";
         }
         unset($this->_data[$group]);
     }
     return $result;
 }