function fileArray($src, $src1, $fileName, $id) { $func = new buildQuery('omeka_'); $name = $src . "/" . $func->filterFileName($fileName); $size = file_size($src, $src1, $fileName); $f_type = `file -i '{$name}'`; $type = array_reverse(explode(' ', $f_type)); echo $f_type . "\n" . $type[0] . "\n"; $file = array(); $file['id'] = $id; $file['item_id'] = $id; $file['size'] = preg_replace('/\\n/', '', $size); $file['has_derivative_image'] = 0; $file['authentication'] = ''; $file['mime_browser'] = preg_replace('/\\n/', '', $type[0]); $file['mime_os'] = preg_replace('/\\n/', '', $type[0]); $file['type_os'] = preg_replace('/\\n/', '', $type[0]); $file['archive_filename'] = $func->processFN($name); $file['original_filename'] = mysql_real_escape_string($fileName); $file['modified'] = ''; //timestamp; $file['added'] = 'CURRENT_TIMESTAMP'; //current timestamp $file['stored'] = 'CURRENT_TIMESTAMP'; return $file; }
public function comment() { $page = $this->version->entity(); $title = $this->title; $link = 'http://samlib.ru/' . ltrim($page->absoluteLink(), '/'); $size = file_size($this->size()); $date = $this->version->encode('d/m/Y H:i:s'); $annotation = (string) app('plaintexter')->apply(new TransformableContainer($page->annotation)); $annotation = wordwrap($annotation, 120); return "{$title} ({$size})\n{$date}\n\n{$link}\n\n{$annotation}"; }
public function get_total_size() { global $db_type; $total = array(); if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') { // Calculate total db size/row count $result = DB::for_table('users')->raw_query('SHOW TABLE STATUS LIKE \'' . $this->feather->prefix . '%\'')->find_many(); $total['size'] = $total['records'] = 0; foreach ($result as $status) { $total['records'] += $status['Rows']; $total['size'] += $status['Data_length'] + $status['Index_length']; } $total['size'] = file_size($total['size']); } return $total; }
</legend> <div class="infldset"> <input type="hidden" name="form_sent" value="1" /> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $pun_config['o_avatars_size']; ?> " /> <label class="required"><strong><?php echo $lang_profile['File']; ?> <span><?php echo $lang_common['Required']; ?> </span></strong><br /><input name="req_file" type="file" size="40" /><br /></label> <p><?php echo $lang_profile['Avatar desc'] . ' ' . $pun_config['o_avatars_width'] . ' x ' . $pun_config['o_avatars_height'] . ' ' . $lang_profile['pixels'] . ' ' . $lang_common['and'] . ' ' . forum_number_format($pun_config['o_avatars_size']) . ' ' . $lang_profile['bytes'] . ' (' . file_size($pun_config['o_avatars_size']) . ').'; ?> </p> </div> </fieldset> </div> <p class="buttons"><input type="submit" name="upload" value="<?php echo $lang_profile['Upload']; ?> " /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back']; ?> </a></p> </form> </div> </div>
/** * gets size of data of a torrent * * @param $transfer name of the torrent * @return int with size of data of torrent. * -1 if error * 4096 if dir (lol ~) */ function getTorrentDataSize($transfer) { global $cfg; $datapath = getTransferDatapath($transfer); return $datapath != "" && $datapath != "." ? file_size(getTransferSavepath($transfer) . $datapath) : -1; }
function displayFiles($folder_id) { global $AppUI, $m, $a, $tab, $page; global $current_uri; global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete; global $canAccess_folders, $canRead_folders, $canEdit_folders; global $canAuthor_folders, $canDelete_folders; global $company_id, $project_id, $task_id; global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders; global $showProject, $cfObj, $dPconfig; $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); $file_types = dPgetSysVal('FileType'); $xpg_pagesize = 30; //TODO?: Set by System Config Value ... $xpg_totalrecs = countFiles($folder_id); //get file count for folder $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1; $xpg_min = $xpg_pagesize * ($page - 1); // This is where we start our record set from $q = new DBQuery(); // most recent version info per file_project and file_version_id $q->createTemp('files_count_max' . $folder_id); $q->addTable('files', 'f'); $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project'); $q->addJoin('projects', 'p', 'p.project_id = f.file_project'); $q->addJoin('tasks', 't', 't.task_id = f.file_task'); $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder'); $q->addWhere('f.file_folder = ' . $folder_id); if (count($allowedProjects)) { $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)'); } if (count($allowedTasks)) { $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)'); } if (count($allowedFolders)) { $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)'); } if ($company_id) { $q->innerJoin('companies', 'co', 'co.company_id = p.project_company'); $q->addWhere('co.company_id = ' . $company_id); if (count($allowedCompanies)) { $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')'); } } $q->addGroup('f.file_version_id'); $q->addGroup('f.file_project'); $file_version_max_counts = $q->exec(); $q->clear(); // most recent version $q->addTable('files', 'f'); $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name'); $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner'); $q->addJoin('projects', 'p', 'p.project_id = f.file_project'); $q->addJoin('users', 'u', 'u.user_id = f.file_owner'); $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addJoin('tasks', 't', 't.task_id = f.file_task'); $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder'); $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout'); $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact'); $q->addWhere('f.file_folder = ' . $folder_id); if (count($allowedProjects)) { $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)'); } if (count($allowedTasks)) { $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)'); } if (count($allowedFolders)) { $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)'); } if ($project_id) { $q->addWhere('f.file_project = ' . $project_id); } if ($task_id) { $q->addWhere('f.file_task = ' . $task_id); } if ($company_id) { $q->innerJoin('companies', 'co', 'co.company_id = p.project_company'); $q->addWhere('co.company_id = ' . $company_id); if (count($allowedCompanies)) { $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')'); } } $q->addOrder('p.project_name'); $q->setLimit($xpg_pagesize, $xpg_min); $files_sql = $q->prepare(); $q->clear(); // all versions $q->addTable('files', 'f'); $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner'); $q->addJoin('projects', 'p', 'p.project_id = f.file_project'); $q->addJoin('users', 'u', 'u.user_id = f.file_owner'); $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addJoin('tasks', 't', 't.task_id = f.file_task'); $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder'); $q->addWhere('f.file_folder = ' . $folder_id); if (count($allowedProjects)) { $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)'); } if (count($allowedTasks)) { $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)'); } if (count($allowedFolders)) { $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)'); } if ($project_id) { $q->addWhere('f.file_project = ' . $project_id); } if ($task_id) { $q->addWhere('f.file_task = ' . $task_id); } if ($company_id) { $q->innerJoin('companies', 'co', 'co.company_id = p.project_company'); $q->addWhere('co.company_id = ' . $company_id); if (count($allowedCompanies)) { $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')'); } } $file_versions_sql = $q->prepare(); $q->clear(); //file arrays $files = array(); $file_versions = array(); if ($canRead) { $files = db_loadList($files_sql); $file_versions = db_loadHashList($file_versions_sql, 'file_id'); } $q->dropTemp('files_count_max' . $folder_id); $q->exec(); if ($files == array()) { return; } ?> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap"><?php echo $AppUI->_('File Name'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Description'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Versions'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Category'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Task Name'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Owner'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Size'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Date'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('co Reason'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('co'); ?> </th> <th nowrap width="1"></th> <th nowrap width="1"></th> </tr> <?php $fp = -1; $file_date = new CDate(); $id = 0; foreach ($files as $row) { $file_date = new CDate($row['file_date']); $canEdit_file = getPermission('files', 'edit', $row['file_id']); //single file if ($fp != $row['file_project']) { if (!$row['file_project']) { $row['project_name'] = $AppUI->_('Not associated to projects'); $row['project_color_identifier'] = 'f4efe3'; } if ($showProject) { $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']); ?> <tr> <td colspan="20" style="border: outset 2px #eeeeee;<?php echo $style; ?> "> <a href="?m=projects&a=view&project_id=<?php echo $row['file_project']; ?> "> <span style="<?php echo $style; ?> "><?php echo $row['project_name']; ?> </span></a> </td> </tr> <?php } } $fp = $row['file_project']; ?> <form name="frm_remove_file_<?php echo $row['file_id']; ?> " action="?m=files" method="post"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="file_id" value="<?php echo $row['file_id']; ?> " /> <input type="hidden" name="redirect" value="<?php echo $current_uri; ?> " /> </form> <form name="frm_duplicate_file_<?php echo $row['file_id']; ?> " action="?m=files" method="post"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="duplicate" value="1" /> <input type="hidden" name="file_id" value="<?php echo $row['file_id']; ?> " /> <input type="hidden" name="redirect" value="<?php echo $current_uri; ?> " /> </form> <tr> <td nowrap="8%"> <?php $file_icon = getIcon($row['file_type']); ?> <a href="./fileviewer.php?file_id=<?php echo $row['file_id']; ?> " title="<?php echo $row['file_description']; ?> "> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16'); ?> <?php echo $row['file_name']; ?> </a> </td> <td width="20%"><?php echo $row['file_description']; ?> </td> <td width="5%" nowrap="nowrap" align="center"> <?php $hidden_table = ''; echo $row['file_lastversion']; if ($row['file_versions'] > 1) { ?> <a href="#" onClick="expand('versions_<?php echo $row['file_id']; ?> ');"> (<?php echo $row['file_versions']; ?> ) </a> <?php } ?> </td> <td width="10%" nowrap="nowrap" align="center"> <?php echo $file_types[$row['file_category']]; ?> </td> <td width="5%" align="center"> <a href="./index.php?m=tasks&a=view&task_id=<?php echo $row['file_task']; ?> "> <?php echo $row['task_name']; ?> </a> </td> <td width="15%" nowrap="nowrap"> <?php echo $row["contact_first_name"] . ' ' . $row["contact_last_name"]; ?> </td> <td width="5%" nowrap="nowrap" align="right"> <?php echo file_size(intval($row['file_size'])); ?> </td> <td width="15%" nowrap="nowrap" align="right"> <?php echo $file_date->format($df . ' ' . $tf); ?> </td> <td width="10%"><?php echo $row['file_co_reason']; ?> </td> <td nowrap="nowrap" align="center"> <?php if ($canEdit && empty($row['file_checkout'])) { ?> <a href="?m=files&a=co&file_id=<?php echo $row['file_id']; ?> "> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file'); ?> </a> <?php } else { if ($row['file_checkout'] == $AppUI->user_id) { ?> <a href="?m=files&a=addedit&ci=1&file_id=<?php echo $row['file_id']; ?> "> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file'); ?> </a> <?php } else { if ($file['file_checkout'] == 'final') { echo ' ' . $AppUI->_('final'); } else { echo ' ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')'; } } } ?> </td> <td nowrap="nowrap" align="right" width="48"> <?php if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') { // Edit File if ($canEdit || $row['project_owner'] == $AppUI->user_id) { ?> <a href="./index.php?m=files&a=addedit&file_id=<?php echo $row['file_id']; ?> "> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file'); ?> </a> <?php } // Duplicate File if ($canAuthor || $row['project_owner'] == $AppUI->user_id) { ?> <a href="#" onclick="document.frm_duplicate_file_<?php echo $row['file_id']; ?> .submit()"> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file'); ?> </a> <?php } // Delete File if ($canDelete || $row['project_owner'] == $AppUI->user_id) { ?> <a href="#" onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php echo $row['file_id']; ?> .submit()}"> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file'); ?> </a> <?php } } ?> </td> <td nowrap="nowrap" align="center" width="1"> <?php if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) { $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"'; ?> <input type="checkbox" <?php echo $bulk_op; ?> name="chk_sub_sel_file_<?php echo $file_row['file_id']; ?> " /> <?php } ?> </td> </tr> <?php if ($row['file_versions'] > 1) { ?> <tr><td colspan="20"> <table style="display: none" id="versions_<?php echo $row['file_id']; ?> " width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap"><?php echo $AppUI->_('File Name'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Description'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Versions'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Category'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Task Name'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Owner'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Size'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Type'); ?> </th> <th nowrap="nowrap"><?php echo $AppUI->_('Date'); ?> </th> <th nowrap="nowrap"width="1"> </th> <th nowrap="nowrap"width="1"> </th> </tr> <?php foreach ($file_versions as $file) { if ($file['file_version_id'] == $row['file_version_id']) { $file_icon = getIcon($file['file_type']); $file_version_date = new Date($file['file_date']); ?> <form name="frm_delete_sub_file_<?php echo $file['file_id']; ?> " action="?m=files" method="post"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="file_id" value="<?php echo $file['file_id']; ?> " /> <input type="hidden" name="redirect" value="<?php echo $current_uri; ?> " /> </form> <form name="frm_duplicate_sub_file_<?php echo $file['file_id']; ?> " action="?m=files" method="post"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="duplicate" value="1" /> <input type="hidden" name="file_id" value="<?php echo $file['file_id']; ?> " /> <input type="hidden" name="redirect" value="<?php echo $current_uri; ?> " /> </form> <tr> <td nowrap="8%"> <a href="./fileviewer.php?file_id=<?php echo $file['file_id']; ?> " title="<?php echo $file['file_description']; ?> "> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16'); ?> <?php echo $file['file_name']; ?> </a> </td> <td width="20%"><?php echo $file['file_description']; ?> </td> <td width="5%" nowrap="nowrap" align="center"><?php echo $file['file_version']; ?> </td> <td width="10%" nowrap="nowrap" align="center"> <?php echo $file_types[$file['file_category']]; ?> </td> <td width="5%" align="center"> <a href="./index.php?m=tasks&a=view&task_id=<?php echo $file['file_task']; ?> "> <?php echo $file['task_name']; ?> </a> </td> <td width="15%" nowrap="nowrap"> <?php echo $file["contact_first_name"] . ' ' . $file["contact_last_name"]; ?> </td> <td width="5%" nowrap="nowrap" align="right"> <?php echo file_size(intval($file['file_size'])); ?> </td> <td nowrap="nowrap"> <?php echo $row['file_type']; ?> </td> <td width="15%" nowrap="nowrap" align="right"> <?php echo $file_version_date->format($df . ' ' . $tf); ?> </td> <td nowrap="nowrap" align="right" width="48"> <?php if (empty($file['file_checkout']) || $file['file_checkout'] == 'final') { // Edit File if ($canEdit || $row['project_owner'] == $AppUI->user_id) { ?> <a href="./index.php?m=files&a=addedit&file_id=<?php echo $row['file_id']; ?> "> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file'); ?> </a> <?php } // Duplicate File if ($canAuthor) { ?> <a href="#" onclick="document.frm_duplicate_file_<?php echo $row['file_id']; ?> .submit()"> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file'); ?> </a> <?php } // Delete File if ($canDelete) { ?> <a href="#" onclick="if (confirm('<?php echo $AppUI->_('Are you sure you want to delete this file?'); ?> ')) {document.frm_remove_file_<?php echo $row['file_id']; ?> .submit()}"> <?php echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', $AppUI->_('delete file')); ?> </a> <?php } } ?> </td> <td nowrap="nowrap" align="center" width="1"> <?php if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) { $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"'; ?> <input type="checkbox" <?php echo $bulk_op; ?> name="chk_sub_sel_file_<?php echo $file_row['file_id']; ?> " /> <?php } ?> </td> </tr> <?php } } ?> </table> </td></tr> <?php } } ?> </table> <?php shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id); echo "<br />"; }
static function generar_zona_vinculos_item($item, $accion, $enviar_div_wrapper = true) { if (!self::acceso_recursivo()) { toba::solicitud()->set_cronometrar(true); } toba_js::cargar_consumos_globales(array('utilidades/toba_editor')); $html_ayuda_editor = toba_recurso::ayuda(null, 'Presionando la tecla CTRL se pueden ver los enlaces hacia los editores de los distintos componentes de esta página'); $html_ayuda_cronometro = toba_recurso::ayuda(null, 'Ver los tiempos de ejecución en la generación de esta página'); $html_ayuda_ajax = toba_recurso::ayuda(null, 'Activar/Desactivar navegación interna de la operación via AJAX'); $html_ayuda_editor = toba_recurso::ayuda(null, 'Volver al editor de toba'); $solicitud = toba::solicitud()->get_id(); $link_cronometro = toba::vinculador()->get_url('toba_editor', '1000263', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $link_analizador_sql = toba::vinculador()->get_url('toba_editor', '30000030', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $link_logger = toba::vinculador()->get_url('toba_editor', '1000003', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $link_archivos = toba::vinculador()->get_url('toba_editor', '30000029', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $estilo = toba::proyecto()->get_parametro('estilo'); if ($enviar_div_wrapper) { echo "<div id='editor_previsualizacion'>"; /*echo "<div id='editor_previsualizacion_colap'><img style='cursor:pointer;_cursor:hand;' title='Ocultar la barra' src='".toba_recurso::imagen_toba('nucleo/expandir_izq.gif', false)."' onclick='toggle_nodo(\$\$(\"editor_previsualizacion_cont\"))'/></div>";*/ } echo "<span id='editor_previsualizacion_cont'>"; echo "<span id='editor_previsualizacion_vis'>"; //Logger list($log_nivel, $log_cant) = toba::logger()->get_mensajes_minimo_nivel(); $niveles = toba::logger()->get_niveles(); $niveles[0] = 'INFO'; $img = self::imagen_editor('logger/' . strtolower($niveles[$log_nivel]) . '.gif', true); $html_ayuda_logger = toba_recurso::ayuda(null, 'Visor de logs'); echo "<a href='{$link_logger}' target='logger' {$html_ayuda_logger} >" . $img . " {$log_cant}</a>\n"; //Cronometro toba::cronometro()->marcar('Resumen toba_editor'); echo "<a href='{$link_cronometro}' target='logger' {$html_ayuda_cronometro} >\n" . toba_recurso::imagen_toba('clock.png', true) . ' ' . round(toba::cronometro()->tiempo_acumulado(), 2) . ' seg' . "</a> "; //Memoria if (function_exists('memory_get_peak_usage')) { $memoria_pico = memory_get_peak_usage(); echo toba_recurso::imagen_toba('memory.png', true, 16, 16, 'Pico máximo de memoria que ha consumido el script actual'); echo ' ' . file_size($memoria_pico, 0) . ' '; } //Base de datos $fuente = toba_admin_fuentes::instancia()->get_fuente_predeterminada(false, toba_editor::get_proyecto_cargado()); if ($fuente) { try { $base = toba_admin_fuentes::instancia()->get_fuente($fuente, toba_editor::get_proyecto_cargado())->get_db(); $info_db = $base->get_info_debug(); $total = 0; foreach ($info_db as $info) { if (isset($info['fin'])) { $total += $info['fin'] - $info['inicio']; } } $rol = toba::db()->get_rol_actual(); toba::memoria()->set_dato_instancia('previsualizacion_consultas', array('fuente' => $fuente, 'datos' => $info_db)); echo "<a href='{$link_analizador_sql}' target='logger'>" . toba_recurso::imagen_toba('objetos/datos_relacion.gif', true, 16, 16, 'Ver detalles de las consultas y comandos ejecutados en este pedido de página') . count($info_db) . " ({$rol})</a>"; } catch (toba_error $e) { //Si no se tiene acceso a la base no se hace nada } } //Archivos $archivos = self::get_archivos_incluidos(); $total = 0; foreach ($archivos as $arch) { $total += filesize($arch); } toba::memoria()->set_dato_instancia('previsualizacion_archivos', $archivos); echo "<a href='{$link_archivos}' target='logger'>" . toba_recurso::imagen_toba('nucleo/php.gif', true, 16, 16, 'Ver detalle de archivos .php del proyecto incluidos en este pedido de página') . ' ' . count($archivos) . " arch. (" . file_size($total, 0) . ')</a>'; //Session $tamano = file_size(strlen(serialize($_SESSION)), 0); echo toba_recurso::imagen_toba('sesion.png', true, 16, 16, 'Tamaño de la sesión') . " {$tamano} "; echo "</span>"; //-- ACCIONES echo "<span id='editor_previsualizacion_acc'>"; $perfiles = array(apex_ef_no_seteado => '-- Todos --'); foreach (toba::manejador_sesiones()->get_perfiles_funcionales() as $perfil) { $perfiles[$perfil] = $perfil; } $actuales = toba::manejador_sesiones()->get_perfiles_funcionales_activos(); $actual = null; if (count($actuales) == 1) { $actual = current($actuales); } $js = "title='Cambia el perfil actual del usuario' onchange=\"location.href = toba_prefijo_vinculo + '&perfil_activo=' + this.value\""; echo "Perfiles: " . toba_form::select('cambiar_perfiles', $actual, $perfiles, 'ef-combo', $js); //Usuario de la base $hay_limitado = false; if (!isset(self::$fuentes)) { self::$fuentes = toba_info_editores::get_fuentes_datos(toba_editor::get_proyecto_cargado()); } foreach (self::$fuentes as $fuente) { if ($fuente['permisos_por_tabla']) { $hay_limitado = true; } } if ($hay_limitado) { $actual = self::$memoria['conexion_limitada'] ? 'limitado' : 'normal'; $datos = array("normal" => "Normal", "limitado" => "Limitados"); $js = "title='Cambia temporalmente el usuario de conexión a la base' onchange=\"location.href = toba_prefijo_vinculo + '&usuario_conexion=' + this.value\""; echo "Permisos DB: " . toba_form::select('cambiar_rol', $actual, $datos, 'ef-combo', $js); } //Skin $skins = rs_convertir_asociativo(toba_info_editores::get_lista_skins(), array('estilo', 'proyecto'), 'descripcion'); $js = "title='Cambia temporalmente el skin de la aplicación' onchange=\"location.href = toba_prefijo_vinculo + '&skin=' + this.value\""; $defecto = toba::proyecto()->get_parametro('estilo') . apex_qs_separador . toba::proyecto()->get_parametro('estilo_proyecto'); echo "Skin: " . toba_form::select('cambiar_skin', $defecto, $skins, 'ef-combo', $js); //AJAX echo "<a id='editor_ajax' href='javascript: editor_cambiar_ajax()' {$html_ayuda_ajax}>" . toba_recurso::imagen_toba('objetos/ajax_off.png', true) . "</a>\n"; //Edicion echo "<a href='javascript: editor_cambiar_vinculos()' {$html_ayuda_editor} >" . toba_recurso::imagen_toba('edicion_chico.png', true) . "</a>\n"; //Arbol $vinculos = self::get_vinculos_item($item, $accion); if (isset($vinculos[1])) { self::mostrar_vinculo($vinculos[1]); } //Editor echo "<a href='#' onclick='return toba_invocar_editor()' {$html_ayuda_editor}>" . toba_recurso::imagen_toba('icono_16.png', true) . "</a>\n"; echo "</span>"; echo "</span>"; echo "<div class='div-editor' style='position:fixed; top: 85px; left: 1px;'>"; foreach (self::get_vinculos_item($item, $accion) as $vinculo) { self::mostrar_vinculo($vinculo); } echo "</div>"; if ($enviar_div_wrapper) { echo "</div>"; } }
<tr> <td><?php echo $i; $i++; ?> </td> <td><?php echo $utf8_name; ?> </td> <td><?php echo $key; ?> </td> <td><?php echo file_size(filesize($path . '/' . $item)); ?> </td> <td><?php echo is_readable($path . '/' . $item) ? '是' : '否'; ?> </td> <td><?php echo is_writeable($path . '/' . $item) ? '是' : '否'; ?> </td> <td><?php echo is_executable($path . '/' . $item) ? '是' : '否'; ?> </td> <td><a href="<?php
if (isset($_GET['table']) && AJAX_request()) { $html = '<div class="table-responsive"><table class="table table-hover ' . $table_fixed . '"><thead><tr>'; if ($table_fixed == '') { $html .= '<th class="col-md-4">' . $lang[5] . '</th><th class="hidden-xs col-md-2">' . $lang[6] . '</th><th class="hidden-xs col-md-2">' . $lang[7] . '</th><th class="hidden-xs col-md-2">' . $lang[28] . '</th>'; } else { $html .= '<th class="col-xs-12 col-sm-6">' . $lang[5] . '</th><th class="hidden-xs col-xs-2 col-sm-2 col-md-2">' . $lang[6] . '</th><th class="hidden-xs col-xs-2 col-sm-2 col-md-2">' . $lang[7] . '</th>'; } $html .= '<th class="hidden-xs col-md-2">' . $lang[8] . '</th></tr></thead><tbody>'; //output appropriate items if (is_array($files) || is_object($files)) { foreach ($files as $index => $file) { $html .= '<tr>'; if ($table_fixed == '') { $html .= '<td class="col-md-3">' . showfile($file) . '</td><td class="hidden-xs col-md-2">' . file_size($file) . '</td><td class="hidden-xs col-md-2">' . extension($file) . '</td><td class="hidden-xs col-md-2">' . fileTime($index, $file) . '</td>'; } else { $html .= '<td class="col-xs-12 col-sm-5">' . showfile($file) . '</td><td class="hidden-xs col-xs-2 col-sm-2 col-md-2">' . file_size($file) . '</td><td class="hidden-xs col-xs-2 col-sm-2 col-md-2"><span class="label label-default">' . extension($file) . '</span></td>'; } $html .= '<td class="hidden-xs col-xs-3 col-sm-3 col-md-3">' . action($file) . '</td></tr>'; } } $html .= '<tr>'; if ($table_fixed == '') { $html .= '<td colspan="5" class="col-xs-12 col-sm-12 col-md-12">'; } else { $html .= '<td colspan="4" class="col-xs-12 col-sm-12 col-md-12">'; } $html .= $lang[9] . ' : <mark>' . $page . '</mark> ' . $lang[10] . ' : <mark>' . $total_files . '</mark></td></tr></tbody></table></div>'; if ($alert_msg != '') { $alert_msg = alert($alert_msg); } $response = array('table' => $html, 'total' => $total_pages, 'page' => $page, 'dir' => $directory, 'dirHtml' => GetOldirectory(), 'alert' => $alert_msg);
<?php /* * Created by Kolerts */ if (!isset($_REQUEST['func'])) { echo "Error: bad request!"; exit; } switch ($_REQUEST['func']) { case 'detail_xml': if (isset($_REQUEST['record'])) { $path = "custom/kXML/xml/{$_REQUEST['path']}/{$_REQUEST['record']}.xml"; if (file_exists($path)) { echo "<b>Имя файла</b>: {$_REQUEST['record']}.xml"; echo "<br/><b>Размер файла</b>: " . file_size($path); if (!$_REQUEST['custom_generate']) { echo "<br/><b>Кол-во элементов</b>: " . count_elements("{$_REQUEST['path']}/{$_REQUEST['record']}"); } echo "<br/><b>Дата изменения файла</b>: " . date("d/m/Y H:i:s.", filemtime($path)); } else { echo "Error: can't access to file!"; } } else { echo "Error: bad request!"; } break; case 'delete_xml': include_once 'modules/kXML/add_functions.php'; $_REQUEST['record'] = str_replace('.php', '', $_REQUEST['record']); $path = "custom/kXML/xml/{$_REQUEST['path']}/{$_REQUEST['record']}.xml";
$targetDir = $targetDir . DIRECTORY_SEPARATOR; $filter = $targetDir; $files = array(); $sort = array(); foreach (glob($filter . "*", GLOB_BRACE) as $file) { //echo $file; // if file isn't this directory or its parent, add it to the results $filepath = $file; $file = explode(DIRECTORY_SEPARATOR, $file); $file = $file[count($file) - 1]; //print_r($file); // echo $file . "<br>"; if (is_dir($filepath)) { } else { $imginfo = @getimagesize($filepath); $files[] = array("name" => $file, "type" => pathinfo($file, PATHINFO_EXTENSION), "raw_size" => filesize($filepath), "size" => file_size(filesize($filepath)), "a_time" => date("F d Y H:i:s", fileatime($filepath)), "c_time" => date("F d Y H:i:s", filectime($filepath)), "m_time" => date("F d Y H:i:s", filemtime($filepath)), "raw_m_time" => filemtime($filepath), "perms" => fileperms($filepath), "image_w" => $imginfo[0], "image_h" => $imginfo[1], "image_t" => $imginfo[2]); switch ($sorter) { case 1: $sort[] = $file; break; case 3: $sort[] = filesize($filepath); break; case 4: $sort[] = strtolower(pathinfo($file, PATHINFO_EXTENSION)); break; case 20: $sort[] = filemtime($filepath); break; case 21: $sort[] = fileatime($filepath);
$update = array('use_gravatar' => 0); $data = array(':id' => $id); $db->update('users', $update, 'id=:id', $data); } else { message($lang_profile['Unknown failure']); } redirect(panther_link($panther_url['profile_personality'], array($id)), $lang_profile['Avatar upload redirect']); } $page_title = array($panther_config['o_board_title'], $lang_common['Profile'], $lang_profile['Upload avatar']); $required_fields = array('req_file' => $lang_profile['File']); $focus_element = array('upload_avatar', 'req_file'); define('PANTHER_ACTIVE_PAGE', 'profile'); require PANTHER_ROOT . 'header.php'; $csrf_token = generate_csrf_token(); $tpl = load_template('upload_avatar.tpl'); echo $tpl->render(array('lang_profile' => $lang_profile, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['upload_avatar'], array($id, $csrf_token)), 'csrf_token' => $csrf_token, 'panther_config' => $panther_config, 'avatar_size' => forum_number_format($panther_config['o_avatars_size']), 'file_size' => file_size($panther_config['o_avatars_size']))); require PANTHER_ROOT . 'footer.php'; } else { if ($action == 'delete_avatar') { confirm_referrer('profile.php'); if ($panther_user['id'] != $id && !$panther_user['is_admmod']) { message($lang_common['No permission'], false, '403 Forbidden'); } delete_avatar($id); redirect(panther_link($panther_url['profile_personality'], array($id)), $lang_profile['Avatar deleted redirect']); } else { if (isset($_POST['update_group_membership'])) { confirm_referrer('profile.php'); if (!$panther_user['is_admin']) { message($lang_common['No permission'], false, '403 Forbidden'); }
if ($panther_config['o_feed_type'] == '2') { $feed = array('type' => 'atom', 'link' => panther_link($panther_url['topic_atom'], array($id)), 'lang' => $lang_common['Atom topic feed']); } } break; } ($hook = get_extensions('footer_feedsr')) ? eval($hook) : null; } // Display debug info (if enabled/defined) if ($panther_config['o_debug_mode'] == '1') { // Calculate script generation time $time_diff = sprintf('%.3f', microtime(true) - $panther_start); $debug_info = sprintf($lang_common['Querytime'], $time_diff, $db->get_num_queries()); if (function_exists('memory_get_usage')) { $debug_info .= ' - ' . sprintf($lang_common['Memory usage'], file_size(memory_get_usage())); if (function_exists('memory_get_peak_usage')) { $debug_info .= ' ' . sprintf($lang_common['Peak usage'], file_size(memory_get_peak_usage())); } } } else { $debug_info = ''; } $queries = $panther_config['o_show_queries'] == '1' ? display_saved_queries() : ''; // End the transaction $db->end_transaction(); $style_path = ($panther_config['o_style_path'] != 'style' ? $panther_config['o_style_path'] : PANTHER_ROOT . $panther_config['o_style_path']) . '/' . $panther_user['style'] . '/templates/'; $tpl = defined('PANTHER_ADMIN_CONSOLE') && (file_exists($style_path . 'admin_footer.tpl') || $panther_user['style'] == $panther_config['o_default_style'] && !file_exists($style_path)) ? 'admin_footer.tpl' : 'footer.tpl'; $tpl = load_template($tpl); echo $tpl->render(array('footer_style' => isset($footer_style) ? $footer_style : '', 'controls' => $controls, 'quickjump' => $quickjump_tpl, 'lang_common' => $lang_common, 'links' => $links, 'panther_config' => $panther_config, 'feed' => $feed, 'debug_info' => $debug_info, 'queries' => $queries)); ob_flush(); exit;
} else { $server_load = __('Not available', 'luna'); } // Get number of current visitors $result = $db->query('SELECT COUNT(user_id) FROM ' . $db->prefix . 'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error()); $num_online = $db->result($result); // Collect some additional info about MySQL if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') { // Calculate total db size/row count $result = $db->query('SHOW TABLE STATUS LIKE \'' . $db->prefix . '%\'') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error()); $total_records = $total_size = 0; while ($status = $db->fetch_assoc($result)) { $total_records += $status['Rows']; $total_size += $status['Data_length'] + $status['Index_length']; } $total_size = file_size($total_size); } // Check for the existence of various PHP opcode caches/optimizers if (function_exists('mmcache')) { $php_accelerator = '<a href="http://' . __('turck-mmcache.sourceforge.net/', 'luna') . '">' . __('Turck MMCache', 'luna') . '</a>'; } elseif (isset($_PHPA)) { $php_accelerator = '<a href="http://' . __('www.php-accelerator.co.uk/', 'luna') . '">' . __('ionCube PHP Accelerator', 'luna') . '</a>'; } elseif (ini_get('apc.enabled')) { $php_accelerator = '<a href="http://' . __('www.php.net/apc/', 'luna') . '">' . __('Alternative PHP Cache (APC)', 'luna') . '</a>'; } elseif (ini_get('zend_optimizer.optimization_level')) { $php_accelerator = '<a href="http://' . __('www.zend.com/products/guard/zend-optimizer/', 'luna') . '">' . __('Zend Optimizer', 'luna') . '</a>'; } elseif (ini_get('eaccelerator.enable')) { $php_accelerator = '<a href="http://' . __('www.eaccelerator.net/', 'luna') . '">' . __('eAccelerator', 'luna') . '</a>'; } elseif (ini_get('xcache.cacher')) { $php_accelerator = '<a href="http://' . __('xcache.lighttpd.net/', 'luna') . '">' . __('XCache', 'luna') . '</a>'; } else {
?> <tr> <td><?php echo $icon; ?> </td> <td><?php echo "<a href=\"{$link}\">{$name}</a>"; ?> </td> <td><?php echo $type; ?> </td> <td><?php echo file_size($size); ?> </td> </tr> <?php } ?> </table> <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> <script> var options={ //Boolean - Whether we should show a stroke on each segment segmentShowStroke : true,
* Licensed under GPLv3 (http://getluna.org/license.php) */ // Make sure no one attempts to run this script "directly" if (!defined('FORUM')) { exit; } // Display debug info (if enabled/defined) if (defined('FORUM_DEBUG')) { echo '<p id="debug">[ '; // Calculate script generation time $time_diff = sprintf('%.3f', get_microtime() - $luna_start); echo sprintf(__('Generated in %1$s seconds, %2$s queries executed', 'luna'), $time_diff, $db->get_num_queries()); if (function_exists('memory_get_usage')) { echo ' - ' . sprintf(__('Memory usage: %1$s', 'luna'), file_size(memory_get_usage())); if (function_exists('memory_get_peak_usage')) { echo ' ' . sprintf(__('(Peak: %1$s)', 'luna'), file_size(memory_get_peak_usage())); } } echo ' ]</p>' . "\n"; } // End the transaction $db->end_transaction(); ?> </div> </div> </div> <script src="../include/js/vendor/jquery.js"></script> <script src="../include/js/vendor/bootstrap.min.js"></script> <script src="../include/js/vendor/colours.min.js"></script> <script language="javascript"> var flat_palette = [
<div class="well well-sm"> <?php if ($file) { ?> <div class="pull-right"> <a href="<?php echo asset($file); ?> " class="btn btn-xs btn-info"><?php echo $filename; ?> | <?php echo file_size($filesize); ?> </a> <a href="<?php echo $removeAction; ?> " class="btn btn-xs btn-danger"><i class="icon-remove"></i> Удалить</a> </div> <?php } ?> <?php echo Form::file($field); ?> </div>
</div> <div class="clearer"></div> </div> </div> </div> <?php // Display debug info (if enabled/defined) if (defined('FEATHER_DEBUG')) { echo '<p id="debugtime">[ '; // Calculate script generation time $time_diff = sprintf('%.3f', get_microtime() - $feather_start); echo sprintf($lang_common['Querytime'], $time_diff, count(\DB::get_query_log()[0])); if (function_exists('memory_get_usage')) { echo ' - ' . sprintf($lang_common['Memory usage'], file_size(memory_get_usage())); if (function_exists('memory_get_peak_usage')) { echo ' ' . sprintf($lang_common['Peak usage'], file_size(memory_get_peak_usage())); } } echo ' ]</p>' . "\n"; } // Display executed queries (if enabled) if (defined('FEATHER_SHOW_QUERIES')) { display_saved_queries(); } ?> </div> <div class="end-box"></div> </div> </body> </html>
echo $file['file_task']; ?> "> <?php echo $file['task_name']; ?> </a> </td> <td width="15%" nowrap="nowrap"> <?php echo $file["contact_first_name"] . ' ' . $file["contact_last_name"]; ?> </td> <td width="5%" nowrap="nowrap" align="right"> <?php echo file_size(intval($file['file_size'])); ?> </td> <td nowrap="nowrap"> <?php echo mb_substr($file['file_type'], mb_strpos($file['file_type'], '/') + 1); ?> </td> <td width="15%" nowrap="nowrap" align="right"> <?php echo $hdate->format("{$df} {$tf}"); ?> </td> </tr> <?php }
/** * createColumn is handy because it can take any input $fieldName and use * its suffix to determine how the field should be displayed. * * This allows us to treat project_description, task_description, * company_description, or even some_other_crazy_wacky_description in * exactly the same way without additional lines of code or configuration. * If you want to do your own, feel free... but this is probably easier. * * Examples: _budget, _date, _name, _owner * * This may not work for things like company_type or project_type which are * actually just references to look up tables, ... but should work on * fields like project_company, dept_company because we still have a * common suffix. * * @note I'm kind of annoyed about the complexity and sheer number of * paths of this method but overall I think it's laid out reasonably * well. I think the more important part is that I've been able to * encapsulate it all here instead of spreading it all over the modules * and views. */ public function createCell($fieldName, $value, $custom = array()) { $additional = ''; if ('' == $value) { return '<td>-</td>'; } $pieces = explode('_', $fieldName); $prefix = $pieces[0]; $suffix = '_' . end($pieces); if ($fieldName == 'project_actual_end_date') { $suffix = '_actual'; } switch ($suffix) { //BEGIN: object-based linkings /* * TODO: The following cases are likely to change once we have an approach to * handle module-level objects and their proper mapping/linkings. */ case '_company': case '_contact': case '_task': $module = substr($suffix, 1); $class = 'C' . ucfirst($module); $obj = new $class(); $obj->load($value); $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value; $cell = '<a href="' . $link . '">' . $obj->{"{$module}" . '_name'} . '</a>'; $suffix .= ' _name'; break; case '_department': $module = substr($suffix, 1); $class = 'C' . ucfirst($module); $obj = new $class(); $obj->load($value); /** * This is a branch separate from _company, _contact, etc above because although the module is called * departments, the fields are dept_id and dept_name. :( * ~ caseydk, Dec 11 2013 */ $link = '?m=' . w2p_pluralize($module) . '&a=view&dept_id=' . $value; $cell = '<a href="' . $link . '">' . $obj->dept_name . '</a>'; $suffix .= ' _name'; break; case '_folder': $obj = new CFile_Folder(); $obj->load($value); $foldername = $value ? $obj->file_folder_name : 'Root'; $image = '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" />'; $link = '?m=files&tab=4&folder=' . (int) $value; $cell = '<a href="' . $link . '">' . $image . ' ' . $foldername . '</a>'; $suffix .= ' _name'; break; case '_user': case '_username': $obj = new CContact(); $obj->findContactByUserid($this->tableRowData['user_id']); $link = '?m=users&a=view&user_id=' . $this->tableRowData['user_id']; $cell = '<a href="' . $link . '">' . $obj->user_username . '</a>'; break; //END: object-based linkings /* * TODO: These two prefix adjustments are an ugly hack because our departments * table doesn't follow the same convention as every other table we have. * This needs to be fixed in v4.0 - caseydk 13 Feb 2012 * * TODO: And unfortunately, the forums module is screwy using 'viewer' instead * of our standard 'view' for the page. ~ caseydk 16 Feb 2012 */ //END: object-based linkings /* * TODO: These two prefix adjustments are an ugly hack because our departments * table doesn't follow the same convention as every other table we have. * This needs to be fixed in v4.0 - caseydk 13 Feb 2012 * * TODO: And unfortunately, the forums module is screwy using 'viewer' instead * of our standard 'view' for the page. ~ caseydk 16 Feb 2012 */ case '_name': $prefix = $prefix == 'project_short' ? 'project' : $prefix; $prefix = $prefix == 'dept' ? 'department' : $prefix; $page = $prefix == 'forum' || $prefix == 'message' ? 'viewer' : 'view'; $link = '?m=' . w2p_pluralize($prefix) . '&a=' . $page . '&'; $link = $prefix == 'message' ? '?m=forums&a=' . $page . '&' : $link; $prefix = $prefix == 'department' ? 'dept' : $prefix; $link .= $prefix . '_id=' . $this->tableRowData[$prefix . '_id']; $link .= $prefix == 'task_log' ? '&tab=1&task_id=' . $this->tableRowData['task_id'] : ''; $icon = $fieldName == 'file_name' ? '<img src="' . w2PfindImage(getIcon($this->tableRowData['file_type']), 'files') . '" /> ' : ''; $cell = '<a href="' . $link . '">' . $icon . $value . '</a>'; //TODO: task_logs are another oddball.. $cell = $prefix == 'task_log' ? str_replace('task_logs', 'tasks', $cell) : $cell; break; case '_author': case '_creator': case '_owner': case '_updator': if ((int) $value) { $obj = new CContact(); $obj->findContactByUserid($value); $suffix .= ' nowrap'; $link = '?m=users&a=view&user_id=' . $value; $cell = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>'; } else { $cell = $value; } break; // The above are all contact/user display names, the below are numbers. // The above are all contact/user display names, the below are numbers. case '_count': case '_hours': $cell = $value; break; case '_duration': $durnTypes = w2PgetSysVal('TaskDurationType'); $cell = $value . ' ' . $this->AppUI->_($durnTypes[$this->tableRowData['task_duration_type']]); break; case '_size': $cell = file_size($value); break; case '_budget': $cell = w2PgetConfig('currency_symbol'); $cell .= formatCurrency($value, $this->AppUI->getPref('CURRENCYFORM')); break; case '_url': $value = str_replace(array('"', '"', '<', '>'), '', $value); $cell = w2p_url($value); break; case '_email': $cell = w2p_email($value); break; case '_birthday': case '_date': $myDate = intval($value) ? new w2p_Utilities_Date($value) : null; $cell = $myDate ? $myDate->format($this->df) : '-'; break; case '_actual': $end_date = intval($this->tableRowData['project_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_end_date']) : null; $actual_end_date = intval($this->tableRowData['project_actual_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_actual_end_date']) : null; $style = $actual_end_date < $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : ''; if ($actual_end_date) { $cell = '<a href="?m=tasks&a=view&task_id=' . $this->tableRowData['project_last_task'] . '" ' . $style . '>' . $actual_end_date->format($this->df) . '</a>'; } else { $cell = '-'; } break; case '_created': case '_datetime': case '_update': case '_updated': $myDate = intval($value) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($value, '%Y-%m-%d %T')) : null; $cell = $myDate ? $myDate->format($this->dtf) : '-'; break; case '_description': $cell = w2p_textarea($value); break; case '_priority': $mod = $value > 0 ? '+' : '-'; $image = '<img src="' . w2PfindImage('icons/priority' . $mod . abs($value) . '.gif') . '" width="13" height="16" alt="">'; $cell = $value != 0 ? $image : ''; break; case '_complete': case '_assignment': case '_allocated': case '_allocation': $cell = round($value) . '%'; break; case '_password': $cell = '(' . $this->AppUI->_('hidden') . ')'; break; case '_version': $value = (int) (100 * $value); $cell = number_format($value / 100, 2); break; case '_identifier': $additional = 'style="background-color:#' . $value . '; color:' . bestColor($value) . '" '; $cell = $this->tableRowData['project_percent_complete'] . '%'; break; case '_project': $module = substr($suffix, 1); $class = 'C' . ucfirst($module); $obj = new $class(); $obj->load($value); $color = $obj->project_color_identifier; $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value; $cell = '<span style="background-color:#' . $color . '; padding: 3px"><a href="' . $link . '" style="color:' . bestColor($color) . '">' . $obj->{"{$module}" . '_name'} . '</a></span>'; $suffix .= ' _name'; break; case '_assignees': $cell = $value; break; case '_problem': if ($value) { $cell = '<a href="?m=tasks&a=index&f=all&project_id=' . $this->tableRowData['project_id'] . '">'; $cell .= w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem'); $cell .= '</a>'; } else { $cell = '-'; } break; default: $value = isset($custom[$fieldName]) ? $custom[$fieldName][$value] : $value; $cell = htmlspecialchars($value, ENT_QUOTES); } $begin = '<td ' . $additional . 'class="' . $suffix . '">'; $end = '</td>'; return $begin . $cell . $end; }
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id) { global $m, $a, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $cfObj, $xpg_totalrecs, $xpg_total_pages, $page, $company_id, $allowed_companies, $current_uri, $w2Pconfig, $canEdit, $canRead; $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); // SETUP FOR FILE LIST $q = new w2p_Database_Query(); $q->addQuery('f.*, max(f.file_id) as latest_id, count(f.file_version) as file_versions, round(max(file_version), 2) as file_lastversion'); $q->addQuery('ff.*'); $q->addTable('files', 'f'); $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder'); $q->addJoin('projects', 'p', 'p.project_id = file_project'); $q->addJoin('tasks', 't', 't.task_id = file_task'); $q->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL'); $q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL'); //TODO: apply permissions properly $project = new CProject(); $deny1 = $project->getDeniedRecords($AppUI->user_id); if (count($deny1) > 0) { $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')'); } //TODO: apply permissions properly $task = new CTask(); $deny2 = $task->getDeniedRecords($AppUI->user_id); if (count($deny2) > 0) { $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')'); } if ($project_id) { $q->addWhere('file_project = ' . (int) $project_id); } if ($task_id) { $q->addWhere('file_task = ' . (int) $task_id); } if ($company_id) { $q->addWhere('project_company = ' . (int) $company_id); } $q->setLimit($xpg_pagesize, $xpg_min); $q->addWhere('file_folder = ' . (int) $folder_id); $q->addGroup('file_version_id DESC'); $qv = new w2p_Database_Query(); $qv->addTable('files'); $qv->addQuery('file_id, file_version, file_project, file_name, file_task, file_description, u.user_username as file_owner, file_size, file_category, task_name, file_version_id, file_checkout, file_co_reason, file_type, file_date, cu.user_username as co_user, project_name, project_color_identifier, project_owner, con.contact_first_name, con.contact_last_name, co.contact_first_name as co_contact_first_name, co.contact_last_name as co_contact_last_name '); $qv->addJoin('projects', 'p', 'p.project_id = file_project'); $qv->addJoin('users', 'u', 'u.user_id = file_owner'); $qv->addJoin('contacts', 'con', 'con.contact_id = u.user_contact'); $qv->addJoin('tasks', 't', 't.task_id = file_task'); $qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder'); if ($project_id) { $qv->addWhere('file_project = ' . (int) $project_id); } if ($task_id) { $qv->addWhere('file_task = ' . (int) $task_id); } if ($company_id) { $qv->addWhere('project_company = ' . (int) $company_id); } $qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout'); $qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact'); $qv->addWhere('file_folder = ' . (int) $folder_id); $files = array(); $file_versions = array(); $files = $q->loadList(); $file_versions = $qv->loadHashList('file_id'); $q->clear(); $qv->clear(); if ($files === array()) { return 0; } $s = ' <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th>' . $AppUI->_('Description') . '</th> <th>' . $AppUI->_('Versions') . '</th> <th>' . $AppUI->_('Category') . '</th> <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th> <th>' . $AppUI->_('Owner') . '</th> <th>' . $AppUI->_('Size') . '</th> <th>' . $AppUI->_('Type') . '</a></th> <th>' . $AppUI->_('Date') . '</th> <th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th> <th>' . $AppUI->_('co') . '</th> <th nowrap="nowrap" width="5%"></th> <th nowrap="nowrap" width="1"></th> </tr>'; $fp = -1; $file_date = new w2p_Utilities_Date(); $id = 0; foreach ($files as $row) { $latest_file = $file_versions[$row['latest_id']]; $file_date = new w2p_Utilities_Date($latest_file['file_date']); if ($fp != $latest_file['file_project']) { if (!$latest_file['file_project']) { $latest_file['project_name'] = $AppUI->_('Not attached to a project'); $latest_file['project_color_identifier'] = 'f4efe3'; } if ($showProject) { $style = 'background-color:#' . $latest_file['project_color_identifier'] . ';color:' . bestColor($latest_file['project_color_identifier']); $s .= '<tr>'; $s .= '<td colspan="20" style="border: outset 2px #eeeeee;' . $style . '">'; if ($latest_file['file_project'] > 0) { $href = './index.php?m=projects&a=view&project_id=' . $latest_file['file_project']; } else { $href = './index.php?m=projects'; } $s .= '<a href="' . $href . '">'; $s .= '<span style="' . $style . '">' . $latest_file['project_name'] . '</span></a>'; $s .= '</td></tr>'; } } $fp = $latest_file['file_project']; $s .= '<tr> <td nowrap="8%"> <form name="frm_remove_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="del" value="1" /> <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form> <form name="frm_duplicate_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8"> <input type="hidden" name="dosql" value="do_file_aed" /> <input type="hidden" name="duplicate" value="1" /> <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" /> <input type="hidden" name="redirect" value="' . $current_uri . '" /> </form> '; $junkFile = new CFile(); // TODO: This is just to get getIcon included.. $file_icon = getIcon($row['file_type']); $s .= '<a href="./fileviewer.php?file_id=' . $latest_file['file_id'] . '"><img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" /> ' . $latest_file['file_name'] . '</a></td>'; $s .= '<td width="20%">' . w2p_textarea($latest_file['file_description']) . '</td><td width="5%" nowrap="nowrap" align="right">'; $hidden_table = ''; $s .= $row['file_lastversion']; if ($row['file_versions'] > 1) { $s .= ' <a href="javascript: void(0);" onClick="expand(\'versions_' . $latest_file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>'; $hidden_table = '<tr><td colspan="20"> <table style="display: none" id="versions_' . $latest_file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl"> <tr> <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th> <th>' . $AppUI->_('Description') . '</th> <th>' . $AppUI->_('Versions') . '</th> <th>' . $AppUI->_('Category') . '</th> <th>' . $AppUI->_('Folder') . '</th> <th>' . $AppUI->_('Task Name') . '</th> <th>' . $AppUI->_('Owner') . '</th> <th>' . $AppUI->_('Size') . '</th> <th>' . $AppUI->_('Type') . '</a></th> <th>' . $AppUI->_('Date') . '</th> </tr>'; foreach ($file_versions as $file) { if ($file['file_version_id'] == $latest_file['file_version_id']) { $file_icon = getIcon($file['file_type']); $hdate = new w2p_Utilities_Date($file['file_date']); $hidden_table .= '<tr><td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file['file_id'] . '" title="' . $file['file_description'] . '">' . '<img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" /> ' . $file['file_name'] . ' </a></td> <td width="20%">' . $file['file_description'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . $file['file_version'] . '</td> <td nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td> <td nowrap="nowrap" align="left">' . ($file['file_folder_name'] != '' ? '<a href="' . W2P_BASE_URL . '/index.php?m=files&tab=' . (count($file_types) + 1) . '&folder=' . $file['file_folder_id'] . '">' . w2PshowImage('folder5_small.png', '16', '16', 'folder icon', 'show only this folder', 'files') . $file['file_folder_name'] . '</a>' : 'Root') . '</td> <td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $file['file_task'] . '">' . $file['task_name'] . '</a></td> <td nowrap="nowrap">' . $file['contact_first_name'] . ' ' . $file['contact_last_name'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . file_size(intval($file['file_size'])) . '</td> <td nowrap="nowrap">' . $file['file_type'] . '</td> <td width="5%" nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($file['file_date'], $df . ' ' . $tf) . '</td>'; if ($canEdit && $w2Pconfig['files_show_versions_edit']) { $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . "</a>"; } $hidden_table .= '</td><tr>'; } } $hidden_table .= '</table>'; } $s .= '</td> <td width="10%" nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td> <td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $latest_file['file_task'] . '">' . $latest_file['task_name'] . '</a></td> <td nowrap="nowrap">' . $latest_file['contact_first_name'] . ' ' . $latest_file['contact_last_name'] . '</td> <td width="5%" nowrap="nowrap" align="right">' . intval($latest_file['file_size'] / 1024) . ' kb</td> <td nowrap="nowrap">' . $latest_file['file_type'] . '</td> <td nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($latest_file['file_date'], $df . ' ' . $tf) . '</td> <td width="10%">' . $latest_file['file_co_reason'] . '</td> <td nowrap="nowrap">'; if (empty($row['file_checkout'])) { $s .= '<a href="?m=files&a=co&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('up.png', '16', '16', 'checkout', 'checkout file', 'files') . '</a>'; } elseif ($row['file_checkout'] == $AppUI->user_id) { $s .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('down.png', '16', '16', 'checkin', 'checkin file', 'files') . '</a>'; } else { if ($latest_file['file_checkout'] == 'final') { $s .= 'final'; } else { $s .= $latest_file['co_contact_first_name'] . ' ' . $latest_file['co_contact_last_name'] . '<br>(' . $latest_file['co_user'] . ')'; } } $s .= '</td><td nowrap="nowrap" width="50">'; if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) { $s .= '<a style="float: left;" href="./index.php?m=files&a=addedit&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . '</a>'; $s .= '<a style="float: left;" href="javascript: void(0);" onclick="document.frm_duplicate_file_' . $latest_file['file_id'] . '.submit()">' . w2PshowImage('duplicate.png', '16', '16', 'duplicate file', 'duplicate file', 'files') . '</a>'; $s .= '<a style="float: left;" href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $latest_file['file_id'] . '.submit()}">' . w2PshowImage('remove.png', '16', '16', 'delete file', 'delete file', 'files') . '</a>'; } $s .= '</td>'; $s .= '<td nowrap="nowrap" align="center" width="1">'; if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) { $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $latest_file['file_id'] . ') : removeBulkComponent(' . $latest_file['file_id'] . ')"'; $s .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $latest_file['file_id'] . '" />'; } $s .= '</td></tr>'; $s .= $hidden_table; $hidden_table = ''; } return $s; }
function diff_size($bytes, $dec = 0, $plus = '+') { $size = file_size(abs($bytes), $dec); $size = ($bytes >= 0 ? $plus : '-') . $size; return $size; }
$cur_post['message'] = $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']); // Do signature parsing/caching if ($panther_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $panther_user['show_sig'] != '0') { if (isset($signature_cache[$cur_post['poster_id']])) { $signature = $signature_cache[$cur_post['poster_id']]; } else { $signature = $parser->parse_signature($cur_post['signature']); $signature_cache[$cur_post['poster_id']] = $signature; } } else { $signature = ''; } $attachments = array(); if ($download && isset($results[$cur_post['id']]) && count($results[$cur_post['id']]) > 0) { foreach ($results[$cur_post['id']] as $cur_attach) { $attachments[] = array('icon' => attach_icon(attach_get_extension($cur_attach['filename'])), 'link' => panther_link($panther_url['attachment'], array($cur_attach['id'])), 'name' => $cur_attach['filename'], 'size' => sprintf($lang_topic['Attachment size'], file_size($cur_attach['size'])), 'downloads' => sprintf($lang_topic['Attachment downloads'], forum_number_format($cur_attach['downloads']))); } } $posts[] = array('id' => $cur_post['id'], 'count' => $post_count++, 'number' => $start_from + $post_count, 'link' => panther_link($panther_url['post'], array($cur_post['id'])), 'posted' => format_time($cur_post['posted']), 'username' => $username, 'user_title' => $user_title, 'poster_id' => $cur_post['poster_id'], 'poster_reputation' => $cur_post['poster_reputation'], 'user_avatar' => $user_avatar, 'group_image' => $group_image, 'edited' => $cur_post['edited'] ? format_time($cur_post['edited']) : '', 'edited_by' => $cur_post['edited_by'], 'edit_reason' => $cur_post['edit_reason'], 'attachments' => $attachments, 'message' => $cur_post['message'], 'signature' => $signature, 'is_online' => $cur_post['is_online'], 'user_info' => $user_info, 'user_contacts' => $user_contacts, 'group_image' => $group_image, 'post_actions' => $post_actions, 'actions' => $actions); } $render['posts'] = $posts; if ($cur_topic['parent']) { $render['parent_link'] = panther_link($panther_url['forum'], array($cur_topic['parent_forum'], url_friendly($cur_topic['parent']))); } ($hook = get_extensions('topic_before_users_online')) ? eval($hook) : null; if ($panther_config['o_users_online'] == '1') { require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/online.php'; $guests_in_topic = $users = array(); $online = $db->run('SELECT o.user_id, o.ident, o.currently, o.logged, u.group_id FROM ' . $db->prefix . 'online AS o INNER JOIN ' . $db->prefix . 'users AS u ON u.id=o.user_id WHERE o.currently LIKE \'%viewtopic.php%\' AND o.idle = 0'); foreach ($online as $user_online) { if (strpos($user_online['currently'], '&p=') !== false) {
/** * downloads a file. * * @param $down * @return string with current */ function downloadFile($down) { global $cfg; $current = ""; // we need to strip slashes twice in some circumstances // Ex. If we are trying to download test/tester's file/test.txt // $down will be "test/tester\\\'s file/test.txt" // one strip will give us "test/tester\'s file/test.txt // the second strip will give us the correct // "test/tester's file/test.txt" $down = stripslashes(stripslashes($down)); if (tfb_isValidPath($down)) { $path = $cfg["path"] . $down; $p = explode(".", $path); $pc = count($p); $f = explode("/", $path); $file = array_pop($f); $arTemp = explode("/", $down); if (count($arTemp) > 1) { array_pop($arTemp); $current = implode("/", $arTemp); } if (file_exists($path)) { // size $filesize = file_size($path); // filenames in IE containing dots will screw up the filename $headerName = strstr($_SERVER['HTTP_USER_AGENT'], "MSIE") ? preg_replace('/\\./', '%2e', $file, substr_count($file, '.') - 1) : $file; // partial or full ? if (isset($_SERVER['HTTP_RANGE'])) { // Partial download $bufsize = 32768; if (preg_match("/^bytes=(\\d+)-(\\d*)\$/D", $_SERVER['HTTP_RANGE'], $matches)) { $from = $matches[1]; $to = $matches[2]; if (empty($to)) { $to = $filesize - 1; } $content_size = $to - $from + 1; @header("HTTP/1.1 206 Partial Content"); @header("Content-Range: {$from} - {$to} / {$filesize}"); @header("Content-Length: {$content_size}"); @header("Content-Type: application/force-download"); @header("Content-Disposition: attachment; filename=\"" . $headerName . "\""); @header("Content-Transfer-Encoding: binary"); // write the session to close so you can continue to browse on the site. @session_write_close(); $fh = fopen($path, "rb"); fseek($fh, $from); $cur_pos = ftell($fh); while ($cur_pos !== FALSE && ftell($fh) + $bufsize < $to + 1) { $buffer = fread($fh, $bufsize); echo $buffer; $cur_pos = ftell($fh); } $buffer = fread($fh, $to + 1 - $cur_pos); echo $buffer; fclose($fh); } else { AuditAction($cfg["constants"]["error"], "Partial download : " . $cfg["user"] . " tried to download " . $down); @header("HTTP/1.1 500 Internal Server Error"); exit; } } else { // standard download @header("Content-type: application/octet-stream\n"); @header("Content-disposition: attachment; filename=\"" . $headerName . "\"\n"); @header("Content-transfer-encoding: binary\n"); @header("Content-length: " . $filesize . "\n"); // write the session to close so you can continue to browse on the site. @session_write_close(); $fp = popen("cat " . tfb_shellencode($path), "r"); fpassthru($fp); pclose($fp); } // log AuditAction($cfg["constants"]["fm_download"], $down); exit; } else { AuditAction($cfg["constants"]["error"], "File Not found for download: " . $cfg["user"] . " tried to download " . $down); } } else { AuditAction($cfg["constants"]["error"], "ILLEGAL DOWNLOAD: " . $cfg["user"] . " tried to download " . $down); } return $current; }
exit; } if (isset($_GET["lv-resize-add"])) { LVM_LV_ADDSIZE(); exit; } if (isset($_GET["lv-resize-red"])) { LVM_LV_DELSIZE(); exit; } if (isset($_GET["disk-ismounted"])) { disk_ismounted(); exit; } if (isset($_GET["filesize"])) { file_size(); exit; } if (isset($_GET["filetype"])) { file_type(); exit; } if (isset($_GET["mime-type"])) { mime_type(); exit; } if (isset($_GET["sync-remote-smtp-artica"])) { postfix_sync_artica(); exit; } //etc/hosts
} ?> </td> <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php echo $latest_file["file_task"]; ?> "><?php echo $latest_file["task_name"]; ?> </a></td> <td width="15%" nowrap="nowrap"><?php echo $latest_file["contact_first_name"] . ' ' . $latest_file["contact_last_name"]; ?> </td> <td width="5%" nowrap="nowrap" align="right"><?php echo file_size(intval($latest_file["file_size"])); ?> </td> <td nowrap="nowrap"><?php echo $AppUI->_(substr($latest_file['file_type'], strpos($latest_file['file_type'], '/') + 1)); ?> </td> <td width="15%" nowrap="nowrap" align="right"><?php echo $file_date->format("{$df} {$tf}"); ?> </td> </tr> <?php echo $hidden_table; $hidden_table = ''; }
<br /> <table width="100%" cellspacing="1" cellpadding="4" border="0" class="tbl"> <tr> <th colspan="2"><?php echo $AppUI->_('Document Space Utilized'); ?> </th> </tr> <tr> <td><?php echo $AppUI->_('Space Utilized'); ?> :</td> <td nowrap="nowrap"><?php echo file_size($files); ?> </td> </tr> </table> </td> <td width="100%" valign="top"> <table width="100%" cellspacing="1" cellpadding="4" border="0" class="tbl"> <tr> <th><?php echo $AppUI->_('Task Assignee'); ?> </th> <th><?php echo $AppUI->_('Pending Tasks'); ?>
function ListDirectory($dirName) { global $dirModified, $dir, $cfg; $bgLight = $cfg["bgLight"]; $bgDark = $cfg["bgDark"]; $entrys = array(); $bg = $bgLight; $dirName = stripslashes($dirName); if (isset($dir)) { //setup default parent directory URL $parentURL = "dir.php"; //get the real parentURL if (preg_match("/^(.+)\\/.+\$/", $dir, $matches) == 1) { $parentURL = "dir.php?dir=" . urlencode($matches[1]); } echo "<a href=\"" . $parentURL . "\"><img src=\"images/up_dir.gif\" width=16 height=16 title=\"" . _BACKTOPARRENT . "\" border=0>[" . _BACKTOPARRENT . "]</a>"; } //echo "<table cellpadding=2 width=740>"; /* --- Multi Delete Hack --- */ echo '<table cellpadding="2"" width="740">'; echo '<form action="multi.php" method="post" name="multidir">'; $handle = opendir($dirName); while ($entry = readdir($handle)) { $entrys[] = $entry; } natsort($entrys); foreach ($entrys as $entry) { //if ($entry != "." && $entry != ".." && substr($entry, 0, 1) != ".") { if ($entry != "." && $entry != ".." && substr($entry, 0, 1) != "." && $entry != "lost+found") { if (@is_dir($dirName . $entry)) { echo "<tr bgcolor=\"" . $bg . "\"><td><a href=\"dir.php?dir=" . urlencode($dir . $entry) . "\"><img src=\"images/folder2.gif\" width=\"16\" height=\"16\" title=\"" . $entry . "\" border=\"0\" align=\"absmiddle\">" . $entry . "</a></td>"; // Some Stats dir hack // b4rt-5 if ($cfg['enable_dirstats'] == 1) { $dudir = shell_exec($cfg['bin_du'] . " -sk -h " . correctFileName($dirName . $entry)); $dusize = explode("\t", $dudir); $arStat = @lstat($dirName . $entry); $timeStamp = @filemtime($dirName . $entry); //$timeStamp = $arStat[10]; echo "<td align=\"right\">" . $dusize[0] . "B</td>"; echo "<td width=140>" . @date("m-d-Y h:i a", $timeStamp) . "</td>"; } else { echo "<td> </td>"; echo "<td> </td>"; } echo "<td align=\"right\" nowrap>"; // rename hack include 'rename_dir_extension.php'; // move hack include 'move_dir_extension.php'; // b4rt-5 : SFV Check if ($cfg['enable_sfvcheck'] == 1) { if (false !== ($sfv = findSFV($dirName . $entry))) { echo '<a href="javascript:CheckSFV(\'' . $sfv[dir] . '\',\'' . $sfv[sfv] . '\')"><img ' . 'src="images/sfv_enabled.gif" border="0" ' . 'width="16" height="16" alt="sfv check torrent"></a>'; } else { echo '<img src="images/sfv_disabled.gif" border="0" width="16" height="16" alt="sfv check torrent (no sfv found)">'; } } // b4rt-5 : SFV Check // maketorrentt if ($cfg["enable_maketorrent"]) { echo "<a href=\"JavaScript:MakeTorrent('maketorrent.php?path=" . urlencode($dir . $entry) . "')\"><img src=\"images/make.gif\" width=16 height=16 title=\"Make Torrent\" border=0></a>"; } // download if ($cfg["enable_file_download"]) { echo "<a href=\"dir.php?tar=" . urlencode($dir . $entry) . "\"><img src=\"images/tar_down.gif\" width=16 height=16 title=\"Download as " . $cfg["package_type"] . "\" border=0></a>"; } // The following lines of code were suggested by Jody Steele jmlsteele@stfu.ca // this is so only the owner of the file(s) or admin can delete // only give admins and users who "own" this directory // the ability to delete sub directories if (IsAdmin($cfg["user"]) || preg_match("/^" . $cfg["user"] . "/", $dir)) { //echo "<a href=\"dir.php?del=".urlencode($dir.$entry)."\" onclick=\"return ConfirmDelete('".addslashes($entry)."')\"><img src=\"images/delete_on.gif\" width=16 height=16 title=\""._DELETE."\" border=0></a>"; /* --- Multi Delete Hack --- */ /* checkbox appended to line */ echo "<a href=\"dir.php?del=" . urlencode($dir . $entry) . "\" onclick=\"return ConfirmDelete('" . addslashes($entry) . "')\"><img src=\"images/delete_on.gif\" width=16 height=16 title=\"" . _DELETE . "\" border=0></a><input type=\"checkbox\" name=\"file[]\" value=\"" . urlencode($dir . $entry) . "\">"; /* --- Multi Delete Hack --- */ } else { echo " "; } echo "</td></tr>\n"; if ($bg == $bgLight) { $bg = $bgDark; } else { $bg = $bgLight; } } } } closedir($handle); $entrys = array(); $handle = opendir($dirName); while ($entry = readdir($handle)) { $entrys[] = $entry; } natsort($entrys); foreach ($entrys as $entry) { if ($entry != "." && $entry != "..") { if (@is_dir($dirName . $entry)) { // Do nothing } else { $arStat = @lstat($dirName . $entry); $arStat[7] = $arStat[7] == 0 ? @file_size($dirName . $entry) : $arStat[7]; if (array_key_exists(10, $arStat)) { $timeStamp = @filemtime($dirName . $entry); } else { $timeStamp = ""; } $fileSize = number_format($arStat[7] / 1024); // Code added by Remko Jantzen to assign an icon per file-type. But when not // available all stays the same. $image = "images/time.gif"; $imageOption = "images/files/" . getExtension($entry) . ".png"; if (file_exists("./" . $imageOption)) { $image = $imageOption; } echo "<tr bgcolor=\"" . $bg . "\">"; echo "<td>"; // Can users download files? if ($cfg["enable_file_download"]) { // Yes, let them download echo "<a href=\"dir.php?down=" . urlencode($dir . $entry) . "\" >"; echo "<img src=\"" . $image . "\" width=\"16\" height=\"16\" alt=\"" . $entry . "\" border=\"0\"></a>"; echo "<a href=\"dir.php?down=" . urlencode($dir . $entry) . "\" >" . $entry . "</a>"; } else { // No, just show the name echo "<img src=\"" . $image . "\" width=\"16\" height=\"16\" alt=\"" . $entry . "\" border=\"0\">"; echo $entry; } echo "</td>"; echo "<td align=\"right\">" . $fileSize . " KB</td>"; // b4rt-5 // Some Stats dir hack if ($cfg['enable_dirstats'] == 1) { echo "<td width=140>" . @date("m-d-Y h:i a", $timeStamp) . "</td>"; } else { echo "<td>" . @date("m-d-Y g:i a", $timeStamp) . "</td>"; } // b4rt-5 echo "<td align=\"right\" nowrap>"; // rename hack include 'rename_dir_extension.php'; // move hack include 'move_dir_extension.php'; // b4rt if ($cfg['enable_rar'] == 1) { // R.D. - Display links for unzip/unrar //************************************************************************************************************** if (IsAdmin($cfg["user"]) || preg_match("/^" . $cfg["user"] . "/", $dir)) { if (strpos($entry, '.rar') !== FALSE and strpos($entry, '.Part') === FALSE or strpos($entry, '.part01.rar') !== FALSE or strpos($entry, '.part1.rar') !== FALSE) { echo "<a href=\"javascript:UncompDetails('uncomp.php?file=" . urlencode($dir . $entry) . "&dir=" . urlencode($dir) . "&type=rar')\"><img src=\"images/rar_enabled.gif\" width=16 height=16 title=\"Unrar\" border=0></a>"; } if (strpos($dir . $entry, '.zip') !== FALSE) { echo "<a href=\"javascript:UncompDetails('uncomp.php?file=" . urlencode($dir . $entry) . "&dir=" . urlencode($dir) . "&type=zip')\"><img src=\"images/zip.png\" width=16 height=16 title=\"Unzip\" border=0></a>"; } } //************************************************************************************************************** } // b4rt // nfo if ($cfg["enable_view_nfo"] && (substr(strtolower($entry), -4) == ".nfo" || substr(strtolower($entry), -4) == ".txt" || substr(strtolower($entry), -4) == ".log")) { echo "<a href=\"viewnfo.php?path=" . urlencode(addslashes($dir . $entry)) . "\"><img src=\"images/view_nfo.gif\" width=16 height=16 title=\"View '{$entry}'\" border=0></a>"; } // maketorrent if ($cfg["enable_maketorrent"]) { echo "<a href=\"JavaScript:MakeTorrent('maketorrent.php?path=" . urlencode($dir . $entry) . "')\"><img src=\"images/make.gif\" width=16 height=16 title=\"Make Torrent\" border=0></a>"; } // download if ($cfg["enable_file_download"]) { // Show the download button echo "<a href=\"dir.php?down=" . urlencode($dir . $entry) . "\" >"; echo "<img src=\"images/download_owner.gif\" width=16 height=16 title=\"Download\" border=0>"; echo "</a>"; } // The following lines of code were suggested by Jody Steele jmlsteele@stfu.ca // this is so only the owner of the file(s) or admin can delete // only give admins and users who "own" this directory // the ability to delete files if (IsAdmin($cfg["user"]) || preg_match("/^" . $cfg["user"] . "/", $dir)) { //echo "<a href=\"dir.php?del=".urlencode($dir.$entry)."\" onclick=\"return ConfirmDelete('".addslashes($entry)."')\"><img src=\"images/delete_on.gif\" width=16 height=16 title=\""._DELETE."\" border=0></a>"; /* --- Multi Delete Hack --- */ /* checkbox appended to line */ echo "<a href=\"dir.php?del=" . urlencode($dir . $entry) . "\" onclick=\"return ConfirmDelete('" . addslashes($entry) . "')\"><img src=\"images/delete_on.gif\" width=16 height=16 title=\"" . _DELETE . "\" border=0></a><input type=\"checkbox\" name=\"file[]\" value=\"" . urlencode($dir . $entry) . "\">"; /* --- Multi Delete Hack --- */ } else { echo " "; } echo "</td></tr>\n"; if ($bg == $bgLight) { $bg = $bgDark; } else { $bg = $bgLight; } } } } // b4rt-5 # Some Stats dir hack closedir($handle); /* --- Multi Delete Hack --- */ echo '<input type="hidden" name="action" value="fileDelete" />'; echo '<tr><td align="right" colspan="4"><a href="javascript:document.multidir.submit()" onclick="return ConfirmDelete(\'Multiple Files\')"><img src="images/delete_on.gif" title="Delete" border="0" height="16" width="16"></a><input type="checkbox" onclick="checkCheck(this);" /></td></tr>'; echo "</form>"; /* --- Multi Delete Hack --- */ echo "</table>"; if ($cfg['enable_dirstats'] == 1) { $cmd = $cfg['bin_du'] . " -ch \"" . $dirName . "\" | " . $cfg['bin_grep'] . " \"total\""; $du = shell_exec($cmd); echo '<table cellpadding="0" width="740">'; $du2 = substr($du, 0, -7); echo "<tr bgcolor=#ececec>"; echo "<td align=\"center\">" . _TDDU . " " . $du2 . "B</td></tr>"; echo "</table>"; } // b4rt-5 }
/** * gets size of data of a torrent * * @param $torrent name of the torrent * @return int with size of data of torrent. * -1 if error * 4096 if dir (lol ~) * string with file/dir-name if doesnt exist. (lol~) */ function getTorrentDataSize($torrent) { global $cfg; require_once 'BDecode.php'; $ftorrent = $cfg["torrent_file_path"] . $torrent; $fd = fopen($ftorrent, "rd"); $alltorrent = fread($fd, filesize($ftorrent)); $btmeta = BDecode($alltorrent); $name = $btmeta['info']['name']; if (trim($name) != "") { // load torrent-settings from db to get data-location loadTorrentSettingsToConfig($torrent); if (!isset($cfg["savepath"]) || empty($cfg["savepath"])) { $cfg["savepath"] = $cfg["path"] . getOwner($torrent) . '/'; } $name = $cfg["savepath"] . $name; # this is from dir.php - its not a function, and we need to call it several times $tData = stripslashes(stripslashes($name)); if (!ereg("(\\.\\.\\/)", $tData)) { $fileSize = file_size($tData); return $fileSize; } } return -1; }
// Et enfin on ferme le dossier if (isset($filesvar)) { krsort($filesvar); foreach ($filesvar as $time => $file) { $files[] = $file; } } if (isset($files)) { foreach ($files as $fichier) { $nom_fichier_brut = preg_replace('`img/members/' . $id . '/(.+)`', '$1', $fichier); // Nom du fichier avec extension $nom_fichier = preg_replace('`(.+)\\..*`', '$1', $nom_fichier_brut); // Nom du fichier sans extension $type_fichier = preg_replace('`.*\\.(.+)`', '$1', $nom_fichier_brut); // Extension du fichier $size_fichier = file_size(filesize($fichier)); // Taille du fichier $miniature = $dir . 'mini_' . $nom_fichier . '.' . $type_fichier; // Adresse de la miniature potentiellement existente $mini = explode('_', $nom_fichier); // On vérifie que ce n'est pas une miniature if ($mini[0] != 'mini') { ?> <tr> <td class="tc1"><a href="<?php echo $fichier; ?> "><?php echo $nom_fichier; ?> </a> [<?php