function cw_file_get_info($type, $file) { global $current_location, $tables; $file['file_url'] = $current_location . '/index.php?target=document&type=' . $type . '&file_id=' . $file['file_id']; $file['file_path'] = cw_realpath($file['file_path']); $res = cw_query_first("select c.customer_id, ca.firstname, ca.lastname from {$tables['customers']} as c left join {$tables['customers_addresses']} as ca on ca.customer_id=c.customer_id and ca.main=1 where c.customer_id='{$file['by_customer_id']}'"); $file['uploaded_by'] = $res['firstname'] . ' ' . $res['lastname'] . '(' . $res['customer_id'] . ')'; return $file; }
<?php cw_load('files'); $action = preg_replace("/[^a-zA-Z0-9]/", "", $action); $template_name = "help/hlp_" . strtolower($action) . ".tpl"; if ($action == "TSTLBL") { $status =& cw_session_register("status"); $error =& cw_session_register("error"); if (!empty($status)) { $smarty->assign('status', $status); $status = false; } if (!empty($error)) { $smarty->assign('error', $error); $error = false; } $smarty->assign('tmp_dir', $var_dirs['tmp'] . '/usps_test_labels/'); } if (file_exists(cw_realpath($smarty->template_dir . DIRECTORY_SEPARATOR . $template_name))) { $smarty->assign('template_name', $template_name); }
function cw_image_get_url($id, $type, $image_path) { global $available_images, $app_dir, $var_dirs, $current_location, $config; if (is_url($image_path)) { return $image_path; } $check_config = array('products_images_thumb' => 'watermark_thumbnails', 'products_images_det' => 'watermark_thumbnails', 'products_detailed_images' => 'watermark_detail', 'categories_images_thumb' => 'watermark_category', 'manufacturer_images' => 'watermark_manufacturer', 'magnifier_images' => 'watermark_magnifier'); if ($config['Watermarks'][$check_config[$type]] == 'Y') { $image_path = cw_image_get_watermarked($image_path); } if ($image_path == false) { return cw_get_default_image($type); } $image_path = cw_realpath($image_path); if (!strncmp($var_dirs['images'], $image_path, strlen($var_dirs['images'])) && @file_exists($image_path)) { //if (!strncmp(str_replace('/','\\',$var_dirs['images']), str_replace('/','\\',$image_path), strlen($var_dirs['images'])) && @file_exists($image_path)) return $current_location . str_replace(DIRECTORY_SEPARATOR, "/", substr($image_path, strlen(preg_replace("/" . preg_quote(DIRECTORY_SEPARATOR, "/") . "\$/S", "", $app_dir)))); } return cw_get_default_image($type); }
function cw_mkdir($dir, $mode = 0777) { $dir = cw_realpath($dir); $dirstack = array(); while (!@is_dir($dir) && $dir != '/') { if ($dir != ".") { array_unshift($dirstack, $dir); } $dir = dirname($dir); } while ($newdir = array_shift($dirstack)) { if (substr($newdir, -2) == "..") { continue; } umask(00); if (!@mkdir($newdir, $mode)) { return false; } } return true; }