Пример #1
0
 /**
  * Set base meta data and read the comment lines from the file head
  *
  * Usage example:
  * <code>
  * <?php
  * $file = '/phpdoc/en/reference/array/functions/next.xml';
  * $FDEn = new FileData($file, false);
  * $file = '/phpdoc/de/reference/array/functions/next.xml';
  * $FDTrans = new FileData($file, true);
  * ?>
  * </code>
  *
  * @param  string $file     File name to inspect
  * @param  bool   $isTrans  Define if the specified file is a translation
  * @return void
  */
 public function __construct($file, $isTrans)
 {
     self::$tags = implode('|', array('EN-Revision', 'Revision', 'Maintainer', 'Status', 'Credits', 'Rev-Revision', 'Reviewer'));
     $this->isTranslation = (bool) $isTrans;
     $this->data = array();
     $handle = fopen($file, 'r');
     for ($i = 0; $i <= 9 || feof($handle); ++$i) {
         $rawFile = trim(fgets($handle));
         switch (substr($rawFile, 0, 4)) {
             case '<!--':
                 $this->setMetaData($rawFile);
                 break;
             case '<?xm':
                 break;
             default:
                 $i = 9;
                 break;
         }
     }
     fclose($handle);
     $this->data['size'] = round(filesize($file) / 1024, 0);
     $this->data['mtime'] = filemtime($file);
     clearstatcache();
     return;
 }
 protected function serve($file_info)
 {
     $cache = new sfFileCache(array('cache_dir' => sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . 'cache'));
     if ($file_info->getIsCached() && $cache->has($file_info->getId(), 'uploaded_files')) {
         $file_data = new FileData();
         $file_data->setBinaryData($cache->get($file_info->getId(), 'uploaded_files'));
     } else {
         $file_data = $file_info->getFileData();
         $cache->set($file_info->getId(), 'uploaded_files', fread($file_data->getBinaryData(), $file_info->getSize()));
         $file_info->setIsCached(true);
         $file_info->save();
     }
     sfConfig::set('sf_web_debug', false);
     //              $this->getResponse()->addHttpMeta('content-type', $file_info->getMime());
     //              $this->getResponse()->addHttpMeta('content-length', $file_info->getSize());
     return $file_data;
 }
Пример #3
0
 public static function filesize($id)
 {
     $file = ORM::factory('Storage', $id);
     if (!$file->loaded()) {
         return '';
     }
     $size = filesize($file->file_path);
     return FileData::size($size);
 }
Пример #4
0
<?php

$file = FileData::getByCode($_GET["code"]);
$url = "storage/data/" . $file->user_id . "/";
$filename = $file->filename;
if (!$file->is_folder) {
    $fullurl = $url . $filename;
    header("Content-Disposition: attachment; filename='{$filename}'");
    readfile($fullurl);
    // or echo file_get_contents($filename);
}
Пример #5
0
/**
 * Paste_from_file
 * Parses a named uploaded file of html or txt type
 * The function identifies title, head and body for html files,
 * or body for text files.
 * 
 * @return FileData object
 */
function paste_from_file()
{
    $fileData = new FileData();
    if ($_FILES['uploadedfile_paste']['name'] == '') {
        $fileData->setErrorMsg(_AT('TR_ERROR_FILE_NOT_SELECTED'));
    } elseif ($_FILES['uploadedfile_paste']['type'] == 'text/plain' || $_FILES['uploadedfile_paste']['type'] == 'text/html') {
        $path_parts = pathinfo($_FILES['uploadedfile_paste']['name']);
        $ext = strtolower($path_parts['extension']);
        if (in_array($ext, array('html', 'htm'))) {
            $contents = file_get_contents($_FILES['uploadedfile_paste']['tmp_name']);
            /* get the <title></title> of this page             */
            $start_pos = strpos(strtolower($contents), '<title>');
            $end_pos = strpos(strtolower($contents), '</title>');
            if ($start_pos !== false && $end_pos !== false) {
                $start_pos += strlen('<title>');
                $fileData->setTitle(trim(substr($contents, $start_pos, $end_pos - $start_pos)));
            }
            unset($start_pos);
            unset($end_pos);
            $fileData->setHead(trim(get_html_head_by_tag($contents, array("link", "style", "script"))));
            $fileData->setBody(trim(get_html_body($contents)));
        } else {
            if ($ext == 'txt') {
                $fileData->setBody(trim(file_get_contents($_FILES['uploadedfile_paste']['tmp_name'])));
            }
        }
    } else {
        $fileData->setErrorMsg(_AT('TR_ERROR_BAD_FILE_TYPE'));
    }
    return $fileData;
}
Пример #6
0
<?php

