예제 #1
0
function timeFormat($time, $format = 'full')
{
    if ($time === '') {
        return '';
    }
    if ($format == 'ago') {
        $unit = 60;
        $p = time() - $time;
        if ($p / $unit < 1) {
            return $p / 1 . '秒前';
        }
        $unit *= 60;
        if ($p / $unit < 1) {
            return intval($p / 60) . '分钟前';
        }
        $unit *= 24;
        if ($p / $unit < 1) {
            return intval($p / 60 / 60) . '小时前';
        }
        $unit *= 30;
        if ($p / $unit < 1) {
            return intval($p / 60 / 60 / 24) . '天前';
        }
        return tm($time, 'full');
    }
    if ($format == 'full') {
        return date('Y-m-d H:i:s', $time);
    }
    if ($format == 'date') {
        return date('Y-m-d', $time);
    }
    if ($format == 'month') {
        return date('m-d', $time);
    }
}
예제 #2
0
파일: imp.php 프로젝트: abdeljawwad/sedr
function main($imp, $cmd)
{
    global $SIDU;
    if (!$SIDU[1]) {
        $err = @lang(2201);
    } elseif ($SIDU['eng'] == 'pg' && !$SIDU[2]) {
        $err = @lang(2202);
    }
    echo "<form action='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']}' method='post' enctype='multipart/form-data'>\n\t<div class='web'><p class='dot'><b>", @lang(2203), ": <i class='red'>DB = {$SIDU['1']}", $SIDU[2] ? ".{$SIDU['2']}" : "", "</i></b></p>";
    if ($err) {
        echo "<p class='err'>{$err}</p></div></form>";
        return;
    }
    if ($cmd) {
        $SIDU[4] = $imp['tab'];
    }
    if ($SIDU[4]) {
        $res = @tm("SQL", "SELECT * FROM " . @goodname($SIDU[4]) . " LIMIT 1");
        $col = @get_sql_col($res, $SIDU['eng']);
        foreach ($col as $v) {
            $imp['cols'][] = $v[0];
        }
    }
    if (!$imp['col']) {
        $imp['col'] = @implode("\n", $imp['cols']);
    }
    if ($cmd) {
        $err = @valid_data($SIDU, $imp);
        if ($err) {
            echo "<p class='err'>{$err}</p>";
        } else {
            return @save_data($SIDU, $imp);
        }
    }
    if ($SIDU['eng'] == 'my') {
        $sql = "SHOW TABLES from `{$SIDU['1']}`";
    } elseif ($SIDU['eng'] == 'sl') {
        $sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1";
    } else {
        $sql = "SELECT relname FROM pg_class a,pg_namespace b\nWHERE a.relnamespace=b.oid AND b.nspname='public' AND a.relkind='r' ORDER BY 1";
    }
    $arr = @sql2arr($sql, 1);
    $tabs[0] = @lang(2204);
    foreach ($arr as $v) {
        $tabs[$v] = $v;
    }
    echo "<table><tr><td>", @lang(2205), ":</td><td>", @html_form("select", "imp[tab]", $SIDU[4], "", "", "onchange=\"location='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},r,'+this.options[this.selectedIndex].value\"", $tabs), "</td></tr>";
    if ($SIDU[4]) {
        echo "<tr><td valign='top'>", @lang(2206), ":</td><td>", @html_form("textarea", "imp[col]", $imp['col'], 350, 90), "</td></tr>";
    }
    echo "<tr><td valign='top'>", @lang(2207), ":</td><td><input type='file' name='f'/> ", @lang(2208, '2MB'), "</td></tr></table>\n\t<p class='dot'><br/><b>", @lang(2209), ":</b></p>\n\t<p class='dot'>", @lang(2210), ": ", @html_form("text", "imp[sepC]", $imp['sepC'] ? $imp['sepC'] : ',', 50), " eg \\t , ; « | »\n\t<br/>", @lang(2211), " ", @html_form("text", "imp[cut1]", $imp['cut1'], 50), " ", @lang(2212), " ", @html_form("text", "imp[cut2]", $imp['cut2'], 50), " ", @lang(2213), "\n\t<br/>", @lang(2214), ": ", @html_form("text", "imp[pk]", $imp['pk'], 150), " eg. c1;c2\n\t<br/>", @html_form("checkbox", "imp[del]", $imp['del'], "", "", "", array(1 => '')), @lang(2215), "\n\t<br/>", @html_form("checkbox", "imp[merge]", $imp['merge'], "", "", "", array(1 => '')), @lang(2216), "\n\t<br/>", @html_form("checkbox", "imp[stop]", $imp['stop'], "", "", "", array(1 => '')), @lang(2217), "</p>\n\t<p>", @html_form("submit", "cmd", @lang(2218)), "</p></div></form>";
}
예제 #3
0
function save_data($SIDU, $txt, $eng)
{
    $txt = @trim($txt);
    if (@substr($txt, -1) == ')') {
        $txt = @trim(@substr($txt, 0, -1));
        if (@substr($txt, -1) == ',') {
            $txt = @substr($txt, 0, -1);
        }
        $txt .= ')';
    }
    $res = @tm("SQL", $txt);
    $err = @sidu_err(1);
    if ($err) {
        return $err;
    }
    echo @html_js("Goto('menu','menu.php?id={$SIDU['0']}',1);Goto('main','db.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']},{$SIDU['5']},{$SIDU['6']}',1);self.close()");
    exit;
}
예제 #4
0
function utm($lon, $lat)
{
    /* Convert lon/lat to UTM x/y */
    global $NORTH;
    global $workingUTMzone;
    // compute UTMzone
    list($UTMzone, $UTMlatZone) = getUTMzone($lon, $lat);
    //echo "$".$UTMzone."$";
    if ($UTMzone != $workingUTMzone) {
        initUTM($UTMzone);
    }
    if ($lon < 0.0) {
        $lon += 360.0;
    }
    list($x, $y) = tm($lon, $lat);
    $x += 500000.0;
    if ($lat < 0) {
        $y += 10000000.0;
    }
    /* For S hemisphere, add 10^6 m */
    return array($x, $y, $UTMzone, $UTMlatZone);
}
예제 #5
0
파일: tab.php 프로젝트: abdeljawwad/sedr
function save_data($SIDU, $eng, $cmd)
{
    foreach ($_POST as $k => $v) {
        if (@substr($k, 0, 5) == 'data_' || @substr($k, 0, 10) == 'cbox_data_') {
            $arr = @explode('_', $k, 3);
            $data[$arr[0]][$arr[1]][$arr[2]] = $v;
        }
    }
    foreach ($SIDU['col'] as $i => $v) {
        $col[] = $eng == 'pg' ? '"' . $v[0] . '"' : $v[0];
    }
    $tab = $eng == 'pg' ? '"' . $SIDU[2] . '"."' . $SIDU[4] . '"' : ($eng == 'my' ? "`{$SIDU['1']}`.`{$SIDU['4']}`" : $SIDU[4]);
    foreach ($data['cbox']['data'] as $i => $v) {
        //only need i
        unset($COL);
        unset($VAL);
        $where = '';
        $is_new = @substr($i, 0, 3) === 'new';
        if (!$is_new || $cmd == 'data_del') {
            foreach ($_POST['pkV'][$i] as $j => $v) {
                $where .= " and " . $col[$j] . (@strtoupper($v) === 'NULL' ? " IS NULL" : "='{$v}'");
            }
            $where = "WHERE " . @substr($where, 5);
        }
        if ($cmd == 'data_save') {
            foreach ($data['data'][$i] as $j => $v) {
                $v = @strip($v, 1, 0, 1);
                if (!$is_new || $eng != 'pg' || $v != '' || @substr($SIDU['col'][$j][3], 0, 8) != 'nextval(') {
                    if ($eng == 'pg' && $SIDU['page']['dataEasy']) {
                        if ($SIDU['col'][$j][1] == "smallint" || $SIDU['col'][$j][1] == "int") {
                            $v = @ceil($v);
                        } elseif ((@substr($SIDU['col'][$j][1], 0, 8) == "varchar(" || @substr($SIDU['col'][$j][1], 0, 5) == "char(") && @strtoupper($v) != 'NULL') {
                            $v = @trim(@substr($v, 0, $SIDU['col'][$j][4] - 4));
                        }
                    }
                    $COL[] = $col[$j];
                    $VAL[] = $v;
                }
                //above logic too complex - even myself forgot :D
            }
            if ($is_new && isset($COL)) {
                $res = @tm("insert", $tab, $COL, $VAL);
            } elseif (!$is_new) {
                $res = @tm("update", $tab, $COL, $VAL, $where);
            }
        } elseif ($cmd == 'data_del') {
            $res = @tm("delete", $tab, null, null, $where);
        }
        $errno = @sidu_err(1);
        if ($errno) {
            $err .= ($eng == 'pg' ? $errno : "Err {$errno}") . "\\n";
        } elseif ($cmd == "data_save") {
            echo @html_js("parent.document.dataTab.cbox_data_{$i}.checked=''");
        } elseif ($cmd == "data_del") {
            echo @html_js("parent.document.getElementById('tr_{$i}').style.display='none'");
        }
    }
    if ($err) {
        echo @html_js("alert('" . @strtr($err, @array("'" => "\\'", "\"" => "\\\"", "\n" => "\\n")) . "')");
    }
}
예제 #6
0
					<td id="tbl-msg">Message</td>
				</tr>
			</thead>
			<tbody>
				<?php 
