コード例 #1
0
 /**
  * Clears the output buffer, sends a http status code and a content if given
  * @static 
  * @param int $http_status
  * @param string $mime_type
  * @param string $content
  */
 function sendHeaderAndContent($http_status = 200, $content = '', $mime_type = 'text/html')
 {
     // Clear all Joomla header and buffer stuff
     while (@ob_end_clean()) {
     }
     $http_status = intval($http_status);
     @header("HTTP/1.0 {$http_status}");
     if ($mime_type) {
         @header("Content-type: {$mime_type}; charset=" . vmGetCharset());
     } elseif ($mime_type != '') {
         @header("Content-type: text/html; charset=" . vmGetCharset());
     }
     if ($content) {
         echo $content;
     }
 }
コード例 #2
0
ファイル: ps_main.php プロジェクト: BackupTheBerlios/kmit-svn
/**
* Function to create an email object for further use (uses phpMailer)
* @param string From e-mail address
* @param string From name
* @param string E-mail subject
* @param string Message body
* @return phpMailer Mail object
*/
function vmCreateMail($from = '', $fromname = '', $subject = '', $body = '')
{
    global $mosConfig_absolute_path, $mosConfig_sendmail;
    global $mosConfig_smtpauth, $mosConfig_smtpuser;
    global $mosConfig_smtppass, $mosConfig_smtphost;
    global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailer;
    $phpmailer_classname = 'phpmailer';
    if (file_exists($mosConfig_absolute_path . '/libraries/phpmailer/phpmailer.php')) {
        $phpmailer_path = $mosConfig_absolute_path . '/libraries/phpmailer/phpmailer.php';
    } elseif (file_exists($mosConfig_absolute_path . '/includes/phpmailer/class.phpmailer.php')) {
        $phpmailer_path = $mosConfig_absolute_path . '/includes/phpmailer/class.phpmailer.php';
        $phpmailer_classname = 'mosphpmailer';
    }
    require_once $phpmailer_path;
    if (class_exists($phpmailer_classname)) {
        $mail = new $phpmailer_classname();
    }
    $phpmailer_path = dirname($phpmailer_path);
    $mail->PluginDir = $phpmailer_path . '/';
    $mail->SetLanguage('en', $phpmailer_path . '/language/');
    $mail->CharSet = vmGetCharset();
    $mail->IsMail();
    $mail->From = $from ? $from : $mosConfig_mailfrom;
    $mail->FromName = $fromname ? $fromname : $mosConfig_fromname;
    $mail->Sender = $from ? $from : $mosConfig_mailfrom;
    $mail->Mailer = $mosConfig_mailer;
    // Add smtp values if needed
    if ($mosConfig_mailer == 'smtp') {
        $mail->SMTPAuth = $mosConfig_smtpauth;
        $mail->Username = $mosConfig_smtpuser;
        $mail->Password = $mosConfig_smtppass;
        $mail->Host = $mosConfig_smtphost;
    } else {
        // Set sendmail path
        if ($mosConfig_mailer == 'sendmail') {
            if (isset($mosConfig_sendmail)) {
                $mail->Sendmail = $mosConfig_sendmail;
            }
        }
    }
    // if
    if ($subject) {
        $mail->Subject = vmAbstractLanguage::safe_utf8_encode($subject, $mail->CharSet);
    }
    if ($body) {
        $mail->Body = $body;
    }
    // Patch to get correct Line Endings
    switch (substr(strtoupper(PHP_OS), 0, 3)) {
        case "WIN":
            $mail->LE = "\r\n";
            break;
        case "MAC":
            // Mac OS9
            $mail->LE = "\r";
            break;
        case "DAR":
            // Mac OSX
        // Mac OSX
        default:
            // change nothing
            break;
    }
    return $mail;
}
コード例 #3
0
// so: for the rest of this module track if this menu contains the selected item
// Default value: first node (=baseid), but not selected
$opento = $baseid;
$opento_selected = "false";
// what do you know... the first node was selected
if ($baseid == $openid) {
    $opento_selected = "true";
}
$target = "";
// create the first node, parent is always -1
$menu_htmlcode .= "{$tree}.add(\"{$baseid}\",\"-1\",\"{$basename}\",\"{$baselink}\",\"\",\"{$target}\");\n";
$db->reset();
// process each of the nodes
while ($db->next_record()) {
    // get name and link (just to save space in the code later on)
    $name = htmlentities($db->f("category_name"), ENT_QUOTES, vmGetCharset()) . ps_product_category::products_in_category($db->f("category_id"));
    $url = $sess->url($mm_action_url . "index.php?page=shop.browse&category_id=" . $db->f("category_id"));
    $menu_htmlcode .= "{$tree}.add(\"" . $db->f("category_id") . "\",\"" . $db->f("category_parent_id") . "\",\"{$name}\",\"{$url}\",\"\",\"{$target}\");\n";
    // if this node is the selected node
    if ($db->f("category_id") == $openid) {
        $opento = $openid;
        $opento_selected = "true";
    }
}
$menu_htmlcode .= "document.write({$tree});\n";
$menu_htmlcode .= $openAll == "true" ? "{$tree}.openAll();\n" : "{$tree}.closeAll();\n";
$menu_htmlcode .= "{$tree}.openTo(\"{$opento}\",\"{$opento_selected}\");\n";
$menu_htmlcode .= "</script>\n";
$menu_htmlcode .= "<noscript>\n";
$menu_htmlcode .= $ps_product_category->get_category_tree($category_id, $class_mainlevel);
$menu_htmlcode .= "</noscript>\n";
コード例 #4
0
 /**
  * This checks if attributes values were chosen by the user
  * onCartAdd
  *
  * @param array $d
  * @return array $result
  */
 function cartGetAttributes(&$d)
 {
     global $db;
     // added for the advanced attributes modification
     //get listing of titles for attributes (Sean Tobin)
     $attributes = array();
     if (!isset($d["prod_id"])) {
         $d["prod_id"] = $d["product_id"];
     }
     $q = "SELECT product_id, attribute, custom_attribute FROM #__{vm}_product WHERE product_id='" . (int) $d["prod_id"] . "'";
     $db->query($q);
     $db->next_record();
     if (!$db->f("attribute") && !$db->f("custom_attribute")) {
         $q = "SELECT product_parent_id FROM #__{vm}_product WHERE product_id='" . (int) $d["prod_id"] . "'";
         $db->query($q);
         $db->next_record();
         $q = "SELECT product_id, attribute, custom_attribute FROM #__{vm}_product WHERE product_id='" . $db->f("product_parent_id") . "'";
         $db->query($q);
         $db->next_record();
     }
     $advanced_attribute_list = $db->f("attribute");
     if ($advanced_attribute_list) {
         $fields = explode(";", $advanced_attribute_list);
         foreach ($fields as $field) {
             $field = trim($field);
             $base = explode(",", $field);
             $title = array_shift($base);
             array_push($attributes, $title);
         }
     }
     // We need this for being able to work with attribute names and values which are using non-ASCII characters
     if (strtolower(vmGetCharset()) != 'utf-8') {
         $encodefunc = 'utf8_encode';
         $decodefunc = 'utf8_decode';
     } else {
         $encodefunc = 'strval';
         $decodefunc = 'strval';
     }
     $description = "";
     $attribute_given = false;
     // Loop through the simple attributes and check if one of the valid values has been provided
     foreach ($attributes as $a) {
         $pagevar = str_replace(" ", "_", $a);
         $pagevar .= $d['prod_id'];
         $pagevar = $encodefunc($pagevar);
         if (!empty($d[$pagevar])) {
             $attribute_given = true;
         }
         if ($description != '') {
             $description .= "; ";
         }
         $description .= $a . ":";
         $description .= empty($d[$pagevar]) ? '' : $decodefunc($d[$pagevar]);
     }
     rtrim($description);
     $d["description"] = $description;
     // end advanced attributes modification addition
     $custom_attribute_list = $db->f("custom_attribute");
     $custom_attribute_given = false;
     // Loop through the custom attribute list and check if a value has been provided
     if ($custom_attribute_list) {
         $fields = explode(";", $custom_attribute_list);
         $description = $d["description"];
         foreach ($fields as $field) {
             $pagevar = str_replace(" ", "_", $field);
             $pagevar .= $d['prod_id'];
             $pagevar = $encodefunc($pagevar);
             if (!empty($d[$pagevar])) {
                 $custom_attribute_given = true;
             }
             if ($description != '') {
                 $description .= "; ";
             }
             $description .= $field . ":";
             $description .= empty($d[$pagevar]) ? '' : $decodefunc($d[$pagevar]);
         }
         rtrim($description);
         $d["description"] = $description;
         // END add for custom fields by denie van kleef
     }
     $result['attribute_given'] = $attribute_given;
     $result['advanced_attribute_list'] = $advanced_attribute_list;
     $result['custom_attribute_given'] = $custom_attribute_given;
     $result['custom_attribute_list'] = $custom_attribute_list;
     return $result;
 }