include '../../includes/inc.main.php';
if ($_GET['action'] == 'newimage') {
    if (count($_FILES['image']) > 0) {
        $TempDir = $Admin->ImgGalDir();
        $Name = "user" . intval(rand() * rand() / rand()) . "__" . $Admin->AdminID;
        $Img = new FileData($_FILES['image'], $TempDir, $Name);
        echo $Img->BuildImage(200, 200);
        die;
    }
}
switch (strtolower($_POST['action'])) {
    //////////////////////////////////////////// NEW TEST USER ///////////////////////////////////////////////////////////////
    case 'generate':
        $curl = curl_init();
        curl_setopt_array($curl, array(CURLOPT_URL => "https://api.mercadolibre.com/users/test_user?access_token=" . $_SESSION['access_token'], CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\n    \"site_id\":\"MLA\"\n}", CURLOPT_HTTPHEADER => array("cache-control: no-cache", "conten: application/json", "content-type: application/json")));
        $response = curl_exec($curl);
        $err = curl_error($curl);
        curl_close($curl);
        if ($err) {
            echo "cURL Error #:" . $err;
        } else {
            echo $response;
            //$Data = json_decode($response,true);
            //$DB->execQuery('INSERT','test_user','id,nickname,password,site_status,email,creation_date',$Data['id']",'".$Data['nickname']."','".$Data['password']."','".$Data['site_status']."','".$Data['email']."',NOW()");
        }
        die;
        break;
        //////////////////////////////////////////// EDIT ///////////////////////////////////////////////////////////////
    //////////////////////////////////////////// EDIT ///////////////////////////////////////////////////////////////
Пример #7
0
session_start();
include 'odm-load.php';
if (!isset($_SESSION['uid'])) {
    redirect_visitor();
}
$last_message = isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : '';
if (!isset($_REQUEST['id']) || $_REQUEST['id'] == '') {
    header('Location:error.php?ec=2');
    exit;
}
draw_header(msg('area_view_history'), $last_message);
//revision parsing
if (strchr($_REQUEST['id'], '_')) {
    list($_REQUEST['id'], $revision_id) = explode('_', $_REQUEST['id']);
}
$datafile = new FileData($_REQUEST['id'], $pdo);
// verify
if ($datafile->getError() != null) {
    header('Location:error.php?ec=2');
    exit;
} else {
    // obtain data from resultset
    $owner_full_name = $datafile->getOwnerFullName();
    $owner = $owner_full_name[1] . ', ' . $owner_full_name[0];
    $real_name = $datafile->getRealName();
    $category = $datafile->getCategoryName();
    $created = $datafile->getCreatedDate();
    $description = $datafile->getDescription();
    $comments = $datafile->getComment();
    $status = $datafile->getStatus();
    $id = $_REQUEST['id'];
Пример #8
0
require_once dirname(__FILE__) . "/../../PaygateApiClient.class.php";
require_once dirname(__FILE__) . "/../config.php";
$client = new PaygateApiClient(INVIPAY_API_URL, INVIPAY_API_KEY, INVIPAY_SIGNATURE_KEY);
$repository = dirname(__FILE__) . "/repository/";
$payments = scandir($repository);
Logger::info('Scanning payments repository');
foreach ($payments as $paymentFile) {
    if ($paymentFile != '.' && $paymentFile != '..') {
        Logger::info('Found payment data {0}', $paymentFile);
        $paymentData = unserialize(file_get_contents($repository . $paymentFile));
        $paymentId = $paymentData->getPaymentId();
        Logger::info('Payment {0} has status {1}', $paymentId, $paymentData->getStatus());
        if ($paymentData->getStatus() == PaymentRequestStatus::COMPLETED) {
            Logger::info('Finalizing payment {0}', $paymentId);
            $request = new PaymentManagementData();
            $request->setPaymentId($paymentId);
            $request->setDoConfirmDelivery(true);
            $conversionData = new OrderToInvoiceData();
            $conversionData->setInvoiceDocumentNumber("TestInvoice/1/2/3/" . uniqid());
            $conversionData->setIssueDate(date('Y-m-d', time()));
            $conversionData->setDueDate(date('Y-m-d', time() + 14 * 24 * 60 * 60));
            $request->setConversionData($conversionData);
            $document = new FileData();
            $document->setFromFile(dirname(__FILE__) . '/../test.pdf');
            $request->setDocument($document);
            $result = $client->managePayment($request);
            Logger::info('Result is: {0}', $result);
        }
    }
}
Пример #9
0

<?php 
$data = new FileData();
if (isset($_GET['idsp'])) {
    $idsp = $_GET['idsp'];
    //id спецификации
    echo '<h3><p align="center">Спецификация</p></h3>';
    include 'interf/view_specif.php';
} else {
    echo '<h3><p align="center">Таблица метериалы и услуги</p></h3>';
    if ($curent_user->QwestPriwilege('VEIW_OLL_TABLE_MATERIAL')) {
        $data->ViweMaterialTable($data->GetArrayOrganizationIDfinsek(), $curent_user->GetUsersIdViewname());
    }
    if ($curent_user->QwestPriwilege('VIEW_MY_TABLE_MATERIAL')) {
        $data->ViweMaterialTableFoUsers($data->GetArrayOrganizationIDfinsek(), $curent_user->GetOrganizationID());
    }
}
Пример #10
0
    $mail_subject = msg('email_subject_review_status');
    $mail_greeting = msg('email_greeting') . ":\n\r\t" . msg('email_i_would_like_to_inform');
    $mail_body = msg('email_was_declined_for_publishing_at') . ' ' . $time . ' on ' . $date . ' ' . msg('email_because_you_did_not_revise') . ' ' . $GLOBALS['CONFIG']['revision_expiration'] . ' ' . msg('days');
    $mail_salute = "\n\r\n\r" . msg('email_salute') . ",\n\r{$full_name}";
    foreach ($data_result as $row) {
        $file_obj = new FileData($row['id'], $pdo);
        $user_obj = new User($file_obj->getOwner(), $pdo);
        $mail_to = $user_obj->getEmailAddress();
        if ($GLOBALS['CONFIG']['demo'] == 'False') {
            mail($mail_to, $mail_subject . $file_obj->getName(), $mail_greeting . $file_obj->getName() . ' ' . $mail_body . $mail_salute, $mail_headers);
        }
    }
}
//do not show file
if ($GLOBALS['CONFIG']['file_expired_action'] == 1) {
    $reviewer_comments = 'To=' . msg('author') . ';Subject=' . msg('message_file_expired') . ';Comments=' . msg('email_file_was_rejected_because') . ' ' . $GLOBALS['CONFIG']['revision_expiration'] . ' ' . msg('days');
    foreach ($data_result as $row) {
        $file_obj = new FileData($row['id'], $pdo);
        $file_obj->Publishable(-1);
        $file_obj->setReviewerComments($reviewer_comments);
    }
}
//lock file, not check-outable
if ($GLOBALS['CONFIG']['file_expired_action'] == 2) {
    foreach ($data_result as $row) {
        $file_obj = new FileData($row['id'], $pdo);
        $file_obj->setStatus(-1);
    }
}
echo msg('message_all_actions_successfull');
draw_footer();
Пример #11
0
<?php

require_once "Math.php";
require_once "File.php";
$job = !isset($_REQUEST["job"]) ? '' : trim($_REQUEST["job"]);
$evenNumbers = array();
$oddNumbers = array();
$fiboNumbers = array();
$file = array();
if ($job == "uploadFile") {
    $file = new FileData($_FILES["aNumbers"]);
    //assign data from file to $file object
    //get even, odd and fibonacci numbers from file and store in respective arrays
    $evenNumbers = $file->GetEvenNumbers();
    $oddNumbers = $file->GetOddNumbers();
    $fiboNumbers = $file->GetFibonacciNumbers();
    if (!isset($_SESSION['file'])) {
        $_SESSION['file'] = $file;
    }
}
$job = !isset($_GET["job"]) ? '' : trim($_GET["job"]);
if ($job == "exportnumbers") {
    //If a valid file was submitted with the submit button, then its details are saved in a session
    if (isset($_SESSION['file'])) {
        $file = $_SESSION['file'];
        $file->ExportNumbers($_SESSION["filename"] . ".csv");
        //call ExportNumbers function using the filename stored in a session and adding .csv as an extension
    }
}
if ($job == "reset") {
    session_destroy();
Пример #12
0
<?php

//print_r($_SESSION);
if (!empty($_POST) && isset($_SESSION["user_id"])) {
    $alphabeth = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ1234567890_-";
    $code = "";
    for ($i = 0; $i < 12; $i++) {
        $code .= $alphabeth[rand(0, strlen($alphabeth) - 1)];
    }
    $f = new FileData();
    $f->code = $code;
    $f->is_public = isset($_POST["is_public"]) ? 1 : 0;
    $f->folder_id = $_POST["folder_id"] != "" ? $_POST["folder_id"] : "NULL";
    $f->user_id = $_SESSION["user_id"];
    $f->description = $_POST["description"];
    $handle = new Upload($_FILES['filename']);
    if ($handle->uploaded) {
        $url = "storage/data/" . $_SESSION["user_id"];
        $handle->Process($url);
        if ($handle->processed) {
            $f->filename = $handle->file_dst_name;
            $f->add();
            Core::alert("Agregado exitosamente!");
            Core::redir("./?view=home");
        }
    }
}
Пример #13
0
 function getAuthority($data_id)
 {
     $data_id = (int) $data_id;
     $fileData = new FileData($data_id, $GLOBALS['connection'], DB_NAME);
     if ($this->user_obj->isAdmin() || $this->user_obj->isReviewerForFile($data_id)) {
         return $this->ADMIN_RIGHT;
     }
     if ($fileData->isOwner($this->uid) && $fileData->isLocked()) {
         return $this->WRITE_RIGHT;
     }
     $uperm = $this->userperm_obj->getPermission($data_id);
     $dperm = $this->deptperm_obj->getPermission($data_id);
     if ($uperm >= $this->userperm_obj->NONE_RIGHT and $uperm <= $this->userperm_obj->ADMIN_RIGHT) {
         return $uperm;
     } else {
         return $dperm;
     }
 }
Пример #14
0
        $GLOBALS['smarty']->assign('lmode', '');
        display_smarty_template('deleteview.tpl');
    }
} elseif (isset($_POST['submit']) && $_POST['submit'] == 'Delete file(s)') {
    isset($_REQUEST['checkbox']) ? $_REQUEST['checkbox'] : '';
    foreach ($_REQUEST['checkbox'] as $value) {
        if (!pmt_delete($value)) {
            header('Location: error.php?ec=21');
            exit;
        }
    }
    header('Location:' . urlencode($redirect) . '?last_message=' . urlencode(msg('undeletepage_file_permanently_deleted')));
} elseif (isset($_REQUEST['submit']) && $_REQUEST['submit'] == 'Undelete') {
    if (isset($_REQUEST['checkbox'])) {
        foreach ($_REQUEST['checkbox'] as $fileId) {
            $file_obj = new FileData($fileId, $pdo);
            $file_obj->undelete();
            fmove($GLOBALS['CONFIG']['archiveDir'] . $fileId . '.dat', $GLOBALS['CONFIG']['dataDir'] . $fileId . '.dat');
        }
    }
    header('Location:' . urlencode($redirect) . '?last_message=' . urlencode(msg('undeletepage_file_undeleted')));
}
draw_footer();
/*
 * Permanently Delete A File
 * @param integer $id The file ID to be deleted permanently
 */
