/**
  * Does not look like this function is being used is being used 
  * 
  * @param type $url_id
  * @return string 
  */
 public static function getURLImages($url_id = null)
 {
     if (is_null($url_id)) {
         $url = 'http://' . $_SERVER['HTTP_HOST'] . '/';
         $url_id = UrlManager::get_url_id($url);
     }
     $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
     $images = array();
     for ($img_id = 1; $img_id <= 3; $img_id++) {
         if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) {
             $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png';
         }
     }
     return $images;
 }
Ejemplo n.º 2
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
     $url .= substr($url, strlen($url) - 1, strlen($url)) == '/' ? '' : '/';
     $url_id = UrlManager::get_url_id($url);
     $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
     $image_fields = array("url_image_1", "url_image_2", "url_image_3");
     foreach ($image_fields as $image_field) {
         if ($_FILES[$image_field]['error'] == 0) {
             // Hardcoded: only PNG files allowed
             if (end(explode('.', $_FILES[$image_field]['name'])) == 'png') {
                 move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png');
             }
             // else fail silently
         }
         // else fail silently
     }
 }
 Security::clear_token();
 $tok = Security::get_token();