function showDownloads($filename, $filesize, $filedesc, $fileuploader, $file_upload_time, $fileuri, $course_name) { echo '<div style="box-shadow:rgb(200,200,200) 3px 4px; border-radius:10px; width: 500px; margin:10px; padding:5px; background-color:#eee; z-index:10;> <p style="font-family: verdana; padding:10px;"> <label style=" float:left;font-size:14px;color:#AABBCC">' . $fileuploader . '</label> <label style=" float:right;font-size:14px;color:#AABBCC">' . getHumanTime($file_upload_time) . '</label> <br /><label style="font-size:18px;font-family: Arial;color:#0AB3F1">' . $filename . '</label> <a style="float:right;" target="_blank" href="' . $fileuri . '"><img src="images/ui/ic_download_option.png"/></a> <br /><label style="font-size:12px;color:#999">' . $filedesc . '</label><br /> <label style="font-size:14px; float:right;color:#AABBCC">' . $course_name . '</label> <label style="font-size:14px; float:left;color:#AABBCC">' . getFileSize($filesize) . '</label> </p> </div>'; }
function getFileSize($pathString) { if (!file_exists($pathString)) { $fileSize = 0; } else { if (is_file($pathString)) { $fileSize = filesize($pathString); } else { $fileSize = 0; foreach (glob($pathString . "/*") as $fn) { $fileSize += getFileSize($fn); } } } return $fileSize; }
function displayContents() { $lines = readLastLines(20, true); if ($lines === null) { echo '<p>The log file is null.</p>'; } else { if (empty($lines)) { echo '<p>The log file is empty.</p>'; } else { echo '<table class="widefat"><tbody>'; $isOddRow = false; foreach ($lines as $line) { $isOddRow = !$isOddRow; printf('<tr%s><td style="white-space:nowrap;">%s</td><td>%s</td></tr>', $isOddRow ? ' class="alternate"' : '', !empty($line['timestamp']) ? formatTimestamp($line['timestamp']) : '', htmlspecialchars($line[43])); } echo '</tbody></table>'; echo '<p>'; printf('Log file: %s (%s) ', htmlspecialchars(getFilename()), formatByteCount(getFileSize(), 2)); echo '</p>'; } } }
function uploadFileToS3($sourceFile, $folder = "") { $resultado = array("res" => false); // Instanciamos un cliente de s3 $client = Aws::factory(getServerRoot() . '/modulos/aws/modelos/configurationFile.php')->get('s3'); $bucket = getBucketName(); $key = generateFileKey($sourceFile, $folder); while ($client->doesObjectExist($bucket, $key)) { //Si ese objeto ya existe, generamos otro key //Este caso es muy raro, debido a la generación, //Pero puede pasar $key = generateFileKey($sourceFile, $folder); } require_once 'funcionesPHP/funcionesParaArchivos.php'; //Si el archivo es más grande que 10MB, utilizamos la función //para subir por partes $megabytesLimit = 10 * 1048576; if (getFileSize($sourceFile) < $megabytesLimit) { $client->putObject(array('Bucket' => $bucket, 'Key' => $key, 'SourceFile' => $sourceFile, 'ACL' => 'public-read')); $resultado["res"] = true; } else { $uploader = UploadBuilder::newInstance()->setClient($client)->setSource($sourceFile)->setBucket($bucket)->setKey($key)->setOption('ACL', 'public-read')->build(); try { $uploader->upload(); $resultado["res"] = true; } catch (MultipartUploadException $e) { $uploader->abort(); $resultado["res"] = false; } } if ($resultado['res']) { $resultado["bucket"] = $bucket; $resultado["key"] = $key; $prefijoLink = getPrefijoLink(); $resultado["link"] = $prefijoLink . $bucket . "/" . $key; } return $resultado; }
if (!count($errors)) { foreach ($core_files as $core_name => $core) { $file = $pathToCore . "/{$core_name}"; $core_hash = md5($core); if ($script_hash[$core_name] === $core_hash) { $mode = "No change"; $full_size = $full_script_size[$core_name]; $size = getFileSize($file); $savings = sprintf("%.2f%%", 100 - $size / $full_size * 100); //$size/$full_size ;//sprintf("%.2f%%", $x * 100) $completed[] = "{$mode}: {$file} - ({$savings} reduction)"; } elseif (@file_put_contents($file, $core) !== false) { $change_count++; $mode = "Updated"; $full_size = $full_script_size[$core_name]; $size = getFileSize($file); $savings = sprintf("%.2f%%", 100 - $size / $full_size * 100); //$size/$full_size ;//sprintf("%.2f%%", $x * 100) $diff = $size - $script_size[$core_name]; if ($script_hash[$core_name] == false) { $mode = "Created"; } $completed[] = "{$mode}: {$file} - ({$savings} reduction; {$diff} byte change.)"; } else { $errors[] = "Unable to create core file: {$file}"; break; } } } } if (count($errors)) {
if($upload->is_nsfw()) { ?> <a href="<?= Link::setPref("hide_nsfw", (me()->getPref("hide_nsfw") == 1 ? "" : "1")) ?>" title="<?= me()->getPref("hide_nsfw") == 1 ? "show" : "hide" ?> images that are not safe for work">[nsfw]</a><? } if($upload->is_tmbo()) { ?> <a href="<?= Link::setPref("hide_tmbo", (me()->getPref("hide_tmbo") == 1 ? "" : "1")) ?>" title="<?= me()->getPref("hide_tmbo") == 1 ? "show" : "hide" ?> images that might be offensive">[tmbo]</a><? } ?> </span> <? } echo "<a href=\"".$upload->URL()."\" target=\"_blank\">" . htmlEscape($upload->filename()) . "</a>"; ?> <span id="dimensions" class="info"><? if($upload->file() != "") echo getFileSize($upload->file()); ?></span> <br/> <!-- username/time block --> <span id="upload_info" class="info"> uploaded by <?= $upload->uploader()->htmlUsername() ?> @ <?= $upload->timestamp() ?> </span> <br/><br/> <!-- file block --> <?
function view($supid) { # validate input require_lib("validate"); $v = new validate(); $v->isOk($supid, "num", 1, 50, "Invalid Supplier id."); # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>-" . $e["msg"] . "</li>"; } return $confirm; } # Select db_connect(); $sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'"; $suppRslt = db_exec($sql) or errDie("Unable to access databse.", SELF); if (pg_numrows($suppRslt) < 1) { return "<li> Invalid supplier ID.</li>"; } else { $supp = pg_fetch_array($suppRslt); # get vars foreach ($supp as $key => $value) { ${$key} = $value; } } # Get department db_conn("exten"); $sql = "SELECT * FROM departments WHERE deptid = '{$deptid}' AND div = '" . USER_DIV . "'"; $deptRslt = db_exec($sql); if (pg_numrows($deptRslt) < 1) { $deptname = "<li class='err'>Department not Found.</li>"; } else { $dept = pg_fetch_array($deptRslt); $deptname = $dept['deptname']; } db_conn("cubit"); $sql = "SELECT * FROM supp_groups WHERE id='{$groupid}'"; $grpRslt = db_exec($sql); $group = pg_fetch_array($grpRslt); db_conn('cubit'); $Sl = "SELECT id FROM cons WHERE supp_id='{$supid}'"; $Ry = db_exec($Sl) or errDie("Unable to get contact from db."); $i = 0; $conpers = ""; if (pg_num_rows($Ry) > 0) { $cdata = pg_fetch_array($Ry); $Sl = "SELECT * FROM conpers WHERE con='{$cdata['id']}' ORDER BY name"; $Ry = db_exec($Sl) or errDie("Unable to get contacts from db."); if (pg_num_rows($Ry) > 0) { $conpers = "\r\n\t\t\t\t<h3>Contact Persons</h3>\r\n\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Name</th>\r\n\t\t\t\t\t\t<th>Position</th>\r\n\t\t\t\t\t\t<th>Tel</th>\r\n\t\t\t\t\t\t<th>Cell</th>\r\n\t\t\t\t\t\t<th>Fax</th>\r\n\t\t\t\t\t\t<th>Email</th>\r\n\t\t\t\t\t\t<th>Notes</th>\r\n\t\t\t\t\t\t<th colspan='2'>Options</th>\r\n\t\t\t\t\t</tr>"; while ($cp = pg_fetch_array($Ry)) { $i++; $bgcolor = $i % 2 ? bgcolorg() : bgcolorg(); $conpers .= "\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>{$cp['name']}</td>\r\n\t\t\t\t\t\t<td>{$cp['pos']}</td>\r\n\t\t\t\t\t\t<td>{$cp['tell']}</td>\r\n\t\t\t\t\t\t<td>{$cp['cell']}</td>\r\n\t\t\t\t\t\t<td>{$cp['fax']}</td>\r\n\t\t\t\t\t\t<td>{$cp['email']}</td>\r\n\t\t\t\t\t\t<td>{$cp['notes']}</td>\r\n\t\t\t\t\t\t<td><a href='conper-edit.php?id={$cp['id']}&type=edit'>Edit</a></td>\r\n\t\t\t\t\t\t<td><a href='conper-rem.php?id={$cp['id']}'>Delete</a></td>\r\n\t\t\t\t\t</tr>"; } $conpers .= "</table>"; } } // Retrieve team name $sql = "SELECT name FROM crm.teams WHERE id='{$team_id}'"; $team_rslt = db_exec($sql) or errDie("Unable to retrieve teams."); $team_name = pg_fetch_result($team_rslt, 0); # Layout $confirm = "\r\n\t\t<h3>Supplier Details</h3>\r\n\t\t<table cellpadding=0 cellspacing=0>\r\n\t\t\t<tr valign='top'>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Supplier Details</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Department</td>\r\n\t\t\t\t\t\t\t<td>{$deptname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Supplier No</td>\r\n\t\t\t\t\t\t\t<td>{$supno}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Name</td>\r\n\t\t\t\t\t\t\t<td>{$supname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Group</td>\r\n\t\t\t\t\t\t\t<td>{$group['groupname']}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Branch</td>\r\n\t\t\t\t\t\t\t<td>{$branch}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>VAT Number</td>\r\n\t\t\t\t\t\t\t<td>{$vatnum}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Address</td>\r\n\t\t\t\t\t\t\t<td><pre>{$supaddr}</pre></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Postal Address</td>\r\n\t\t\t\t\t\t\t<td><pre>{$suppostaddr}</pre></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Contact Name</td>\r\n\t\t\t\t\t\t\t<td>{$contname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Tel No.</td>\r\n\t\t\t\t\t\t\t<td>{$tel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Fax No.</td>\r\n\t\t\t\t\t\t\t<td>{$fax}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Cell No.</td>\r\n\t\t\t\t\t\t\t<td>{$cell}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>E-mail</td>\r\n\t\t\t\t\t\t\t<td>{$email}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Web Address</td>\r\n\t\t\t\t\t\t\t<td>http://{$url}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Status BEE</td>\r\n\t\t\t\t\t\t\t<td>{$bee_status}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Team Permissions</td>\r\n\t\t\t\t\t\t\t<td>{$team_name}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Comments</td>\r\n\t\t\t\t\t\t\t<td>{$comments}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<th colspan='2'> Bank Details</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Bank </td>\r\n\t\t\t\t\t\t\t<td>{$bankname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Branch</td>\r\n\t\t\t\t\t\t\t<td>{$branname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Branch Code</td>\r\n\t\t\t\t\t\t\t<td>{$brancode}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Account Number</td>\r\n\t\t\t\t\t\t\t<td>{$bankaccno}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Reference Number</td>\r\n\t\t\t\t\t\t\t<td>{$reference}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Settlement Discount %</td>\r\n\t\t\t\t\t\t\t<td>{$setdisc} %</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr><td><br></td></tr>\r\n\t\t\t\t\t\t<tr><td>"; // Documents // $sdoc_db = new dbSelect("supplier_docs", "crm", m("where", "supid='$supid'")); // $sdoc_db->run(); $docs_out = ""; // while ($sdoc_data = $sdoc_db->fetch_array()) { db_conn('crm'); $get_docs = "SELECT * FROM supplier_docs WHERE supid = '{$supid}'"; $run_docs = db_exec($get_docs) or errDie("Unable to get supplier document information."); while ($sdoc_data = pg_fetch_array($run_docs)) { if (strlen($sdoc_data['filename']) > 0) { $showdoc = "{$sdoc_data['filename']}"; } elseif (strlen($sdoc_data['real_filename']) > 0) { $showdoc = "{$sdoc_data['real_filename']}"; } else { $showdoc = "File" . $sdoc_data["id"]; } $docs_out .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='supp_doc_get.php?id={$sdoc_data['id']}'>{$showdoc}</a></td>\r\n\t\t\t\t\t<td>" . getFileSize($sdoc_data["size"]) . "</td>\r\n\t\t\t\t</tr>"; } $confirm .= "\r\n\t\t\t\t</tr>\r\n\t\t\t</td>\r\n\t\t\t<tr>\r\n\t\t\t\t<td colspan='2'>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th colspan='2'>Documents</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<th>Filename</th>\r\n\t\t\t\t\t\t\t<th>Size</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t{$docs_out}\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; $confirm .= "\r\n\t\t\t\t</table>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2' align='right'>\r\n\t\t\t\t\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t<td><a href='supp-view.php'>View Suppliers</a></td>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t</form>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t{$conpers}"; return $confirm; }
?> <tr style='width: 100%'> <td style='vertical-align: middle; width: 65%;' class='text-left'> <a class="trigger" href="<?php echo "functions/sendFile.php?file=" . $path . urlencode($file); ?> "><?php echo getFileMimeType($path . $file) . " " . $file; ?> </a></td> <td style='vertical-align: middle; width: 20%;' class='text-right'><?php echo date("M d Y H:i", filemtime($path . $file)); ?> </td> <td style='vertical-align: middle; width: 10%;' class='text-right'><?php echo getFileSize($path . $file); ?> </td> </tr> <?php $total_files++; $total_filesize += filesize($path . $file); } } $kb = 1000; $mb = $kb * 1000; $gb = $mb * 1000; $tb = $gb * 1000; $pb = $tb * 1000; if ($total_filesize < $kb) { $total_filesize = $total_filesize . " bytes";
/** * show page with load info * s * @param int $id * @return none */ public function view($id = null) { //turn access $this->ACL->turn(array($this->module, 'view_materials')); $id = intval($id); if (empty($id) || $id < 1) { redirect('/'); } $this->Model->bindModel('attaches'); $this->Model->bindModel('author'); $this->Model->bindModel('category'); $entity = $this->Model->getById($id); if (empty($entity)) { $this->Parser->showHttpError(); } if ($entity->getAvailable() == 0 && !$this->ACL->turn(array('other', 'can_see_hidden'), false)) { return $this->showInfoMessage(__('Permission denied'), '/' . $this->module . '/'); } if (!$this->ACL->checkCategoryAccess($entity->getCategory()->getNo_access())) { return $this->showInfoMessage(__('Permission denied'), '/' . $this->module . '/'); } // Some gemor with add fields if (is_object($this->AddFields)) { $entity = $this->AddFields->mergeRecords(array($entity)); $entity = $entity[0]; } $max_attaches = $this->Register['Config']->read('max_attaches', $this->module); if (empty($max_attaches) || !is_numeric($max_attaches)) { $max_attaches = 5; } //category block $this->_getCatsTree($entity->getCategory()->getId()); /* COMMENT BLOCK */ if (Config::read('comment_active', $this->module) == 1 && $this->ACL->turn(array($this->module, 'view_comments'), false) && $entity->getCommented() == 1) { if ($this->ACL->turn(array($this->module, 'add_comments'), false)) { $this->comments_form = $this->_add_comment_form($id); } $this->comments = $this->_get_comments($entity); } $this->Register['current_vars'] = $entity; $this->addToPageMetaContext('category_title', h($entity->getCategory()->getTitle())); $this->addToPageMetaContext('entity_title', h($entity->getTitle())); $tags = $entity->getTags(); $description = $entity->getDescription(); if (!empty($tags)) { $this->page_meta_keywords = h($tags); } if (!empty($description)) { $this->page_meta_description = h($description); } $navi = array(); $navi['module_url'] = get_url('/' . $this->module . '/'); $navi['category_url'] = get_url('/' . $this->module . '/category/' . $entity->getCategory()->getId()); $navi['category_name'] = h($entity->getCategory()->getTitle()); $navi['navigation'] = $this->_buildBreadCrumbs($entity->getCategory()->getId()); $this->_globalize($navi); $markers = array(); $markers['moder_panel'] = $this->_getAdminBar($entity); if ($entity->getDownload() && is_file(ROOT . '/sys/files/' . $this->module . '/' . $entity->getDownload())) { $attach_serv = '<a target="_blank" href="' . get_url('/' . $this->module . '/download_file/' . $entity->getId()) . '">' . __('Download from server') . ' (' . getFileSize(ROOT . '/sys/files/' . $this->module . '/' . $entity->getDownload()) . ' Кб)</a>'; } else { if ($entity->getDownload() && !is_file(ROOT . '/sys/files/' . $this->module . '/' . $entity->getDownload())) { $attach_serv = '<span style="color:red;" class="atm-lost-file">' . __('File is deleted or damaged') . '</span>'; } else { $attach_serv = ''; } } if ($entity->getDownload_url_size()) { $attach_rem_size = ' (' . getSimpleFileSize($entity->getDownload_url_size()) . ')'; } else { $attach_rem_size = ''; } if ($entity->getDownload_url()) { $attach_rem_url = '<a target="_blank" href="' . get_url('/' . $this->module . '/download_file_url/' . $entity->getId()) . '">' . __('Download remotely') . $attach_rem_size . '</a>'; } else { $attach_rem_url = ''; } $markers['attachment'] = $attach_serv . ' | ' . $attach_rem_url; $announce = $this->Textarier->parseBBCodes($entity->getMain(), $entity); $markers['mainText'] = $announce; $markers['main_text'] = $announce; $entry_url = entryUrl($entity, $this->module); $markers['entry_url'] = $entry_url; $markers['profile_url'] = getProfileUrl($entity->getAuthor_id()); $entity->setAdd_markers($markers); if ($entity->getTags()) { $entity->setTags(explode(',', $entity->getTags())); } $source = $this->render('material.html', array('entity' => $entity)); $entity->setViews($entity->getViews() + 1); $entity->save(); $this->DB->cleanSqlCache(); return $this->_view($source); }
</td> <td bgcolor=#f1f1f1 align=right><?php echo getFileSize($dbData[Data_length] + $dbData[Index_length]); ?> </td> <td><?php echo $dbData[Create_time]; ?> </td> </tr> <?php $num++; } ?> </table> </td> </tr> </form> </table> <script> document.showdb.size.value="<?php echo getFileSize($size); ?> (<?php echo $num - 1; ?> )"; </script>
$file_extension = strtolower(substr(strrchr($filename, '.'), 1)); function getFileSize($url) { if (substr($url, 0, 4) == 'http') { $x = array_change_key_case(get_headers($url, 1), CASE_LOWER); if (strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0) { $x = $x['content-length'][1]; } else { $x = $x['content-length']; } } else { $x = @filesize($url); } return $x; } $fileSize = getFileSize($file_url); function fileExists($path) { return @fopen($path, "r") == true; } if (!fileExists($file_url)) { die("<br> The file <b>" . $file_url . "</b> doesn't exist; check the URL"); } //This will set the Content-Type to the appropriate setting for the file switch ($file_extension) { case 'mp3': $content_type = 'audio/mpeg'; break; case 'mp4a': $content_type = 'audio/mp4'; break;
function confirm($_POST) { # get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($deptid, "num", 1, 255, "Invalid Department."); $v->isOk($supid, "num", 1, 50, "Invalid supplier id."); $v->isOk($supno, "string", 1, 255, "Invalid suppleir number."); $v->isOk($supname, "string", 1, 255, "Invalid supplier name."); $v->isOk($loc, "string", 1, 3, "Invalid Type."); $v->isOk($fcid, "num", 1, 30, "Invalid Currency."); $v->isOk($vatnum, "string", 1, 255, "Invalid supplier vat number."); $v->isOk($registration, "string", 1, 255, "Invalid registration/id number."); $v->isOk($supaddr, "string", 1, 255, "Invalid supplier address."); $v->isOk($suppostaddr, "string", 0, 255, "Invalid supplier postal address."); $v->isOk($contname, "string", 1, 255, "Invalid contact name."); $v->isOk($tel, "string", 1, 20, "Invalid tel no."); $v->isOk($fax, "string", 0, 20, "Invalid fax no."); $v->isOk($cell, "string", 0, 20, "Invalid cell no."); $v->isOk($email, "email", 0, 255, "Invalid e-mail address."); $v->isOk($listid, "num", 1, 20, "Invalid price list."); $v->isOk($url, "url", 0, 255, "Invalid web address."); $v->isOk($bankname, "string", 0, 255, "Invalid bank name."); $v->isOk($branname, "string", 0, 255, "Invalid branch name."); $v->isOk($brancode, "string", 0, 255, "Invalid branch code."); $v->isOk($bankaccname, "string", 0, 255, "Invalid bank account name."); $v->isOk($bankacctype, "string", 0, 255, "Invalid bank account type."); $v->isOk($bankaccno, "num", 0, 255, "Invalid bank account number."); $v->isOk($comments, "string", 0, 255, "Invalid characters in comment."); $v->isOk($branch, "string", 0, 255, "Invalid supplier branch."); $v->isOk($reference, "string", 0, 255, "Invalid reference."); $v->isOk($bee_status, "string", 0, 255, "Invalid BEE Status"); $v->isOk($supp_grp, "num", 1, 9, "Invalid supplier group selected."); $v->isOk($team_id, "num", 1, 9, "Invalid team selection."); $v->isOk($setdisc, "float", 1, 40, "Invalid Settlement Discount Amount."); $v->isOk($setdays, "num", 1, 40, "Invalid Settlement Discount Days"); # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>" . $e["msg"] . "</li>"; } return edit_err($_POST, $confirm); exit; $confirm .= "<p><input type='button' onClick='JavaScript:history.back();' value='« Correct submission'>"; return $confirm; } db_conn('cubit'); $Sl = "SELECT * FROM suppliers WHERE supno='{$supno}' AND supid!='{$supid}'"; $Ri = db_exec($Sl) or errDie("Unable to get data."); if (pg_num_rows($Ri) > 0) { return edit_err($_POST, "<li class='err'>There is already a supplier with that number.</lI>"); } # get department db_conn("exten"); $sql = "SELECT * FROM departments WHERE deptid = '{$deptid}' AND div = '" . USER_DIV . "'"; $deptRslt = db_exec($sql); if (pg_numrows($deptRslt) < 1) { $deptname = "<li class='err'>Department not Found.</li>"; } else { $dept = pg_fetch_array($deptRslt); $deptname = $dept['deptname']; } # Get Price List $sql = "SELECT * FROM spricelist WHERE listid = '{$listid}' AND div = '" . USER_DIV . "'"; $listRslt = db_exec($sql); if (pg_numrows($listRslt) < 1) { $plist = "<li class='err'>Class not Found.</li>"; } else { $list = pg_fetch_array($listRslt); $plist = $list['listname']; } # Locations drop down $locs = array("loc" => "Local", "int" => "International"); $curr = getSymbol($fcid); $get_suppgrp = "SELECT groupname FROM supp_groups WHERE id = '{$supp_grp}' LIMIT 1"; $run_suppgrp = db_exec($get_suppgrp) or errDie("Unable to get supplier group information"); if (pg_numrows($run_suppgrp) < 1) { $showsupp_grp = "Unknown Supplier Group"; } else { $garr = pg_fetch_array($run_suppgrp); $showsupp_grp = $garr['groupname']; } $hidden = "\r\n\t\t<input type='hidden' name='deptid' value='{$deptid}'>\r\n\t\t<input type='hidden' name='supid' value='{$supid}'>\r\n\t\t<input type='hidden' name='supno' value='{$supno}'>\r\n\t\t<input type='hidden' name='supname' value='{$supname}'>\r\n\t\t<input type='hidden' name='loc' value='{$loc}'>\r\n\t\t<input type='hidden' name='location' value='{$loc}'>\r\n\t\t<input type='hidden' name='fcid' value='{$fcid}'>\r\n\t\t<input type='hidden' name='vatnum' value='{$vatnum}'>\r\n\t\t<input type='hidden' name='registration' value='{$registration}'>\r\n\t\t<input type='hidden' name='supaddr' value='{$supaddr}'>\r\n\t\t<input type='hidden' name='suppostaddr' value='{$suppostaddr}'>\r\n\t\t<input type='hidden' name='contname' value='{$contname}'>\r\n\t\t<input type='hidden' name='tel' value='{$tel}'>\r\n\t\t<input type='hidden' name='fax' value='{$fax}'>\r\n\t\t<input type='hidden' name='cell' value='{$cell}'>\r\n\t\t<input type='hidden' name='email' value='{$email}'>\r\n\t\t<input type='hidden' name='url' value='{$url}'>\r\n\t\t<input type='hidden' name='listid' value='{$listid}'>\r\n\t\t<input type='hidden' name='bankname' value='{$bankname}'>\r\n\t\t<input type='hidden' name='branname' value='{$branname}'>\r\n\t\t<input type='hidden' name='brancode' value='{$brancode}'>\r\n\t\t<input type='hidden' name='bankaccname' value='{$bankaccname}'>\r\n\t\t<input type='hidden' name='bankacctype' value='{$bankacctype}'>\r\n\t\t<input type='hidden' name='bankaccno' value='{$bankaccno}'>\r\n\t\t<input type='hidden' name='comments' value='{$comments}'>\r\n\t\t<input type='hidden' name='branch' value='{$branch}'>\r\n\t\t<input type='hidden' name='reference' value='{$reference}'>\r\n\t\t<input type='hidden' name='bee_status' value='{$bee_status}'>\r\n\t\t<input type='hidden' name='supp_grp' value='{$supp_grp}'>\r\n\t\t<input type='hidden' name='team_id' value='{$team_id}' />\r\n\t\t<input type='hidden' name='setdisc' value='{$setdisc}' />\r\n\t\t<input type='hidden' name='setdays' value='{$setdays}' />"; // Retrieve teams $sql = "SELECT * FROM crm.teams WHERE id = '{$team_id}' LIMIT 1"; $team_rslt = db_exec($sql) or errDie("Unable to retrieve teams."); $team_data = pg_fetch_array($team_rslt); $team_sel = "{$team_data['name']}"; if (!isset($team_sel)) { $team_sel = ""; } $confirm = "\r\n\t\t<h3>Confirm Supplier</h3>\r\n\t\t<form action='" . SELF . "' method='POST'>\r\n\t\t\t{$hidden}\r\n\t\t\t<input type='hidden' name='key' value='write'>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t<table cellpadding='0' cellspacing='0'>\r\n\t\t\t<tr valign='top'>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th colspan='2'>Supplier Details</th>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Department</td>\r\n\t\t\t\t\t\t\t<td>{$deptname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Supplier No</td>\r\n\t\t\t\t\t\t\t<td>{$supno}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Supplier/Name </td>\r\n\t\t\t\t\t\t\t<td>{$supname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Registration/ID </td>\r\n\t\t\t\t\t\t\t<td>{$registration}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Branch</td>\r\n\t\t\t\t\t\t\t<td>{$branch}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Type</td>\r\n\t\t\t\t\t\t\t<td>{$locs[$loc]}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Currency</td>\r\n\t\t\t\t\t\t\t<td>{$curr['symbol']} - {$curr['name']}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>VAT Number</td>\r\n\t\t\t\t\t\t\t<td>{$vatnum}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Address</td>\r\n\t\t\t\t\t\t\t<td><pre>{$supaddr}</pre></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Postal Address</td>\r\n\t\t\t\t\t\t\t<td><pre>{$suppostaddr}</pre></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Contact Name</td>\r\n\t\t\t\t\t\t\t<td>{$contname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Tel No.</td>\r\n\t\t\t\t\t\t\t<td>{$tel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Fax No.</td>\r\n\t\t\t\t\t\t\t<td>{$fax}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Cell No.</td>\r\n\t\t\t\t\t\t\t<td>{$cell}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>E-mail</td>\r\n\t\t\t\t\t\t\t<td>{$email}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Web Address</td>\r\n\t\t\t\t\t\t\t<td>http://{$url}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Price List</td>\r\n\t\t\t\t\t\t\t<td>{$plist}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Supplier Group</td>\r\n\t\t\t\t\t\t\t<td>{$showsupp_grp}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Status BEE</td>\r\n\t\t\t\t\t\t\t<td>{$bee_status}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Team Permissions</td>\r\n\t\t\t\t\t\t\t<td>{$team_sel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Comments</td>\r\n\t\t\t\t\t\t\t<td>" . nl2br($comments) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td><input type='submit' name='back' value='« Correction'></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<th colspan='2'> Bank Details</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Bank </td>\r\n\t\t\t\t\t\t<td>{$bankname}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Branch</td>\r\n\t\t\t\t\t\t<td>{$branname}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Branch Code</td>\r\n\t\t\t\t\t\t<td>{$brancode}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Account Name</td>\r\n\t\t\t\t\t\t<td>{$bankaccname}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Account Type</td>\r\n\t\t\t\t\t\t<td>{$bankacctype}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Account Number</td>\r\n\t\t\t\t\t\t<td>{$bankaccno}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Reference</td>\r\n\t\t\t\t\t\t<td>{$reference}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Settlement Discount %</td>\r\n\t\t\t\t\t\t<td>{$setdisc} %</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Statement Day</td>\r\n\t\t\t\t\t\t<td>{$setdays}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t" . TBL_BR . "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Write »'></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t" . TBL_BR . "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2'>"; // Retrieve documents added already $sql = "\r\n\t\tSELECT id,file,type,filename,size,real_filename,'supplier_docs' AS table \r\n\t\t\tFROM crm.supplier_docs\r\n\t\t\tWHERE supid='{$supid}' \r\n\t\tUNION \r\n\t\tSELECT id,file,type,filename,size,real_filename,'stmp_docs' AS table \r\n\t\t\tFROM crm.stmp_docs \r\n\t\t\tWHERE session='{$_REQUEST['CUBIT_SESSION']}' ORDER BY id DESC"; $sdoc_rslt = db_exec($sql) or errDie("Unable to retrieve docs."); $sdoc_out = ""; while ($sdoc_data = pg_fetch_array($sdoc_rslt)) { if (strlen($sdoc_data['filename']) > 0) { $showdoc = "{$sdoc_data['filename']}"; } elseif (strlen($sdoc_data['real_filename']) > 0) { $showdoc = "{$sdoc_data['real_filename']}"; } else { $showdoc = "File" . $sdoc_data["id"]; } if ($sdoc_data['table'] == "supplier_docs") { $sdoc_out .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='supp_doc_get.php?id={$sdoc_data['id']}&tmp=1'>{$showdoc}</a></td>\r\n\t\t\t\t\t<td>" . getFileSize($sdoc_data["size"]) . "</td>\r\n\t\t\t\t\t<td><input type='checkbox' name='oldrem[{$sdoc_data['id']}]' value='{$sdoc_data['id']}' /></td>\r\n\t\t\t\t</tr>"; } else { $sdoc_out .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='supp_doc_get.php?id={$sdoc_data['id']}&tmp=1'>{$showdoc}</a></td>\r\n\t\t\t\t\t<td>" . getFileSize($sdoc_data["size"]) . "</td>\r\n\t\t\t\t\t<td><input type='checkbox' name='rem[{$sdoc_data['id']}]' value='{$sdoc_data['id']}' /></td>\r\n\t\t\t\t</tr>"; } } if (empty($sdoc_out)) { $sdoc_out .= "<tr class='" . bg_class() . "'><td colspan='3'><li>No documents added</li></td></tr>"; } $confirm .= "\r\n\t\t\t\t\t\t\t\t</form>\r\n\t\t\t\t\t\t\t\t<form method='POST' action='" . SELF . "' enctype='multipart/form-data'>\r\n\t\t\t\t\t\t\t\t\t<input type='hidden' name='key' value='doc_save' />\r\n\t\t\t\t\t\t\t\t\t{$hidden}\r\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th colspan='4'>Documents</th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>Filename</th>\r\n\t\t\t\t\t\t\t\t\t\t<th>Upload</th>\r\n\t\t\t\t\t\t\t\t\t\t<th> </th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type='text' name='doc_filename'></td>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type='file' name='doc_file'></td>\r\n\t\t\t\t\t\t\t\t\t\t<td colspan='2' align='center'>\r\n\t\t\t\t\t\t\t\t\t\t\t<input type='submit' value='Update'>\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>Filename</th>\r\n\t\t\t\t\t\t\t\t\t\t<th>Size</th>\r\n\t\t\t\t\t\t\t\t\t\t<th>Remove</th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t{$sdoc_out}\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td colspan='2' align='right'>\r\n\t\t\t\t\t\t\t\t<table border='0' cellpadding='2' cellspacing='1'>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t<td><a href='supp-view.php'>View Suppliers</a></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>"; return $confirm; }
function getFsize($file) { return getFileSize($file); }
/** * ファイルサイズを取得 * * @param $path * @return int */ function getFileSize($path) { $total_size = 0; //指定したのがファイルだった場合はサイズを返して終了。 if (is_file($path)) { return filesize($path); } elseif (is_dir($path)) { $basename = basename($path); //カレントディレクトリと上位ディレクトリを指している場合はここで終了。 if ($basename == '.' || $basename == '..') { return 0; } //ディレクトリ内のファイル一覧を入手。 $file_list = scandir($path); foreach ($file_list as $file) { //ディレクトリ内の各ファイルを引数にして、自分自身を呼び出す。 $total_size += getFileSize($path . '/' . $file); } return $total_size; } return 0; }
function main() { global $indexStyle; $dir = $_SERVER['PATH_ROOT'] . $_SERVER['PATH_INFO']; $files = array_diff(scandir($dir), array('.', '..')); $files = filesGroupDir($dir, $files); $html = ""; $html .= "<!DOCTYPE html>\n"; $html .= "<html>\n"; $html .= "<head>\n"; $html .= "<meta charset=\"UTF-8\">\n"; $html .= "<style>" . $indexStyle . "</style>\n"; $html .= "</head>\n"; $html .= "<body>\n"; $html .= "<h2>Index of " . $_SERVER['PATH_INFO'] . "</h2>\n"; $html .= "<table>\n"; $html .= "<tr>\n"; $html .= "<th>Name</th>\n"; $html .= "<th>Size</th>\n"; $html .= "<th>Time</th>\n"; $html .= "</tr>\n"; $html .= "<tr>\n"; $html .= '<td><a href="..">..</a></td>' . "\n"; $html .= "<td></td>\n"; $html .= "<td></td>\n"; $html .= "</tr>\n"; foreach ($files as $k => $v) { $name = $v; if (strlen($name) > 30) { $name = substr($name, 0, 27) . '...'; } $path = getRealPath($dir . $v); $datemodified = date('Y\\-m\\-d H:i', getFileMTime($path)); $size = sizeFilter(getFileSize($path)); $hrefSuffix = ''; if (filetype($path) == 'dir') { $hrefSuffix = '/'; $size = "-"; } $html .= "<tr>\n"; $html .= '<td><a href="' . $v . $hrefSuffix . '">' . $name . $hrefSuffix . '</a></td>' . "\n"; $html .= "<td>" . $size . "</td>\n"; $html .= "<td>" . $datemodified . "</td>\n"; $html .= "</tr>\n"; } $html .= "</table>\n"; $html .= "</body>\n"; $html .= "</html>\n"; echo $html; }
function crearClaseDeArchivo($idUsuario, $idCurso, $idTema, $fileName, $fileType) { require_once 'modulos/usuarios/modelos/usuarioModelo.php'; require_once 'modulos/cursos/modelos/CursoModelo.php'; require_once 'modulos/cursos/modelos/TemaModelo.php'; //Carpeta donde se va a guardar el archivo temporal $filePath = getServerRoot() . "/archivos/temporal/uploaderFiles/"; $res = array(); //Validamos que el curso sea del usuario y que el tema sea del curso if (getIdUsuarioDeCurso($idCurso) == $idUsuario && $idCurso == getIdCursoPerteneciente($idTema)) { //Guardamos el nombre original del archivo para establecerlo como titulo $pathInfo = pathinfo($filePath . $fileName); $titulo = $pathInfo['filename']; $newName = getUniqueCode(64) . "." . $pathInfo['extension']; require_once 'funcionesPHP/funcionesParaArchivos.php'; //Le cambiamos el nombre del archivo a uno generico if (rename($filePath . $fileName, $filePath . $newName)) { $file = $filePath . $newName; $pathInfo = pathinfo($file); $clase = new Clase(); $clase->idTema = $idTema; $clase->titulo = $titulo; $clase->idTipoClase = getTipoClase($fileType); //Establecemos el ancho de banda utilizado por la subida de este archivo $size = getFileSize($file); require_once 'modulos/principal/modelos/variablesDeProductoModelo.php'; deltaVariableDeProducto("usoActualAnchoDeBanda", $size); require_once 'modulos/aws/modelos/s3Modelo.php'; if ($clase->idTipoClase == 0 || $clase->idTipoClase == 4) { //Creamos la clase en la bd //Si es video o audio creamos la clase con la bandera que todavía no se transforma $clase->transformado = 0; $clase->usoDeDisco = 0; $clase->duracion = "00:00"; $clase->orden = getUltimoOrdenEnTema($idTema) + 1; $idClase = altaClase($clase); if ($idClase >= 0) { //Subimos el archivo al servicio S3 de amazon $s3res = uploadFileToS3($file); if ($s3res['res']) { //El archivo se subio al cdn //Generamos los datos del mensaje $datosDelMensaje = array("bucket" => $s3res['bucket'], "key" => $s3res['key'], "tipo" => $clase->idTipoClase, "host" => getDomainName(), "idClase" => $idClase); $datosJson = json_encode($datosDelMensaje); require_once 'modulos/aws/modelos/sqsModelo.php'; if (AddMessageToQueue($datosJson)) { //Se mando correctamente el mensaje //Se dió de alta correctamente $res['resultado'] = true; $res['url'] = "#"; } else { //Ocurrio un eror al agregar el mensaje $res['resultado'] = false; $res['mensaje'] = "Ocurrió un error al guardar tu archivo en nuestros servidores. Intenta de nuevo más tarde"; } } else { //Erro al subir el archivo al s3 de amazon $res['resultado'] = false; $res['mensaje'] = "Ocurrió un error al guardar tu archivo en nuestros servidores. Intenta de nuevo más tarde"; } } else { //Ocurrió un error al agregar a la bd $res['resultado'] = false; $res['mensaje'] = "Ocurrió un error al guardar tu archivo en nuestros servidores. Intenta de nuevo más tarde"; } } else { $clase->transformado = 1; //Subimos el archivo al servicio S3 de amazon $s3res = uploadFileToS3($file); if ($s3res['res']) { //Si se subio, guardamos la clase en la bd $clase->archivo = $s3res['link']; $clase->usoDeDisco = $size; $clase->orden = getUltimoOrdenEnTema($idTema) + 1; $idClase = altaClase($clase); if ($idClase >= 0) { //Se dió de alta correctamente $res['resultado'] = true; $res['url'] = "#"; } else { //Ocurrió un error al agregar a la bd $res['resultado'] = false; $res['mensaje'] = "Ocurrió un error al guardar tu archivo en nuestros servidores. Intenta de nuevo más tarde"; } } else { //Si ocurrió un error al subir al s3 $res['resultado'] = false; $res['mensaje'] = "Ocurrió un error al guardar tu archivo en nuestros servidores. Intenta de nuevo más tarde"; } } //Sin importar que paso, borramos el archivo temporal unlink($file); } else { //Si ocurrió un error, se borra y regresamos false unlink($filePath . $fileName); $res['resultado'] = false; $res['mensaje'] = "El nombre del archivo no es válido"; } } else { //Hay errores en la integridad usuario <-> curso //borramos el archivo unlink($filePath . $fileName); $res['resultado'] = false; $res['mensaje'] = "No tienes permisos para modificar este curso"; } return $res; }
if (preg_match('/Content-Length:(.*)/si', $tmp, $arr)) { return trim($arr[1]); } } } return null; } else { return null; } } $Gid = DownloadMe_rEdit($expGid[0], false); $Data = $DownData['File'][$Gid]; $Aid = $Data['aid']; $Lid = $Data['blogid']; $Return = array('error' => "远程获取失败!"); $addSize = getFileSize($Data['filepath']); if ($addSize) { $editIF = $DB->query("UPDATE " . DB_PREFIX . "attachment SET filesize='{$addSize}' WHERE aid={$Aid} AND blogid={$Lid}"); $Return = array('error' => "数据更新失败"); if ($editIF) { DownloadMe_Up(); $Return = array('succ' => "数据修改成功", 'data' => changeFileSize($addSize)); } } } } $DMsg = json_encode(array_unique($Return)); echo $downJsonRet . '(' . $DMsg, ')'; exit; } if (isset($_GET['plugin']) && addslashes($_GET['plugin']) == "download") {
function bucketSize($url) { $file = repl(URLSITE, '', $url); $file = realpath(APPLICATION_PATH . '/../public/' . $file); return File::exists($file) ? getFileSize(fgc($file)) : '0 kb'; }
if (is_dir($root . $folder . '/' . $item)) { $dir = new DirectoryItem(); $dir->directory = $item; if (streq('..', $item)) { $dir->path = dirname($folder); if (streq($dir->path, "\\")) { $dir->path = ""; } } else { $dir->path = $folder . '/' . $item; } if (!($inroot && streq('..', $item))) { $dirlist[] = $dir; } } else { $file = new FileItem(); $file->name = $item; $file->image = findimage($item); //Strip leading slash $path = $folder . '/' . $item; if (strlen($path) > 0) { $path = substr($path, 1, strlen($path) - 1); } $file->path = $path; $file->size = decodeSize(getFileSize($root . $folder . '/' . $item)); $filelist[] = $file; } } } $master->Smarty->assign('filelist', $filelist); $master->Smarty->assign('folderlist', $dirlist);
$month = date( "m", $time ); $day = date( "d", $time ); $filename = $row['filename']; $extension = substr( $filename, strrpos( $filename, '.' ) ); ?> <item id="<?= $row['id'] ?>"> <title><![CDATA[<?= $nsfw . $filename ?> (uploaded by <? echo $row['username']?>)]]></title> <date><? echo date( "r", strtotime( $row['timestamp'] ) ) ?></date> <imgUrl><?= "http://tmbo.org/offensive/uploads/$year/$month/$day/image/" . rawurlencode( $row['filename'] ) ?></imgUrl> <thumbUrl><?= "http://tmbo.org/offensive/uploads/$year/$month/$day/image/thumbs/th" . $row['id'] . $extension ?></thumbUrl> <username><![CDATA[<?= $row['username'] ?>]]></username> <userId><![CDATA[<?= $row['userid'] ?>]]></userId> <fileSize><![CDATA[<?= getFileSize( "../uploads/$year/$month/$day/image/" . $row['filename'] ) ?>]]></fileSize> <comments><?= $row['comments']?></comments> <good><?= $row['good']?></good> <bad><?= $row['bad']?></bad> <tmbo><?= $row['tmbo']?></tmbo> <repost><?= $row['repost']?></repost> </item> <? } ?> </itemList>
foreach ($shotlist['shots'] as $file => $caption) { $thumb = "thumb.{$file}"; $thumb_img = "screenshots/{$thumb}"; $thumbnail = "images/{$thumb_img}"; $file_img = "screenshots/{$file}"; $filename = "images/{$file_img}"; if (!file_exists($filename) || !file_exists($thumbnail)) { next; } if ($endrow) { print "</tr><tr>\n"; $endrow = false; } // We need the GD extension installed for this to work $thumb_size = getimagesize($thumbnail); $file_size = getFileSize($filename); $img = img($thumb_img, $thumb, $thumb_size[0], $thumb_size[1]); print "<td><a href=\"ss.php?ss_date={$date}&ss_file={$file}\">\n"; print "{$img}<br />\n"; print "{$file} ({$file_size})</a><br />\n"; print "{$caption}</td>\n\n"; $rowcount++; if ($rowcount == 3) { $rowcount = 0; $endrow = true; } } print "</tr></table><br />\n"; } } else { // View a single screenshot
function setDirectoryListXML($currentDirectory, $navigationList, $directoryList, $fileList, $message) { global $cfg; $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n"; $xml .= "<directoryList " . genAttributeList($navigationList) . " previous=\"" . getPreviousDir($navigationList["relative"]) . "\">\n"; $xml .= $message; foreach ($directoryList as $name) { $fullName = $currentDirectory . "/" . $name; $changedDate = getChangedDate($fullName); $fSize = getFileSize($fullName); $xml .= "<directory name=\"" . htmlspecialchars($name) . "\" type=\"dir\" size=\"" . $fSize . "\" changedDate=\"" . $changedDate . "\"/>\n"; } foreach ($fileList as $name) { $fullName = $currentDirectory . "/" . $name; $pathSplited = pathinfo($fullName); $changedDate = getChangedDate($fullName); $fSize = getFileSize($fullName); $xml .= "<file name=\"" . htmlspecialchars($name) . "\" type=\"" . $pathSplited["extension"] . "\" size=\"" . $fSize . "\" changedDate=\"" . $changedDate . "\"/>\n"; } $xml .= "<cgi><lang>" . $cfg["lang"] . "</lang></cgi>"; $xml .= "</directoryList>\n"; return $xml; }
if (isset($_GET['path']) and isset($_GET['user']) and isset($_GET['status'])) { // --> begin authentication $havePermission = false; if (isset($_GET['apikey'])) { $auth = (string) $_GET['apikey']; $havePermission = $auth == $apikey; } else { $havePermission = $_SESSION["email"] == $_GET['user']; } // --> end authentication if (!$havePermission) { echo json_encode(array("result" => "permissionDenied")); } else { $path = (string) $_GET['path']; $user = (string) $_GET['user']; $status = (string) $_GET['status']; $oldStatus = getFileStatus($path, $user); setFileStatus($path, $user, $status); if ($oldStatus == "active" and $status == "deleted") { $fileSize = getFileSize($path, $user); addUserSpaceUsage($user, -$fileSize); } if ($oldStatus == "deleted" and $status == "active") { $fileSize = getFileSize($path, $user); addUserSpaceUsage($user, $fileSize); } echo json_encode(array("result" => "ok")); } } else { echo json_encode(array("result" => "missingParams")); }
function print_gallery_movies($movies) { global $baseURL, $dir; if (count($movies) > 0) { echo "<!-- Begin Movies-->\n"; ?> <script type="text/javascript"> function movie_player(movie,width,height) { var movie=window.open(movie,'','scrollbars=no,menubar=no,height='+height+',width='+width+',resizable=no,toolbar=no,location=no,status=no'); return false; } </script> <?php echo "<div id='movies'>\n"; echo "\t<h3>Movies</h3>\n"; echo "\t<ul>\n"; foreach ($movies as $movie) { if (hasExt($movie, array("mpg", "avi"))) { echo "\t\t<li><a target='_new' href=\"" . rrawurlencode($baseURL . $dir . $movie) . "\">"; echo "{$movie}</a> (" . getFileSize($scriptBase . $dir . $movie) . ")"; echo "</li>\n"; } if (hasExt($movie, "mov")) { echo "\t<li>\n"; echo "\t\t"; print_movie($movie, "qt_player"); echo "</li>\n"; } if (hasExt($movie, array("flv", "f4v", "mp4", "mp3"))) { echo "\t<li>\n"; echo "\t\t"; print_movie($movie, "swf_player"); echo "</li>\n"; } } echo "\t</ul>\n"; echo "</div>\n"; echo "<!-- End Movies-->\n\n"; } }
function confirm() { extract($_POST); if ($err = validate($_POST)) { return enter($err); } if (isset($addr_same)) { $addr1 = $paddr1; } if (!isset($cusnum) && $key != "doc_save") { $qry = new dbSelect("customers", "cubit", grp(m("where", "accno='{$accno}' AND div='" . USER_DIV . "'"))); $qry->run(); if ($qry->num_rows() > 0) { return enter("<li class='err'>A Customer/Client with this account number already exists.</li>"); } } $data = qryCategory($category); $catname = $data["category"]; $data = qryClass($class); $classname = $data["classname"]; $data = qryPricelist($pricelist); $plist = $data["listname"]; $data = qryDepartment($deptid); $deptname = $data["deptname"]; if ($sales_rep == "0") { $salesperson = "None"; } else { $data = qrySalesPerson($sales_rep); $salesperson = $data["salesp"]; } /* customer is local/international */ $locs = grp(m("loc", "Local"), m("int", "International")); $curr = getSymbol($fcid); if (isset($crm)) { $ex = "<input type='hidden' name='crm' value='' />"; } else { $ex = ""; } if (isset($cusnum)) { $cusid = "<input type='hidden' name='cusnum' value='{$cusnum}' />"; } else { $cusid = ""; } $odate = mkdate($o_year, $o_month, $o_day); // Retrieve teams $sql = "SELECT * FROM crm.teams WHERE id='{$team_id}'"; $team_rslt = db_exec($sql) or errDie("Unable to retrieve team."); $team_data = pg_fetch_array($team_rslt); $hidden = onthespot_passon() . "\n\t\t\t<input type='hidden' name='deptid' value='{$deptid}' />\n\t\t\t<input type='hidden' name='accno' value='{$accno}' />\n\t\t\t<input type='hidden' name='surname' value='{$surname}' />\n\t\t\t<input type='hidden' name='title' value='{$title}' />\n\t\t\t<input type='hidden' name='init' value='{$init}' />\n\t\t\t<input type='hidden' name='location' value='{$location}' />\n\t\t\t<input type='hidden' name='fcid' value='{$fcid}' />\n\t\t\t<input type='hidden' name='category' value='{$category}' />\n\t\t\t<input type='hidden' name='class' value='{$class}' />\n\t\t\t<input type='hidden' name='addr1' value='{$addr1}' />\n\t\t\t<input type='hidden' name='paddr1' value='{$paddr1}' />\n\t\t\t<input type='hidden' name='del_addr1' value='{$del_addr1}' />\n\t\t\t<input type='hidden' name='vatnum' value='{$vatnum}' />\n\t\t\t<input type='hidden' name='contname' value='{$contname}' />\n\t\t\t<input type='hidden' name='bustel' value='{$bustel}' />\n\t\t\t<input type='hidden' name='tel' value='{$tel}' />\n\t\t\t<input type='hidden' name='cellno' value='{$cellno}' />\n\t\t\t<input type='hidden' name='fax' value='{$fax}' />\n\t\t\t<input type='hidden' name='email' value='{$email}' />\n\t\t\t<input type='hidden' name='url' value='{$url}' />\n\t\t\t<input type='hidden' name='traddisc' value='{$traddisc}' />\n\t\t\t<input type='hidden' name='setdisc' value='{$setdisc}' />\n\t\t\t<input type='hidden' name='pricelist' value='{$pricelist}' />\n\t\t\t<input type='hidden' name='chrgint' value='{$chrgint}' />\n\t\t\t<input type='hidden' name='overdue' value='{$overdue}' />\n\t\t\t<input type='hidden' name='intrate' value='{$intrate}' />\n\t\t\t<input type='hidden' name='credterm' value='{$credterm}' />\n\t\t\t<input type='hidden' name='odate' value='{$odate}' />\n\t\t\t<input type='hidden' name='credlimit' value='{$credlimit}' />\n\t\t\t<input type='hidden' name='deptname' value='{$deptname}' />\n\t\t\t<input type='hidden' name='o_day' value='{$o_day}' />\n\t\t\t<input type='hidden' name='o_month' value='{$o_month}' />\n\t\t\t<input type='hidden' name='o_year' value='{$o_year}' />\n\t\t\t<input type='hidden' name='lead_source' value='{$lead_source}' />\n\t\t\t<input type='hidden' name='comments' value='{$comments}' />\n\t\t\t<input type='hidden' name='sales_rep' value='{$sales_rep}' />\n\t\t\t<input type='hidden' name='re' value='{$re}' />\n\t\t\t<input type='hidden' name='bankname' value='{$bankname}' />\n\t\t\t<input type='hidden' name='branname' value='{$branname}' />\n\t\t\t<input type='hidden' name='brancode' value='{$brancode}' />\n\t\t\t<input type='hidden' name='bankaccname' value='{$bankaccname}' />\n\t\t\t<input type='hidden' name='bankaccno' value='{$bankaccno}' />\n\t\t\t<input type='hidden' name='bankacctype' value='{$bankacctype}' />\n\t\t\t<input type='hidden' name='team_id' value='{$team_id}' />\n\t\t\t<input type='hidden' name='registration' value='{$registration}' />"; $OUT = "\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t<input type='hidden' name='key' value='write' />\n\t\t\t{$hidden}\n\t\t\t{$ex}\n\t\t\t{$cusid}\n\t\t<table cellpadding='0' cellspacing='0'>\n\t\t<tr>\n\t\t\t<th colspan='2'>Confirm Customer : Customer Details</th>\n\t\t</tr>\n\t\t<tr valign='top'>\n\t\t\t<td>\n\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Department</td>\n\t\t\t\t\t\t<td>{$deptname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Acc No</td>\n\t\t\t\t\t\t<td>{$accno}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Company/Name</td>\n\t\t\t\t\t\t<td>{$surname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Registration/ID</td>\n\t\t\t\t\t\t<td>{$registration}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Title</td>\n\t\t\t\t\t\t<td>{$title}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Initials</td>\n\t\t\t\t\t\t<td>{$init}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Type</td>\n\t\t\t\t\t\t<td>{$locs[$location]}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Currency</td>\n\t\t\t\t\t\t<td>{$curr['symbol']} - {$curr['name']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Category</td>\n\t\t\t\t\t\t<td>{$catname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Classification</td>\n\t\t\t\t\t\t<td>{$classname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Link to Sales rep</td>\n\t\t\t\t\t\t<td>{$salesperson}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td valign='top'>Postal Address</td>\n\t\t\t\t\t\t<td valign='center'>" . nl2br($paddr1) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td valign='top'>Physical Address</td>\n\t\t\t\t\t\t<td valign='center'>" . nl2br($addr1) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td valign='top'>Delivery Address</td>\n\t\t\t\t\t\t<td valign='center'>" . nl2br($del_addr1) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>VAT Number</td>\n\t\t\t\t\t\t<td>{$vatnum}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Contact Name</td>\n\t\t\t\t\t\t<td>{$contname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Business Tel.</td>\n\t\t\t\t\t\t<td>{$bustel}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Team Permissions</td>\n\t\t\t\t\t\t<td>{$team_data['name']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='submit' name='back' value='« Correction' /></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Home Tel.</td>\n\t\t\t\t\t\t<td>{$tel}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Cell No.</td>\n\t\t\t\t\t\t<td>{$cellno}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Fax No.</td>\n\t\t\t\t\t\t<td>{$fax}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>E-mail</td>\n\t\t\t\t\t\t<td>{$email}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Web Address</td>\n\t\t\t\t\t\t<td>http://{$url}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Trade Discount</td>\n\t\t\t\t\t\t<td>{$traddisc}%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Settlement Discount</td>\n\t\t\t\t\t\t<td>{$setdisc}%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Price List</td>\n\t\t\t\t\t\t<td>{$plist}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Charge Interest</td>\n\t\t\t\t\t\t<td>{$chrgint}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Interest Rate</td>\n\t\t\t\t\t\t<td>{$intrate}%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Overdue</td>\n\t\t\t\t\t\t<td>{$overdue}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Account Open Date</td>\n\t\t\t\t\t\t<td>{$odate}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Credit Term</td>\n\t\t\t\t\t\t<td>{$credterm}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Credit Limit</td>\n\t\t\t\t\t\t<td>{$credlimit}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Lead Source</td>\n\t\t\t\t\t\t<td>" . crm_get_leadsrc($lead_source) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<th colspan='2'> Bank Details</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Bank </td>\n\t\t\t\t\t\t<td>{$bankname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Branch</td>\n\t\t\t\t\t\t<td>{$branname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Branch Code</td>\n\t\t\t\t\t\t<td>{$brancode}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Account Name</td>\n\t\t\t\t\t\t<td>{$bankaccname}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Account Number</td>\n\t\t\t\t\t\t<td>{$bankaccno}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Account Type</td>\n\t\t\t\t\t\t<td>{$bankacctype}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Comments</td>\n\t\t\t\t\t\t<td>" . nl2br($comments) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td align='right'><input type='submit' value='Write »' /></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</form>"; // Retrieve documents added already if (isset($cusnum) && !empty($cusnum)) { $sql = "SELECT id,file,type,filename,size,'customer_docs' AS table FROM crm.customer_docs\n\t\t\t\t\t\tWHERE cusnum='{$cusnum}' UNION SELECT id,file,type,filename,size,'ctmp_docs' AS table FROM crm.ctmp_docs\n\t\t\t\t\t\tWHERE session='{$_REQUEST['CUBIT_SESSION']}'"; } else { $sql = "SELECT * FROM crm.ctmp_docs\n\t\t\t\t\t\tWHERE session='{$_REQUEST['CUBIT_SESSION']}' ORDER BY id DESC"; } $cdoc_rslt = db_exec($sql) or errDie("Unable to retrieve docs."); $cdoc_out = ""; while ($cdoc_data = pg_fetch_array($cdoc_rslt)) { $cdoc_out .= "<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<a href='cust_doc_get.php?id={$cdoc_data['id']}&tmp=1&table={$cdoc_data['table']}'>\n\t\t\t\t\t\t\t\t\t{$cdoc_data['filename']}\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>" . getFileSize($cdoc_data["size"]) . "</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type='checkbox' name='rem[{$cdoc_data['id']}]'\n\t\t\t\t\t\t\t\tvalue='{$cdoc_data['id']}' />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>"; } if (empty($cdoc_out)) { $cdoc_out .= "<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td colspan='3'><li>No documents added</li></td>\n\t\t\t\t\t\t</tr>"; } $OUT .= "\n\t\t\t\t\t<form method='post' action='" . SELF . "' enctype='multipart/form-data'>\n\t\t\t\t\t<input type='hidden' name='key' value='doc_save' />\n\t\t\t\t\t{$hidden}\n\t\t\t\t\t{$cusid}\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th colspan='3'>Documents</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Filename</th>\n\t\t\t\t\t\t\t<th>Upload</th>\n\t\t\t\t\t\t\t<th> </th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><input type='text' name='doc_filename'></td>\n\t\t\t\t\t\t\t<td><input type='file' name='doc_file'></td>\n\t\t\t\t\t\t\t<td colspan='2' align='center'>\n\t\t\t\t\t\t\t\t<input type='submit' value='Update'>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Filename</th>\n\t\t\t\t\t\t\t<th>Size</th>\n\t\t\t\t\t\t\t<th>Remove</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t{$cdoc_out}\n\t\t\t\t\t</table>\n\t\t\t\t\t</td></tr>\n\t\t\t</td></tr>\n\t\t</table>"; mkQuickLinks(ql("customers-view.php", "View Customers")); return $OUT; }
function view($cusnum) { # validate input require_lib("validate"); $v = new validate(); $v->isOk($cusnum, "num", 1, 50, "Invalid customer id."); # display errors, if any if ($v->isError()) { $confirm = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirm .= "<li class='err'>{$e['msg']}</li>"; } return $confirm; } # Select db_connect(); $sql = "SELECT * FROM customers WHERE cusnum = '{$cusnum}' AND div = '" . USER_DIV . "'"; $custRslt = db_exec($sql) or errDie("Unable to access databse.", SELF); if (pg_numrows($custRslt) < 1) { return "<li>Invalid Customer ID.</li>"; } else { $cust = pg_fetch_array($custRslt); # get vars extract($cust); } if (!isset($category)) { $category = "0"; } if (!isset($class)) { $class = "0"; } if (!isset($pricelist)) { $pricelist = "0"; } if (!isset($deptid)) { $deptid = "0"; } db_conn("exten"); # get Category $sql = "SELECT * FROM categories WHERE catid = '{$category}' AND div = '" . USER_DIV . "'"; $catRslt = db_exec($sql); if (pg_numrows($catRslt) < 1) { $category = "<li class='err'>Category not Found.</li>"; } else { $cat = pg_fetch_array($catRslt); $category = $cat['category']; } # get Classification $sql = "SELECT * FROM class WHERE clasid = '{$class}' AND div = '" . USER_DIV . "'"; $clasRslt = db_exec($sql); if (pg_numrows($clasRslt) < 1) { $class = "<li class='err'>Class not Found.</li>"; } else { $clas = pg_fetch_array($clasRslt); $class = $clas['classname']; } # get Price List $sql = "SELECT * FROM pricelist WHERE listid = '{$pricelist}' AND div = '" . USER_DIV . "'"; $listRslt = db_exec($sql); if (pg_numrows($listRslt) < 1) { $plist = "<li class='err'>Class not Found.</li>"; } else { $list = pg_fetch_array($listRslt); $plist = $list['listname']; } # get department $sql = "SELECT * FROM departments WHERE deptid = '{$deptid}' AND div = '" . USER_DIV . "'"; $deptRslt = db_exec($sql); if (pg_numrows($deptRslt) < 1) { $deptname = "<li class='err'>Department not Found.</li>"; } else { $dept = pg_fetch_array($deptRslt); $deptname = $dept['deptname']; } db_conn('cubit'); $Sl = "SELECT id FROM cons WHERE cust_id='{$cusnum}'"; $Ry = db_exec($Sl) or errDie("Unable to get contact from db."); $i = 0; $conpers = ""; if (pg_num_rows($Ry) > 0) { $cdata = pg_fetch_array($Ry); $Sl = "SELECT * FROM conpers WHERE con='{$cdata['id']}' ORDER BY name"; $Ry = db_exec($Sl) or errDie("Unable to get contacts from db."); if (pg_num_rows($Ry) > 0) { $conpers = "\r\n\t\t\t\t<h3>Contact Persons</h3>\r\n\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Name</th>\r\n\t\t\t\t\t\t<th>Position</th>\r\n\t\t\t\t\t\t<th>Tel</th>\r\n\t\t\t\t\t\t<th>Cell</th>\r\n\t\t\t\t\t\t<th>Fax</th>\r\n\t\t\t\t\t\t<th>Email</th>\r\n\t\t\t\t\t\t<th>Notes</th>\r\n\t\t\t\t\t\t<th colspan='2'>Options</th>\r\n\t\t\t\t\t</tr>"; while ($cp = pg_fetch_array($Ry)) { $conpers .= "\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>{$cp['name']}</td>\r\n\t\t\t\t\t\t<td>{$cp['pos']}</td>\r\n\t\t\t\t\t\t<td>{$cp['tell']}</td>\r\n\t\t\t\t\t\t<td>{$cp['cell']}</td>\r\n\t\t\t\t\t\t<td>{$cp['fax']}</td>\r\n\t\t\t\t\t\t<td>{$cp['email']}</td>\r\n\t\t\t\t\t\t<td>{$cp['notes']}</td>\r\n\t\t\t\t\t\t<td><a href='conper-edit.php?id={$cp['id']}&type=edit'>Edit</a></td>\r\n\t\t\t\t\t\t<td><a href='conper-rem.php?id={$cp['id']}'>Delete</a></td>\r\n\t\t\t\t\t</tr>"; } $conpers .= "</table>"; } } // Sales rep if ($sales_rep) { db_conn("exten"); $sql = "SELECT salesp FROM salespeople WHERE salespid = '{$sales_rep}'"; $sr_rslt = db_exec($sql) or errDie("Unable to retrieve sales rep from Cubit."); $sr_username = pg_fetch_result($sr_rslt, 0); } else { $sr_username = "******"; } // Retrieve team name $sql = "SELECT name FROM crm.teams WHERE id='{$team_id}'"; $team_rslt = db_exec($sql) or errDie("Unable to retrieve teams."); $team_name = pg_fetch_result($team_rslt, 0); db_connect(); $display_piclist = ""; $display_iframe = ""; #check if this cust has any pics ... if (isset($cusnum) and strlen($cusnum) > 0) { #editing customer ... show frame if we have pics $get_pics = "SELECT * FROM display_images WHERE type = 'customer' AND ident_id = '{$cusnum}' LIMIT 1"; $run_pics = db_exec($get_pics) or errDie("Unable to get customer images information."); if (pg_numrows($run_pics) < 1) { #no pics for this customer $display_iframe = ""; } else { #compile listing for customer $get_piclist = "SELECT * FROM display_images WHERE type = 'customer' AND ident_id = '{$cusnum}'"; $run_piclist = db_exec($get_piclist) or errDie("Unable to get customer images information."); if (pg_numrows($run_piclist) < 1) { #wth .. pic went missing somewhere ... #so nothing } else { $display_piclist = "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2'>\r\n\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t<th>Picture Name</th>\r\n\t\t\t\t\t\t\t\t\t<th>View</th>\r\n\t\t\t\t\t\t\t\t</tr>"; while ($arr = pg_fetch_array($run_piclist)) { $display_piclist .= "\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>{$arr['image_name']}</td>\r\n\t\t\t\t\t\t\t<td><a target='iframe1' href='view_image.php?picid={$arr['id']}'>View</a></td>\r\n\t\t\t\t\t\t</tr>"; #at least 1 picture for this customer $display_iframe = "<tr><td colspan='2'><iframe name='iframe1' width='200' height='260' scrolling='false' marginwidth='0' marginheight='0' frameborder='0' src='view_image.php?picid={$arr['id']}'></iframe></td></tr>"; } $display_piclist .= "\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>"; } } } // layout $view = "\r\n\t\t<table cellpadding=0 cellspacing=0>\r\n\t\t\t<tr>\r\n\t\t\t\t<th colspan='2'>Customer Details</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr valign='top'>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Department</td>\r\n\t\t\t\t\t\t\t<td>{$deptname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Acc No</td>\r\n\t\t\t\t\t\t\t<td>{$accno}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Surname/Company</td>\r\n\t\t\t\t\t\t\t<td>{$surname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Title</td>\r\n\t\t\t\t\t\t\t<td>{$title}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Initials</td>\r\n\t\t\t\t\t\t\t<td>{$init}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Category</td>\r\n\t\t\t\t\t\t\t<td>{$category}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Classification</td>\r\n\t\t\t\t\t\t\t<td>{$class}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Link to Sales rep</td>\r\n\t\t\t\t\t\t\t<td>{$sr_username}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td valign=top>Postal Address</td>\r\n\t\t\t\t\t\t\t<td valign=center>" . nl2br($paddr1) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td valign=top>Delivery Address</td>\r\n\t\t\t\t\t\t\t<td valign=center>" . nl2br($addr1) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td valign=top>Alternative Delivery Address(1)</td>\r\n\t\t\t\t\t\t\t<td valign=center>" . nl2br($add1) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td valign=top>Alternative Delivery Address(2)</td>\r\n\t\t\t\t\t\t\t<td valign=center>" . nl2br($add2) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>VAT Number</td>\r\n\t\t\t\t\t\t\t<td>{$vatnum}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Contact Name</td>\r\n\t\t\t\t\t\t\t<td>{$contname}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Business Tel.</td>\r\n\t\t\t\t\t\t\t<td>{$bustel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Team Permissions</td>\r\n\t\t\t\t\t\t\t<td>{$team_name}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Home Tel.</td>\r\n\t\t\t\t\t\t\t<td>{$tel}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Cell No.</td>\r\n\t\t\t\t\t\t\t<td>{$cellno}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Fax No.</td>\r\n\t\t\t\t\t\t\t<td>{$fax}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>E-mail</td>\r\n\t\t\t\t\t\t\t<td>{$email}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Web Address</td>\r\n\t\t\t\t\t\t\t<td>http://{$url}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Trade Discount</td>\r\n\t\t\t\t\t\t\t<td>{$traddisc}%</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Settlement Discount</td>\r\n\t\t\t\t\t\t\t<td>{$setdisc}%</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Price List</td>\r\n\t\t\t\t\t\t\t<td>{$plist}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Charge Interest</td>\r\n\t\t\t\t\t\t\t<td>{$chrgint}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Overdue</td>\r\n\t\t\t\t\t\t\t<td>{$overdue}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Account Open Date</td>\r\n\t\t\t\t\t\t\t<td>{$odate}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Credit Term</td>\r\n\t\t\t\t\t\t\t<td>{$credterm}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Credit Limit</td>\r\n\t\t\t\t\t\t\t<td>{$credlimit}</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t\t<td>Comments</td>\r\n\t\t\t\t\t\t\t<td>" . nl2br($comments) . "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t{$display_iframe}\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t\t{$display_piclist}\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; db_conn("crm"); $docs_out = ""; $sql = "SELECT * FROM customer_docs WHERE cusnum = '{$cusnum}'"; $run_sql = db_exec($sql) or errDie("Unable to get customer information."); if (pg_numrows($run_sql) > 0) { while ($cdoc_data = pg_fetch_array($run_sql)) { if (strlen($cdoc_data['filename']) > 0) { $showdoc = "{$cdoc_data['filename']}"; } elseif (strlen($cdoc_data['real_filename']) > 0) { $showdoc = "{$cdoc_data['real_filename']}"; } else { $showdoc = "File" . $cdoc_data["id"]; } $docs_out .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='cust_doc_get.php?id={$cdoc_data['id']}'>{$showdoc}</a></td>\r\n\t\t\t\t\t<td>" . getFileSize($cdoc_data["size"]) . "</td>\r\n\t\t\t\t</tr>"; } } $view .= "\r\n\t\t<tr>\r\n\t\t\t<td>\r\n\t\t\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th colspan='2'>Documents</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Filename</th>\r\n\t\t\t\t\t\t<th>Size</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t{$docs_out}\r\n\t\t\t\t</table>\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<p>\r\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Quick Links</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='customers-view.php'>View Customers</a></td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\r\n\t\t\t</tr>\r\n\t\t</table>"; return $view; }
?> " download="<?php echo $pathInfo['basename']; ?> "> <img src="ressources/<?php echo $lang[LOCAL_LANG]['file_img_download']; ?> " /> </a><br/> <?php echo $lang[LOCAL_LANG]['right_click']; ?> <br/> <strong><?php echo $lang[LOCAL_LANG]['size']; ?> </strong> <?php echo getFileSize($filePath); ?> </div> <br /> <br /> </section> <footer> <div class="padding"></div> </footer> </body> </html>