Exemple #1
1
$dir = str_replace("://localhost", "://" . $hostname, $dir);
// $dir = str_replace("%3A%2F%2Flocalhost", "://127.0.0.1", $dir);
$dir = str_replace("%3A%2F%2Flocalhost", "://" . $hostname, $dir);
// in case, removing protocol of the path (inserted manually) to permit opening corresponding dir on the server
$checkFileProtocol = substr($dir, 0, 7);
if ($checkFileProtocol == "file://") {
    $dir = str_replace("file://", "", $dir);
}
$checkFileProtocol = substr($dir, 0, 13);
if ($checkFileProtocol == "file%3A%2F%2F") {
    $dir = str_replace("file%3A%2F%2F", "", $dir);
}
global $dir3;
$dir3 = $dir;
// in case, controlling path (inserted manually)
$dir = pathToUrl($dir, $general_url, $general_path);
// in case, adding protocol
$dir = addProtocol($dir, $general_url);
// translating url to corresponding path
$pathDir = urlToPath($dir, $general_path, $general_url);
// manage working directory (inserted manually or by default)
if ($dir == "") {
    $thisDirectoryPath = $REQUEST_URI;
} else {
    $thisDirectoryPath = $pathDir;
}
// deleting double protocols
$dir = str_replace("http" . $secureHttp . "://http" . $secureHttp . "://", "http" . $secureHttp . "://", $dir);
$dir = str_replace("http" . $secureHttp . "%3A%2F%2Fhttp" . $secureHttp . "%3A%2F%2F", "http" . $secureHttp . "://", $dir);
$dir = str_replace("http" . $secureHttp . "://file://", "", $dir);
$dir = str_replace("http" . $secureHttp . "%3A%2F%2Ffile%3A%2F%2F", "", $dir);
Exemple #2
0
 function css($files, $inline = false)
 {
     // Register in header to prevent duplicates
     $registry = ClassRegistry::getObject('css');
     if (is_array($files)) {
         $out = '';
         foreach ($files as $i) {
             if (!isset($registry[$i])) {
                 $out .= "\n\t" . $this->css($i, $inline);
             }
         }
         if ($out != '' && $inline) {
             echo $out . "\n";
         }
         return;
     }
     ClassRegistry::setObject($files, 1, 'css');
     // Create minify script url
     $no_ext = str_replace(array(MVC_ADMIN . _DS, '.css', _DS), array('', '', DS), $files);
     $ThemeFolder = false !== strpos($files, MVC_ADMIN) ? 'AdminTheme' : 'Theme';
     $cssPath = $this->locateThemeFile('theme_css', $no_ext, '.css', $ThemeFolder);
     if ($cssPath) {
         $cssUrl = pathToUrl($cssPath);
         $rel = 'stylesheet';
         $out = sprintf($this->tags['css'], $rel, $cssUrl, '');
         cmsFramework::addScript($out, $inline);
     }
 }
Exemple #3
0
 function __construct(&$controller, $register = true)
 {
     if (is_object($controller)) {
         $count = count($this->__passedVars);
         for ($j = 0; $j < $count; $j++) {
             if (isset($this->__passedVars[$j]) && isset($controller->{$this->__passedVars[$j]})) {
                 $var = $this->__passedVars[$j];
                 $this->{$var} = $controller->{$var};
             }
         }
     }
     //		$inAdmin = $this->inAdmin = defined('MVC_FRAMEWORK_ADMIN') ? true : false;
     $theme = Configure::read('Theme.name', 'default');
     if (!isset($this->viewImages)) {
         $this->viewImagesPath = S2Object::locateThemeFile('.info', 'path', '') . 'theme_images' . DS;
         $this->viewImages = pathToUrl($this->viewImagesPath);
     }
     parent::__construct();
     /*		if ($register) {
     			ClassRegistry::addObject('view', $this);
     		}		*/
 }