コード例 #5
0
ファイル: htmlTools.class.php プロジェクト: noikiy/owaspbwa
/**
 * Converts all special chars to html entities
 *
 * @param string $string
 * @param string $quote_style
 * @param boolean $only_special_chars Only Convert Some Special Chars ? ( <, >, &, ... )
 * @return string
 */
function shopMakeHtmlSafe($string, $quote_style = 'ENT_QUOTES', $use_entities = false)
{
    if (defined($quote_style)) {
        $quote_style = constant($quote_style);
    }
    if ($use_entities) {
        $string = @htmlentities($string, constant($quote_style), vmGetCharset());
    } else {
        $string = @htmlspecialchars($string, $quote_style, vmGetCharset());
    }
    return $string;
}
コード例 #6
0
ファイル: class.inputfilter.php プロジェクト: noikiy/owaspbwa
 /**
  * Try to convert to plaintext
  * @access protected
  * @param String $source
  * @return String $source
  */
 function decode($source)
 {
     if ($source != "") {
         //bypass php html_entity_decode bug # 21338 on systems where unable to upgrade php
         // url decode
         $source = @html_entity_decode($source, ENT_QUOTES, vmGetCharset());
         // convert decimal
         $source = preg_replace('/&#(\\d+);/me', "chr(\\1)", $source);
         // decimal notation
         // convert hex
         $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source);
         // hex notation
     }
     return $source;
 }
