Example #1
0
     $smarty->assign('galleryRows', count($galleriesArray));
     $smarty->assign('galleries', $galleriesArray);
 }
 // Date range to & from
 foreach (range(2000, date("Y")) as $year) {
     $fromYear[$year] = $year;
     $toYearTmp[$year] = $year;
     $toYear = array_reverse($toYearTmp, true);
 }
 foreach (range(1, 12) as $month) {
     $month = zerofill($month);
     $fromMonth[$month] = $month;
     $toMonth[$month] = $month;
 }
 foreach (range(1, 31) as $day) {
     $day = zerofill($day);
     $fromDay[$day] = $day;
     $toDay[$day] = $day;
 }
 if ($_SESSION['searchForm']['searchDate']['dateRangeSearch']) {
     $searchDateObj = new kdate();
     // Setup a new kdate object to use specifically on media details
     $searchDateObj->setMemberSpecificDateInfo();
     $searchDateObj->distime = 0;
     $searchDateObj->adjust_date = 0;
     $fromDateText = $searchDateObj->showdate("{$_SESSION[searchForm][searchDate][fromYear]}-{$_SESSION[searchForm][searchDate][fromMonth]}-{$_SESSION[searchForm][searchDate][fromDay]} 00:00:00");
     $toDateText = $searchDateObj->showdate("{$_SESSION[searchForm][searchDate][toYear]}-{$_SESSION[searchForm][searchDate][toMonth]}-{$_SESSION[searchForm][searchDate][toDay]} 00:00:00");
     $smarty->assign('fromDateText', $fromDateText);
     $smarty->assign('toDateText', $toDateText);
 }
 // Default is sortnumber, id desc
        if ($expected !== $result) {
            printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result);
            return false;
        }
    } else {
        if ($length <= 1) {
            printf("[%03d] Length reported is too small to run test\n", $offset);
            return false;
        }
    }
    return true;
}
/*
We map those to PHP numeric types -
	no padding/filling done. Neither with libmysql nor with mysqlnd.
zerofill(2, $link, 'TINYINT');
zerofill(3, $link, 'SMALLINT');
zerofill(4, $link, 'MEDIUMINT');
zerofill(5, $link, 'INT');
zerofill(6, $link, 'INTEGER');
zerofill(7, $link, 'BIGINT');
zerofill(8, $link, 'FLOAT');
zerofill(9, $link, 'DOUBLE');
zerofill(10, $link, 'DOUBLE PRECISION');
*/
zerofill(11, $link, 'DECIMAL');
zerofill(12, $link, 'DEC');
mysqli_close($link);
print "done!";
$test_table_name = 'test_mysqli_stmt_bind_result_zerofill_table_1';
require_once "clean_table.inc";
Example #3
0
/**
 * @desc File field Object
 * */