function pmt_delete($id)
{
    global $pdo;
    $userperm_obj = new User_Perms($_SESSION['uid'], $pdo);
Пример #15
0
 public function confirmDeliveryAndSendInvoice($order)
 {
     $invoices = array();
     $invoiceNumbers = array();
     if ($order->hasInvoices()) {
         foreach ($order->getInvoiceCollection() as $invoiceItem) {
             $invoices[] = $invoiceItem;
             $invoiceNumbers[] = $invoiceItem->getIncrementId();
         }
     }
     $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices);
     $pdfData = $pdf->render();
     $documentNumber = join(', ', $invoiceNumbers);
     $issueDate = strtotime($order->getCreatedAt());
     $dueDateDays = intval(Mage::getStoreConfig('payment/ipcpaygate/invipay_base_duedate'));
     $dueDate = $issueDate + $dueDateDays * 60 * 60 * 24;
     $client = $this->getApiClient();
     $request = new PaymentManagementData();
     $request->setPaymentId($order->getInvipayPaymentId());
     $request->setDoConfirmDelivery(true);
     $conversionData = new OrderToInvoiceData();
     $conversionData->setInvoiceDocumentNumber($documentNumber);
     $conversionData->setIssueDate(date('Y-m-d', $issueDate));
     $conversionData->setDueDate(date('Y-m-d', $dueDate));
     $request->setConversionData($conversionData);
     $document = new FileData();
     $document->setName('Zamowienie_nr_' . $order->getEntityId() . '.pdf');
     $document->setMimeType('application/pdf');
     $document->setContentFromBin($pdfData);
     $request->setDocument($document);
     $result = $client->managePayment($request);
     $order->setInvipayDeliveryConfirmed(true);
     $order->setInvipayCompleted(true);
     $order->save();
 }
