Exemple #1
0
 public function rpcCache()
 {
     $this->dir = getSettingsPath() . "/httprpc";
     if (!is_dir($this->dir)) {
         makeDirectory($this->dir);
     }
 }
function gravaArquivos($media_folder)
{
    $media_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $media_folder;
    if (isset($_FILES)) {
        //ksort($_FILES);
        if (!makeDirectory($media_path)) {
            return 2;
        }
        //Não foi possível criar o diretório
        $media_items = array();
        $media_name = array('antena', 'lnb', 'base', 'cabo', 'conector', 'checkup_sky');
        $indice = 0;
        foreach ($_FILES as $key => $media_file) {
            $media_items[$key] = '';
            if ($media_file['size'] > 0) {
                $media_file_name = $_POST['os'] . '-' . $media_name[$indice] . '.jpeg';
                $media_items[$key] = $media_file_name;
                $media_file_path = $media_path . '/' . $media_file_name;
                if (!move_uploaded_file($media_file['tmp_name'], $media_file_path)) {
                    return 3;
                }
                //Não foi possível enviar o arquivo
            }
            $indice++;
        }
    } else {
        return 0;
        //Sem arquivos para gravar
    }
    return 1;
    //Arquivos gravados com sucesso
}
function moverImagen($img) {
	global $conn;

	if ($img != "") {
		$fileOrigen = IMAGES_EDICION_PATH.$img;
		$partes_ruta = pathinfo($img);
		$filename = $_POST["id"].".".$partes_ruta["extension"];
		$fileDest = IMAGES_BANNERS_PATH.$_POST["id"]."/".$filename;

		if (!file_exists(IMAGES_BANNERS_PATH.$_POST["id"]))
			makeDirectory(IMAGES_BANNERS_PATH.$_POST["id"]);

		unlink($fileDest);
		if (rename($fileOrigen, $fileDest)) {
			$params = array(":id" => $_POST["id"],
											":imagen" => $filename);
			$sql =
				"UPDATE rrhh.rbr_banners
						SET br_imagen = :imagen
					WHERE br_id = :id";
			DBExecSql($conn, $sql, $params, OCI_DEFAULT);
		}
		else
			unlink($fileOrigen);
	}
}
function subirArchivo($arch, $folder, $extensionesPermitidas, $maxFileSize, &$file, &$msgError) {
	$tmpfile = $arch["tmp_name"];
	$partes_ruta = pathinfo(strtolower($arch["name"]));

	$filename = $arch["name"];
	$ruta = $folder.$_POST["id"]."/";
	$file = $ruta.$filename;

	if (!makeDirectory($ruta)) {
		$msgError = "ERROR: No se puede crear la carpeta.";
		return false;
	}

	if (!in_array($partes_ruta["extension"], $extensionesPermitidas)) {
		$msgError = "ERROR: El archivo debe tener alguna de las siguientes extensiones: ".implode(" o ", $extensionesPermitidas).".";
		return false;
	}

	if (!is_uploaded_file($tmpfile)) {
		$msgError = "ERROR: El archivo no subió correctamente.";
		return false;
	}

	if (filesize($tmpfile) > $maxFileSize) {
		$msgError = "ERROR: El archivo no puede ser mayor a ".tamanoArchivo($maxFileSize).".";
		return false;
	}

	if (!move_uploaded_file($tmpfile, $file)) {
		$msgError = "ERROR: El archivo no pudo ser guardado.";
		return false;
	}

	return true;
}
Exemple #5
0
 public function __construct()
 {
     $this->dir = getSettingsPath() . "/httprpc";
     if (!is_dir($this->dir)) {
         makeDirectory($this->dir);
     }
 }
Exemple #6
0
 public function __construct($name = '')
 {
     $this->dir = getSettingsPath() . $name;
     if (!is_dir($this->dir)) {
         makeDirectory($this->dir);
     }
 }
