예제 #1
0
 function validateData()
 {
     $loc = new Localize(OBIB_LOCALE, "classes");
     $valid = true;
     if ($this->_isRequired and $this->_fieldData == "") {
         $valid = false;
         $this->_fieldDataError = $loc->getText("biblioFieldError1");
     }
     if ($this->_tag == "") {
         $valid = false;
         $this->_tagError = $loc->getText("biblioFieldError1");
     } else {
         if (!is_numeric($this->_tag)) {
             $valid = false;
             $this->_tagError = $loc->getText("biblioFieldError2");
         }
     }
     if ($this->_subfieldCd == "") {
         $valid = false;
         $this->_subfieldCdError = $loc->getText("biblioFieldError1");
     }
     // Check for image
     if ($this->getTag() == "902" && $this->getSubfieldCd() == "a") {
         $fieldData = $this->getFieldData();
         $index = $this->getTag() . $this->getSubfieldCd();
         if (!empty($fieldData["tmp_name"][$index])) {
             if ($info = getimagesize($fieldData["tmp_name"][$index])) {
                 $filename = $fieldData["name"][$index];
                 $filename_parts = explode(".", $filename);
                 unset($filename_parts[count($filename_parts) - 1]);
                 $filename = implode("-", $filename_parts);
                 $allow_types = array('image/jpeg', 'image/png', 'image/gif');
                 // If file type is allowed
                 if (in_array($info["mime"], $allow_types)) {
                     $ext = image_type_to_extension($info[2]);
                     $tmp = md5($filename . session_id() . time());
                     $filename = $filename . "_" . substr($tmp, strlen($tmp) - 7, strlen($tmp)) . $ext;
                     $filepath = "../pictures/{$filename}";
                     copy($fieldData["tmp_name"][$index], $filepath);
                     make_thumbnail($filepath, array('width' => 200));
                     $this->setFieldData($filename);
                 } else {
                     $valid = false;
                     $this->_fieldDataError = $loc->getText("biblioFieldErrorPictureType");
                 }
             } else {
                 $valid = false;
                 $this->_fieldDataError = $loc->getText("biblioFieldErrorPictureType");
             }
         }
     }
     unset($loc);
     return $valid;
 }
예제 #2
0
 function readContent($folderpath)
 {
     global $b;
     $ordner = $folderpath;
     $title = basename($ordner);
     $title = substr($title, 11);
     echo "<div class=\"row tan\">";
     echo "<h2>" . $title . "</h2>";
     //Check if Path is a Folder
     if (!is_dir($ordner)) {
         echo "Ungueltiger Ordnername";
         echo "</br>";
         return;
     }
     //Opens folder and read every item
     $dh = opendir($ordner);
     while (false !== ($filename = readdir($dh))) {
         $files[] = $filename;
     }
     sort($files);
     $allebilder = $files;
     foreach ($allebilder as $bild) {
         $bildinfo = pathinfo($ordner . "/" . $bild);
         $string = explode('.', $bildinfo['basename']);
         $endung = $string[count($string) - 1];
         if (!file_exists('img/_thumbnail/' . basename($ordner))) {
             mkdir('img/_thumbnail/' . basename($ordner), 0775, true);
         }
         if (strcasecmp($endung, "jpg") == 0 || strcasecmp($endung, "PNG") == 0) {
             make_thumbnail($bildinfo['dirname'] . "/" . $bildinfo['basename'], "img/_thumbnail/" . basename($ordner) . "/" . $bildinfo['basename']);
             $thumbnailpath = "img/_thumbnail/" . basename($ordner) . "/" . $bildinfo['basename'];
             $picpath = $bildinfo['dirname'] . "/" . $bildinfo['basename'];
             $picname = $bildinfo['basename'];
             $picname = substr($picname, 0, -4);
             echo "<img class=\"galerie_pics\" src=\"" . $thumbnailpath . "\" data-glisse-big=\"" . $picpath . "\" rel=\"group" . $b . "\" title=\"" . $picname . "\"/>";
         }
     }
     echo "</br></br>";
     echo "</div>";
     closedir($dh);
     $b++;
 }