Пример #16
0
include 'odm-load.php';
if (!isset($_SESSION['uid'])) {
    redirect_visitor();
}
require_once "AccessLog_class.php";
$last_message = isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : '';
$secureurl_obj = new phpsecureurl();
$lrequest_id = $_REQUEST['id'];
//save an original copy of id
if (strchr($_REQUEST['id'], '_')) {
    list($_REQUEST['id'], $lrevision_id) = explode('_', $_REQUEST['id']);
    $lrevision_dir = $GLOBALS['CONFIG']['revisionDir'] . '/' . $_REQUEST['id'] . '/';
}
if (!isset($_GET['submit'])) {
    draw_header(msg('view') . ' ' . msg('file'), $last_message);
    $file_obj = new FileData($_REQUEST['id'], $GLOBALS['connection'], DB_NAME);
    $file_name = $file_obj->getName();
    $file_id = $file_obj->getId();
    $realname = $file_obj->getName();
    // Get the suffix of the file so we can look it up
    // in the $mimetypes array
    $suffix = '';
    if (strchr($realname, '.')) {
        // Fix by blackwes
        $prefix = substr($realname, 0, strrpos($realname, "."));
        $suffix = strtolower(substr($realname, strrpos($realname, ".") + 1));
    }
    $lmimetype = File::mime_by_ext($suffix);
    //echo "Realname is $realname<br>";
    //echo "prefix = $prefix<br>";
    //echo "suffix = $suffix<br>";
Пример #17
0
<?php

if (!empty($_GET)) {
    $fp = PermisionData::getById($_GET["id"]);
    //	print_r($fp);
    $file = FileData::getById($fp->file_id);
    $fp->del();
    Core::redir("./?view=filepermisions&id=" . $file->code);
}
Пример #18
0
 /**
  * getAuthority
  * Return the authority that this user have on file data_id
  * by combining and prioritizing user and department right
  * @param int $data_id
  * @return int
  */
 public function getAuthority($data_id)
 {
     $data_id = (int) $data_id;
     $fileData = new FileData($data_id, $this->connection);
     if ($this->user_obj->isAdmin() || $this->user_obj->isReviewerForFile($data_id)) {
         return $this->ADMIN_RIGHT;
     }
     if ($fileData->isOwner($this->uid) && $fileData->isLocked()) {
         return $this->WRITE_RIGHT;
     }
     $user_permissions = $this->user_perms_obj->getPermission($data_id);
     $department_permissions = $this->dept_perms_obj->getPermission($data_id);
     if ($user_permissions >= $this->user_perms_obj->NONE_RIGHT and $user_permissions <= $this->user_perms_obj->ADMIN_RIGHT) {
         return $user_permissions;
     } else {
         return $department_permissions;
     }
 }
Пример #19
0
// Deprecated
// check for session and $id
session_start();
include_once 'odm-load.php';
if (!isset($_SESSION['uid'])) {
    redirect_visitor();
}
$last_message = isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : '';
if (!isset($id) || $id == '') {
    header('Location:error.php?ec=2');
    exit;
}
// includes
// in case file is accessed directly
// verify again that user has view rights
$filedata = new FileData($id, $pdo);
$filedata->setId($id);
if ($filedata->getError() != '') {
    header('Location:error.php?ec=2');
    ob_end_flush();
    // Flush buffer onto screens
    ob_end_clean();
    // Clean up buffer
    exit;
} else {
    // all checks completed
    /* to avoid problems with some browsers,
          download script should not include parameters on the URL
          so let's use a form and pass the parameters via POST
       */
    // form not yet submitted
Пример #20
0
<?php

//print_r($_SESSION);
if (!empty($_POST) && isset($_SESSION["user_id"])) {
    $alphabeth = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ1234567890_-";
    $code = "";
    for ($i = 0; $i < 12; $i++) {
        $code .= $alphabeth[rand(0, strlen($alphabeth) - 1)];
    }
    $f = new FileData();
    $f->code = $code;
    $f->is_public = isset($_POST["is_public"]) ? 1 : 0;
    $f->user_id = $_SESSION["user_id"];
    $f->description = $_POST["description"];
    $f->filename = $_POST["filename"];
    $f->add_folder();
    Core::alert("Agregado exitosamente!");
    Core::redir("./?view=home");
}
Пример #21
0
 // update revision log
 $query = "UPDATE {$GLOBALS['CONFIG']['db_prefix']}log set revision='" . intval(intval($lrevision_num) - 1) . "' WHERE id = '{$id}' and revision = 'current'";
 mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error());
 $query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}log (id, modified_on, modified_by, note, revision) VALUES('{$id}', NOW(), '" . addslashes($username) . "', '" . addslashes($_POST['note']) . "', 'current')";
 $result = mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error());
 // update file status
 $query = "UPDATE {$GLOBALS['CONFIG']['db_prefix']}data SET status = '0', publishable='{$lpublishable}', realname='{$filename}' WHERE id='{$id}'";
 $result = mysql_query($query, $GLOBALS['connection']) or die("Error in query: {$query}. " . mysql_error());
 // rename and save file
 $newFileName = $id . '.dat';
 copy($_FILES['file']['tmp_name'], $GLOBALS['CONFIG']['dataDir'] . $newFileName);
 AccessLog::addLogEntry($id, 'I');
 /**
  * Send out email notifications to reviewers
  */
 $file_obj = new FileData($id, $GLOBALS['connection'], DB_NAME);
 $get_full_name = $user_obj->getFullName();
 $full_name = $get_full_name[0] . ' ' . $get_full_name[1];
 $department = $file_obj->getDepartment();
 $reviewer_obj = new Reviewer($id, $GLOBALS['connection'], DB_NAME);
 $reviewer_list = $reviewer_obj->getReviewersForDepartment($department);
 $date = date('Y-m-d H:i:s T');
 // Build email for general notices
 $mail_subject = msg('checkinpage_file_was_checked_in');
 $mail_body2 = msg('checkinpage_file_was_checked_in') . "\n\n";
 $mail_body2 .= msg('label_filename') . ':  ' . $file_obj->getName() . "\n\n";
 $mail_body2 .= msg('label_status') . ': ' . msg('addpage_new') . "\n\n";
 $mail_body2 .= msg('date') . ': ' . $date . "\n\n";
 $mail_body2 .= msg('addpage_uploader') . ': ' . $full_name . "\n\n";
 $mail_body2 .= msg('email_thank_you') . ',' . "\n\n";
 $mail_body2 .= msg('email_automated_document_messenger') . "\n\n";
