예제 #1
0
/** converts the table name into item type
 *
 * @return   string item type
 */
function DBTable2Type($table)
{
    $table = cs_strtolower($table);
    $type = '';
    if ($table == 'annotations') {
        $type = CS_ANNOTATION_TYPE;
    } elseif ($table == 'dates') {
        $type = CS_DATE_TYPE;
    } elseif ($table == 'discussionarticles') {
        $type = CS_DISCARTICLE_TYPE;
    } elseif ($table == 'discussions') {
        $type = CS_DISCUSSION_TYPE;
    } elseif ($table == 'labels') {
        $type = CS_LABEL_TYPE;
    } elseif ($table == 'materials') {
        $type = CS_MATERIAL_TYPE;
    } elseif ($table == 'files') {
        $type = CS_FILE_TYPE;
    } elseif ($table == 'todos') {
        $type = CS_TODO_TYPE;
    } elseif ($table == 'links') {
        $type = CS_LINK_TYPE;
    } elseif ($table == 'link_items') {
        $type = CS_LINKITEM_TYPE;
    } elseif ($table == 'item_link_file') {
        $type = CS_LINKITEMFILE_TYPE;
    } elseif ($table == 'homepage_link_page_page') {
        $type = CS_LINKHOMEPAGEHOMEPAGE_TYPE;
    } else {
        $type = $table;
    }
    return $type;
}
예제 #2
0
$file_array = collectFiles($dir,$file_array);
echo(' ... [done]'.LINEBREAK);

$count = count($file_array);
init_progress_bar($count);
foreach ( $file_array as $file ) {
   $file_id = substr($file,strrpos($file,'/')+1);
   if ( !empty($file_id) ) {
      $sql = 'SELECT filename FROM files WHERE files_id="'.$file_id.'";';
      $result = select($sql);
      unset($sql);
      $row = mysql_fetch_assoc($result);
      mysql_free_result($result);
      if ( !$row ) {
         unlink($file);
      } elseif ( !empty($row['filename']) ) {
         $ext = cs_strtolower(mb_substr(strrchr($row['filename'],'.'),1));
         $filename2 = $file.'.'.$ext;
         if ( file_exists($file)
              and !file_exists($filename2)
            ) {
            rename($file,$filename2);
         }
      }
   }
   update_progress_bar($count);
}

// end of execution time
echo(getProcessedTimeInHTML($time_start));
?>
예제 #3
0
 function copyFileFromRoomToRoom($old_room_id, $old_file_id, $filename, $new_room_id, $new_file_id)
 {
     $retour = false;
     if (empty($old_room_id)) {
         include_once 'functions/error_functions.php';
         trigger_error('old_room_id is not set', E_USER_ERROR);
     }
     $this->_makeFolder($this->_first_id, $new_room_id);
     $source_file = str_replace('//', '/', $this->_getFilePath('', $old_room_id) . '/' . $old_file_id . '.' . cs_strtolower(mb_substr(strrchr($filename, '.'), 1)));
     $target_file = str_replace('//', '/', $this->_getFilePath('', $new_room_id) . '/' . $new_file_id . '.' . cs_strtolower(mb_substr(strrchr($filename, '.'), 1)));
     // copy
     if (file_exists($source_file)) {
         $retour = copy($source_file, $target_file);
     } else {
         $retour = true;
     }
     return $retour;
 }
예제 #4
0
 function getIconFilename()
 {
     $ext = cs_strtolower(mb_substr(strrchr($this->getFileName(), '.'), 1));
     if (!empty($this->_icon[$ext])) {
         $img = $this->_icon[$ext];
     } else {
         $img = $this->_icon['unknown'];
     }
     return $img;
 }
예제 #5
0
 function _format_flash($text, $array)
 {
     $retour = '';
     if (empty($array[1])) {
         // internal resource
         $file_name_array = $this->_getItemFileListForView();
         $file = $file_name_array[$array[2]];
         if (isset($file)) {
             $source = $file->getURL();
             $ext = $file->getExtension();
             $extern = false;
         }
     } else {
         $source = $array[1] . $array[2];
         $ext = cs_strtolower(mb_substr(strrchr($source, '.'), 1));
         $extern = true;
     }
     if (!empty($array[3])) {
         $args = $this->_environment->getTextConverter()->parseArgs($array[3]);
     } else {
         $args = array();
     }
     if (!empty($args['play'])) {
         $play = $args['play'];
     } else {
         $play = 'false';
     }
     if (!empty($args['float']) and ($args['float'] == 'left' or $args['float'] == 'right')) {
         $float = 'float:' . $args['float'] . ';';
     } elseif (!empty($args['lfloat'])) {
         $float = 'float:left;';
     } elseif (!empty($args['rfloat'])) {
         $float = 'float:right;';
     } else {
         $float = '';
     }
     if (!empty($args['navigation']) and $args['navigation']) {
         $with_player = true;
     } elseif (!empty($args['navigation']) and !$args['navigation']) {
         $with_player = false;
     } elseif ($ext == 'swf') {
         $with_player = false;
     } else {
         $with_player = true;
     }
     if (!empty($source)) {
         $link_text = '(:flash ' . $file->getDiskFileNameWithoutFolder() . ':)';
         $text = str_replace($array[0], $link_text, $text);
     }
     $retour = $text;
     return $retour;
 }
