public function restore()
 {
     $va93b85dcfbb9969f5bb3c6be71737ed5 = getPathInfo($this->filePath);
     if (is_dir($va93b85dcfbb9969f5bb3c6be71737ed5['dirname'])) {
         $v9b207167e5381c47682c6b4f58a623fb = @mkdir($this->filePath);
         if ($v9b207167e5381c47682c6b4f58a623fb) {
             @chmod($this->filePath, $this->permissions);
         }
     }
     return is_dir($this->filePath);
 }
Beispiel #2
0
 protected function saveIncomingFile()
 {
     $file_name = getRequest('filename');
     $buffer = outputBuffer::current('HTTPOutputBuffer');
     $content = $buffer->getHTTPRequestBody();
     if (!strlen($file_name)) {
         return "failure\nEmpty filename.";
     }
     list($dir_name, , $extension) = array_values(getPathInfo($file_name));
     if (!strlen($extension) || !umiFile::isAllowedFileType($extension)) {
         return "failure\nUnknown file type.";
     }
     if (!isset($_SESSION['1c_latest_catalog-file'])) {
         $_SESSION['1c_latest_catalog-file'] = "";
     }
     $i_flag = $_SESSION['1c_latest_catalog-file'] == $file_name ? FILE_APPEND : 0;
     $base_name = substr($file_name, 0, strlen($file_name) - strlen($extension) - 1);
     $temp_dir = self::$importDirectory;
     if (!is_dir($temp_dir)) {
         mkdir($temp_dir, 0777, true);
     }
     if (strtolower($extension) == "xml") {
         file_put_contents($temp_dir . $base_name . "." . $extension, $content, $i_flag);
     } else {
         $quota_byte = getBytesFromString(mainConfiguration::getInstance()->get('system', 'quota-files-and-images'));
         if ($quota_byte != 0) {
             $all_size = getBusyDiskSize(array('/files', '/images'));
             if ($all_size + strlen($content) >= $quota_byte) {
                 return "failure\n max dirsize in /files and /images summary.";
             }
         }
         $images_dir = "./images/cms/data/" . $dir_name . "/";
         if (!is_dir($images_dir)) {
             mkdir($images_dir, 0777, true);
         }
         file_put_contents("./images/cms/data/" . $file_name, $content, $i_flag);
         if (realpath("./images/cms/data/" . $file_name) != CURRENT_WORKING_DIR . "/images/cms/data/" . $file_name) {
             unlink("./images/cms/data/" . $file_name);
             return "failure\nWrong file path.";
         }
     }
     $_SESSION['1c_latest_catalog-file'] = $file_name;
     return "success";
 }