Exemple #7
0
function gravaArquivos($media_folder)
{
    $media_path = realpath($_SERVER['DOCUMENT_ROOT']) . '\\files\\fotos\\' . $media_folder;
    if (isset($_FILES)) {
        ksort($_FILES);
        if (!makeDirectory($media_path)) {
            return 2;
        }
        //Não foi possível criar o diretório
        $media_items = array();
        foreach ($_FILES as $key => $media_file) {
            $media_items[$key] = '';
            if ($media_file['size'] > 0) {
                $media_file_name = $_POST['os'] . '-' . $media_file['name'];
                $media_items[$key] = $media_file_name;
                $media_file_path = $media_path . '/' . $media_file_name;
                if (!move_uploaded_file($media_file['tmp_name'], $media_file_path)) {
                    return 3;
                }
                //Não foi possível enviar o arquivo
            } else {
                return 0;
                //Arquivo corrompido: 0 bytes
            }
            $indice++;
        }
    } else {
        return 0;
        //Sem arquivos para gravar
    }
    return 1;
    //Arquivos gravados com sucesso
}
Exemple #8
0
 public static function start($commands, $flags = self::FLG_DEFAULT)
 {
     $taskNo = time();
     $dir = self::formatPath($taskNo);
     if (count($commands)) {
         makeDirectory($dir);
         if (($sh = fopen($dir . "/start.sh", "w")) !== false) {
             fputs($sh, '#!/bin/sh' . "\n");
             fputs($sh, 'dir="$(dirname $0)"' . "\n");
             fputs($sh, 'echo $$ > "${dir}"/pid' . "\n");
             fputs($sh, 'chmod a+rw "${dir}"/pid' . "\n");
             file_put_contents($dir . "/flags", $flags);
             @chmod($dir . "/flags", 0666);
             fputs($sh, 'touch "${dir}"/status' . "\n");
             fputs($sh, 'chmod a+rw "${dir}"/status' . "\n");
             fputs($sh, 'touch "${dir}"/errors' . "\n");
             fputs($sh, 'chmod a+rw "${dir}"/errors' . "\n");
             fputs($sh, 'touch "${dir}"/log' . "\n");
             fputs($sh, 'chmod a+rw "${dir}"/log' . "\n");
             fputs($sh, 'last=0' . "\n");
             $err = $flags & self::FLG_ONE_LOG ? "log" : "errors";
             foreach ($commands as $ndx => $cmd) {
                 if ($cmd == '{') {
                     fputs($sh, 'if [ $last -eq 0 ] ; then ' . "\n");
                 } else {
                     if ($cmd == '}') {
                         fputs($sh, 'fi' . "\n");
                     } else {
                         if ($cmd[0] == '>') {
                             fputs($sh, 'echo "' . substr($cmd, 1) . '" >> "${dir}"/log' . "\n");
                         } else {
                             if ($flags & self::FLG_ECHO_CMD) {
                                 fputs($sh, 'echo "' . $cmd . '" >> "${dir}"/log' . "\n");
                             }
                             if ($flags & self::FLG_NO_ERR) {
                                 fputs($sh, $cmd . ' >> "${dir}"/log' . "\n");
                             } else {
                                 fputs($sh, $cmd . ' 2>> "${dir}"/' . $err . ' >> "${dir}"/log' . "\n");
                             }
                             fputs($sh, 'if [ $? -ne 0 ] ; then ' . "\n\t" . 'last=1' . "\n" . 'fi' . "\n");
                         }
                     }
                 }
             }
             fputs($sh, 'echo $last > "${dir}"/status' . "\n");
             fclose($sh);
             @chmod($dir . "/start.sh", 0755);
             if (!self::run($dir . "/start.sh", $flags)) {
                 if (!($flags & self::FLG_WAIT)) {
                     sleep(1);
                 }
                 return self::check($taskNo, $flags);
             }
         }
         self::clean($dir);
     }
     return array("no" => $taskNo, "pid" => 0, "status" => 255, "log" => array(), "errors" => array("Can't start operation"));
 }
Exemple #9
0
function makeDirectory($dir, $mode = 0755)
{
    if (is_dir($dir) || @mkdir($dir, $mode)) {
        return true;
    }
    if (!makeDirectory(dirname($dir), $mode)) {
        return false;
    }
    return @mkdir($dir, $mode);
}
Exemple #10
0
 public function __construct()
 {
     $pathToDatabase = getSettingsPath() . '/peers.dat';
     @makeDirectory(dirname($pathToDatabase));
     $needCreate = !is_readable($pathToDatabase);
     if ($this->handle = sqlite_open($pathToDatabase, 0666, $this->error)) {
         if ($needCreate) {
             sqlite_exec($this->handle, 'create table comments( ' . 'id integer primary key,' . 'ip text unique,' . 'comment text)', $this->error);
             @chmod($pathToDatabase, 0666);
         }
     }
 }
function moverImagen($img) {
	global $conn;

	if (($img != "") and ($img != "old")) {
		$fileOrigen = IMAGES_EDICION_PATH.$img;
		$partes_ruta = pathinfo($img);
		$filename = $_POST["id"].".".$partes_ruta["extension"];
		$fileDest = DATA_CELEBRACIONES_PATH.$filename;

		if (!file_exists(DATA_CELEBRACIONES_PATH.$_POST["id"]))
			makeDirectory(DATA_CELEBRACIONES_PATH.$_POST["id"]);

		unlink($fileDest);
		if (!rename($fileOrigen, $fileDest))
			unlink($fileOrigen);
	}
}
Exemple #12
0
function uploadFile($arch, $folder, &$archPath) {
	$tempfile = $arch["tmp_name"];
	$partes_ruta = pathinfo($arch["name"]);

	$uploadOk = false;
	if (is_uploaded_file($tempfile)) {
		if (!file_exists($folder))
			makeDirectory($folder);

		if (move_uploaded_file($tempfile, $folder.$partes_ruta['basename'])) {
			$uploadOk = true;
			$archPath = $partes_ruta["basename"];
		}
	}

	return $uploadOk;
}
Exemple #13
0
 public function makeDirectory()
 {
     $dir = self::formatPath($this->id);
     makeDirectory($dir);
     return $dir;
 }