foreach ($log as $l) {
    ?>
					<tr class="<?php 
    echo $l->mtype;
    ?>
">
						<td title="<?php 
    echo strip_tags(dt($l->timestamp));
    ?>
"><?php 
    echo tm($l->timestamp);
    ?>
</td>
					<?php 
    if ($l->mtype == 'user_message') {
        ?>
						<td>
							<?php 
        if ($l->type == 'message') {
            ?>
								<?php 
            echo ph($l->nickname);
            ?>
: <?php 
            echo add_irc_colors(_irc_link_links(ph($l->text)));
            ?>
 /**
  * Returns correctly formated date-time
  * @param mixed $date STRING(datestring) | INT(unix-time-format)
  * @param boolean $disable_wrapper disables the wrapper for moment.js
  * @return string
  */
 function dt_tm($time, $disable_wrapper = false)
 {
     return ($disable_wrapper ? '' : '<span data-moment="' . $time . '">') . dt($time, true) . ' ' . tm($time, true) . ($disable_wrapper ? '' : '</span>');
 }
예제 #8
0
 private function montos_punto_memo($monto)
 {
     // se convierte el monto a valor en letra
     $V = new EnLetras();
     $valor = explode(".", $monto);
     if (count($valor) > 1) {
         $con = strtoupper($V->ValorEnLetras($valor[0], " Bs. F Con "));
         return $con . strtoupper($V->ValorEnLetras($valor[1], " Centimos")) . " (Bs. F " . tm($monto) . ")";
     } else {
         return strtoupper($V->ValorEnLetras($valor[0], " Bs. F")) . " (Bs. F " . tm($monto) . ")";
     }
 }
예제 #9
0
파일: exp.php 프로젝트: abdeljawwad/sedr
function valid_data($SIDU, &$exp, $cmd)
{
    if (!$exp['db'] && !$exp['drop'] && !$exp['desc'] && !$exp['data']) {
        $exp['desc'] = $exp['data'] = 1;
    }
    if ($exp['drop']) {
        $exp['desc'] = 1;
    }
    if ($exp['ext'] != 'html' && $exp['ext'] != 'sql') {
        $exp['ext'] = 'csv';
    }
    //	if (!$cmd) $exp['zip'] = 1;//default save as zip
    $exp['where'] = @trim(@stripslashes($exp['where']));
    if (!$_GET['sql']) {
        if ($SIDU[4]) {
            $exp['tabs'][0] = $SIDU[4];
        } else {
            $exp['tabs'] = @explode(",", $_GET['tab']);
        }
        if ($SIDU['eng'] == 'my') {
            foreach ($exp['tabs'] as $tab) {
                $exp['sql'][] = "SELECT * FROM `{$SIDU['1']}`.`{$tab}`";
            }
        } elseif ($SIDU['eng'] == 'pg') {
            foreach ($exp['tabs'] as $tab) {
                $exp['sql'][] = "SELECT * FROM \"{$SIDU['2']}\".\"{$tab}\"";
            }
        } else {
            foreach ($exp['tabs'] as $tab) {
                $exp['sql'][] = "SELECT * FROM {$tab}";
            }
        }
        if (!$exp['sql'][1]) {
            $res = @tm("SQL", $exp['sql'][0] . " LIMIT 1");
            $col = @get_sql_col($res, $SIDU['eng']);
            foreach ($col as $v) {
                $exp['tab_col'][] = $v[0];
            }
            if ($exp['tab_col'] != $exp['col']) {
                foreach ($exp['col'] as $k => $v) {
                    $exp['col'][$k] = @goodname($v);
                }
                $exp['sql'][0] = "SELECT " . @implode(",", $exp['col']) . @substr($exp['sql'][0], 8);
            }
            if ($exp['where']) {
                $exp['sql'][0] .= " WHERE {$exp['where']}";
            }
        }
    } else {
        $exp['sql'][0] = $_GET['sql'];
    }
}
예제 #10
0
 private function migrarInformeSocioEconomico()
 {
     $tipos = ['Q' => 1, 'A' => 2, 'H' => 3, 'C' => 4, 'R' => 5, 'O' => 6];
     $tenencias = ['P' => 1, 'A' => 2, 'D' => 3, 'L' => 4, 'O' => 5, 'C' => 6, 'I' => 7];
     $this->info("Migrando informes socio economicos");
     $this->getTable('inf_social')->chunk(1000, function ($informes) use($tipos, $tenencias) {
         foreach ($informes as $informe) {
             $this->info("Migrando informe de la solicitud: " . $informe->idsolicitud);
             $solicitud = Solicitud::findOrFail($informe->idsolicitud);
             $solicitud->desabilitarConcurrencia();
             $solicitud->desabilitarValidaciones();
             $solicitud->tipo_vivienda_id = $tipos[$informe->tipocasa];
             $solicitud->tenencia_id = $tenencias[$informe->tipotenencia];
             $solicitud->informe_social = $informe->observaciones;
             $solicitud->total_ingresos = tm($informe->totalingresos);
             $solicitud->save();
         }
     });
 }
예제 #11
0
</head>

<body>
<p align="center">
  <img src="<?php 
tm('site_logo');
?>
" alt="*" height="150">
  <br/>
  Seja bem-vindo ao <b><?php 
tm('site_name');
?>
</b>, onde os caminhos se encontram.
  </p>
<p align="center"><?php 
tm('content');
?>
</p>
<p align="center"><?php 
tm("menu");
?>
</p>
<div style="background-color: #00ff33" align="center"><b><br/>
<?php 
tm('power');
tm('footer');
?>
</b>
</div>
</body>
</html>
예제 #12
0
파일: db.php 프로젝트: abdeljawwad/sedr
function main_func($SIDU, $link, $conn)
{
    $col = @array('OID' => 'oid', 'Func' => 'proname', 'Owner' => 'towner', 'return' => 'prorettype', 'lang' => 'prolang', 'Definition' => 'prosrc', 'Comment' => 'comm');
    @db_conn($conn, $link[1]);
    $lang = @sql2arr("SELECT oid,lanname FROM pg_language", 2);
    $typ = @sql2arr("SELECT oid,typname FROM pg_type", 2);
    $res = @tm("SQL", "SELECT b.proname,b.oid,pg_get_userbyid(b.proowner) AS towner,b.pronamespace,\nobj_description(b.oid,'pg_proc') AS comm,b.proargtypes,b.prorettype,b.prolang,b.prosrc\nFROM pg_namespace a,pg_proc b\nWHERE a.oid=b.pronamespace AND a.nspname='{$link['2']}'" . ($link[4] != '' ? " AND b.proname LIKE '{$link['4']}%'" : "") . " ORDER BY 1");
    while ($row = @pg_fetch_array($res)) {
        $row['prorettype'] = $typ[$row['prorettype']];
        $row['prolang'] = $lang[$row['prolang']];
        $para = @explode(" ", @trim($row['proargtypes']));
        unset($parr);
        foreach ($para as $v) {
            $parr[] = $typ[$v];
        }
        $para = @implode(",", $parr);
        if ($para) {
            $row['proname'] .= "({$para})";
        }
        foreach ($col as $k => $v) {
            $data[$k] = $row[$v];
        }
        $arr[] = $data;
    }
    @cout_obj($SIDU, $link, $arr, $col);
}
예제 #13
0
 public function getTotalIngresosForAttribute()
 {
     return tm($this->total_ingresos);
 }
예제 #14
0
파일: scheduler.php 프로젝트: rrsc/freemed
<?php

// $Id$
//
// Authors:
//      Jeff Buchbinder <*****@*****.**>
//
// FreeMED Electronic Medical Record and Practice Management System
// Copyright (C) 1999-2012 FreeMED Software Foundation
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include_once dirname(__FILE__) . '/bootstrap.test.php';
tm("org.freemedsoftware.api.Scheduler.GetDailyAppointments", array('2006-11-30'));
tm("org.freemedsoftware.api.Scheduler.FindDateAppointments", array('2006-11-30'));
// org.freemedsoftware.api.Scheduler.FindGroupAppointments ( group_id )
tm("org.freemedsoftware.api.Scheduler.GetAppointment", array(1));
// org.freemedsoftware.api.Scheduler.CopyAppointment ( group_id, date )
// org.freemedsoftware.api.Scheduler.CopyGroupAppointment ( group_id, date )
// org.freemedsoftware.api.Scheduler.SetAppointment ( hash of data )
예제 #15
0
파일: menu.php 프로젝트: abdeljawwad/sedr
function menu_sl($conn, $tree)
{
    global $SIDU;
    foreach ($conn[6] as $db) {
        $SIDU['dbL'] = @db_conn($conn, $db);
        $arr[$db][0]['r'] = array();
        $res = @tm("SQL", "SELECT type,name FROM sqlite_master ORDER BY 2");
        while ($row = @sqlite_fetch_array($res, SQLITE_NUM)) {
            if ($row[0] == 'table') {
                @menu_tree_init($arr[$db][0]['r'], $row[1], $tree);
            } elseif ($row[0] == 'view') {
                @menu_tree_init($arr[$db][0]['v'], $row[1], $tree);
            }
        }
        @menu_tree_init($arr[$db][0]['r'], "sqlite_master", $tree);
    }
    return $arr;
}
예제 #16
0
 public function getMontoaprForAttribute()
 {
     return tm($this->montoapr);
 }
예제 #17
0
 public function getCoberturaAttribute($value)
 {
     return tm($value);
 }
예제 #18
0
 public function atualizarEstatus($data, $autorizador_id = null)
 {
     list($cont_aprobados, $cont_devueltos, $cont_procesados, $cont_total) = array(0, 0, 0, 0);
     $presupuestos_model = Presupuesto::where('solicitud_id', '=', $data['solicitud']['id'])->get();
     $cont_total = count($presupuestos_model);
     if (!empty($presupuestos_model)) {
         foreach ($presupuestos_model as $presupuesto_model) {
             if ($presupuesto_model->estatus_doc == "APR") {
                 $cont_aprobados++;
             }
             if ($presupuesto_model->estatus_doc == "PPA") {
                 $cont_procesados++;
             }
             if ($presupuesto_model->estatus_doc == "DEV") {
                 $cont_devueltos++;
             }
         }
     }
     $solicitud_model = Solicitud::where('id', '=', $data['solicitud']['id'])->first();
     if ($cont_aprobados == $cont_total) {
         if (!empty($solicitud_model)) {
             $solicitud_model->estatus = "APR";
             $solicitud_model->save();
         }
     } elseif ($cont_devueltos > 0) {
         if (!empty($solicitud_model)) {
             $solicitud_model->estatus = "DEV";
             $solicitud_model->save();
         }
     } elseif ($cont_procesados > 0) {
         if (!empty($solicitud_model)) {
             $solicitud_model->estatus = "PPA";
             $solicitud_model->usuario_autorizacion_id = $autorizador_id;
             $solicitud_model->beneficiario_json = json_encode($solicitud_model->personaBeneficiario->toArray());
             if (is_object($solicitud_model->personaSolicitante)) {
                 $solicitud_model->solicitante_json = json_encode($solicitud_model->personaSolicitante->toArray());
             }
             $solicitud_model->total_ingresos = tm($solicitud_model->total_ingresos);
             $solicitud_model->save();
         }
     }
     return;
 }
예제 #19
0
 public function getMontoMensualForAttribute()
 {
     return tm($this->monto_mensual);
 }
예제 #20
0
function sidu_sl_pk($tab)
{
    $res = @tm("SQL", "pragma table_info({$tab})");
    while ($row = @sqlite_fetch_array($res)) {
        if ($row['pk']) {
            $pk[] = $row['name'];
        }
    }
    return @implode(',', $pk);
}
예제 #21
0
tm('site_logo');
?>
" align="right" width="130">
  <?php 
tm('site_name');
?>
  <br/>
</div>
<div class="menubar"><?php 
tm('menu');
?>
</div>
<div id="content" class="content">
<?php 
tm('content');
?>
</div> <!-- content -->
</div> <!-- page -->
<div id="footer" class="footer">
<?php 
tm('footer');
?>
<br/>
<!-- Não remova a atribuição! -->
<font size="1"><?php 
tm('power');
?>
</font>
</div> <!-- footer -->
</body>
</html>
예제 #22
0
">Edit post</a></li>
	</ul><?php 
}
?>
	<div class="spotlight">
		<a href="<?php 
echo site_url('user/' . $creator->id);
?>
"><div class="avatar" style="background-image:url(<?php 
echo avatar_image($creator->id);
?>
);"></div><?php 
echo showname($creator);
?>
		<br /><span class="date" title="<?php 
echo tm($entry->timestamp, true);
?>
"><?php 
echo dt($entry->timestamp);
?>
</span></a>
		<em><?php 
echo d($creator->about);
?>
</em>
	</div>
	<center>
		<?php 
echo $rating->display_large();
?>
	</center>