Beispiel #3
0
}
// add a trailing / to rootUrl
// $scriptUrl =  "/path/to/bizou/index.php"
// $rootUrl =  "/path/to/bizou/"
require 'functions.php';
// if url == http://localhost/photos/index.php/toto/titi, path_info == /toto/titi
// if url == http://localhost/photos/index.php, path_info is not set
// if url == http://localhost/photos/, path_info is not set
// if path_info is not set, we are at top level, so we redirect to /photos/index.php/
if (!isset($_SERVER["PATH_INFO"])) {
    header("Location: {$scriptUrl}/");
    exit;
}
// simplePath is the simple path to the directory
// extract /path/to/dir/ from /index.php/path/to/dir/
$simplePath = getPathInfo();
# realDir is the directory in filesystem
# seen from current script directory
$realDir = IMAGES_DIR . $simplePath;
if (!is_dir($realDir)) {
    header("HTTP/1.1 404 Not Found");
    die("Directory Not Found");
}
// init folders with the . folder
$folders = array();
$imageFiles = array();
$otherFiles = array();
$folderCount = 0;
$imageCount = 0;
foreach (scandir($realDir) as $file) {
    if ($file != '.' and $file != '..') {
 protected function translateData(iUmiObjectProperty $v1a8db4c996d8ed8289da5f957879ab94)
 {
     $v26b75b176d665f24a5fd22a2ad815763 = array();
     $v2063c1608d6e0baf80249c42e2be5804 = $v1a8db4c996d8ed8289da5f957879ab94->getValue();
     $v06e3d36fa30cea095545139854ad1fb9 = $v1a8db4c996d8ed8289da5f957879ab94->getField();
     $v945100186b119048837b9859c2c46410 = $v06e3d36fa30cea095545139854ad1fb9->getId();
     $v972bf3f05d14ffbdb817bef60638ff00 = $v06e3d36fa30cea095545139854ad1fb9->getName();
     $v6d58e323dd91f19ec80d313941942f94 = $v06e3d36fa30cea095545139854ad1fb9->getTitle();
     $v833750ac635fcc57dc33ecafe365f9a7 = $v06e3d36fa30cea095545139854ad1fb9->getFieldType();
     $v5fd6df40d7c4dd7f503475344d8c145c = $v833750ac635fcc57dc33ecafe365f9a7->getDataType();
     if ($v5fd6df40d7c4dd7f503475344d8c145c == "password" && !xmlTranslator::$showUnsecureFields || in_array($v972bf3f05d14ffbdb817bef60638ff00, array('user_dock', 'user_settings_data', 'activate_code')) && !xmlTranslator::$showUnsecureFields) {
         return false;
     }
     $v74f510617fc594986f85795a43ecb7cd = is_object($v2063c1608d6e0baf80249c42e2be5804) || is_array($v2063c1608d6e0baf80249c42e2be5804) && !empty($v2063c1608d6e0baf80249c42e2be5804) || !is_array($v2063c1608d6e0baf80249c42e2be5804) && strlen($v2063c1608d6e0baf80249c42e2be5804);
     if ($v74f510617fc594986f85795a43ecb7cd || self::$showEmptyFields || translatorWrapper::$showEmptyFields) {
         $v26b75b176d665f24a5fd22a2ad815763['@id'] = $v945100186b119048837b9859c2c46410;
         $v26b75b176d665f24a5fd22a2ad815763['@name'] = $v972bf3f05d14ffbdb817bef60638ff00;
         $v26b75b176d665f24a5fd22a2ad815763['@type'] = $v5fd6df40d7c4dd7f503475344d8c145c;
         if ($v5fd6df40d7c4dd7f503475344d8c145c == 'relation' && $v06e3d36fa30cea095545139854ad1fb9->getFieldType()->getIsMultiple()) {
             $v26b75b176d665f24a5fd22a2ad815763['@multiple'] = 'multiple';
         }
         $v26b75b176d665f24a5fd22a2ad815763['title'] = $v6d58e323dd91f19ec80d313941942f94;
         if ($v5fd6df40d7c4dd7f503475344d8c145c == 'price') {
             $v05c08ca192baab52e722f628f416fb2b = regedit::getInstance()->getVal("//modules/eshop/default_currency_code");
             if ($v05c08ca192baab52e722f628f416fb2b) {
                 $vf82265ccceac13b2f40ccd9e81cbd263 = umiBasket::getInstance()->getCurrencyIdBySId($v05c08ca192baab52e722f628f416fb2b);
                 if ($vf82265ccceac13b2f40ccd9e81cbd263) {
                     $v1af0389838508d7016a9841eb6273962 = umiObjectsCollection::getInstance()->getObject($vf82265ccceac13b2f40ccd9e81cbd263);
                     if ($v1af0389838508d7016a9841eb6273962) {
                         $v26b75b176d665f24a5fd22a2ad815763['currency'] = array('@id' => $vf82265ccceac13b2f40ccd9e81cbd263, '@code' => $v1af0389838508d7016a9841eb6273962->getValue('eshop_currency_letter_code'), '@symbol' => $v1af0389838508d7016a9841eb6273962->getValue('eshop_currency_symbol'), '@rate' => $v1af0389838508d7016a9841eb6273962->getValue('eshop_currency_exchange_rate'));
                         $v26b75b176d665f24a5fd22a2ad815763['curSymb'] = $v1af0389838508d7016a9841eb6273962->getValue("eshop_currency_symbol");
                     }
                 }
             }
         }
         $v26b75b176d665f24a5fd22a2ad815763['value'] = array();
         switch ($v5fd6df40d7c4dd7f503475344d8c145c) {
             case "symlink":
                 $v26b75b176d665f24a5fd22a2ad815763['value']['nodes:page'] = array();
                 foreach ($v2063c1608d6e0baf80249c42e2be5804 as $v8e2dcfd7e7e24b1ca76c1193f645902b) {
                     $v26b75b176d665f24a5fd22a2ad815763['value']['nodes:page'][] = $v8e2dcfd7e7e24b1ca76c1193f645902b;
                 }
                 break;
             case "relation":
                 $v5891da2d64975cae48d175d1e001f5da = umiObjectsCollection::getInstance();
                 $v26b75b176d665f24a5fd22a2ad815763['value']['nodes:item'] = array();
                 if (is_array($v2063c1608d6e0baf80249c42e2be5804)) {
                     foreach ($v2063c1608d6e0baf80249c42e2be5804 as $v16b2b26000987faccb260b9d39df1269) {
                         $v26b75b176d665f24a5fd22a2ad815763['value']['nodes:item'][] = $v5891da2d64975cae48d175d1e001f5da->getObject($v16b2b26000987faccb260b9d39df1269);
                     }
                 } else {
                     $v26b75b176d665f24a5fd22a2ad815763['value']['item'] = $v5891da2d64975cae48d175d1e001f5da->getObject($v2063c1608d6e0baf80249c42e2be5804);
                 }
                 break;
             case "date":
                 if ($v2063c1608d6e0baf80249c42e2be5804 instanceof iUmiDate) {
                     $v1b299b309feb62d3291407caed9cf4fa = array('get_editable_region', 'save_editable_region');
                     $v8b1dc169bf460ee884fceef66c6607d6 = cmsController::getInstance();
                     $v1ddcb92ade31c8fbd370001f9b29a7d9 = in_array($v8b1dc169bf460ee884fceef66c6607d6->getCurrentMethod(), $v1b299b309feb62d3291407caed9cf4fa) ? false : 'r';
                     $v26b75b176d665f24a5fd22a2ad815763['value']['@formatted-date'] = $v2063c1608d6e0baf80249c42e2be5804->getFormattedDate("d.m.Y H:i");
                     $v26b75b176d665f24a5fd22a2ad815763['value']['@unix-timestamp'] = $v2063c1608d6e0baf80249c42e2be5804->getFormattedDate("U");
                     $v26b75b176d665f24a5fd22a2ad815763['value']['#rfc'] = $v2063c1608d6e0baf80249c42e2be5804->getDateTimeStamp() > 0 ? $v2063c1608d6e0baf80249c42e2be5804->getFormattedDate($v1ddcb92ade31c8fbd370001f9b29a7d9) : "";
                 }
                 break;
             case "optioned":
                 $v93da65a9fd0004d9477aeac024e08e15 = array();
                 $vb81ca7c0ccaa77e7aa91936ab0070695 = umiHierarchy::getInstance();
                 $v5891da2d64975cae48d175d1e001f5da = umiObjectsCollection::getInstance();
                 foreach ($v2063c1608d6e0baf80249c42e2be5804 as $v3a6d0284e743dc4a9b86f97d6dd1a3bf) {
                     $v5ecf0a02e02bd528df985f4f51a5af41 = array();
                     foreach ($v3a6d0284e743dc4a9b86f97d6dd1a3bf as $v599dcce2998a6b40b1e38e8c6006cb0a => $v2d79067f0fcb37a2c56a7c466f56f0ae) {
                         switch ($v599dcce2998a6b40b1e38e8c6006cb0a) {
                             case "tree":
                                 $v8e2dcfd7e7e24b1ca76c1193f645902b = $vb81ca7c0ccaa77e7aa91936ab0070695->getElement($v2d79067f0fcb37a2c56a7c466f56f0ae);
                                 if ($v8e2dcfd7e7e24b1ca76c1193f645902b instanceof iUmiHierarchyElement) {
                                     $v5ecf0a02e02bd528df985f4f51a5af41['page'] = $v8e2dcfd7e7e24b1ca76c1193f645902b;
                                 }
                                 break;
                             case "rel":
                                 $va8cfde6331bd59eb2ac96f8911c4b666 = $v5891da2d64975cae48d175d1e001f5da->getObject($v2d79067f0fcb37a2c56a7c466f56f0ae);
                                 if ($va8cfde6331bd59eb2ac96f8911c4b666 instanceof iUmiObject) {
                                     $v5ecf0a02e02bd528df985f4f51a5af41['object'] = $va8cfde6331bd59eb2ac96f8911c4b666;
                                 }
                                 break;
                             default:
                                 $v5ecf0a02e02bd528df985f4f51a5af41['@' . $v599dcce2998a6b40b1e38e8c6006cb0a] = $v2d79067f0fcb37a2c56a7c466f56f0ae;
                         }
                     }
                     $v93da65a9fd0004d9477aeac024e08e15[] = $v5ecf0a02e02bd528df985f4f51a5af41;
                 }
                 $v26b75b176d665f24a5fd22a2ad815763['value']['nodes:option'] = $v93da65a9fd0004d9477aeac024e08e15;
                 break;
             case "price":
                 $v26b75b176d665f24a5fd22a2ad815763['value']['xlink:href'] = 'udata://emarket/price/' . $v1a8db4c996d8ed8289da5f957879ab94->getObjectId();
             default:
                 if (is_array($v2063c1608d6e0baf80249c42e2be5804)) {
                     unset($v26b75b176d665f24a5fd22a2ad815763['value']);
                     $v26b75b176d665f24a5fd22a2ad815763['nodes:value'] = $v2063c1608d6e0baf80249c42e2be5804;
                     if ($v5fd6df40d7c4dd7f503475344d8c145c == 'tags') {
                         $v26b75b176d665f24a5fd22a2ad815763['combined'] = implode(', ', $v2063c1608d6e0baf80249c42e2be5804);
                     }
                 } else {
                     $v8b1dc169bf460ee884fceef66c6607d6 = cmsController::getInstance();
                     $v2063c1608d6e0baf80249c42e2be5804 = xmlTranslator::executeMacroses($v2063c1608d6e0baf80249c42e2be5804, false, $v1a8db4c996d8ed8289da5f957879ab94->getObjectId());
                     if (defined("XML_PROP_VALUE_MODE") && $v5fd6df40d7c4dd7f503475344d8c145c == "wysiwyg" && $v8b1dc169bf460ee884fceef66c6607d6->getCurrentMode() != "admin") {
                         if (XML_PROP_VALUE_MODE == "XML") {
                             $v26b75b176d665f24a5fd22a2ad815763['value'] = array("xml:xvalue" => "<xvalue>" . $v2063c1608d6e0baf80249c42e2be5804 . "</xvalue>");
                             break;
                         }
                     }
                     if ($v2063c1608d6e0baf80249c42e2be5804 && in_array($v5fd6df40d7c4dd7f503475344d8c145c, array('img_file', 'swf_file', 'file'))) {
                         $v2063c1608d6e0baf80249c42e2be5804 = $v2063c1608d6e0baf80249c42e2be5804->getFilePath(true);
                         $vcaf9b6b99962bf5c2264824231d7a40c = getPathInfo($v2063c1608d6e0baf80249c42e2be5804);
                         $v2f0056df010e0231e4cca0e382df44fc = "|^" . CURRENT_WORKING_DIR . "|";
                         $v2063c1608d6e0baf80249c42e2be5804 = preg_replace($v2f0056df010e0231e4cca0e382df44fc, "", $v2063c1608d6e0baf80249c42e2be5804);
                         $v26b75b176d665f24a5fd22a2ad815763['value']['@path'] = '.' . $v2063c1608d6e0baf80249c42e2be5804;
                         $v26b75b176d665f24a5fd22a2ad815763['value']['@folder'] = preg_replace($v2f0056df010e0231e4cca0e382df44fc, "", $vcaf9b6b99962bf5c2264824231d7a40c['dirname']);
                         $v26b75b176d665f24a5fd22a2ad815763['value']['@name'] = $vcaf9b6b99962bf5c2264824231d7a40c['filename'];
                         $v26b75b176d665f24a5fd22a2ad815763['value']['@ext'] = $vcaf9b6b99962bf5c2264824231d7a40c['extension'];
                         if (in_array($v5fd6df40d7c4dd7f503475344d8c145c, array('img_file', 'swf_file'))) {
                             $v47c80780ab608cc046f2a6e6f071feb6 = getimagesize('.' . $v2063c1608d6e0baf80249c42e2be5804);
                             if (is_array($v47c80780ab608cc046f2a6e6f071feb6)) {
                                 $v26b75b176d665f24a5fd22a2ad815763['value']['@width'] = $v47c80780ab608cc046f2a6e6f071feb6[0];
                                 $v26b75b176d665f24a5fd22a2ad815763['value']['@height'] = $v47c80780ab608cc046f2a6e6f071feb6[1];
                             }
                         }
                     }
                     $v26b75b176d665f24a5fd22a2ad815763['value']['#value'] = $v2063c1608d6e0baf80249c42e2be5804;
                 }
                 break;
         }
     }
     return $v26b75b176d665f24a5fd22a2ad815763;
 }
Beispiel #5
0
/**
*   @desc Создает каталог
*   @return
*/
function createFolder($basepath, $szName)
{
    $fs = DAO::getInstance('fs');
    // проверяем путь на доступ
    $szBasePath = toCanonical(realpath(FILE_PATH . $basepath));
    $szErrorMessage = checkPath($szBasePath);
    if (!is_dir($szBasePath) || !empty($szErrorMessage)) {
        return getPathInfo('', $szErrorMessage);
    }
    // создаем каталог
    $szName = preg_replace('/[\\/\\:\\*\\?\\<\\>\\"|]/', '', $szName);
    $fs->createPath(toCanonical($szBasePath . $szName));
    $fs->chmod(toCanonical($szBasePath . $szName));
    // вызываем список файлов в каталоге
    return getPathInfo($basepath, $szErrorMessage);
}
 protected function translateFile($vd6fe1d0be6347b8ef2427fa629c04485)
 {
     $result = array();
     $v7a6b154733290cd8da376eb56fe2d5fa = getPathInfo($vd6fe1d0be6347b8ef2427fa629c04485);
     $result['attribute:name'] = self::convertCharset($v7a6b154733290cd8da376eb56fe2d5fa['basename']);
     if (isset($v7a6b154733290cd8da376eb56fe2d5fa['extension'])) {
         $result['attribute:ext'] = $vabf77184f55403d75b9d51d79162a7ca = $v7a6b154733290cd8da376eb56fe2d5fa['extension'];
     }
     $result['attribute:size'] = filesize($vd6fe1d0be6347b8ef2427fa629c04485);
     if (function_exists("mime_content_type")) {
         $result['attribute:mimeType'] = mime_content_type($vd6fe1d0be6347b8ef2427fa629c04485);
     }
     $v3fe00293f378dc5b77dcc1a8116cb6f3 = stat($vd6fe1d0be6347b8ef2427fa629c04485);
     $result['attribute:create-time'] = $v3fe00293f378dc5b77dcc1a8116cb6f3['ctime'];
     $result['attribute:modify-time'] = $v3fe00293f378dc5b77dcc1a8116cb6f3['mtime'];
     if ($this->modeAll) {
         switch ($vabf77184f55403d75b9d51d79162a7ca) {
             case "xml":
             case "xsl":
             case "xsd":
             case "html":
                 $result['xml:source'] = file_get_contents($vd6fe1d0be6347b8ef2427fa629c04485);
                 break;
             case "txt":
                 $result['source'] = file_get_contents($vd6fe1d0be6347b8ef2427fa629c04485);
                 break;
             case "gif":
             case "jpg":
             case "jpeg":
             case "png":
                 list($veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81) = $vf7bd60b75b29d79b660a2859395c1a24 = getimagesize($vd6fe1d0be6347b8ef2427fa629c04485);
                 $result['attribute:mimeType'] = $vf7bd60b75b29d79b660a2859395c1a24['mime'];
                 $result['imageWidth'] = $veaae26a6fb20ed3ef54fb23bfa0b1fcc;
                 $result['imageHeight'] = $vb435e227d5dd201e1768b2bcb2e0aa81;
                 break;
         }
     }
     return $result;
 }
 public static function getUnconflictPath($v9024b204fb4c4ffdd07ee631ed791f75)
 {
     if (!file_exists($v9024b204fb4c4ffdd07ee631ed791f75)) {
         return $v9024b204fb4c4ffdd07ee631ed791f75;
     } else {
         $vcaf9b6b99962bf5c2264824231d7a40c = getPathInfo($v9024b204fb4c4ffdd07ee631ed791f75);
         $v954eef6d6eac59aca304b6d7abb4fb3e = $vcaf9b6b99962bf5c2264824231d7a40c['dirname'];
         $v435ed7e9f07f740abf511a62c00eef6e = $vcaf9b6b99962bf5c2264824231d7a40c['filename'];
         $vabf77184f55403d75b9d51d79162a7ca = $vcaf9b6b99962bf5c2264824231d7a40c['extension'];
         for ($v865c0c0b4ab0e063e5caa3387c1a8741 = 1; $v865c0c0b4ab0e063e5caa3387c1a8741 < 257; $v865c0c0b4ab0e063e5caa3387c1a8741++) {
             $v9024b204fb4c4ffdd07ee631ed791f75 = $v954eef6d6eac59aca304b6d7abb4fb3e . "/" . $v435ed7e9f07f740abf511a62c00eef6e . $v865c0c0b4ab0e063e5caa3387c1a8741 . "." . $vabf77184f55403d75b9d51d79162a7ca;
             if (!file_exists($v9024b204fb4c4ffdd07ee631ed791f75)) {
                 return $v9024b204fb4c4ffdd07ee631ed791f75;
             }
         }
         throw new coreException("This is really hard to happen");
     }
 }
 protected function getExternalDTD($path)
 {
     $cmsController = cmsController::getInstance();
     $prefix = $cmsController->getCurrentLang()->getPrefix();
     $info = getPathInfo($cmsController->getTemplatesDirectory() . $path);
     $left = getArrayKey($info, 'dirname') . '/' . getArrayKey($info, 'filename');
     $right = getArrayKey($info, 'extension');
     $primaryPath = $left . '.' . $prefix . '.' . $right;
     $secondaryPath = $left . '.' . $right;
     if (is_file($primaryPath)) {
         return file_get_contents($primaryPath);
     }
     if (is_file($secondaryPath)) {
         return file_get_contents($secondaryPath);
     }
     return '';
 }
 public function getName()
 {
     return getPathInfo($this->configFileName, 'filename');
 }
Beispiel #10
0
/**
 * Function for retrieving a person's
 * uploaded school photo.
 *
 * @since 4.5
 * @param int $id
 *            Person ID.
 * @param string $email
 *            Email of the requested person.
 * @param int $s
 *            Size of the photo.
 * @param string $class
 *            HTML element for CSS.
 * @return mixed
 */
function getSchoolPhoto($id, $email, $s = 80, $class = 'thumb')
{
    $app = \Liten\Liten::getInstance();
    $nae = $app->db->person()->select('photo')->where('personID = ?', $id)->_and_()->where('photo <> ""')->_and_()->where('photo <> "NULL"')->findOne();
    if ($nae !== false) {
        $photosize = getimagesize(get_base_url() . 'static/photos/' . $nae->photo);
        if (getPathInfo('/form/photo/') === '/form/photo/') {
            $avatar = '<a href="' . get_base_url() . 'form/deleteSchoolPhoto/"><img src="' . get_base_url() . 'static/photos/' . $nae->photo . '" ' . imgResize($photosize[1], $photosize[1], $s) . ' alt="' . get_name($id) . '" class="' . $class . '" /></a>';
        } else {
            $avatar = '<img src="' . get_base_url() . 'static/photos/' . $nae->photo . '" ' . imgResize($photosize[1], $photosize[1], $s) . ' alt="' . get_name($id) . '" class="' . $class . '" />';
        }
    } else {
        $avatar = get_user_avatar($email, $s, $class);
    }
    return $avatar;
}
Beispiel #11
0
 public function uploadImages()
 {
     $parentId = getRequest("param0");
     $parentElement = umiHierarchy::getInstance()->getElement($parentId);
     $hierarchy = umiHierarchy::getInstance();
     $hierarchyTypes = umiHierarchyTypesCollection::getInstance();
     $objectTypes = umiObjectTypesCollection::getInstance();
     $cmsController = cmsController::getInstance();
     if ($parentElement) {
         $folder = './images/cms/data/';
         $curEl = $parentElement;
         $altDirs = array();
         while (true) {
             $altDir = $curEl->getAltName();
             if ($altDir) {
                 array_unshift($altDirs, $altDir);
             }
             $curEl = $hierarchy->getElement($curEl->getRel());
             if (empty($curEl)) {
                 break;
             }
         }
         foreach ($altDirs as $alt) {
             $folder .= $alt . '/';
             if (!file_exists($folder)) {
                 mkdir($folder);
             }
         }
         $allowedTypes = array("jpg", "jpeg", "gif", "bmp", "png");
         $tplId = $parentElement->getTplId();
         $domainId = $parentElement->getDomainId();
         $langId = $parentElement->getLangId();
         $hierarchyTypeId = $hierarchyTypes->getTypeByName("photoalbum", "photo")->getId();
         $objectTypeId = $objectTypes->getBaseType("photoalbum", "photo");
         $objectType = $objectTypes->getType($objectTypeId);
         if ($objectType->getHierarchyTypeId() != $hierarchyTypeId) {
             $this->errorNewMessage("Object type and hierarchy type doesn't match");
             $this->errorPanic();
         }
         if (isset($_FILES['fs_upl_files']) && is_array($_FILES['fs_upl_files'])) {
             $uploadedFiles = $_FILES['fs_upl_files'];
             foreach ($uploadedFiles['name'] as $id => $pathName) {
                 if ($fileUploaded = umiImageFile::upload("fs_upl_files", $id, $folder)) {
                     $fileName = $fileUploaded->getFileName();
                     $filePath = $fileUploaded->getFilePath();
                     $fileExt = $fileUploaded->getExt();
                     if (in_array(strtolower($fileExt), $allowedTypes)) {
                         $pathInfo = getPathInfo($fileName);
                         $title = $pathInfo['filename'];
                         $elementId = $hierarchy->addElement($parentId, $hierarchyTypeId, $title, $title, $objectTypeId, $domainId, $langId, $tplId);
                         permissionsCollection::getInstance()->setDefaultPermissions($elementId);
                         $element = $hierarchy->getElement($elementId, true);
                         $element->setIsActive(true);
                         $element->setIsVisible(false);
                         $element->setName($title);
                         $element->setValue("photo", $fileUploaded);
                         $element->setValue("create_time", time());
                         $element->commit();
                         $parentElement->setUpdateTime(time());
                         $parentElement->commit();
                     } else {
                         $fileUploaded->delete();
                     }
                 }
             }
             $this->chooseRedirect();
         } else {
             throw new publicAdminException(getLabel("error-expect-files-array"));
         }
     } else {
         throw new publicAdminException(getLabel("error-expect-parent-id"));
     }
 }
Beispiel #12
0
    require $app->config('routers_dir') . 'sql.router.php';
    if (file_exists($app->config('routers_dir') . 'savedquery.router.php')) {
        require $app->config('routers_dir') . 'savedquery.router.php';
    }
} elseif (strpos(getPathInfo('/staff'), "/staff") === 0) {
    require $app->config('routers_dir') . 'staff.router.php';
    if (file_exists($app->config('routers_dir') . 'timesheet.router.php')) {
        require $app->config('routers_dir') . 'timesheet.router.php';
    }
} elseif (strpos(getPathInfo('/stu'), "/stu") === 0) {
    _etsis_student_router();
    if (file_exists($app->config('routers_dir') . 'financial.router.php')) {
        require $app->config('routers_dir') . 'financial.router.php';
    }
    if (file_exists($app->config('routers_dir') . 'gradebook.router.php')) {
        require $app->config('routers_dir') . 'gradebook.router.php';
    }
} elseif (strpos(getPathInfo('/err'), "/err") === 0) {
    require $app->config('routers_dir') . 'error.router.php';
    if (file_exists($app->config('routers_dir') . 'log.router.php')) {
        require $app->config('routers_dir') . 'log.router.php';
    }
} elseif (strpos(getPathInfo('/audit-trail'), "/audit-trail") === 0) {
    require $app->config('routers_dir') . 'log.router.php';
} else {
    require $app->config('routers_dir') . 'index.router.php';
    if (file_exists($app->config('routers_dir') . 'myet.router.php')) {
        require $app->config('routers_dir') . 'myet.router.php';
    }
    // default routes
}
 /**
  * TODO PHPDoc
  * Enter description here ...
  * @param unknown_type $field
  * @param unknown_type $is_multiple
  * @param unknown_type $object
  * @param unknown_type $template
  */
 public function renderEditFieldImageFile($field, $is_multiple, $object, $template)
 {
     list($template_block) = def_module::loadTemplates("data/reflection/{$template}", "reflection_field_img_file");
     $block_arr = array();
     if ($is_multiple) {
         //TODO
     } else {
         $field_name = $field->getName();
         $block_arr['attribute:name'] = $field_name;
         $block_arr['attribute:title'] = $field->getTitle();
         $block_arr['attribute:tip'] = $field->getTip();
         $block_arr['attribute:maxsize'] = $this->getAllowedMaxFileSize("img");
         $block_arr['attribute:field_id'] = $field->getId();
         $value = $object ? $object->getValue($field->getName()) : "";
         if ($value instanceof umiFile) {
             $block_arr['attribute:relative-path'] = $value->getFilePath(true);
             switch ($field_name) {
                 case "menu_pic_ua":
                     $destination_folder = "./images/cms/menu/";
                     break;
                 case "header_pic":
                     $destination_folder = "./images/cms/headers/";
                     break;
                 case "menu_pic_a":
                     $destination_folder = "./images/cms/menu/";
                     break;
                 default:
                     $destination_folder = "./images/cms/data/";
                     break;
             }
             //$block_arr['node:value'] = basename ($value->getFilePath());
             $info = getPathInfo($value->getFilePath(true));
             $info['dirname'] = '.' . $info['dirname'];
             $relative_path = substr($info['dirname'], strlen($destination_folder)) . "/" . $info['basename'];
             if (substr($relative_path, 0, 1) == "/") {
                 $relative_path = substr($relative_path, 1);
             }
             $block_arr['node:value'] = $relative_path;
             $block_arr['attribute:destination-folder'] = $info['dirname'];
         } else {
             $block_arr['node:value'] = "";
             //$block_arr['attribute:destination-folder'] = "";
             $folder_name = $field_name . '/';
             $general_name = "./images/cms/";
             $destination_folder = $general_name . (is_dir($general_name . $folder_name) ? $folder_name : '');
             switch ($field_name) {
                 case "menu_pic_ua":
                     $pFolder = "menu";
                     break;
                 case "header_pic":
                     $pFolder = "headers";
                     break;
                 case "menu_pic_a":
                     $pFolder = "menu";
                     break;
                 default:
                     $pFolder = "data";
                     break;
             }
             $block_arr['attribute:destination-folder'] = $destination_folder . $pFolder;
         }
         if ($object) {
             $block_arr['void:object_id'] = $object->getId();
         }
         $block_arr['attribute:input_name'] = $object ? "data[" . $object->getId() . "][{$field_name}]" : "data[new][{$field_name}]";
     }
     return def_module::parseTemplate($template_block, $block_arr);
 }
 public static function addWatermark($v47826cacc65c665212b821e6ff80b9b0)
 {
     if (!empty($_REQUEST['disable_watermark'])) {
         return false;
     }
     $vb1444fb0c07653567ad325aa25d4e37a = regedit::getInstance();
     $v9234d6561fcbf96ed0c3f0ee5794032d = $vb1444fb0c07653567ad325aa25d4e37a->getVal("//settings/watermark/image");
     $v8fa8b46b17731c7c9c882faede387741 = $vb1444fb0c07653567ad325aa25d4e37a->getVal("//settings/watermark/alpha");
     $v379da31305f1eba200307fcdf9cf0ca0 = $vb1444fb0c07653567ad325aa25d4e37a->getVal("//settings/watermark/valign");
     $vb1c37415e373f67b34bfbdeac8a8338f = $vb1444fb0c07653567ad325aa25d4e37a->getVal("//settings/watermark/halign");
     if (!file_exists($v9234d6561fcbf96ed0c3f0ee5794032d)) {
         return false;
     }
     if (!$v8fa8b46b17731c7c9c882faede387741) {
         $v8fa8b46b17731c7c9c882faede387741 = 100;
     }
     if (!$v379da31305f1eba200307fcdf9cf0ca0) {
         $v379da31305f1eba200307fcdf9cf0ca0 = "bottom";
     }
     if (!$vb1c37415e373f67b34bfbdeac8a8338f) {
         $vb1c37415e373f67b34bfbdeac8a8338f = "right";
     }
     $vfc1eb20506413fbbdc753afe5117cff0 = self::createImage($v9234d6561fcbf96ed0c3f0ee5794032d);
     $v6226ba4abbac63dbd2114cb5966b1bf8 = self::createImage($v47826cacc65c665212b821e6ff80b9b0);
     $vfcf76116d23aa625909b9eb0e709b276 = getPathInfo($v47826cacc65c665212b821e6ff80b9b0);
     if (!$vfc1eb20506413fbbdc753afe5117cff0 || !$v6226ba4abbac63dbd2114cb5966b1bf8) {
         return false;
     }
     $v6382f6cf920a5e1f12258b86b3fcac3b = 0;
     $v44ef37a80954a70dc24d955310d80967 = 0;
     switch ($vb1c37415e373f67b34bfbdeac8a8338f) {
         case "center":
             $v6382f6cf920a5e1f12258b86b3fcac3b = floor(($v6226ba4abbac63dbd2114cb5966b1bf8["width"] - $vfc1eb20506413fbbdc753afe5117cff0["width"]) / 2);
             break;
         case "right":
             $v6382f6cf920a5e1f12258b86b3fcac3b = $v6226ba4abbac63dbd2114cb5966b1bf8["width"] - $vfc1eb20506413fbbdc753afe5117cff0["width"];
     }
     switch ($v379da31305f1eba200307fcdf9cf0ca0) {
         case "center":
             $v44ef37a80954a70dc24d955310d80967 = floor(($v6226ba4abbac63dbd2114cb5966b1bf8["height"] - $vfc1eb20506413fbbdc753afe5117cff0["height"]) / 2);
             break;
         case "bottom":
             $v44ef37a80954a70dc24d955310d80967 = $v6226ba4abbac63dbd2114cb5966b1bf8["height"] - $vfc1eb20506413fbbdc753afe5117cff0["height"];
     }
     $vfa816edb83e95bf0c8da580bdfd491ef = $vfc1eb20506413fbbdc753afe5117cff0['im'];
     $vfe47aa7c733c490d36e80508d5dc4019 = imagecreatetruecolor($vfc1eb20506413fbbdc753afe5117cff0["width"], $vfc1eb20506413fbbdc753afe5117cff0["height"]);
     imagecopy($vfe47aa7c733c490d36e80508d5dc4019, $v6226ba4abbac63dbd2114cb5966b1bf8['im'], 0, 0, $v6382f6cf920a5e1f12258b86b3fcac3b, $v44ef37a80954a70dc24d955310d80967, $vfc1eb20506413fbbdc753afe5117cff0["width"], $vfc1eb20506413fbbdc753afe5117cff0["height"]);
     imagecopy($vfe47aa7c733c490d36e80508d5dc4019, $vfa816edb83e95bf0c8da580bdfd491ef, 0, 0, 0, 0, $vfc1eb20506413fbbdc753afe5117cff0["width"], $vfc1eb20506413fbbdc753afe5117cff0["height"]);
     imagecopymerge($v6226ba4abbac63dbd2114cb5966b1bf8['im'], $vfe47aa7c733c490d36e80508d5dc4019, $v6382f6cf920a5e1f12258b86b3fcac3b, $v44ef37a80954a70dc24d955310d80967, 0, 0, $vfc1eb20506413fbbdc753afe5117cff0["width"], $vfc1eb20506413fbbdc753afe5117cff0["height"], $v8fa8b46b17731c7c9c882faede387741);
     switch ($vfcf76116d23aa625909b9eb0e709b276['extension']) {
         case "jpeg":
         case "jpg":
         case "JPEG":
         case "JPG":
             imagejpeg($v6226ba4abbac63dbd2114cb5966b1bf8['im'], $v47826cacc65c665212b821e6ff80b9b0, 90);
             break;
         case "png":
         case "PNG":
             imagepng($v6226ba4abbac63dbd2114cb5966b1bf8['im'], $v47826cacc65c665212b821e6ff80b9b0);
         case "gif":
         case "GIF":
             imagegif($v6226ba4abbac63dbd2114cb5966b1bf8['im'], $v47826cacc65c665212b821e6ff80b9b0);
             break;
         case "bmp":
         case "BMP":
             imagewbmp($v6226ba4abbac63dbd2114cb5966b1bf8['im'], $v47826cacc65c665212b821e6ff80b9b0);
             break;
     }
     imagedestroy($v6226ba4abbac63dbd2114cb5966b1bf8["im"]);
     imagedestroy($vfc1eb20506413fbbdc753afe5117cff0["im"]);
     return;
 }
Beispiel #15
0
require_once(AT_INCLUDE_PATH . 'classes/UrlRewrite/UrlParser.class.php');
include_once(AT_INCLUDE_PATH.'config.inc.php');
require_once(AT_INCLUDE_PATH.'lib/constants.inc.php');
require_once(AT_INCLUDE_PATH.'lib/mysql_connect.inc.php');
//require_once(AT_INCLUDE_PATH.'vitals.inc.php');

//mimic config variables, vitals.inc.php 135-140
/* get config variables. if they're not in the db then it uses the installation default value in constants.inc.php */
$sql    = "SELECT * FROM ".TABLE_PREFIX."config";
$result = mysql_query($sql, $db);
while ($row = mysql_fetch_assoc($result)) { 
	$_config[$row['name']] = $row['value'];
}

//Get path info
$pathinfo = getPathInfo();

$url_parser = new UrlParser($pathinfo);
$path_array =  $url_parser->getPathArray();
$_pretty_url_course_id = $path_array[0];
$obj = $path_array[1];

if (!$obj->isEmpty()){
	/* 
	 * Addresses the issue for relative uri 
	 * @refer to constants.inc.php $_rel_link
	 */
	$_rel_url = $obj->redirect();
	$var_query = $obj->parsePrettyQuery();
	save2Get($var_query);	//remake all the _GET and _REQUEST variables so that the vitals can use it
Beispiel #16
0
 public function rename()
 {
     $this->flushAsXml('rename');
     $path = CURRENT_WORKING_DIR . base64_decode(getRequest("oldName"));
     $newName = dirname($path) . "/" . basename(base64_decode(getRequest("newName")));
     $old = getPathInfo($path);
     $new = getPathInfo($newName);
     if (strtolower($old['extension']) != strtolower($new['extension'])) {
         return array();
     }
     $oldDir = str_replace('\\', '/', $old['dirname']);
     $newDir = str_replace('\\', '/', $new['dirname']);
     if (strpos($newDir, CURRENT_WORKING_DIR . '/images') === false && strpos($newDir, CURRENT_WORKING_DIR . '/files') === false && strpos($oldDir, CURRENT_WORKING_DIR . '/images') === false && strpos($oldDir, CURRENT_WORKING_DIR . '/files') === false) {
         return array();
     }
     if (!is_demo()) {
         rename($path, $newName);
     } else {
         $newName = $path;
     }
     return array('attribute:path' => substr($newName, strlen(CURRENT_WORKING_DIR)));
 }
function createThumbnail($sImgPath, $iWidth = 0, $iHeight = 0, $sThumbFile = "", $iJpgQuality = 90, $bSlide = false, $bReplace = false)
{
    if (!file_exists($sImgPath)) {
        return false;
    }
    $sFileName = getPathInfo($sImgPath, PATHINFO_BASENAME);
    $sFileExt = strtolower(getPathInfo($sImgPath, PATHINFO_EXTENSION));
    $arrInfo = @getimagesize($sImgPath);
    $iImgWidth = (int) $arrInfo[0];
    $iImgHeight = (int) $arrInfo[1];
    $bNeedSlide = $bSlide && $iWidth > 0 && $iHeight > 0 && ($iWidth != $iImgWidth || $iHeight != $iImgHeight);
    $bSuccess = false;
    if (!strlen($sThumbFile)) {
        $sThumbName = $sFileName . "_" . $iWidth . "_" . $iHeight . "." . $sFileExt;
        $sThumbFile = UMI_AUTHOTHUMBS_PATH . "/" . $sThumbName;
    }
    if (!$bReplace && file_exists($sThumbFile)) {
        return $sThumbFile;
    }
    if ($iWidth > $iImgWidth && $iHeight > $iImgHeight || $iWidth > $iImgWidth && $iHeight == 0 || $iWidth == 0 && $iHeight > $iImgHeight) {
        // Высота больше исходной, ширина автоматическая
        $iWidth = 0;
        $iHeight = 0;
    }
    if ($iWidth > 0 || $iHeight > 0) {
        // resize
        if (!$iHeight) {
            $iHeight = (int) round($iImgHeight * ($iWidth / $iImgWidth));
        }
        if (!$iWidth) {
            $iWidth = (int) round($iImgWidth * ($iHeight / $iImgHeight));
        }
        $rThumb = imagecreatetruecolor($iWidth, $iHeight);
        imagealphablending($rThumb, true);
        $thumb_white_color = imagecolorallocate($rThumb, 255, 255, 255);
        imagefill($rThumb, 0, 0, $thumb_white_color);
        list(, , $imageType) = getimagesize($sImgPath);
        $imageType = (int) $imageType;
        switch ($imageType) {
            case 1:
                // GIF
                $rSource = imagecreatefromgif($sImgPath);
                imagecolortransparent($rThumb, $thumb_white_color);
                imagealphablending($rSource, true);
                imagealphablending($rThumb, true);
                break;
            case 2:
                // JPG
                $rSource = imagecreatefromjpeg($sImgPath);
                break;
            case 3:
                // PNG
                $rSource = imagecreatefrompng($sImgPath);
                imagecolortransparent($rThumb, $thumb_white_color);
                imagealphablending($rSource, true);
                imagealphablending($rThumb, true);
                break;
            case 6:
                // BMP - not supported
                return false;
                break;
            case 15:
                // WBMP
                $rSource = imagecreatefromwbmp($sImgPath);
                break;
            case 16:
                // XBMP
                $rSource = imagecreatefromxbm($sImgPath);
                break;
        }
        if ($bNeedSlide) {
            // TODO create image slide
            if ($iImgWidth < $iWidth && $iImgHeight < $iHeight) {
                // not resize. centred..
                $iPaddingTop = (int) round(($iHeight - $iImgHeight) / 2);
                $iPaddingLeft = (int) round(($iWidth - $iImgWidth) / 2);
                imagecopyresampled($rThumb, $rSource, $iPaddingLeft, $iPaddingTop, 0, 0, $iImgWidth, $iImgHeight, $iImgWidth, $iImgHeight);
            } elseif ($iImgHeight < $iImgWidth) {
                // resize height
                $iSlHeight = (int) round($iImgHeight * ($iWidth / $iImgWidth));
                $iPaddingTop = (int) round(($iHeight - $iSlHeight) / 2);
                imagecopyresampled($rThumb, $rSource, 0, $iPaddingTop, 0, 0, $iWidth, $iSlHeight, $iImgWidth, $iImgHeight);
            } else {
                // resize width
                $iSlWidth = (int) round($iImgWidth * ($iHeight / $iImgHeight));
                $iPaddingLeft = (int) round(($iWidth - $iSlWidth) / 2);
                imagecopyresampled($rThumb, $rSource, $iPaddingLeft, 0, 0, 0, $iSlWidth, $iHeight, $iImgWidth, $iImgHeight);
            }
        } else {
            imagecopyresampled($rThumb, $rSource, 0, 0, 0, 0, $iWidth, $iHeight, $iImgWidth, $iImgHeight);
        }
        if (strtolower(getPathInfo($sImgPath, PATHINFO_EXTENSION)) == "gif") {
            $bSuccess = imagegif($rThumb, $sThumbFile);
        } elseif (strtolower(getPathInfo($sImgPath, PATHINFO_EXTENSION)) == "png") {
            $bSuccess = imagepng($rThumb, $sThumbFile);
        } else {
            $bSuccess = imagejpeg($rThumb, $sThumbFile, $iJpgQuality);
        }
    } else {
        $bSuccess = copy($sImgPath, $sThumbFile);
    }
    return $sThumbFile;
}