Пример #22
0
 public function Newimage()
 {
     if (count($_FILES['image']) > 0) {
         // $Images = $Admin->UserImages(); // Para cuando se requiera limitar la cantidad de imágenes.
         $TempDir = $this->ImgGalDir();
         $Name = "user" . intval(rand() * rand() / rand()) . "__" . $this->AdminID;
         $Img = new FileData($_FILES['image'], $TempDir, $Name);
         echo $Img->BuildImage(200, 200);
     }
 }
Пример #23
0
<?php 
$file = FileData::getByCode($_GET["id"]);
?>


<div class="container">



<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
  <li><i class="fa fa-home"></i> Inicio</li>
  <li><i class="fa fa-asterisk"></i> Editar archivo</li>
</ol>
<h1><a href="./?view=file&code=<?php 
echo $file->code;
?>
"><?php 
echo $file->filename;
?>
</a> <small>Editar Archivo</small></h1>
</div>
</div>

<div class="row">
<div class="col-md-12">

<form role="form" method="post" action="./?action=updatefile">
Пример #24
0
 public function Newimage()
 {
     if (count($_FILES['image']) > 0) {
         if ($_POST['newimage'] != $this->GetDefaultImg() && file_exists($_POST['newimage'])) {
             unlink($_POST['newimage']);
         }
         $TempDir = $this->ImgGalDir;
         $Name = "group" . intval(rand() * rand() / rand());
         $Img = new FileData($_FILES['image'], $TempDir, $Name);
         echo $Img->BuildImage(200, 200);
     }
 }
