Пример #1
0
             // Hardcoded: only PNG files allowed
             if (end(explode('.', $_FILES[$image_field]['name'])) == 'png') {
                 if (file_exists($url_images_dir . $url_id . '_' . $image_field . '.png')) {
                     // if the file exists, we have to remove it before move_uploaded_file
                     unlink($url_images_dir . $url_id . '_' . $image_field . '.png');
                 }
                 move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png');
             }
             // else fail silently
         }
         // else fail silently
     }
     $url_to_go = 'access_urls.php';
     $message = get_lang('URLEdited');
 } else {
     $num = UrlManager::url_exist($url);
     if ($num == 0) {
         // checking url
         if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
             UrlManager::add($url, $description, $active);
         } else {
             //create
             UrlManager::add($url . '/', $description, $active);
         }
         $message = get_lang('URLAdded');
         $url_to_go = 'access_urls.php';
     } else {
         $url_to_go = 'access_url_edit.php';
         $message = get_lang('URLAlreadyAdded');
     }
     // URL Images