function fk_date_field($id, $name, $value, $onclick = null, $cssExtra = '', $mode = 'edit')
{
    $monts[0] = 'Mes:';
    $monts[1] = 'Enero';
    $monts[2] = 'Febrero';
    $monts[3] = 'Marzo';
    $monts[4] = 'Abril';
    $monts[5] = 'Mayo';
    $monts[6] = 'Junio';
    $monts[7] = 'Julio';
    $monts[8] = 'Agosto';
    $monts[9] = 'Septiembre';
    $monts[10] = 'Octubre';
    $monts[11] = 'Noviembre';
    $monts[12] = 'Diciembre';
    $y = 0;
    $m = 0;
    $d = 0;
    $set_date = false;
    if ($value != '') {
        $y = substr($value, 0, 4);
        $m = substr($value, 5, 2);
        $d = substr($value, 8, 2);
        if (checkdate($m, $d, $y)) {
            $set_date = true;
        }
    }
    $html_fld = '';
    $html_fld .= '<div style="width:56px;display:inline-block;">
	               
	              <select name="' . $name . '-d" id="' . $id . '-d" onchange="setDate(\'' . $name . '\')" class="' . $cssExtra . '">';
    $html_fld .= '<option value="00">D&iacute;a:</option>';
    for ($i = 1; $i < 32; $i++) {
        $selected = '';
        if ($set_date && $d == $i) {
            $selected = 'selected="selected"';
        }
        $html_fld .= '<option value="' . zerofill($i, 2) . '" ' . $selected . '>' . $i . '</option>';
    }
    $html_fld .= '</select></div>';
    $html_fld .= '<div style="width:100px;display:inline-block;"><select name="' . $name . '-m" id="' . $id . '-m" onchange="setDate(\'' . $name . '\')" class="' . $cssExtra . '">';
    foreach ($monts as $k => $mnt) {
        $selected = '';
        if ($set_date && $m == $k) {
            $selected = 'selected="selected"';
        }
        $html_fld .= '<option value="' . zerofill($k, 2) . '" ' . $selected . '>' . $mnt . '</option>';
    }
    $html_fld .= '</select></div>';
    $html_fld .= '<div style="width:75px;display:inline-block;"><select name="' . $name . '-y" id="' . $id . '-y" onchange="setDate(\'' . $name . '\')" class="' . $cssExtra . '">';
    $Yini = date('Y');
    $Yfin = date('Y') - 108;
    $html_fld .= '<option value="0000">A&ntilde;o:</option>';
    for ($i = $Yini; $i > $Yfin; $i--) {
        $selected = '';
        if ($set_date && $y == $i) {
            $selected = 'selected="selected"';
        }
        $html_fld .= '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
    }
    $html_fld .= '</select><input type="hidden" name="' . $name . '" id="' . $id . '" value="' . $value . '" class="' . $cssExtra . '"></div>';
    return $html_fld;
}
 }
 $usuario = $_SESSION["login"];
 $bdMi = new MYSQL_MIDB();
 $resultado = $bdMi->sql("SELECT idUsuario, nome, titulo, cargo, portaria, emailInstitucional FROM usuario WHERE emailInstitucional = '{$usuario}'");
 $row = mysql_fetch_array($resultado);
 $idRemetente = $row[0];
 $nomeRemetente = $row[1];
 $tituloRemetente = $row[2];
 $cargoRemetente = $row[3];
 $portariaRemetente = $row[4];
 $emailRemetente = $row[5];
 //***********CONSULTA DE MEMORANDOS*************/
 //Consulta o "maior ID" de memorando da tabela (ou seja, o último) e o incrementa, gerando o nome do próximo.
 //SO PARA TESTE
 $SelectNumeroMemorando = $bdMi->sql("SELECT MAX(nMemorandoEmitido) FROM memorando");
 $numeroMemorando = zerofill(mysql_result($SelectNumeroMemorando, 0));
 //********OBTENÇÃO DO USUÁRIO REMETENTE*********/
 //*********OBTENÇÃO DE OUTRAS VARIÁVEIS*********/
 $dataEmissao2 = explode('-', $dataEmissao);
 $dia = $dataEmissao2[2];
 $mes = $dataEmissao2[1];
 $ano = $dataEmissao2[0];
 $ano2 = explode('0', $ano);
 switch ($mes) {
     case 01:
         $mes = 'Janeiro';
         break;
     case 02:
         $mes = 'Fevereiro';
         break;
     case 03:
 include "conecta-mi-db.php";
 include "funcoes.php";
 $bdMi = new MYSQL_MIDB();
 //**********RECEBIMENTO DAS VARIÁRVEIS**********/
 $txtDestinatario = $_POST['txtDestinatario'];
 $txtCargoRemetente = $_POST['txtCargo'];
 $txtReferencia = $_POST['txtReferencia'];
 $txtTitulo = $_POST['txtTitulo'];
 $txtCorpo = $_POST['txtCorpo'];
 $dataEmissao = $_POST['data'];
 $usuario = $_SESSION["login"];
 //***********CONSULTA DE MEMORANDOS*************/
 //Consulta o "maior ID" de memorando da tabela (ou seja, o último) e o incrementa, gerando o nome do próximo.
 $ultimoMemorando = $bdMi->sql("SELECT MAX(idMemorando) FROM memorando");
 $numeroMemorando1 = $ultimoMemorando[0] + 1;
 $numeroMemorando = zerofill($numeroMemorando1);
 //********OBTENÇÃO DO USUÁRIO REMETENTE*********/
 $resultadoRemetente = $bdMi->sql("SELECT nome FROM usuario WHERE emailInstitucional = '{$usuario}'");
 $remetente = mysql_result($resultadoRemetente, 0, 'nome');
 //*********OBTENÇÃO DE OUTRAS VARIÁVEIS*********/
 $dataEmissao2 = explode('-', $dataEmissao);
 $dia = $dataEmissao2[2];
 $mes = $dataEmissao2[1];
 $ano = $dataEmissao2[0];
 $ano2 = explode('0', $ano);
 switch ($mes) {
     case 01:
         $mes = 'Janeiro';
         break;
     case 02:
         $mes = 'Fevereiro';
Example #6
0
 function zerofill($number, $length = 2)
 {
     return $this->zerofill ? zerofill($number, $length) : $number;
 }
Example #7
0
     } else {
         echo "failure";
     }
     $_SESSION['contrImportFiles'][] = base64_encode($uploadFile);
 }
 if ($uploaderType == 'plupload') {
     if (!$_SESSION['member']['mem_id']) {
         die('No member id exists');
     }
     // Make sure a member id exists
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     $contrFID = zerofill($_SESSION['member']['mem_id'], 5);
     $targetDir = BASE_PATH . '/assets/contributors/contr' . $contrFID . '/';
     // Search folder for files
     //$filename = clean_filename($_FILES['file']['name']); // Clean the filename
     //$uploadFile = $incomingFolder.$filename; // Get the full path for the file
     //$basefilename = basefilename($filename); // Get the base filename
     // Settings
     //$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
     //$targetDir = 'uploads';
     $cleanupTargetDir = true;
     // Remove old files
     $maxFileAge = 5 * 3600;
     // Temp file age in seconds
     // 5 minutes execution time
     @set_time_limit(5 * 60);
     // Uncomment this one to fake upload time
Example #8
0
 /**
  *@package AppForm
  *@method createConsecutiveField()
  *@desc creates consecutive value field
  *@since v0.3.4
  **/
 private function createConsecutiveField($operation)
 {
     //crear opciones de <select> nuevas
     if ($operation == 'save' || $operation == 'savedit') {
         foreach ($this->DbRecord->form_fields as $field => $properties) {
             $post_field_name = $this->encode_fields ? encode($field) : $field;
             //if($properties['Type']=='consecutive' && fk_post($post_field_name)==''){
             if ($properties['Type'] == 'consecutive' && fk_post($post_field_name) == '') {
                 // create consecutive
                 if (isset($properties['properties'])) {
                     $consecutive = self::generarConsecutivo($properties['properties']['config_code'], true);
                     if (isset($properties['properties']['zerofill'])) {
                         $consecutive = zerofill($consecutive, $properties['properties']['zerofill']);
                     }
                     // Actualiza el campo
                     $_POST[$post_field_name] = $properties['properties']['prefix'] . $consecutive . $properties['properties']['sufix'];
                 }
             }
             // if allows adding new
         }
         // foreach field
     }
     // if save
 }
        } else {
            // Cleanup old cached file
            @unlink($cachePathFile);
        }
    }
}
require_once BASE_PATH . '/assets/includes/initialize.php';
require_once BASE_PATH . '/assets/classes/imagetools.php';
/*
 * Convert to global variables
 */