Exemple #4
0
 function onDisplay($field, $showImage = true, $value = false, $return = false)
 {
     if (empty($field)) {
         return null;
     }
     $values = array();
     $option = $value ? 'value' : 'text';
     foreach ($field[$option] as $key => $text) {
         switch ($field['type']) {
             case 'date':
                 $format = Sanitize::getString($field['properties'], 'date_format');
                 $text = $this->Time->nice($text, $format, 0);
                 break;
             case 'integer':
                 $text = Sanitize::getInt($field['properties'], 'curr_format') ? number_format($text) : $text;
                 break;
             case 'decimal':
                 $text = Sanitize::getInt($field['properties'], 'curr_format') ? number_format($text, 2, __l('DECIMAL_SEPARATOR', true), __l('THOUSANDS_SEPARATOR', true)) : round($text, 2);
                 break;
             case 'email':
                 break;
             case 'website':
                 $text = S2ampReplace($text);
                 break;
             case 'code':
                 $text = stripslashes($text);
                 break;
             case 'textarea':
             case 'text':
                 if (!Sanitize::getBool($field['properties'], 'allow_html')) {
                     $text = nl2br($text);
                 }
                 break;
             case 'selectmultiple':
             case 'checkboxes':
             case 'select':
             case 'radiobuttons':
                 $imgSrc = '';
                 if ($showImage && isset($field['image'][$key]) && $field['image'][$key] != '') {
                     if ($imgSrc = $this->locateThemeFile('theme_images', cmsFramework::language() . '.' . $field['image'][$key], '', true)) {
                         $imgSrc = pathToUrl($imgSrc);
                     } elseif ($imgSrc = $this->locateThemeFile('theme_images', $field['image'][$key], '', true)) {
                         $imgSrc = pathToUrl($imgSrc);
                     }
                     if ($imgSrc != '') {
                         $text = '<img src="' . $imgSrc . '" title="' . $text . '" alt="' . $text . '" border="0" />';
                     }
                 }
                 break;
             default:
                 $text = stripslashes($text);
                 break;
         }
         $values[] = $text;
         $this->output[] = $text;
     }
     if ($return) {
         return $values;
     }
 }
 function sendSignupEmails($customer_model, $commande_model)
 {
     global $payment_method;
     // Email Yii::app()->params['adminEmail'] with new user signup
     $message = new YiiMailMessage();
     $message->view = 'template';
     $order_totals = Yii::app()->user->OrderTotals;
     // Pass the credit card info if needed
     if (isset($_POST['cc'])) {
         Yii::app()->user->setState('cc', $_POST['cc']);
         $cc_images = array();
         foreach (array('cc_sideone', 'cc_sidetwo') as $cc_image) {
             // Save credit card images
             $cc_side = CUploadedFile::getInstanceByName($cc_image);
             if ($cc_side != null) {
                 $path = getUploadPath($cc_side);
                 $cc_side->saveAs($path);
                 // Massage the path names so they're clickable URLs
                 $path = pathToUrl($path);
                 $cc_images[$cc_image] = $path;
             }
         }
         $message->setBody(array('include' => 'new-signup.php', 'customer' => $customer_model, 'commande' => $commande_model, 'order_totals' => $order_totals, 'cc' => $_POST['cc'], 'cc_images' => $cc_images), 'text/html');
     } else {
         $message->setBody(array('include' => 'new-signup.php', 'customer' => $customer_model, 'commande' => $commande_model, 'order_totals' => $order_totals), 'text/html');
     }
     // TODO: VERY IMPORTANT TO REMOVE THIS BCC ONCE YOU HIT PRODUCTION!
     $message->addTo(Yii::app()->params['adminEmail']);
     $message->addFrom(Yii::app()->params['adminEmail']);
     $message->setSubject("New User Signup");
     Yii::app()->mail->send($message);
     // Email user welcome message
     $message = new YiiMailMessage();
     $message->view = 'template';
     //userModel is passed to the view
     $message->setBody(array('include' => 'welcome.php', 'customer' => $customer_model, 'payment_method' => $payment_method), 'text/html');
     $message->addTo($customer_model->bilemail);
     $message->addFrom(Yii::app()->params['adminEmail']);
     $message->setSubject("Welcome to Mailnetwork!");
     Yii::app()->mail->send($message);
 }