Пример #25
0
<?php 
if ($go || $is_owner) {
    ?>
<div class="container">


<div class="row">
<div class="col-md-12">
<?php 
    if (isset($_SESSION["user_id"])) {
        ?>
<ol class="breadcrumb">
	<li><a href="./?view=home"><i class="fa fa-home"></i> Inicio</a></li>
	<?php 
        if ($file->folder_id != null) {
            $f = FileData::getById($file->folder_id);
            echo '<li><a href="./?view=home&folder=' . $f->code . '"><i class="fa fa-folder-open"></i> ' . $f->filename . '</a></li>';
        }
        ?>

</ol>
<?php 
    }
    ?>
<div class="btn-group  pull-right">
<a href="./?action=dwnfl&code=<?php 
    echo $file->code;
    ?>
" class="btn btn-default"><i class="fa fa-download"></i> Descargar</a>
</div>
Пример #26
0
    redirect_visitor();
}
require_once "AccessLog_class.php";
$last_message = isset($_REQUEST['last_message']) ? $_REQUEST['last_message'] : '';
if (strchr($_REQUEST['id'], '_')) {
    header('Location:error.php?ec=20');
}
if (!isset($_REQUEST['id']) || $_REQUEST['id'] == '') {
    header('Location:error.php?ec=2');
    exit;
}
/* if the user has read-only authority on the file, his check out 
will be the same as the person with admin or modify right except that the DB will not have any recored of him checking out this file.  Therefore, he will not be able to check-in the file on
the server
*/
$fileobj = new FileData($_GET['id'], $GLOBALS['connection'], DB_NAME);
$fileobj->setId($_GET['id']);
if ($fileobj->getError() != NULL || $fileobj->getStatus() > 0 || $fileobj->isArchived()) {
    header('Location:error.php?ec=2');
    exit;
}
if (!isset($_GET['submit'])) {
    draw_header(msg('area_check_out_file'), $last_message);
    // form not yet submitted
    // display information on how to initiate download
    checkUserPermission($_REQUEST['id'], $fileobj->WRITE_RIGHT, $fileobj);
    ?>


<p>
Пример #27
0
// get current user's information-->department
$user_obj = new User($_SESSION['uid'], $pdo);
if (!$user_obj->isRoot()) {
    header('Location:error.php?ec=24');
}
$flag = 0;
if (isset($_GET['submit']) && $_GET['submit'] == 'view_checkedout') {
    echo PHP_EOL . '<form name="table" action="file_ops.php" method="POST">';
    echo PHP_EOL . '<input name="submit" type="hidden" value="Clear Status">';
    draw_header(msg('label_checked_out_files'), $last_message);
    $file_id_array = $user_obj->getCheckedOutFiles();
    $page_url = 'file_ops.php?';
    $user_perm_obj = new UserPermission($_SESSION['uid'], $pdo);
    $list_status = list_files($file_id_array, $user_perm_obj, $GLOBALS['CONFIG']['dataDir'], true, true);
    if ($list_status != -1) {
        echo PHP_EOL . '<BR><div class="buttons"><button class="positive" type="submit" name="submit" value="Clear Status">' . msg('button_clear_status') . '</button></div><br />';
        echo PHP_EOL . '</form>';
    }
    draw_footer();
} elseif (isset($_POST['submit']) && $_POST['submit'] == 'Clear Status') {
    if (isset($_POST["checkbox"])) {
        foreach ($_POST['checkbox'] as $cbox) {
            $file_id = $cbox;
            $file_obj = new FileData($file_id, $pdo);
            $file_obj->setStatus(0);
        }
    }
    header('Location:file_ops.php?state=2&submit=view_checkedout');
} else {
    echo 'Nothing to do';
}
Пример #28
0
 /**
  * return a boolean on whether or not this department
  * has admin right to the file whose ID is $data_id
  * @param int $data_id
  * @return bool
  */
 public function canAdmin($data_id)
 {
     $filedata = new FileData($data_id, $this->connection);
     //check  to see if this department doesn't have a forbidden right or
     //if this file is publishable
     if (!$this->isForbidden($data_id) or !$filedata->isPublishable()) {
         // return whether or not this deptartment can admin the file
         if ($this->canDept($data_id, $this->ADMIN_RIGHT)) {
             return true;
         } else {
             false;
         }
     }
 }
Пример #29
0
    }
    ?>
