コード例 #1
0
ファイル: index.php プロジェクト: vnabokov/api
function getAllThreads()
{
    /* Reads all threads found in system
    	IRL would make a database query instead of reading the .txt file */
    $file = file("messages.txt");
    // read the threads into array
    $threads = array();
    foreach ($file as $line) {
        // loop to access the properties
        $values = explode("|", $line);
        // explode the coded string
        if ($values[1] != 1) {
            // if not the first message of the thread, don't parse
            continue;
        }
        $item[0] = $values[0];
        $item[1] = createPreview($values[3]);
        array_push($threads, $item);
    }
    return $threads;
}
コード例 #2
0
ファイル: indexMedia.php プロジェクト: noveopiu/dCTL
                    doBackup($fileNameTemp);
                    doBackup($pathToUpload);
                }
                if (move_uploaded_file($fileNameTemp, $pathToUpload)) {
                    @chmod($pathToUpload, CHMOD);
                    //permessi per poterci sovrascrivere/scaricare
                    $updateDone = true;
                    $resultMsg .= '<span class="ok">OK: ho caricato il file "' . strtoupper($fileNameUpload) . '" in "' . strtoupper(dirname(str_ireplace($ftp_path, '', $pathToUpload))) . '".</span><br />';
                    if ($isMedia) {
                        $resultMsg .= '<form action="javascript:void(0);">';
                        $theCode = 'img://' . $fileNameUpload;
                        $resultMsg .= '<fieldset><label>URI: </label><input name="new_name" onclick="javascript:this.form.new_name.focus();this.form.new_name.select();" class="linkRule" type="text" value="' . $theCode . '" size="' . strlen($theCode) . '"/><label>' . SYS_DBL_SPACE . '
 <span class="help">fai un click sul testo per selezionare tutto l\'identificativo, poi premi command+c o ctrl+c per copiare...</span></label></fieldset></form><br />';
                    }
                    if ($doPreview) {
                        createPreview($pathToUpload, TRUE);
                    }
                    if ($updateDone) {
                        $who = '';
                        $content = array();
                        $isLocked = checkIfLocked($pathToUpload, &$who, &$content);
                        if ($isLocked) {
                            if (is_file($content[0])) {
                                unlink($content[0]);
                            }
                        }
                    }
                } else {
                    $resultMsg .= '<span class="error">ERRORE: non riesco a modificare il file "' . strtoupper($fileNameUpload) . '"... aggiornamento non riuscito.</span><br />';
                }
            } else {
コード例 #3
0
ファイル: functions.inc.php プロジェクト: noveopiu/dCTL
function createPreview($g_srcfile, $overwrite = TRUE, $forcedsize = 200, $imgcomp = 0)
{
    if (is_dir($g_srcfile)) {
        $handle = opendir($g_srcfile);
        while ($entry = readdir($handle)) {
            if (substr($entry, 0, 1) != '.') {
                if ($entry != basename(DCTL_MEDIA_SML) && $entry != basename(DCTL_MEDIA_MED)) {
                    createPreview($g_srcfile . SYS_PATH_SEP . $entry, $overwrite, $forcedsize, $imgcomp);
                }
            }
        }
    } else {
        makePreview(DCTL_MEDIA_SML, $g_srcfile, $overwrite, $forcedsize, $imgcomp);
        makePreview(DCTL_MEDIA_MED, $g_srcfile, $overwrite, $forcedsize * 2.5, $imgcomp);
    }
}
コード例 #4
0
ファイル: indexAjax.php プロジェクト: noveopiu/dCTL
     }
     $iconMime = image2MIME($icon);
     if ($iconMime == false) {
         $iconMime = "image/jpeg";
     }
     header("Content-type: {$iconMime}", true);
     readfile($icon);
     break;
 case 'load_preview':
     $fPath = preg_replace('%' . HOST_BASE_PATH . '%', FS_BASE_PATH, $url, 1);
     if (is_file($fPath)) {
         $big = $fPath;
         $med = str_ireplace(DCTL_MEDIA_BIG, DCTL_MEDIA_MED, $fPath);
         $sml = str_ireplace(DCTL_MEDIA_BIG, DCTL_MEDIA_SML, $fPath);
         if (!is_file($med) || !is_file($sml)) {
             createPreview($big);
         }
         $fName = basename($fPath);
         $label = $fName;
         list($fWidth, $fHeight) = getimagesize($fPath);
         $maxH = 120;
         $maxW = 120;
         if ($fHeight > $maxH) {
             $fWidth = $maxH * $fWidth / $fHeight;
             $fHeight = $maxH;
         }
         if ($fWidth > $maxW) {
             $fHeight = $maxW * $fHeight / $fWidth;
             $fWidth = $maxW;
         }
         $returnText .= '<form id="form_img" action="indexMedia.php" method="' . DCTL_FORM_METHOD_POST . '" enctype="' . DCTL_FORM_ENCTYPE_POST . '">';
コード例 #5
0
} else {
    $id_author = '';
}
if (isset($_POST["title"])) {
    $title = $_POST["title"];
} else {
    $title = '';
}
if (isset($_POST["subtitle"])) {
    $subtitle = $_POST["subtitle"];
} else {
    $subtitle = '';
}
if (isset($_POST["text"])) {
    $text = $_POST["text"];
    $preview = createPreview($text, 300);
} else {
    $text = '';
    $preview = '';
}
if (isset($_POST["image"])) {
    $image = $_POST["image"];
} else {
    $image = 'null';
}
if (isset($_POST["date"])) {
    $date = $_POST["date"];
} else {
    $date = '';
}
if (isset($_POST["action"])) {
コード例 #6
0
ファイル: upload.php プロジェクト: sete-pw/images
<?php

if (isset(CO::RE()->files['image'])) {
    $imgs = CO::RE()->files['image'];
    foreach ($imgs['type'] as $key => $type) {
        if (explode('/', $type)[0] == 'image') {
            do {
                $url = md5(date('Y-m-d H:i:s') . '->' . rand(-99999, 99999) . ':' . rand(-99999, 99999) . ':' . rand(-99999, 99999) . ':' . rand(-99999, 99999));
                $ext = explode('.', $imgs['name'][$key]);
                $ext = array_pop($ext);
                $url .= '.' . $ext;
                CO::SQL()->query("INSERT INTO images\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\turl_ext,\n\t\t\t\t\t\t\tcategory,\n\t\t\t\t\t\t\tuser_id\n\t\t\t\t\t\t)values(\n\t\t\t\t\t\t\t?,\n\t\t\t\t\t\t\t?,\n\t\t\t\t\t\t\t?,\n\t\t\t\t\t\t\t?\n\t\t\t\t\t\t);\n\t\t\t\t\t", [['s', $url], ['s', mb_strtolower(trim(strip_tags(CO::RE()->post['url_ext'][$key])), 'utf-8')], ['s', mb_strtolower(trim(strip_tags(CO::RE()->post['file'][$key])), 'utf-8')], ['i', CO::AUTH()->who('id_user')]]);
                $id = CO::SQL()->iid();
                if (!copy($imgs['tmp_name'][$key], DIR_PRIVATE . 'data/image/' . $url)) {
                    CO::SQL()->query("DELETE from images\n\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\tid_image = ?\n\t\t\t\t\t\t\tlimit 1;\n\t\t\t\t\t\t", [['i', $id]]);
                    break;
                }
                createPreview($url);
            } while ($id == 0);
        }
    }
}
CO::RE()->redirect('/file-manager.php');