Exemple #6
0
    function listingManager($listing)
    {
        $canEdit = $this->Access->canEditListing($listing['Listing']['user_id']);
        $canPublish = $this->Access->canPublishListing($listing['Listing']['user_id']);
        $canDelete = $this->Access->canDeleteListing($listing['Listing']['user_id']);
        $isManager = $this->Access->isManager();
        $listing_id = $listing['Listing']['listing_id'];
        $formToken = cmsFramework::getCustomToken($listing_id);
        $canOrder = false;
        if ($this->Paid && $this->Paid->canOrder($listing)) {
            $canOrder = $this->PaidRoutes->getPaymentLink($listing, array('lazy_load' => true));
        }
        if ($canEdit || $canPublish || $canDelete || $isManager || $canOrder) {
            ?>
        <span class="jrManagement jrButton"><?php 
            __t("Manage");
            ?>
<span class="jrArrowBottom"></span>
            
            <?php 
            if ($canOrder) {
                // Load assets for paid listings onclick
                ?>
            <script type="text/javascript">
            /* <![CDATA[ */
            function jr_paidLoadScript(afterLoad)
            {                        
                if(jQuery('body').data('jrOrderAssets') == true)
                {
                    if(undefined!=afterLoad) afterLoad();
                } else {
                    jQuery.getScript('<?php 
                echo $this->locateScript('paidlistings');
                ?>
',function(){
                        jQuery.getCSS("<?php 
                echo pathToUrl($this->locateThemeFile('theme_css', 'paidlistings', '.css'));
                ?>
",function()
                        {
                            jQuery('body').data('jrOrderAssets',true);
                            if(afterLoad!=undefined) afterLoad();
                        });
                    });        
                }
            };
            /* ]]> */
            </script>
            <?php 
            }
            ?>
            
            <div id="jr_listing_manager<?php 
            echo $listing_id;
            ?>
" class="jrManager">
            
                <ul class="jrManagementLinks">
            
                    <?php 
            if ($canOrder) {
                ?>
                    <li>
                        <?php 
                echo $canOrder;
                ?>
                    </li>
                    <?php 
            }
            ?>
                                        
                    <?php 
            if ($canEdit) {
                ?>
                    <li>
                        <span class="jrIcon jrIconEdit"></span>
                        <?php 
                echo $this->Routes->listingEdit(__t("Edit", true), $listing, array('class' => 'jr_edit'));
                ?>
                    </li>
                    <?php 
            }
            ?>
    

                    <?php 
            if ($canPublish) {
                ?>
                    <li>
                        <span class="jrIcon <?php 
                echo $listing['Listing']['state'] ? 'jrIconYes' : 'jrIconDisabled';
                ?>
"></span>
                        <a href="#publish" id="jr_publishLink<?php 
                echo $listing_id;
                ?>
" class="<?php 
                echo $listing['Listing']['state'] ? 'jr_published' : 'jr_unpublished';
                ?>
" onclick="jreviews.listing.publish(this,{'token':'<?php 
                echo $formToken;
                ?>
','listing_id':<?php 
                echo $listing_id;
                ?>
,'unpublished':'<?php 
                __t("Unpublished", false, true);
                ?>
','published':'<?php 
                __t("Published", false, true);
                ?>
'});return false;"><?php 
                echo $listing['Listing']['state'] ? __t("Published", true) : __t("Unpublished", true);
                ?>
</a>
                    </li>
                    <?php 
            }
            ?>
                     
                    <?php 
            if ($isManager) {
                ?>
                    <li>
                        <span class="jrIcon <?php 
                echo $listing['Listing']['featured'] ? 'jrIconYes' : 'jrIconDisabled';
                ?>
"></span>
                        <a href="#feature" id="jr_featuredLink<?php 
                echo $listing_id;
                ?>
" class="<?php 
                echo $listing['Listing']['featured'] ? 'jr_published' : 'jr_unpublished';
                ?>
" onclick="jreviews.listing.feature(this,{'token':'<?php 
                echo $formToken;
                ?>
','listing_id':<?php 
                echo $listing_id;
                ?>
,'state':<?php 
                echo (int) $listing['Listing']['featured'];
                ?>
,'unpublished':'<?php 
                __t("Not featured", false, true);
                ?>
','published':'<?php 
                __t("Featured", false, true);
                ?>
'});return false;"><?php 
                echo $listing['Listing']['featured'] == 1 ? __t("Featured", true) : __t("Not featured", true);
                ?>
</a>
                    </li>
                    
                    <li>
                        <span class="jrIcon <?php 
                echo $listing['Listing']['frontpage'] ? 'jrIconYes' : 'jrIconDisabled';
                ?>
"></span>
                        <a href="#frontpage" id="jr_frontpageLink<?php 
                echo $listing_id;
                ?>
" class="<?php 
                echo $listing['Listing']['frontpage'] ? 'jr_published' : 'jr_unpublished';
                ?>
" onclick="jreviews.listing.frontpage(this,{'token':'<?php 
                echo $formToken;
                ?>
','listing_id':<?php 
                echo $listing_id;
                ?>
,'unpublished':'<?php 
                __t("Not frontpaged", false, true);
                ?>
','published':'<?php 
                __t("Frontpaged", false, true);
                ?>
'});return false;"><?php 
                echo $listing['Listing']['frontpage'] > 0 ? __t("Frontpaged", true) : __t("Not frontpaged", true);
                ?>
</a>
                    </li>    
                    <?php 
            }
            ?>
                            
                    <?php 
            if ($canDelete) {
                ?>
    
                    <li>
                        <a href="#delete" id="jr_deleteLink<?php 
                echo $listing_id;
                ?>
" class="jr_delete" onclick="jreviews.listing.remove(this,{'token':'<?php 
                echo $formToken;
                ?>
','title':'<?php 
                __t("Delete", false, true);
                ?>
','listing_id':<?php 
                echo $listing['Listing']['listing_id'];
                ?>
,'text':'<?php 
                __t("Are you sure you want to delete this listing?", false, true);
                ?>
'});return false;">
                        <span class="jrIcon jrIconDelete"></span> <?php 
                __t("Delete");
                ?>
</a>
                    </li>
                    <?php 
            }
            ?>
                    
                </ul>

            </div>
            
        </span>
        <?php 
        }
    }
 /**
  * Creates a thumbnail if it doesn't already exist and returns an array with full paths to original image and thumbnail
  * returns false if thumbnail cannot be created
  */
 function makeThumb($listing_id, $image, $cat_image, $attributes = array())
 {
     $imageName = '';
     $this->catImage = false;
     $this->noImage = false;
     $tn_mode = Sanitize::getString($attributes, 'tn_mode', 'scale');
     $location = Sanitize::getString($attributes, 'location', '_');
     if ($location != '_') {
         $location = '_' . $location . '_';
     }
     $dimensions = Sanitize::getVar($attributes, 'dimensions', array());
     if (empty($dimensions)) {
         $dimensions = array($this->Config->list_image_resize);
     }
     if (isset($image['path']) && $image['path'] != '') {
         if (isset($image['skipthumb']) && $image['skipthumb'] === true) {
             return array('image' => $image['path'], 'thumbnail' => $image['path']);
         }
         $temp = explode('/', $image['path']);
         $imageName = $temp[count($temp) - 1];
         $length = strlen($listing_id);
         if (substr($imageName, 0, $length + 1) == $listing_id . '_') {
             // Uploaded image already has entry id prepended so we remove it and put it before the content suffix
             $imageName = substr($imageName, $length + 1);
         }
         $thumbnail = "tn_" . $listing_id . $location . $imageName;
         $output = array('image' => $this->www . $image['path'], 'thumbnail' => $this->www_tn . $thumbnail);
         $image_path = trim(isset($image['basepath']) && $image['basepath'] ? $image['path'] : $this->path . $image['path']);
         // If in administration, then can't use relative path because it will include /administrator
         defined('MVC_FRAMEWORK_ADMIN') and strpos($image_path, PATH_ROOT) === false and $image_path = PATH_ROOT . str_replace(_DS, DS, $image_path);
         if ($imageName != '' && file_exists($image_path)) {
             $this->image_size = getimagesize($image_path);
             if (file_exists($this->path_tn . $thumbnail)) {
                 // Thumbnail exists, so we check if current size is correct
                 $thumbnailSize = getimagesize($this->path_tn . $thumbnail);
                 // Checks the thumbnail width to see if it needs to be resized
                 if ($thumbnailSize[0] == $dimensions[0] || $thumbnailSize[0] != $dimensions[0] && $this->image_size[0] < $dimensions[0] || $tn_mode == 'crop' && $thumbnailSize[0] == $thumbnailSize[1] && $thumbnailSize[0] == $dimensions[0]) {
                     // No resizing is necessary
                     $output['width'] = $thumbnailSize[0];
                     $output['height'] = $thumbnailSize[1];
                     return $output;
                 }
             }
             // Create the thumbnail
             if ($newDimensions = $this->{$tn_mode}($image_path, $this->path_tn . $thumbnail, $dimensions)) {
                 $output = array_merge($output, $newDimensions);
                 return $output;
             }
         }
     }
     if ($this->Config->list_category_image && $cat_image != '') {
         $this->image_size = getimagesize($this->path . $cat_image);
         if ($this->image_size[0] == min($this->image_size[0], trim(intval($dimensions[0])))) {
             // Image is smaller (narrower) than thumb so no thumbnailing is done
             return array('width' => $this->image_size[0], 'height' => $this->image_size[1], 'image' => $this->www . $cat_image, 'thumbnail' => $this->www . $cat_image);
         }
         // Create category thumb
         $cat_tn = basename($cat_image);
         if ($newDimensions = $this->{$tn_mode}($this->path . $cat_image, $this->path_tn . 'tn' . $location . $cat_tn, $dimensions)) {
             $this->catImage = true;
             return array('width' => $newDimensions['width'], 'height' => $newDimensions['height'], 'image' => $this->www . $cat_image, 'thumbnail' => $this->www_tn . 'tn' . $location . $cat_tn);
         }
     }
     // Create NoImage thumb
     $this->viewSuffix = '';
     $noImagePath = $this->locateThemeFile('theme_images', $this->Config->list_noimage_filename, '');
     if ($noImagePath && $this->Config->list_noimage_image && $this->Config->list_noimage_filename != '') {
         $noImageWww = pathToUrl($noImagePath);
         $noImageThumbnailPath = $this->path_tn . 'tn' . $location . $this->Config->list_noimage_filename;
         $thumbExists = file_exists($noImageThumbnailPath);
         if ($thumbExists) {
             $noImageSize = getimagesize($noImageThumbnailPath);
             if ($this->image_size[0] == min($noImageSize[0], trim(intval($dimensions[0])))) {
                 // Image is smaller (narrower) than thumb so no thumbnailing is done
                 return array('width' => $noImageSize[0], 'height' => $noImageSize[1], 'image' => $noImageWww, 'thumbnail' => $noImageWww);
             }
             if ($noImageSize[0] != $dimensions[0]) {
                 $newDimensions = $this->{$tn_mode}($noImagePath, $noImageThumbnailPath, $dimensions);
             } else {
                 $newDimensions = array('width' => $noImageSize[0], 'height' => $noImageSize[1]);
             }
         } else {
             $newDimensions = $this->{$tn_mode}($noImagePath, $noImageThumbnailPath, $dimensions);
         }
         $this->noImage = true;
         return array('width' => $newDimensions['width'], 'height' => $newDimensions['height'], 'image' => $noImageWww, 'thumbnail' => $this->www_tn . 'tn' . $location . $this->Config->list_noimage_filename);
     }
     return false;
 }
    <?php 
    if (!isset($cc_images['cc_sidetwo']) && !isset($cc_images['cc_sidetwo'])) {
        ?>
        <p><strong>*This customer did not upload scans of their Credit Card*</strong></p>
    <?php 
    }
    ?>

<?php 
}
?>

<?php 
$arr_uploads = array('dest_idpicture11', 'dest_idpicture12', 'dest_idpsform1', 'dest_idpicture21', 'dest_idpicture22', 'dest_idpsform2', 'dest_idpicture31', 'dest_idpicture32', 'dest_idpsform3');
?>

<?php 
foreach ($arr_uploads as $doc) {
    if ($commande->{$doc} != null && $commande->{$doc} != "") {
        ?>
<a href="<?php 
        echo pathToUrl($commande->{$doc});
        ?>
"><?php 
        echo $doc;
        ?>
</a><br />

<?php 
    }
}
Exemple #9
0
 function css($files, $inline = false)
 {
     /**
      * BYPASSES THE CSS METHOD IN FAVOR OF CCSS (cached)
      */
     if (Configure::read('Cache.assets_css') && !defined('MVC_FRAMEWORK_ADMIN') && !$inline) {
         $this->ccss($files);
         return;
     }
     // Register in header to prevent duplicates
     $headCheck = RegisterClass::getInstance('HeadTracking');
     if (is_array($files)) {
         $out = '';
         foreach ($files as $i) {
             // Check if already in header
             if (!$headCheck->check($i, 'css')) {
                 $out .= "\n\t" . $this->css($i, $inline);
             }
         }
         if ($out != '' && $inline) {
             return $out . "\n";
         }
         return;
     }
     // Create minify script url
     $no_ext = str_replace(array(MVC_ADMIN . _DS, '.css', _DS), array('', '', DS), $files);
     $ThemeFolder = false !== strpos($files, MVC_ADMIN) ? 'AdminTheme' : 'Theme';
     $cssPath = $this->locateThemeFile('theme_css', $no_ext, '.css', $ThemeFolder);
     $cssUrl = pathToUrl($cssPath);
     $headCheck->register($files, 'css');
     $rel = 'stylesheet';
     $out = sprintf($this->tags['css'], $rel, $cssUrl, '');
     cmsFramework::addScript($out, $inline);
 }