예제 #6
0
 function _formatQuicktime($text, $array, $file_name_array)
 {
     $retour = '';
     if (empty($array[1])) {
         // internal resource
         if (!empty($file_name_array)) {
             $file = $file_name_array[$array[2]];
             if (isset($file)) {
                 $source = $file->getURL();
                 $ext = $file->getExtension();
                 $extern = false;
             }
         }
     } else {
         $source = $array[1] . $array[2];
         $ext = cs_strtolower(mb_substr(strrchr($source, '.'), 1));
         $extern = true;
     }
     if (!empty($array[3])) {
         $args = $this->_parseArgs($array[3]);
     } else {
         $args = array();
     }
     if (!empty($args['play'])) {
         $play = $args['play'];
     } else {
         $play = 'false';
     }
     if (!empty($args['float']) and ($args['float'] == 'left' or $args['float'] == 'right')) {
         $float = 'float:' . $args['float'] . ';';
     } elseif (!empty($args['lfloat'])) {
         $float = 'float:left;';
     } elseif (!empty($args['rfloat'])) {
         $float = 'float:right;';
     } else {
         $float = '';
     }
     if (mb_strtolower($ext, 'UTF-8') == 'mp3') {
         $args['height'] = 16;
     }
     if (!empty($source)) {
         $image_text = '';
         $image_text .= '<div style="' . $float . ' padding:10px;">' . LF;
         $image_text .= '<object type="video/quicktime" ';
         $image_text .= '   classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ';
         $image_text .= '   codebase="http://www.apple.com/qtactivex/qtplugin.cab" ';
         if (!empty($args['width'])) {
             $image_text .= '   width="' . $args['width'] . '"' . LF;
         }
         if (!empty($args['height'])) {
             $image_text .= '   height="' . $args['height'] . '"' . LF;
         }
         $image_text .= '>';
         $image_text .= '<param name="src" value="' . $source . '" />' . LF;
         $image_text .= '<param name="controller" value="true" />' . LF;
         $image_text .= '<param name="quality" value="high" />' . LF;
         $image_text .= '<param name="scale" value="tofit" />' . LF;
         $image_text .= '<param name="bgcolor" value="#000000" />' . LF;
         $image_text .= '<param name="wmode" value="opaque" />' . LF;
         $image_text .= '<param name="autoplay" value="' . $play . '" />' . LF;
         $image_text .= '<param name="loop" value="false" />' . LF;
         $image_text .= '<param name="devicefont" value="true" />' . LF;
         $image_text .= '<param name="class" value="mov" />' . LF;
         $image_text .= '<embed src="' . $source . '"' . LF;
         $image_text .= '   quality="high"' . LF;
         $image_text .= '   scale="tofit"' . LF;
         $image_text .= '   controller=true' . LF;
         $image_text .= '   bgcolor="#000000"' . LF;
         $image_text .= '   wmode="opaque"' . LF;
         $image_text .= '   autoplay="' . $play . '"' . LF;
         $image_text .= '   loop=false' . LF;
         $image_text .= '   devicefont=true' . LF;
         if (!empty($args['width'])) {
             $image_text .= '   width="' . $args['width'] . '"' . LF;
         }
         if (!empty($args['height'])) {
             $image_text .= '   height="' . $args['height'] . '"' . LF;
         }
         $image_text .= '   type="video/quicktime"' . LF;
         $image_text .= '   class="mov"' . LF;
         $image_text .= '   pluginspage="http://www.apple.com/quicktime/download/">' . LF;
         $image_text .= '</embed>' . LF;
         $image_text .= '</object>' . LF;
         $image_text .= '</div>' . LF;
         $text = str_replace($array[0], $image_text, $text);
     }
     $retour = $text;
     return $retour;
 }