コード例 #7
0
}
$tpl->set('return_link', $return_link);
// Create the pathway for our template
$navigation_pathway = $tpl->fetch('common/pathway.tpl.php');
if ($ps_product_category->has_childs($category_id)) {
    $category_childs = $ps_product_category->get_child_list($category_id);
    $tpl->set('categories', $category_childs);
    $navigation_childlist = $tpl->fetch('common/categoryChildlist.tpl.php');
}
// Set Dynamic Page Title
if (function_exists('mb_substr')) {
    $page_title = mb_substr($product_name, 0, 64, vmGetCharset());
} else {
    $page_title = substr($product_name, 0, 64);
}
$vm_mainframe->setPageTitle(@html_entity_decode($page_title, ENT_QUOTES, vmGetCharset()));
// Prepend Product Short Description Meta Tag "description"
if (vmIsJoomla('1.5')) {
    $document = JFactory::getDocument();
    $document->setDescription(strip_tags($db_product->f("product_s_desc")));
} else {
    $mainframe->prependMetaTag("description", strip_tags($db_product->f("product_s_desc")));
}
// Show an "Edit PRODUCT"-Link
if ($perm->check("admin,storeadmin")) {
    $edit_link = '<a href="' . $sess->url('index2.php?page=product.product_form&next_page=shop.product_details&product_id=' . $product_id) . '">
      <img src="' . $mosConfig_live_site . '/images/M_images/edit.png" alt="' . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_EDIT_PRODUCT') . '" border="0" /></a>';
} else {
    $edit_link = "";
}
// LINK TO MANUFACTURER POP-UP
コード例 #8
0
ファイル: language.class.php プロジェクト: noikiy/owaspbwa
 /**
  * This safely converts an iso-8859 string into an utf-8 encoded
  * string. It does not convert when the string is already utf-8 encoded
  *
  * @param string $text iso-8859 encoded text
  * @param string $charset This is a k.o.-Argument. If it is NOT equal to 'utf-8', no conversion will take place
  * @return string
  */
 function safe_utf8_encode($text, $charset)
 {
     if (strtolower($charset) == 'utf-8' && !vmAbstractLanguage::seems_utf8($text)) {
         // safely decode and reencode the string
         $text = utf8_encode($text);
     }
     // This converts the currency symbol from HTML entity to the utf-8 symbol
     // example:  &euro; => €
     $text = vmHtmlEntityDecode($text, null, vmGetCharset());
     return $text;
 }