예제 #3
0
     // create a list with allowed filetypes
     $up->setAllowedFiletypes($fts);
     // allow these extensions to be uploaded. all others will be declined.
     if ($up->upload("sary", $photodir, 2)) {
         $PicsInArray = array();
         $PicsInArray = $up->getReportSuccess();
         //print_r($PicsInArray);
         if ($saryfile = $PicsInArray[0][name_renamed]) {
             $size = GetImageSize($photodir . $saryfile);
             $imagewidth = $size[0];
             $imageheight = $size[1];
             $imagetype = $size[2];
             if ($imagewidth > 600) {
                 make_thumbnail($photodir . $saryfile, 600, $photodir . $saryfile);
             }
             make_thumbnail($photodir . $saryfile, 150, $photodir . "s" . $saryfile);
             // upload thumbnail to ftp
             $sresult = put_mirror("sary_namana", "s" . $saryfile, $photodir . "s" . $saryfile);
             $result = put_mirror("sary_namana", $saryfile, $photodir . $saryfile);
             if ($saryid) {
                 $photo_sql_upd = ", sarypath='{$result->ftp_path}', saryfile='{$saryfile}', sarywidth='{$imagewidth}', saryheight='{$imageheight}', ftp_server='{$result->ftp_server}', ftp_user_name='{$result->ftp_user_name}', ftp_user_pass='******', ftp_dir='{$result->ftp_dir}' ";
             } else {
                 $photo_sql_ins_fields = " ,sarypath, saryfile, sarywidth, saryheight, ftp_server, ftp_user_name, ftp_user_pass, ftp_dir ";
                 $photo_sql_ins_values = " , '{$result->ftp_path}', '{$saryfile}', '{$imagewidth}', '{$imageheight}', '{$result->ftp_server}', '{$result->ftp_user_name}', '{$result->ftp_user_pass}', '{$result->ftp_dir}' ";
             }
         } else {
             $x_body .= "<div>Tsy tafiditra tao amin'ny toerany ny sary. Ilazao ny mpitantana. Error: " . __LINE__ . "</div>";
         }
     }
 }
 if ($saryid) {
예제 #4
0
function printUsmarcInputText($tag, $subfieldCd, $required, &$postVars, &$pageErrors, &$marcTags, &$marcSubflds, $showTagDesc, $cntrlType, $occur = "")
{
    $arrayIndex = sprintf("%03d", $tag) . $subfieldCd;
    $formIndex = $arrayIndex . $occur;
    $size = 40;
    $maxLen = 300;
    $cols = 35;
    $rows = 4;
    if (!isset($postVars)) {
        $value = "";
    } elseif (!isset($postVars['values'][$formIndex])) {
        $value = "";
    } else {
        $value = $postVars['values'][$formIndex];
    }
    if (!isset($postVars['fieldIds'])) {
        $fieldId = "";
    } elseif (!isset($postVars['fieldIds'][$formIndex])) {
        $fieldId = "";
    } else {
        $fieldId = $postVars['fieldIds'][$formIndex];
    }
    if (!isset($pageErrors)) {
        $error = "";
    } elseif (!isset($pageErrors[$formIndex])) {
        $error = "";
    } else {
        $error = $pageErrors[$formIndex];
    }
    echo "<tr><td class=\"primary\" valign=\"top\">\n";
    if ($required) {
        echo "<sup>*</sup> ";
    }
    if ($showTagDesc && isset($marcTags[$tag]) && isset($marcSubflds[$arrayIndex])) {
        echo H($marcTags[$tag]->getDescription());
        echo " (" . H($marcSubflds[$arrayIndex]->getDescription()) . ")";
    } elseif (isset($marcSubflds[$arrayIndex])) {
        echo H($marcSubflds[$arrayIndex]->getDescription());
    }
    if ($occur != "") {
        echo " " . H($occur + 1);
    }
    echo ":\n</td>\n";
    echo "<td valign=\"top\" class=\"primary\">\n";
    if ($cntrlType == OBIB_TEXTAREA_CNTRL) {
        $attrs = array('cols' => H($cols), 'rows' => H($rows));
        echo inputField('textarea', "values[" . H($formIndex) . "]", H($value), $attrs);
    } elseif ($cntrlType == OBIB_TEXT_CNTRL) {
        $attrs = array('size' => H($size), 'maxlength' => H($maxLen));
        echo inputField('text', "values[" . H($formIndex) . "]", H($value), $attrs);
    } elseif ($cntrlType == OBIB_FILE_CNTRL) {
        echo "<input type=\"file\"";
        echo " name=\"values[" . H($formIndex) . "]\" size=\"28\" />";
        if ($value) {
            $title = $postVars["values"]["245a"];
            $filepath = "../pictures/{$value}";
            $thumbpath = make_thumbnail($filepath, array('width' => 200));
            if (file_exists($thumbpath)) {
                echo "<br /><a href=\"{$filepath}\" title=\"{$title}\" target=\"_blank\"><img src=\"{$thumbpath}\" border=\"0\" title=\"{$title}\" alt=\"{$alt}\" /></a>";
            } else {
                echo "<div class=\"error\">File does not exists.</div>";
            }
        }
    }
    if ($error != "") {
        echo "<br><font class=\"error\">";
        echo H($error) . "</font>";
    }
    echo "<input type=\"hidden\" name=\"indexes[]\" value=\"" . H($formIndex) . "\" >\n";
    echo "<input type=\"hidden\" name=\"tags[" . H($formIndex) . "]\" value=\"" . H($tag) . "\" >\n";
    echo "<input type=\"hidden\" name=\"subfieldCds[" . H($formIndex) . "]\" value=\"" . H($subfieldCd) . "\" >\n";
    echo "<input type=\"hidden\" name=\"fieldIds[" . H($formIndex) . "]\" value=\"" . H($fieldId) . "\" >\n";
    echo "<input type=\"hidden\" name=\"requiredFlgs[" . H($formIndex) . "]\" value=\"" . H($required) . "\" >\n";
    echo "</td></tr>\n";
}
예제 #5
0
	</table>

<!--**************************************************************************
    *  Printing result table de opendream para portadas
    *   Modificado por jose lara joanlaga@hotmail.com para mostrar foto de portada cuando no es capturada
    ************************************************************************** -->

      <?php 
    $flds = $LbiblioFlds['902a'];
    ?>
    <td nowrap="true" class="primary picture" valign="top" align="center">  
      <?php 
    if ($flds->_fieldData) {
        $filepath = '../' . COVER_PATH . '/' . addslashes($flds->_fieldData);
        $title = H(addslashes($biblio->getTitle()));
        if ($thumbpath = make_thumbnail($filepath, array('height' => 200))) {
            ?>
      <a href="<?php 
            echo $filepath;
            ?>
" title="<?php 
            echo $title;
            ?>
" target="_blank">
      <img src="<?php 
            echo $thumbpath;
            ?>
" border="0" title="<?php 
            echo $title;
            ?>
" 
예제 #6
0
  </tr>
</table>
<br />



<?php 
#***************************************************************************
#*  Show picture
#***************************************************************************
if (isset($biblioFlds["902a"])) {
    $filepath = "../pictures/" . $biblioFlds["902a"]->getFieldData();
    $title = H($biblioFlds["245a"]->getFieldData());
    //$info = _image_resize($filepath, 200);
    //if (is_array($info)):
    if ($thumbpath = make_thumbnail($filepath, array('width' => 200))) {
        ?>
<table class="primary">
  <tr>
    <th align="left" nowrap="yes">
      <?php 
        echo $loc->getText("biblioViewPictureHeader");
        ?>
    </th>
  </tr>
  <tr>
    <td valign="top" class="primary">
      <a href="<?php 
        echo $filepath;
        ?>
" title="<?php 
예제 #7
0
                    $RowKeys = array_keys($row);
                    $RowValues = array_values($row);
                    $sql .= $RowKeys[3] . " = '" . $RowValues[3] . "',";
                    $sql .= $RowKeys[5] . " = '" . $RowValues[5] . "',";
                    $sql .= $RowKeys[7] . " = '" . $file_name . "',";
                    $sql .= $RowKeys[9] . " = '" . $RowValues[9] . "',";
                    $sql .= $RowKeys[11] . " = '" . $RowValues[11] . "',";
                    $sql .= $RowKeys[13] . " = '" . $size_x . "',";
                    $sql .= $RowKeys[15] . " = '" . $size_y . "',";
                    for ($i = 17; $i < count($RowKeys); $i += 2) {
                        if ($i != 17) {
                            $sql .= ", ";
                        }
                        $sql .= $RowKeys[$i] . " = '" . $RowValues[$i] . "'";
                    }
                    make_thumbnail($image[2], $file_name);
                    $result = cpg_db_query($sql);
                    print "DONE";
                }
            }
        }
    }
} else {
    define('IN_COPPERMINE', true);
    require 'include/init.inc.php';
    $input = Inspekt::makeSuperCage();
    /* 
    1. gather album list  [ keep track of the current path ] [could be based on one element ? how is the path constructed ? ]
    2. gather images
    3. make xml 
    4. send
            $file_name = zip_entry_name($entry);
            $file_name = mb_convert_encoding($file_name, "UTF-8", $enc);
            // もう走査しなくていい
            if ($count > FORCOVER) {
                break;
            }
            // 画像か否か
            if (!is_image($file_name, $image_ext)) {
                continue;
            }
            // サムネイルを作るべき画像か
            if ($count == FORCOVER) {
                $data = zip_entry_read($entry, zip_entry_filesize($entry));
                $ext = get_ext($file_name);
                $thumb = array("id" => $i + 1, "zip" => $zip_file, "filepath" => CACHE . "/thumb." . $ext, "ext" => $ext);
                file_put_contents($thumb["filepath"], $data);
                $r = make_thumbnail($thumb);
                if ($r) {
                    save_thumbnail($thumb);
                }
            }
            $count++;
        }
    } else {
        //die("[ERR]ZIP_OPEN : ".$zip_file);
        // ここに代替画像
    }
    zip_close($comic);
}
echo 'ok';
//header('Location: index.php');
예제 #9
0
 private function build_image($resize, $thumb, $table, $name, $file)
 {
     //move image to temp folder
     move_uploaded_file($this->image['tmp_name'], $this->tempfile);
     $this->imagehash = hash_file('md5', $this->tempfile);
     $this->check_db($table, $name, $file);
     if ($this->existing && file_exists($this->newfile)) {
         echo "File already exists. ";
         //			echo "File already exists. Links redirected to $this->newfname. ";
     } else {
         if (!file_exists($this->newfile)) {
             if ($resize) {
                 if ($this->image['type'] != 'image/gif') {
                     if ($temp = open_image($this->tempfile)) {
                         $src = $temp[0];
                         $canvas = inline_crop($src, $this->dimensions, $this->cropmode, $this->prefwidth, $this->prefheight);
                         $this->save_image($this->image['type'], $canvas, $this->newfile);
                         imagedestroy($canvas);
                         imagedestroy($src);
                     } else {
                         unlink($this->tempfile);
                         echo 'Error: image too large or invalid. ';
                         return false;
                     }
                 } else {
                     copy($this->tempfile, $this->newfile);
                     echo 'Image uploaded! ';
                 }
             } else {
                 if ($thumb) {
                     if ($temp = open_image($this->tempfile)) {
                         $src = $temp[0];
                         $canvas = make_thumbnail($src, $this->dimensions, $this->prefwidth, $this->prefheight, $this->thumbcolor);
                         $this->save_image($this->thumbmime, $canvas, $this->thumbfile);
                     } else {
                         unlink($this->tempfile);
                         echo 'Error: image too large or invalid. ';
                         return false;
                     }
                 }
                 copy($this->tempfile, $this->newfile);
             }
         }
     }
     unlink($this->tempfile);
     $this->tempfile = null;
     return true;
 }
예제 #10
0
function store_file($target_file, $target_file_small)
{
    $success = move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $target_file);
    make_thumbnail($target_file, $target_file_small);
    return $success;
}
예제 #11
0
 function validateData()
 {
     $loc = new Localize(OBIB_LOCALE, "classes");
     $valid = true;
     if ($this->_isRequired and $this->_fieldData == "") {
         $valid = false;
         $this->_fieldDataError = $loc->getText("biblioFieldError1");
     }
     if ($this->_tag == "") {
         $valid = false;
         $this->_tagError = $loc->getText("biblioFieldError1");
     } else {
         if (!is_numeric($this->_tag)) {
             $valid = false;
             $this->_tagError = $loc->getText("biblioFieldError2");
         }
     }
     if ($this->_subfieldCd == "") {
         $valid = false;
         $this->_subfieldCdError = $loc->getText("biblioFieldError1");
     }
     // Check for image
     if ($this->getTag() == "902" && $this->getSubfieldCd() == "a") {
         $fieldData = $this->getFieldData();
         if (!empty($fieldData)) {
             if ($fieldData['uselookup'] === true) {
                 // Override with cover lookup
                 $isbn = $fieldData['isbn'];
                 require_once "BiblioCoverQuery.php";
                 $cq = new BiblioCoverQuery();
                 $path = $cq->lookup($isbn, "large");
                 if (!$path) {
                     $this->_fieldDataError = $loc->getText("biblioFieldErrorCoverLookupFailed");
                     $valid = false;
                 } else {
                     $filename = $cq->save($path, 0);
                     $this->setFieldData($filename);
                 }
             } else {
                 $index = $this->getTag() . $this->getSubfieldCd();
                 if (!empty($fieldData["tmp_name"][$index])) {
                     if ($info = getimagesize($fieldData["tmp_name"][$index])) {
                         $filename = $fieldData["name"][$index];
                         $filename_parts = explode(".", $filename);
                         unset($filename_parts[count($filename_parts) - 1]);
                         $filename = implode("-", $filename_parts);
                         $allow_types = array('image/jpeg', 'image/png', 'image/gif');
                         // If file type is allowed
                         if (in_array($info["mime"], $allow_types)) {
                             // Create directory when necessary, raise error when failed to create "not exist" one.
                             if (!(is_dir('../' . COVER_PATH) || is_dir('../' . COVER_PATH_TMP))) {
                                 $dir_error = FALSE;
                                 if (is_dir('../' . dirname(COVER_PATH))) {
                                     // Create new one.
                                     $cover_path = @mkdir('../' . COVER_PATH, 0777);
                                     $tmp_path = @mkdir('../' . COVER_PATH_TMP, 0777);
                                     if (!$cover_path) {
                                         if (is_dir('../' . COVER_PATH)) {
                                             if (decoct(fileperms('../' . COVER_PATH)) != 0777) {
                                                 $force_chmod = @chmod('../' . COVER_PATH, 0777);
                                                 if (!$force_chmod) {
                                                     $dir_error = TRUE;
                                                 }
                                             }
                                         } else {
                                             $dir_error = TRUE;
                                         }
                                     }
                                     if (!$tmp_path) {
                                         if (is_dir('../' . COVER_PATH_TMP)) {
                                             if (decoct(fileperms('../' . COVER_PATH_TMP)) != 0777) {
                                                 $force_chmod = @chmod('../' . COVER_PATH_TMP, 0777);
                                                 if (!$force_chmod) {
                                                     $dir_error = TRUE;
                                                 }
                                             }
                                         } else {
                                             $dir_error = TRUE;
                                         }
                                     }
                                     if ($dir_error) {
                                         print_r('<span style="color: red"><strong>Error:</strong> Failed to save book cover! please set chmod 777 to /media directory.</span><br />');
                                         return false;
                                     }
                                 }
                             }
                             $ext = image_type_to_extension($info[2]);
                             $tmp = md5($filename . session_id() . time());
                             $filename = $filename . "_" . substr($tmp, strlen($tmp) - 7, strlen($tmp)) . $ext;
                             $filepath = "../" . COVER_PATH . "/{$filename}";
                             copy($fieldData["tmp_name"][$index], $filepath);
                             make_thumbnail($filepath, array('height' => 160));
                             $this->setFieldData($filename);
                         } else {
                             $valid = false;
                             $this->_fieldDataError = $loc->getText("biblioFieldErrorPictureType");
                         }
                     } else {
                         $valid = false;
                         $this->_fieldDataError = $loc->getText("biblioFieldErrorPictureLoadFailed");
                     }
                 }
             }
         } else {
         }
     } else {
         if ($this->getTag() == "20" && $this->getSubfieldCd() == "a") {
             require_once "../classes/BiblioQuery.php";
             $biblio = new BiblioQuery();
             $existBibId = $biblio->ISBNExists($this->getFieldData());
             if ($existBibId && $this->_bibid != $existBibId) {
                 $valid = false;
                 $this->_fieldDataError = $loc->getText("biblioFieldErrorDuplicatedISBN") . ' <a href="../shared/biblio_view.php?bibid=' . $existBibId . '&tab=cataloging">' . $loc->getText("biblioFieldViewExistingISBN") . '</a>';
             }
         }
     }
     unset($loc);
     return $valid;
 }
예제 #12
0
function get_field_bild($field_value, $type, $field_id = '', $rubric_field_template = '', $tpl_field_empty = 0, &$maxlength = '', $document_fields = 0, $rubric_id = 0, $dropdown = '')
{
    global $AVE_Template, $AVE_Core, $AVE_Document, $img_pixel;
    $res = 0;
    switch ($type) {
        case 'edit':
            $blanc = 'templates/' . $_SESSION['admin_theme'] . '/images/blanc.gif';
            $massiv = explode('|', $field_value);
            $field = "<div><img id=\"preview__" . $field_id . "\" src=\"" . (!empty($field_value) ? '../' . make_thumbnail(array('link' => $massiv[0])) : $blanc) . "\" class=\"image_field\" alt=\"\" border=\"0\" /></div>";
            switch ($_SESSION['use_editor']) {
                case '0':
                    // стандартный редактор
                // стандартный редактор
                case '2':
                    $field .= "<input type=\"text\" style=\"width:" . $AVE_Document->_field_width . "\" name=\"feld[" . $field_id . "]\" value=\"" . htmlspecialchars($field_value, ENT_QUOTES) . "\" id=\"image__" . $field_id . "\" />&nbsp;";
                    $field .= "<input type=\"button\" class=\"basicBtn\" value=\"...\" title=\"" . $AVE_Template->get_config_vars('MAIN_OPEN_MEDIAPATH') . "\" onclick=\"browse_uploads('image__" . $field_id . "');\" />";
                    break;
                case '1':
                    // Elrte и Elfinder
                    $field .= "<input class=\"docm finder\" type=\"text\" style=\"width:" . $AVE_Document->_field_width . "\" name=\"feld[" . $field_id . "]\" value=\"" . htmlspecialchars($field_value, ENT_QUOTES) . "\" id=\"img_feld__" . $field_id . "\"/>&nbsp;";
                    $field .= "<span class=\"button basicBtn dialog_images\" rel=\"" . $field_id . "\">" . $AVE_Template->get_config_vars('MAIN_OPEN_MEDIAPATH') . "</span>";
                    break;
                case '3':
                    // CK
                    $field .= "<input type=\"text\" style=\"width:" . $AVE_Document->_field_width . "\" name=\"feld[" . $field_id . "]\" value=\"" . htmlspecialchars($field_value, ENT_QUOTES) . "\" id=\"image__" . $field_id . "\" />&nbsp;";
                    $field .= "<input type=\"button\" class=\"basicBtn\" value=\"...\" title=\"" . $AVE_Template->get_config_vars('MAIN_OPEN_MEDIAPATH') . "\" onclick=\"browse_uploads('image__" . $field_id . "');\" />";
                    break;
            }
            $res = $field;
            break;
        case 'doc':
            $field_value = clean_php($field_value);
            $field_param = explode('|', $field_value);
            if ($tpl_field_empty) {
                $field_value = '<img alt="' . (isset($field_param[1]) ? $field_param[1] : '') . '" src="' . ABS_PATH . $field_param[0] . '" border="0" />';
            } else {
                $field_value = preg_replace('/\\[tag:parametr:(\\d+)\\]/ie', '@$field_param[\\1]', $rubric_field_template);
                $field_value = preg_replace_callback('/\\[tag:([r|c|f|t]\\d+x\\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
            }
            $res = $field_value;
            break;
        case 'req':
            $field_value = clean_php($field_value);
            $field_param = explode('|', $field_value);
            $field_param[1] = isset($field_param[1]) ? $field_param[1] : '';
            if ($document_fields[$rubric_id]['tpl_req_empty']) {
                $field_value = '<img src="' . ABS_PATH . $field_param[0] . '" alt="' . $field_param[1] . '" border="0" />';
            } else {
                $field_value = preg_replace('/\\[tag:parametr:(\\d+)\\]/ie', '@$field_param[\\1]', $document_fields[$rubric_id]['rubric_field_template_request']);
                $field_value = preg_replace_callback('/\\[tag:([r|c|f|t]\\d+x\\d+r*):(.+?)]/', 'callback_make_thumbnail', $field_value);
            }
            $maxlength = '';
            $res = $field_value;
            break;
        case 'name':
            $res = 'FIELD_IMAGE';
            break;
    }
    return $res ? $res : $field_value;
}
예제 #13
0
function callback_make_thumbnail($params)
{
    return is_array($params) && isset($params[2]) ? make_thumbnail(array('size' => $params[1], 'link' => $params[2])) : '';
}
예제 #14
0
function printUsmarcInputText($tag, $subfieldCd, $required, &$postVars, &$pageErrors, &$marcTags, &$marcSubflds, $showTagDesc, $cntrlType, $occur = "")
{
    require_once "../classes/Localize.php";
    $shareloc = new Localize(OBIB_LOCALE, "shared");
    $arrayIndex = sprintf("%03d", $tag) . $subfieldCd;
    $formIndex = $arrayIndex . $occur;
    $size = 40;
    $maxLen = 300;
    $cols = 35;
    $rows = 4;
    if (!isset($postVars)) {
        $value = "";
    } elseif (!isset($postVars['values'][$formIndex])) {
        $value = "";
    } else {
        $value = $postVars['values'][$formIndex];
    }
    if (!isset($postVars['fieldIds'])) {
        $fieldId = "";
    } elseif (!isset($postVars['fieldIds'][$formIndex])) {
        $fieldId = "";
    } else {
        $fieldId = $postVars['fieldIds'][$formIndex];
    }
    if (!isset($pageErrors)) {
        $error = "";
    } elseif (!isset($pageErrors[$formIndex])) {
        $error = "";
    } else {
        $error = $pageErrors[$formIndex];
    }
    if ($required) {
        echo "<tr><td class=\"primary form-required\" valign=\"top\">\n";
        echo "<sup>*</sup> ";
    } else {
        echo "<tr><td class=\"primary form-optional\" valign=\"top\">\n";
    }
    if ($showTagDesc && isset($marcTags[$tag]) && isset($marcSubflds[$arrayIndex])) {
        $descr = $marcSubflds[$arrayIndex]->getDescription();
        $subfieldSet = explode(' ', $descr, 2);
        echo $tag . $subfieldCd . ' ';
        //muestra los indices de campos MARC
        //    echo $subfieldSet[0] . ' ' . H($marcTags[$tag]->getDescription());// muestra prefijo
        echo ' ; ' . H($marcTags[$tag]->getDescription());
        //    echo ' - ' . $subfieldSet[1];
        //    echo " - " .  H($marcTags[$tag]->getDescription());//test
        echo " - (" . H($marcSubflds[$arrayIndex]->getDescription()) . ")";
        //test
    } elseif (isset($marcSubflds[$arrayIndex])) {
        echo $tag . $subfieldCd . ' ';
        //muestra los indices de campos MARC
        //    echo H($marcSubflds[$arrayIndex]->getDescription());
        echo ' ; ' . H($marcTags[$tag]->getDescription());
        echo " - (" . H($marcSubflds[$arrayIndex]->getDescription()) . ")";
        //test
    }
    if ($occur != "") {
        echo " " . H($occur + 1);
    }
    echo ":\n</td>\n";
    echo "<td valign=\"top\" class=\"primary\">\n";
    switch ($cntrlType) {
        case OBIB_TEXTAREA_CNTRL:
            $attrs = array('cols' => H($cols), 'rows' => H($rows));
            echo inputField('textarea', "values[" . H($formIndex) . "]", $value, $attrs);
            break;
        case OBIB_TEXT_CNTRL:
            $attrs = array('size' => H($size), 'maxlength' => H($maxLen));
            echo inputField('text', "values[" . H($formIndex) . "]", $value, $attrs);
            break;
        case OBIB_FILE_CNTRLF:
            echo "<input type=\"text\"";
            echo " name=\"values[" . H($formIndex) . "]\" size=\"" . H($size) . "\" maxlength=\"" . H($maxLen) . "\" ";
            echo "value=\"" . H($value) . "\" >";
            echo "<sup>(6)</sup>";
            break;
        case OBIB_FILE_CNTRLD:
            echo "<input type=\"text\"";
            echo " name=\"values[" . H($formIndex) . "]\" size=\"" . H($size) . "\" maxlength=\"" . H($maxLen) . "\" ";
            echo " onChange=\"File_DigiReload()\" ";
            echo "value=\"" . H($value) . "\" >";
            echo "<sup>(5)</sup>";
            break;
        case OBIB_FILE_CNTRLA:
            echo "<input type=\"text\"";
            echo " name=\"values[" . H($formIndex) . "]\" size=\"" . H($size) . "\" maxlength=\"" . H($maxLen) . "\" ";
            echo " onChange=\"File_AutReload()\" ";
            echo "value=\"" . H($value) . "\" >";
            echo "<sup>(3)</sup>" . H($value);
            break;
        case OBIB_FILE_CNTRLS:
            echo "<input type=\"text\"";
            echo " name=\"values[" . H($formIndex) . "]\" size=\"" . H($size) . "\" maxlength=\"" . H($maxLen) . "\" ";
            echo " onChange=\"File_CoverReload()\" ";
            echo "value=\"" . H($value) . "\" >";
            echo "<sup>(1)</sup>" . $values[H($formIndex)];
            break;
        case OBIB_FILE_CNTRL:
            echo "<input type=\"file\"";
            echo " name=\"values[" . H($formIndex) . "]\" size=\"28\" />";
            echo "<input type=\"hidden\" name=\"old[" . H($formIndex) . "]\" value=\"{$value}\" />";
            if ($value) {
                $title = $postVars["values"]["245a"];
                $filepath = "../" . COVER_PATH . "/{$value}";
                $thumbpath = make_thumbnail($filepath, array('height' => 120));
                if (file_exists($thumbpath)) {
                    echo "<br /><a href=\"{$filepath}\" title=\"{$title}\" target=\"_blank\"><img src=\"{$thumbpath}\" border=\"0\" title=\"{$title}\" alt=\"{$title}\" /></a>";
                } else {
                    echo "<div class=\"error\">File does not exists.</div>";
                }
                echo " <a href=\"../catalog/biblio_cover_del.php?bibid=" . HURL($_REQUEST['bibid']) . "&redirect=edit\" onclick=\"javascript: return confirm('" . htmlspecialchars($shareloc->getText('Are you sure to remove this picture?'), ENT_QUOTES) . "');\">" . $shareloc->getText('Remove') . "</a>";
            }
            echo "<sup>(1)</sup>";
            break;
        case OBIB_FILE_CNTRLB:
            echo "<input type=\"file\"";
            echo " name=\"autor\"  ";
            echo " onChange=\"File_AutReload()\">\n";
            echo "<sup>(2)</sup>";
            break;
        case OBIB_FILE_CNTRLK:
            echo "<input type=\"file\"";
            echo " name=\"digital\"  ";
            echo " onChange=\"File_DigiReload()\" ";
            echo "<sup>(4)</sup>";
            break;
        default:
            break;
    }
    if ($error != "") {
        echo "<br><font class=\"error\">";
        if ($formIndex == '020a' || $formIndex == '245a') {
            // Enable suggestion link for existing ISBN check.
            echo $error . "</font>";
        } else {
            echo H($error) . "</font>";
        }
    }
    echo "<input type=\"hidden\" name=\"indexes[]\" value=\"" . H($formIndex) . "\" >\n";
    echo "<input type=\"hidden\" name=\"tags[" . H($formIndex) . "]\" value=\"" . H($tag) . "\" >\n";
    echo "<input type=\"hidden\" name=\"subfieldCds[" . H($formIndex) . "]\" value=\"" . H($subfieldCd) . "\" >\n";
    echo "<input type=\"hidden\" name=\"fieldIds[" . H($formIndex) . "]\" value=\"" . H($fieldId) . "\" >\n";
    echo "<input type=\"hidden\" name=\"requiredFlgs[" . H($formIndex) . "]\" value=\"" . H($required) . "\" >\n";
    echo "</td></tr>\n";
}