</table>
</form>

<?php 
    draw_footer();
} elseif (isset($_POST['submit']) && $_POST['submit'] == 'resubmit') {
    if (!isset($_REQUEST['checkbox'])) {
        header('Location:rejects.php?last_message=' . urlencode(msg('message_you_did_not_enter_value')));
        exit;
    }
    if (isset($_POST["checkbox"])) {
        foreach ($_POST['checkbox'] as $cbox) {
            $fileid = $cbox;
            $file_obj = new FileData($fileid, $pdo);
            $file_obj->Publishable(0);
        }
    }
    header('Location:rejects.php?mode=' . urlencode(@$_REQUEST['mode']) . '&last_message=' . urlencode(msg('message_file_authorized')));
} elseif ($_POST['submit'] == 'delete') {
    if (!isset($_REQUEST['checkbox'])) {
        header('Location: rejects.php?last_message=' . urlencode(msg('message_you_did_not_enter_value')));
        exit;
    }
    $url = 'delete.php?mode=tmpdel&';
    $id = 0;
    if (isset($_POST["checkbox"])) {
        $loop = 0;
        foreach ($_POST['checkbox'] as $num => $cbox) {
            $fileid = $cbox;
Пример #30
0
$orderId = null;
Logger::info('Searching for an order transaction');
$filter = new TransactionsFilter();
$filter->setSide(TransactionSide::SALE);
$filter->setType(TransactionType::ORDER);
$result = $client->listTransactions($filter);
$ordersCount = count($result);
Logger::info('Found {0} orders', $ordersCount);
if ($ordersCount > 0) {
    $orderId = $result[0]->getId();
    Logger::info('Using order {0} for further processing', $orderId);
}
// Convert order to invoice
if ($orderId !== null) {
    Logger::info('Converting order {0} into invoice', $orderId);
    $pdf = new FileData();
    $pdf->setFromFile(dirname(__FILE__) . '/../test.pdf');
    $data = new OrderConversionData();
    $data->setTransactionId($orderId);
    $data->setInvoiceDocumentNumber("Converted from order " . uniqid());
    $data->setIssueDate(date('Y-m-d', time()));
    $data->setDueDate(date('Y-m-d', time() + 30 * 24 * 60 * 60));
    $data->setInvoiceDocument($pdf);
    $result = $client->convertOrderToInvoice($data);
    Logger::info('Result is: {0}', $result);
}
// Confirm delivery
if ($orderId !== null) {
    Logger::info('Confirming delivery for transaction {0}', $orderId);
    $result = $client->confirmDelivery($orderId);
    Logger::info('Result is: {0}', $result);