$size = $_GET['size'] ? $_GET['size'] : '100';
$quality = $config['settings']['thumb_quality'];
$sharpen = $config['settings']['thumb_sharpen'];
$photoID = zerofill($_GET['photoID'], 4);
$itemID = zerofill($_GET['itemID'], 4);
$itemType = $_GET['itemType'];
$crop = $_GET['crop'];
$hcrop = $_GET['hcrop'];
$sizeType = $_GET['sizeType'] ? $_GET['sizeType'] : 'small';
if ($size > 149 and file_exists(BASE_PATH . "/assets/item_photos/{$itemType}{$itemID}_ip{$photoID}_med.jpg")) {
    // If size setting is larger then 200 use the medium size instead
    $sizeType = 'med';
}
if ($size > 500 and file_exists(BASE_PATH . "/assets/item_photos/{$itemType}{$itemID}_ip{$photoID}_org.jpg")) {
    // If size setting is larger then 500 use the original size instead
    $sizeType = 'org';
}
// xxxxxxxxxxxxxx check to make sure of memory limit
$path = BASE_PATH . "/assets/item_photos/{$itemType}{$itemID}_ip{$photoID}_{$sizeType}.jpg";
// Direct path to product shot file to use
Example #10
0
 $contrFolderInfo = checkContrDirectories();
 $variationsPath = "{$config[settings][library_path]}/contr{$contrFolderInfo[contrFID]}/variations/";
 $originallySelectedDigitalSizes = explode(",", $originalMediaDS);
 if ($digital) {
     // Get new or updated digital SP entries
     foreach ($digital as $key => $value) {
         $cleanDigitalPrice = '';
         // Clear digital price just in case
         // Check to see if temp file exists for this one
         $tempDSPresult = mysqli_query($db, "SELECT * FROM {$dbinfo[pre]}media_dsp_temp WHERE media_id = '{$mediaID}' AND dsp_id = '{$value}' ORDER BY tmpid DESC");
         $tempDSProws = mysqli_num_rows($tempDSPresult);
         if ($tempDSProws) {
             $tempDSP = mysqli_fetch_array($tempDSPresult);
             $dspExt = strtolower(end(explode(".", $tempDSP[filename])));
             // Find the extension of the dsp file
             $newDSPname = zerofill($mediaID, 6) . "_" . zerofill($value, 3) . "_{$fileNameNoExtension}.{$dspExt}";
             // Move temp file to correct location
             copy("./assets/tmp/{$tempDSP[filename]}", "{$variationsPath}{$newDSPname}");
             // Delete temp file
             unlink("./assets/tmp/{$tempDSP[filename]}");
             $origDSPname = $tempDSP['ofilename'];
         } else {
             $newDSPname = $digitalFilename[$value];
             $origDSPname = $digitalFilename[$value];
         }
         if (in_array($value, $originallySelectedDigitalSizes)) {
             //$dsp_price_clean = $cleanvalues->currency_clean(${'dsp_price_'.$value});
             $cleanDigitalPrice = $cleanCurrency->currency_clean($digitalPrice[$value]);
             if ($_SESSION['member']['membershipDetails']['contr_col'] == 0) {
                 $sql = "UPDATE {$dbinfo[pre]}media_digital_sizes SET \r\n\t\t\t\t\t\t\t\t\tmedia_id='{$mediaID}',\r\n\t\t\t\t\t\t\t\t\tds_id='{$value}',\r\n\t\t\t\t\t\t\t\t\tlicense='{$digitalLicense[$value]}',\r\n\t\t\t\t\t\t\t\t\tprice='{$cleanDigitalPrice}',\r\n\t\t\t\t\t\t\t\t\tprice_calc='norm',\r\n\t\t\t\t\t\t\t\t\tcredits='{$digitalCredits[$value]}',\r\n\t\t\t\t\t\t\t\t\tcredits_calc='norm',\r\n\t\t\t\t\t\t\t\t\tcustomized='1',\r\n\t\t\t\t\t\t\t\t\tfilename='{$newDSPname}',\r\n\t\t\t\t\t\t\t\t\tofilename='{$origDSPname}'\r\n\t\t\t\t\t\t\t\t\tWHERE media_id = '{$mediaID}' AND ds_id = '{$value}'";
                 $result = mysqli_query($db, $sql);
Example #11
0
     #(so user doesn't want upload a new file)
     #See http:/www.php.net/features.file-upload and http://www.php.net/manual/en/features.file-upload.errors.php about common errors
     #Not valid before PHP 4.2.0
     switch ($_FILES['NewLogo']['error']) {
         case 0:
             #There is no error, the file uploaded with success.
             #Gets filename
             $base = get_name_from_file($_FILES['NewLogo']['name']);
             $ext = get_extension_from_file($_FILES['NewLogo']['name']);
             $filename = $base . '.' . $ext;
             $i = 1;
             //counter, for file name appending purpose
             while (file_exists(DIR_LOGOS . $filename)) {
                 #This filename already exists, so we append it with 3-digits numeric value (e.g. 001, 002, ...).
                 #When 999 is overtaken, filename's appended by 1000, 1001, ..., 9999, 10000, ...
                 $filename = $base . zerofill($i, 3) . '.' . $ext;
                 $i++;
             }
             if (!move_uploaded_file($_FILES['NewLogo']['tmp_name'], DIR_LOGOS . $filename)) {
                 $errors[] = $Lang['Errors']['move_upload_error'];
             } else {
                 //Sets logo filename in card data
                 $card->logo = $filename;
             }
             break;
             #TODO : more explicit error messages
         #TODO : more explicit error messages
         default:
             $errors[] = $Lang['Errors']['other_upload_error'];
     }
 }