Exemple #14
0
    $name = dirname(__FILE__) . "/labels/" . $label . ".png";
    if (is_readable($name)) {
        sendFile($name, "image/png");
        exit;
    }
}
if (isset($_REQUEST["tracker"])) {
    $tracker = rawurldecode($_REQUEST["tracker"]);
    $name = dirname(__FILE__) . "/trackers/" . $tracker . ".png";
    if (is_readable($name)) {
        sendFile($name, "image/png");
        exit;
    }
    $name = getSettingsPath() . '/trackers';
    if (!is_dir($name)) {
        makeDirectory($name);
    }
    $name .= '/';
    if (strlen($tracker)) {
        $name .= $tracker;
        $name .= '.ico';
        if (!is_readable($name)) {
            $url = Snoopy::linkencode("http://" . $tracker . "/favicon.ico");
            $client = new Snoopy();
            @$client->fetchComplex($url);
            if ($client->status == 200) {
                file_put_contents($name, $client->results);
            }
        }
        if (is_readable($name)) {
            sendFile($name, "image/x-icon");
Exemple #15
0
$settingsFlags = array("showDownloadsPage" => 0x1, "showConnectionPage" => 0x2, "showBittorentPage" => 0x4, "showAdvancedPage" => 0x8, "showPluginsTab" => 0x10, "canChangeULRate" => 0x20, "canChangeDLRate" => 0x40, "canChangeTorrentProperties" => 0x80, "canAddTorrentsWithoutPath" => 0x100, "canAddTorrentsWithoutStarting" => 0x200, "canAddTorrentsWithResume" => 0x400, "canAddTorrentsWithRandomizeHash" => 0x800);
$perms = 0;
foreach ($settingsFlags as $flagName => $flagVal) {
    if (!array_key_exists($flagName, $permissions) || $permissions[$flagName]) {
        $perms |= $flagVal;
    }
}
$jResult .= "theWebUI.showFlags = " . $perms . ";\n";
$jResult .= "theURLs.XMLRPCMountPoint = '" . $XMLRPCMountPoint . "';\n";
$jResult .= "theWebUI.systemInfo = {};\ntheWebUI.systemInfo.php = { canHandleBigFiles : " . (PHP_INT_SIZE <= 4 ? "false" : "true") . " };\n";
if ($handle = opendir('../plugins')) {
    ignore_user_abort(true);
    set_time_limit(0);
    $tmp = getTempDirectory();
    if ($tmp != '/tmp/') {
        makeDirectory($tmp);
    }
    if (!@file_exists($tempDirectory . '/.') || !is_readable($tempDirectory) || !is_writable($tempDirectory)) {
        $jResult .= "noty(theUILang.badTempPath+' (" . $tempDirectory . ")','error');";
    }
    if (!function_exists('preg_match_all')) {
        $jResult .= "noty(theUILang.PCRENotFound,'error');";
        $jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?' };\n";
    } else {
        $remoteRequests = array();
        $theSettings = rTorrentSettings::get(true);
        if (!$theSettings->linkExist) {
            $jResult .= "noty(theUILang.badLinkTorTorrent,'error');";
            $jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?', apiVersion : 0 };\n";
        } else {
            if ($theSettings->idNotFound) {
Exemple #16
0
    if ($email) {
        $subject = 'New Form Posting';
        $message = 'The following form has been posted:';
        foreach ($_POST as $head => $val) {
            $message .= $head . ':' . ' ' . $val;
        }
        $headers = 'From: $email_from';
        mail($to, $subject, $message, $headers);
    }
    /**
    * Do CSV file saving, if set to 'true'
    */
    if ($csv) {
        $csv_path = 'data/' . $form_id . '/' . $csv_folder;
        $csv_file_path = $csv_path . '/formentry.csv';
        if (!makeDirectory($csv, $csv_path)) {
            exit;
        }
        $head_items = simple_array('head', $_POST, $media_items, date("F j, Y, g:i a"));
        $val_items = simple_array('val', $_POST, $media_items, date("F j, Y, g:i a"));
        mssafe_csv($csv_file_path, $val_items, $head_items);
    }
    /**
     * Success, send alert message to FormEntry Touch device
     */
    xml_response('true', 'true', 'Success', 'Your form was successfully posted. Thank you.', 'OK');
} else {
    $login_success = false;
    if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
        if ($user_name == $_SERVER['PHP_AUTH_USER'] && $password == $_SERVER['PHP_AUTH_PW']) {
            $login_success = true;
function _my_create_product()
{
    if (is_home() && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'create_product') || is_page(2) && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'create_product') || is_page('compose') && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'create_product')) {
        //    if (is_page('withproduct') && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'create_product')){
        $time_start = microtime(true);
        //INIT
        $ratio = "";
        $ratioT = "";
        //var_dump($_POST);
        //die();
        // GET FILEPATH
        $fileName = $_POST['post_title'];
        $lang = $_POST['lang'];
        // tip:ZlychRK4D8Ftのノイズ //
        $imgUrl = 'http://api.typograffit.com/posts/getImage/';
        $typoAddress = $imgUrl . $fileName;
        // GET INPUT TEXT
        $baseInfoUrl = 'http://api.typograffit.com/rest_json/posts/getInfo/post_id:' . $fileName;
        $ch = curl_init();
        // init
        curl_setopt($ch, CURLOPT_URL, $baseInfoUrl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $c = curl_exec($ch);
        curl_close($ch);
        $obj = json_decode($c);
        $input_string = $obj->{'body'};
        if (mb_strlen($input_string) > 30) {
            $post_title_string = mb_substr($input_string, 0, 30) . '...';
        } else {
            $post_title_string = $input_string;
        }
        // IMAGICK
        $image = new Imagick($typoAddress);
        $image->paintTransparentImage("white", 0, 0);
        $image->despeckleImage();
        $hashImage = clone $image;
        $image->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
        $image->setImageResolution(150, 150);
        $hashWidth = $image->getImageWidth();
        $hashHeight = $image->getImageHeight();
        //RATIO
        if ($hashWidth >= $hashHeight * 3 / 4) {
            //横長
            $ratio = "oblong";
        } else {
            //縦長
            $ratio = "verlong";
        }
        if ($hashWidth >= $hashHeight * 5 / 6) {
            //横長
            $ratioT = "oblong";
        } else {
            //縦長
            $ratioT = "verlong";
        }
        //TSHIRT
        if (isset($_POST['cat_shirt'])) {
            $tentwelveImage = clone $image;
            $resizeFlag = 0;
            // RESIZE
            $w = 1800;
            $h = 2400;
            $w2 = 1500;
            $h2 = 1800;
            $boxWidth = 360;
            //(500-$hashWidth/2,200)を始点に[360px,480px]のボックスに収める
            $boxHeight = 480;
            // DB INIT
            //$post_title_string = 'TG-SHIRT';
            $att_post_title_string = $fileName . '-tshirt';
            $att_img_title_string = $fileName . '-enlarge_12_16';
            //COMPOSING SHIRT
            $shirtMockPath = '/home1/typograf/public_html/typograffit/wp-content/uploads/typo/tshirt-white.png';
            $imageShirt = new Imagick($shirtMockPath);
            if ($hashWidth < $w && $hashHeight < $h) {
                $resizeFlag = 1;
            }
            if ($resizeFlag == 1) {
                $image->resampleImage(150, 150, imagick::FILTER_CUBIC, 1);
                if ($ratio == "oblong") {
                    //横長
                    $image->resizeImage($w, 0, imagick::FILTER_CUBIC, 1);
                    $tentwelveImage->resizeImage($w2, 0, imagick::FILTER_CUBIC, 1);
                    //$image->thumbnailImage($w, $h, true);
                    $hashImage->resizeImage($boxWidth, 0, imagick::FILTER_CUBIC, 1);
                    $shirtHashWidth = $boxWidth;
                } else {
                    //縦長
                    $image->resizeImage(0, $h, imagick::FILTER_CUBIC, 1);
                    $tentwelveImage->resizeImage(0, $h2, imagick::FILTER_CUBIC, 1);
                    //$image->thumbnailImage($w, $h, true);
                    $hashImage->resizeImage(0, $boxHeight, imagick::FILTER_CUBIC, 1);
                    $shirtHashWidth = $hashImage->getImageWidth();
                }
            }
            // SAVE
            $saveDir = makeDirectory($fileName);
            // SAVE ENLRGE IMAGE
            //$saveEnlargePath = WP_CONTENT_URL.'/uploads/typo/'.$fileName.'-enlarge.png';
            //$saveEnlargePath = wp_upload_dir('typo').$fileName.'-enlarge.png';
            $saveEnlargePath = $saveDir . 'enlarge_12_16.png';
            $image->writeImage($saveEnlargePath);
            $image->destroy();
            $saveMinEnlargePath = $saveDir . 'enlarge_10_12.png';
            $tentwelveImage->writeImage($saveMinEnlargePath);
            $tentwelveImage->destroy();
            // SAVE COMPOSING IMAGE
            //$imageShirt = compositeImage($layer, Imagick::COMPOSITE_DEFAULT, $x, $y);
            $posX = 500 - $shirtHashWidth / 2;
            $posY = 200;
            //$saveCompPath = WP_CONTENT_URL.'/uploads/typo/'.$fileName.'-tshirt.png';
            $imageShirt->compositeImage($hashImage, Imagick::COMPOSITE_DEFAULT, $posX, $posY);
            $saveCompPath = $saveDir . 'tshirt.png';
            $imageShirt->writeImage($saveCompPath);
            $imageShirt->destroy();
            //insert PRODUCT
            if ($lang == 'ja') {
                $post_id = wp_insert_post(array('post_title' => $post_title_string, 'post_name' => $fileName, 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_type' => 'product'), true);
                $_POST['icl_post_language'] = $lang;
                wpml_update_translatable_content('post_product', $post_id, $lang);
                wp_set_post_terms($post_id, '3031', 'product_cat');
                //CHANGE VARIABLE
                wp_set_object_terms($post_id, 'variable', 'product_type');
                //my array for setting the attributes
                $avail_attributes = array('2XL-ja', 'XL-ja', 'L-ja', 'M-ja', 'S-ja', 'XS-ja');
            } else {
                $post_id = wp_insert_post(array('post_title' => $post_title_string, 'post_name' => $fileName, 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_type' => 'product'), true);
                wp_set_post_terms($post_id, '3030', 'product_cat');
                //2903 is TShirt.
                //CHANGE VARIABLE
                wp_set_object_terms($post_id, 'variable', 'product_type');
                //my array for setting the attributes
                $avail_attributes = array('2XL', 'XL', 'L', 'M', 'S', 'XS');
            }
            //Sets the attributes up to be used as variations but doesnt actually set them up as variations
            wp_set_object_terms($post_id, $avail_attributes, 'pa_size');
            $thedata = array('pa_size' => array('name' => 'pa_size', 'value' => '', 'position' => '0', 'is_visible' => '1', 'is_variation' => '1', 'is_taxonomy' => '1'));
            update_post_meta($post_id, '_product_attributes', $thedata);
            //Sets the Default Attributes
            if ($lang == 'ja') {
                $default_thedata = array('pa_size' => 'M-ja');
            } else {
                $default_thedata = array('pa_size' => 'M');
            }
            update_post_meta($post_id, '_default_attributes', $default_thedata);
            //add SKU etc
            update_post_meta($post_id, '_sku', $fileName);
            update_post_meta($post_id, '_price', '28.0');
            update_post_meta($post_id, '_regular_price', '28.0');
            update_post_meta($post_id, '_visibility', 'visible');
            update_post_meta($post_id, '_stock_status', 'instock');
            //insert VARIATION
            $var_shirt_post = array('post_title' => 'Variation #1 of ' . $fileName, 'post_name' => 'product-' . $post_id . '-variation-1', 'post_status' => 'publish', 'post_parent' => $post_id, 'post_type' => 'product_variation', 'guid' => home_url() . '/product_variation/product-' . $post_id . '-variation-1/');
            // Insert the post into the database
            $post_var_id = wp_insert_post($var_shirt_post);
            update_post_meta($post_var_id, '_price', '28.0');
            update_post_meta($post_var_id, '_regular_price', '28.0');
            update_post_meta($post_var_id, '_wcml_custom_prices_status', '1');
            update_post_meta($post_var_id, '_price_JPY', '2900');
            update_post_meta($post_var_id, '_regular_price_JPY', '2900');
            update_post_meta($post_var_id, 'attribute_pa_size', '');
            //insert Generated IMAGE
            $attachment_post = array('post_mime_type' => 'image/png', 'post_title' => $att_post_title_string, 'post_content' => '', 'post_status' => 'inherit');
            $attachment_id = wp_insert_attachment($attachment_post, $saveCompPath, $post_id);
            update_post_meta($post_id, '_thumbnail_id', $attachment_id);
            update_post_meta($post_var_id, '_thumbnail_id', $attachment_id);
            $update_postid_author = wp_update_post(array('ID' => $post_id, 'post_author' => '999'));
            $update_varid_author = wp_update_post(array('ID' => $post_var_id, 'post_author' => '999'));
        } elseif (isset($_POST['cat_tote'])) {
            //トートバッグ合成
            // RESIZE
            $w = 1500;
            $h = 1800;
            $boxWidth = 300;
            //(500-$hashWidth/2,500)を始点に[300px,360px]のボックスに収める
            $boxHeight = 360;
            // DB INIT
            //$post_title_string = 'TG-TOTE';
            $att_post_title_string = $fileName . '-tote';
            $att_img_title_string = $fileName . '-enlarge_10_12';
            //COMPOSING SHIRT
            $toteMockPath = '/home1/typograf/public_html/typograffit/wp-content/uploads/typo/tote-white.png';
            $imageTote = new Imagick($toteMockPath);
            if ($hashWidth < $w && $hashHeight < $h) {
                $resizeFlag = 1;
            }
            if ($resizeFlag == 1) {
                $image->resampleImage(150, 150, imagick::FILTER_CUBIC, 1);
                if ($ratioT == "oblong") {
                    //横長
                    $image->resizeImage($w, 0, imagick::FILTER_CUBIC, 1);
                    //$image->thumbnailImage($w, $h, true);
                    $hashImage->resizeImage($boxWidth, 0, imagick::FILTER_CUBIC, 1);
                    $toteHashWidth = $boxWidth;
                } else {
                    //縦長
                    $image->resizeImage(0, $h, imagick::FILTER_CUBIC, 1);
                    //$image->thumbnailImage($w, $h, true);
                    $hashImage->resizeImage(0, $boxHeight, imagick::FILTER_CUBIC, 1);
                    $toteHashWidth = $hashImage->getImageWidth();
                }
            }
            // SAVE
            $saveDir = makeDirectory($fileName);
            // SAVE ENLRGE IMAGE
            //$saveEnlargePath = WP_CONTENT_URL.'/uploads/typo/'.$fileName.'-enlarge.png';
            //$saveEnlargePath = wp_upload_dir('typo').$fileName.'-enlarge.png';
            $saveEnlargePath = $saveDir . 'enlarge_10_12.png';
            $image->writeImage($saveEnlargePath);
            $image->destroy();
            // SAVE COMPOSING IMAGE
            //$imageShirt = compositeImage($layer, Imagick::COMPOSITE_DEFAULT, $x, $y);
            $posX = 500 - $toteHashWidth / 2 - 15;
            $posY = 500;
            //$saveCompPath = WP_CONTENT_URL.'/uploads/typo/'.$fileName.'-tshirt.png';
            $imageTote->compositeImage($hashImage, Imagick::COMPOSITE_DEFAULT, $posX, $posY);
            $saveCompPath = $saveDir . 'tote.png';
            $imageTote->writeImage($saveCompPath);
            $imageTote->destroy();
            //insert PRODUCT
            if ($lang == 'ja') {
                $post_id = wp_insert_post(array('post_title' => $post_title_string, 'post_name' => $fileName, 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_type' => 'product'), true);
                $_POST['icl_post_language'] = $lang;
                wpml_update_translatable_content('post_product', $post_id, $lang);
                wp_set_post_terms($post_id, '3033', 'product_cat');
            } else {
                $post_id = wp_insert_post(array('post_title' => $post_title_string, 'post_name' => $fileName, 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_type' => 'product'), true);
                wp_set_post_terms($post_id, '3032', 'product_cat');
            }
            //2904 is Totes.
            //add SKU etc
            update_post_meta($post_id, '_sku', $fileName);
            update_post_meta($post_id, '_price', '22.0');
            update_post_meta($post_id, '_regular_price', '22.0');
            update_post_meta($post_id, '_wcml_custom_prices_status', '1');
            update_post_meta($post_id, '_price_JPY', '2500');
            update_post_meta($post_id, '_regular_price_JPY', '2500');
            update_post_meta($post_id, '_visibility', 'visible');
            update_post_meta($post_id, '_stock_status', 'instock');
            //insert Generated IMAGE
            $attachment_post = array('post_mime_type' => 'image/png', 'post_title' => $att_post_title_string, 'post_content' => '', 'post_status' => 'inherit');
            $attachment_id = wp_insert_attachment($attachment_post, $saveCompPath, $post_id);
            update_post_meta($post_id, '_thumbnail_id', $attachment_id);
            //insert Enlarged IMAGE
            /*
                         $attachment_enlarge_post = array(
                            'post_mime_type' => 'image/png',
                            'post_title' => $att_img_title_string,
                            'post_content' => '',
                            'post_status' => 'inherit',
                        );
                        $typogenerated_id = wp_insert_attachment( $attachment_enlarge_post, $saveEnlargePath, $post_id );
                        update_post_meta( $post_id, '_typogenerated_id' , $typogenerated_id);
            */
            $update_author = wp_update_post(array('ID' => $post_id, 'post_author' => '998'));
        }
        /*
                elseif(isset($_POST['cat_mug'])){
                    //マグカップ合成
        
                }
        */
        /*
        		 $time_end = microtime(true);
        		 $time = $time_end - $time_start;
            		error_log($time."Seconds");
        */
        //データの挿入に成功していたら移動
        if (!is_wp_error($post_id)) {
            //カスタムフィールドurl_rel(参考URL)を追加
            update_post_meta($post_id, 'url_ref', $_POST['url']);
            //ページを移動
            header('Location: ' . get_permalink($post_id));
            die;
        }
    }
}
 function download()
 {
     $this->load->model('space/comment_model', 'comment_m');
     $list = $this->comment_m->get_face_list();
     foreach ($list as $v) {
         //var_export($v['face']);
         $file = basename($v['face']);
         $filename = substr($file, 0, strpos($file, "."));
         makeDirectory(FCPATH . '/public/data/images/face/general');
         downloadImage($v['face'], FCPATH . '/public/data/images/face/general/' . $filename);
     }
 }
Exemple #19
0
	$params = array(":idusuario" => $_SESSION["idUsuario"],
									":ipusuario" => $_SERVER["REMOTE_ADDR"],
									":ruta" => $path);
	$sql =
		"INSERT INTO tmp.tnw_nominaweb (nw_idusuario, nw_ipusuario, nw_ruta, nw_fechahorainicio)
														VALUES (:idusuario, :ipusuario, :ruta, SYSDATE)";
	DBExecSql($conn, $sql, $params);
}


$_SESSION["pageLoadOk"] = false;
register_shutdown_function("shutdown", 57);
set_time_limit(1800);

if (!makeDirectory(DATA_CARGA_MASIVA_TRABAJADORES.$_SESSION["idUsuario"])) {
	echo "<script type='text/javascript'>alert('ERROR: No se puede crear la carpeta de usuario.');</script>";
	exit;
}

$file = DATA_CARGA_MASIVA_TRABAJADORES.$_SESSION["idUsuario"]."/".date("Ymd_His").".xls";
$fileE = DATA_CARGA_MASIVA_TRABAJADORES_EXTERNAL.$_SESSION["idUsuario"]."\\".date("Ymd_His").".xls";

guardarArchivo($file);
solicitarArchivo($fileE);

$params = array(":idusuario" => $_SESSION["idUsuario"], ":ipusuario" => $_SERVER["REMOTE_ADDR"]);
$sql =
	"SELECT MAX(nw_id)
		 FROM tmp.tnw_nominaweb
		WHERE nw_idusuario = :idusuario
Exemple #20
0
<?php

eval(getPluginConf($plugin["name"]));
require_once '../plugins/trafic/ratios.php';
$st = getSettingsPath();
makeDirectory(array($st . '/trafic', $st . '/trafic/trackers', $st . '/trafic/torrents'));
$req = new rXMLRPCRequest($theSettings->getScheduleCommand("trafic", $updateInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($rootPath . '/plugins/trafic/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}'));
if ($req->run() && !$req->fault) {
    $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
} else {
    $jResult .= "plugin.disable(); noty('trafic: '+theUILang.pluginCantStart,'error');";
}
$jResult .= "plugin.collectStatForTorrents = " . ($collectStatForTorrents ? "true;" : "false;");
$jResult .= "plugin.updateInterval = " . $updateInterval . ";";
$jResult .= "plugin.disableClearButton = " . ($disableClearButton ? "true" : "false") . ";";
Exemple #21
0
function getProfilePath($user = null)
{
    global $profilePath;
    $ret = fullpath(isset($profilePath) ? $profilePath : '../share', dirname(__FILE__));
    if (is_null($user)) {
        $user = getUser();
    }
    if ($user != '') {
        $ret .= '/users/' . $user;
        if (!is_dir($ret)) {
            makeDirectory(array($ret, $ret . '/settings', $ret . '/torrents'));
        }
    }
    return $ret;
}
 public function temp()
 {
     $appPath = $this->api_config['upload']['temp']['path'] . "/";
     $savePath = FCPATH . $appPath;
     makeDirectory($savePath);
     $img_src = urldecode($this->input->get('src'));
     $save_name = "tbk_" . mktime() . "_" . mt_rand(1000, 9999);
     $savePath = $savePath . $save_name;
     $download_info = downloadImage($img_src, $savePath);
     if (is_array($download_info)) {
         $images = $this->ImageServers_model->getDataModel();
         $save_name = $download_info['filename'];
         $images['filename'] = $save_name;
         $images['path'] = $appPath;
         $images['w'] = $download_info['width'];
         $images['h'] = $download_info['height'];
         $images['size'] = $download_info['size'];
         $images['type'] = $download_info['mime'];
         $images['time'] = mktime();
         $this->my_result(1, "上传成功");
         $this->code['info'] = $images;
     } else {
         $this->my_result(-1, "上传失败");
     }
     $data = $this->code;
     $this->echo_api(1, $data);
 }
 public function postFileupload(Request $request)
 {
     if (!$request->hasFile('file')) {
         exit('file is empty!');
     }
     $file = $request->file('file');
     if (!$file->isValid()) {
         exit('fiel upload error!');
     }
     $destPath = realpath(base_path('public/images'));
     if (!file_exists($destPath)) {
         makeDirectory(base_path('public' . '\\' . 'images'), 0755, true);
     }
     $filename = $file->getClientOriginalName();
     if (!$file->move($destPath, $filename)) {
         exit('save file fail!');
     }
     exit('file upload success!');
 }
Exemple #24
0
}
$permissions = parse_ini_file($access);
$settingsFlags = array("showDownloadsPage" => 0x1, "showConnectionPage" => 0x2, "showBittorentPage" => 0x4, "showAdvancedPage" => 0x8, "showPluginsTab" => 0x10, "canChangeULRate" => 0x20, "canChangeDLRate" => 0x40, "canChangeTorrentProperties" => 0x80);
$perms = 0;
foreach ($settingsFlags as $flagName => $flagVal) {
    if (array_key_exists($flagName, $permissions) && $permissions[$flagName]) {
        $perms |= $flagVal;
    }
}
$jResult .= "theWebUI.showFlags = " . $perms . ";\n";
$jResult .= "theURLs.XMLRPCMountPoint = '" . $XMLRPCMountPoint . "';\n";
$jResult .= "theWebUI.systemInfo = {};\ntheWebUI.systemInfo.php = { canHandleBigFiles : " . (PHP_INT_SIZE <= 4 ? "false" : "true") . " };\n";
if ($handle = opendir('../plugins')) {
    ignore_user_abort(true);
    set_time_limit(0);
    makeDirectory(getTempDirectory());
    if (!@file_exists($tempDirectory . '/.') || !is_readable($tempDirectory) || !is_writable($tempDirectory)) {
        $jResult .= "noty(theUILang.badTempPath+' (" . $tempDirectory . ")','error');";
    }
    if (!function_exists('preg_match_all')) {
        $jResult .= "noty(theUILang.PCRENotFound,'error');";
        $jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?' };\n";
    } else {
        $remoteRequests = array();
        $theSettings = rTorrentSettings::get(true);
        if (!$theSettings->linkExist) {
            $jResult .= "noty(theUILang.badLinkTorTorrent,'error');";
            $jResult .= "theWebUI.systemInfo.rTorrent = { started: false, iVersion : 0, version : '?', libVersion : '?', apiVersion : 0 };\n";
        } else {
            if ($theSettings->idNotFound) {
                $jResult .= "noty(theUILang.idNotFound,'error');";
/**
 * 写碎片缓存文件
 *
 * @param
 *        	s string $cache_name
 * @param
 *        	s string $caches
 *        	
 * @return
 *
 */
function write_fragment_cache($cache_name, $caches)
{
    $cache_path = FCPATH . 'public/data/fragment';
    if (!file_exists($cache_path)) {
        makeDirectory($cache_path);
    }
    $cache_file_path = $cache_path . '/' . $cache_name . '.html';
    $content = $caches;
    return file_put_contents($cache_file_path, $content, LOCK_EX);
}
$params = array(":id" => $id);
$stmt = DBExecSql($conn, $sql, $params);
$row = DBGetQuery($stmt, 1, false);

if (!$fromDelphi)
	validarAccesoCotizacion($_REQUEST["id"]);
// FIN Validaciones..


try {
	SetDateFormatOracle("DD/MM/YYYY");

	//	*******  INICIO - Armado del reporte..  *******
	$numeroSolicitud = $row["NROSOLICITUD"];
	$path = DATA_CARTA_COTIZACION.armPathFromNumber($numeroSolicitud);
	if (!makeDirectory($path))
		throw new Exception("ERROR: No se puede crear la carpeta.");
	$file = $path.$nombre.$numeroSolicitud.".pdf";

	// Armo el sql principal..
	$params = array(":id" => $id);
	if ($modulo == "R") {		// Si es una revisión de precio..
		$sql =
			"SELECT NULL artactual,
							DECODE(NVL(sr_canttrabajadores, 0), 0, hc_totempleadosmayorcero, sr_canttrabajadores) cantidadtrabajadores,
						  ac_codigo ciiu,
							art.afiliacion.get_clausulapenal clausulapenal,
						  art.utiles.armar_cuit(sr_cuit) cuit,
						  ((sr_costofijocotizado * 12 * DECODE(NVL(sr_canttrabajadores, 0), 0, hc_totempleadosmayorcero, sr_canttrabajadores)) + (sr_porcentajevariablecotizado / 100 * 13) * DECODE(NVL(sr_masasalarial, 0), 0, hc_masatotalmayorcero, sr_masasalarial)) cuotaanual,
						  DECODE(NVL(sr_canttrabajadores, 0), 0, hc_totempleadosmayorcero, sr_canttrabajadores) * 0 cuotainicialrc,
						  DECODE(NVL(sr_canttrabajadores, 0), 0, hc_totempleadosmayorcero, sr_canttrabajadores) * sr_costofinalcotizado cuotamensual,
Exemple #27
0
<?php

require_once 'xmlrpc.php';
eval(getPluginConf($plugin["name"]));
$listPath = getSettingsPath() . "/erasedata";
@makeDirectory($listPath);
$thisDir = dirname(__FILE__);
$req = new rXMLRPCRequest(array($theSettings->getOnEraseCommand(array('erasedata0' . getUser(), getCmd('d.open') . '= ; ' . getCmd('branch=') . getCmd('d.get_custom5') . '=,"' . getCmd('f.multicall') . '=,\\"' . getCmd('execute') . '={' . $thisDir . '/cat.sh,' . $listPath . ',$system.pid=,$' . getCmd('f.get_frozen_path') . '=}\\""')), $theSettings->getOnEraseCommand(array('erasedata1' . getUser(), getCmd('branch=') . getCmd('d.get_custom5') . '=,"' . getCmd('execute') . '={' . $thisDir . '/fin.sh,' . $listPath . ',$' . getCmd('system.pid') . '=,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.is_multi_file') . '=,$' . getCmd('d.get_custom5') . '=}"')), $theSettings->getAbsScheduleCommand("erasedata", $garbageCheckInterval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($thisDir . '/update.php') . ' ' . escapeshellarg(getUser()) . ' &}')));
if ($req->success()) {
    $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
} else {
    $jResult .= "plugin.disable(); noty('erasedata: '+theUILang.pluginCantStart,'error');";
}
Exemple #28
0
<?php

eval(getPluginConf($plugin["name"]));
$st = getSettingsPath();
makeDirectory(array($st . '/rss', $st . '/rss/cache'));
$needStart = isLocalMode() && $theSettings->linkExist;
if ($needStart) {
    require_once $rootPath . '/plugins/rss/rss.php';
    $mngr = new rRSSManager();
    if ($mngr->setHandlers()) {
        $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
    } else {
        $jResult .= "plugin.disable(); noty('rss: '+theUILang.pluginCantStart,'error');";
    }
} else {
    $theSettings->registerPlugin($plugin["name"], $pInfo["perms"]);
}
Exemple #29
0
		else {
			$filename = IMAGES_NOVEDADES_EXTRANET_PATH.$_POST["carpeta"]."\\".$partes_ruta["filename"].".".$partes_ruta["extension"];

			// Intento obtener un nombre de archivo que no exista en el servidor..
			$i = 0;
			while (file_exists($filename)) {
				$i++;
				if ($i > $maxReintentos) {
					$msgError = "El archivo ya existe en el servidor.";
					break;
				}
				$filename = IMAGES_NOVEDADES_EXTRANET_PATH.$_POST["carpeta"]."\\".$partes_ruta["filename"]."_".$i.".".$partes_ruta["extension"];
			}

			if ($msgError == "") {		// Si pudimos obtener el nombre con el que va a quedar el archivo en el servidor..
				if (!makeDirectory(IMAGES_NOVEDADES_EXTRANET_PATH.$_POST["carpeta"]))
					$msgError = "No se pudo crear la carpeta de imagenes.";
				elseif (!move_uploaded_file($tmpfile, $filename))
					$msgError = "El archivo no pudo ser guardado.";
			}
		}
	}

	if ($msgError != "") {
		if (file_exists($filename))
			unlink($filename);
?>
		<script type="text/javascript">
			alert('<?php 
echo $msgError;
?>
Exemple #30
0
function download(ChapterPage $chapterPage, $ttl = null)
{
    return liftM3(function ($path, $imageContent, ChapterPage $chapterPage) {
        return writeFile($path . '/' . $chapterPage->getPage()->getName() . '.jpg', $imageContent);
    }, makeDirectory('./manga/' . $chapterPage->getChapter()->getName()), Either\doubleMap(function (Err $error) use($chapterPage) {
        return new ErrChapter($chapterPage, $error);
    }, f\identity, getOnlyImage(getUrl($chapterPage->getPageImage()->getUrl(), $ttl))), Either\Right::of($chapterPage));
}