本文整理汇总了PHP中formatTimeStamp函数的典型用法代码示例。如果您正苦于以下问题:PHP formatTimeStamp函数的具体用法?PHP formatTimeStamp怎么用?PHP formatTimeStamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatTimeStamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showPages
/**
* Muestra los envíos existentes
*/
function showPages($acceso = -1)
{
global $mc, $xoopsModule, $xoopsSecurity;
$keyw = rmc_server_var($_REQUEST, 'keyw', '');
$acceso = rmc_server_var($_REQUEST, 'acceso', -1);
$cat = rmc_server_var($_REQUEST, 'cat', '');
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT COUNT(*) FROM " . $db->prefix("qpages_pages");
if ($acceso >= 0) {
$sql .= " WHERE acceso={$acceso}";
}
if (trim($keyw) != '') {
$sql .= ($acceso >= 0 ? " AND " : " WHERE ") . "titulo LIKE '%{$keyw}%'";
}
if (isset($cat) && $cat > 0) {
$sql .= ($acceso >= 0 || $keyw != '' ? " AND " : " WHERE ") . "cat='{$cat}'";
}
/**
* Paginacion de Resultados
*/
$page = rmc_server_var($_REQUEST, 'page', 1);
$page = $page <= 0 ? 1 : $page;
$limit = 15;
list($num) = $db->fetchRow($db->query($sql));
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url('pages.php?cat=' . $cat . '&page={PAGE_NUM}');
$sql .= " ORDER BY id_page DESC LIMIT {$start},{$limit}";
$sql = str_replace("SELECT COUNT(*)", "SELECT *", $sql);
$result = $db->query($sql);
$pages = array();
while ($row = $db->fetchArray($result)) {
$p = new QPPage();
$p->assignVars($row);
# Enlaces para las categorías
$catego = new QPCategory($p->getCategory());
$pages[] = array('id' => $p->getID(), 'titulo' => $p->getTitle(), 'catego' => $catego->getName(), 'fecha' => formatTimeStamp($p->getDate(), 's'), 'link' => $p->getPermaLink(), 'estado' => $p->getAccess(), 'modificada' => $p->getModDate() == 0 ? '--' : formatTimestamp($p->getModDate(), 'c'), 'lecturas' => $p->getReads(), 'order' => $p->order(), 'type' => $p->type(), 'desc' => $p->getDescription());
}
/**
* Cargamos las categorias
*/
$categos = array();
qpArrayCategos($categos);
$categories = array();
foreach ($categos as $k) {
$categories[] = array('id' => $k['id_cat'], 'nombre' => $k['nombre'], 'saltos' => $k['saltos']);
}
RMTemplate::get()->add_style('admin.css', 'qpages');
RMTemplate::get()->add_script('../include/js/qpages.js');
RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
RMTemplate::get()->assign('xoops_pagetitle', __('Pages Management', 'qpages'));
xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> » ' . ($acceso < 0 ? __('All Pages', 'qpages') : ($acceso == 0 ? __('Draft pages', 'qpages') : __('Published pages', 'qpages'))));
xoops_cp_header();
include RMTemplate::get()->get_template("admin/qp_pages.php", 'module', 'qpages');
xoops_cp_footer();
}
示例2: showAlbums
/**
* @desc Visualiza todos los albums
**/
function showAlbums()
{
global $tpl, $xoopsModule, $mc, $xoopsSecurity;
define('RMSUBLOCATION', 'sets');
$db = Database::getInstance();
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$limit = 15;
$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'id_set';
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 1;
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
$query = "search={$search}&page={$page}&sort={$sort}&mode={$mode}";
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_sets');
$sql1 = '';
$words = array();
if ($search) {
//Separamos en palabras
$words = explode(" ", $search);
foreach ($words as $k) {
$k = trim($k);
if (strlen($k) <= 2) {
continue;
}
$sql1 .= $sql1 == '' ? " WHERE (title LIKE '%{$k}%' OR uname LIKE '%{$k}%')" : " OR (title LIKE '%{$k}%' OR uname LIKE '%{$k}%')";
}
}
list($num) = $db->fetchRow($db->query($sql . $sql1));
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$tpages = ceil($num / $limit);
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url("sets.php?page={PAGE_NUM}&sort={$sort}&mode={$mode}&search={$search}");
//Fin de barra de navegación
$sql = str_replace('COUNT(*)', '*', $sql);
$sql2 = $sort ? " ORDER BY {$sort} " . ($mode ? "DESC" : "ASC ") : '';
$sql2 .= " LIMIT {$start},{$limit}";
$result = $db->query($sql . $sql1 . $sql2);
$sets = array();
while ($rows = $db->fetchArray($result)) {
foreach ($words as $k) {
$rows['title'] = eregi_replace("({$k})", "<span class='searchResalte'>\\1</span>", $rows['title']);
$rows['uname'] = eregi_replace("({$k})", "<span class='searchResalte'>\\1</span>", $rows['uname']);
}
$set = new GSSet();
$set->assignVars($rows);
$sets[] = array('id' => $set->id(), 'title' => $set->title(), 'owner' => $set->uname(), 'public' => $set->isPublic(), 'date' => formatTimeStamp($set->date(), 'c'), 'pics' => $set->pics(), 'url' => $set->url());
}
GSFunctions::toolbar();
xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Albums Management', 'galleries'));
RMTemplate::get()->assign('xoops_pagetitle', 'Albums Management');
RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
RMTemplate::get()->add_head("<script type='text/javascript'>\n\n var delete_warning='" . __('Do you really wish to delete selected albums?', 'galleries') . "';\n\n var delete_formats='" . __('Do you really wish to delete all images formats for this album?\\nOnly deletes formats for albums, search and others, except normal thumbnails.', 'galleries') . "';\n\n </script>");
RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets');
$cHead = '<link href="' . XOOPS_URL . '/modules/galleries/styles/admin.css" media="all" rel="stylesheet" type="text/css" />';
xoops_cp_header($cHead);
include RMTemplate::get()->get_template('admin/gs_albums.php', 'module', 'galleries');
xoops_cp_footer();
}
示例3: showWorks
/**
* @desc Visualiza todos los trabajos existentes
**/
function showWorks()
{
global $xoopsModule, $xoopsSecurity;
$db = XoopsDatabaseFactory::getDatabaseConnection();
$page = rmc_server_var($_REQUEST, 'page', 1);
$limit = rmc_server_var($_REQUEST, 'limit', 15);
$show = rmc_server_var($_REQUEST, 'show', '');
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('pw_works');
if ($show == 'public') {
$sql .= " WHERE public=1";
} elseif ($show == 'hidden') {
$sql .= " WHERE public=0";
}
list($num) = $db->fetchRow($db->query($sql));
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url('works.php?page={PAGE_NUM}');
$sql = "SELECT * FROM " . $db->prefix('pw_works');
if ($show == 'public') {
$sql .= " WHERE public=1";
} elseif ($show == 'hidden') {
$sql .= " WHERE public=0";
}
$sql .= " ORDER BY id_work DESC LIMIT {$start}, {$limit}";
$result = $db->query($sql);
$works = array();
//Container
while ($row = $db->fetchArray($result)) {
$work = new PWWork();
$work->assignVars($row);
//Obtenemos la categoría
$cat = new PWCategory($work->category());
//Obtenemos el cliente
$user = new PWClient($work->client());
$works[] = array('id' => $work->id(), 'title' => $work->title(), 'catego' => $cat->name(), 'client' => $user->name(), 'start' => formatTimeStamp($work->start(), 's'), 'mark' => $work->mark(), 'public' => $work->isPublic(), 'description' => $work->descShort());
}
PWFunctions::toolbar();
RMTemplate::get()->add_style('admin.css', 'works');
RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
RMTemplate::get()->add_script('../include/js/admin_works.js');
RMTemplate::get()->add_head("<script type='text/javascript'>\nvar pw_message='" . __('Do you really want to delete selected works?', 'works') . "';\n\n var pw_select_message = '" . __('You must select some work before to execute this action!', 'works') . "';</script>");
xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » " . __('Works', 'works'));
xoops_cp_header();
include RMTemplate::get()->get_template("admin/pw_works.php", 'module', 'works');
xoops_cp_footer();
}
示例4: showUsers
/**
* @desc Visualiza todos los usuarios existentes
**/
function showUsers()
{
global $xoopsModule, $db, $tpl, $xoopsSecurity;
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$limit = 15;
$search = rmc_server_var($_REQUEST, 'search', '');
$db = XoopsDatabaseFactory::getDatabaseConnection();
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users');
$sql1 = '';
$search = trim($search);
if ($search && strlen($search) > 2) {
$sql1 .= $sql1 == '' ? " WHERE (uname LIKE '%{$search}%')" : " OR (uname LIKE '%{$search}%')";
}
list($num) = $db->fetchRow($db->query($sql . $sql1));
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$tpages = ceil($num / $limit);
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url("users.php?page={PAGE_NUM}&search={$search}");
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
//Fin de barra de navegación
$sql = "SELECT * FROM " . $db->prefix('gs_users');
$sql2 = " LIMIT {$start},{$limit}";
$result = $db->query($sql . $sql1 . $sql2);
while ($rows = $db->fetchArray($result)) {
$uname = eregi_replace("({$search})", "<span class='searchResalte'>\\1</span>", $rows['uname']);
$user = new GSUser();
$user->assignVars($rows);
$users[] = array('id' => $user->id(), 'uid' => $user->uid(), 'uname' => $uname, 'quota' => RMUtilities::formatBytesSize($user->quota()), 'blocked' => $user->blocked(), 'used' => GSFunctions::makeQuota($user), 'pics' => $user->pics(), 'sets' => $user->sets(), 'date' => formatTimeStamp($user->date(), 'custom'), 'url' => $user->userUrl());
}
GSFunctions::toolbar();
xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Users management', 'galleries'));
RMTemplate::get()->assign('xoops_pagetitle', __('Users management', 'galleries'));
RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets&form=frm-users');
RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected users?', 'galleries') . "';\n</script>");
xoops_cp_header();
include RMTemplate::get()->get_template("admin/gs_users.php", 'module', 'galleries');
xoops_cp_footer();
}
示例5: showAnnounces
/**
* @desc Muestra la lista de los anuncios existentes
*/
function showAnnounces()
{
global $db, $xoopsModule, $xoopsSecurity;
$result = $db->query("SELECT * FROM " . $db->prefix("bxpress_announcements") . " ORDER BY date");
$announcements = array();
while ($row = $db->fetchArray($result)) {
$an = new bXAnnouncement();
$an->assignVars($row);
$announcements[] = array('id' => $an->id(), 'text' => TextCleaner::getInstance()->truncate($an->text(), 100), 'date' => formatTimestamp($an->date()), 'expire' => formatTimeStamp($an->expire()), 'where' => constant('BX_FWHERE' . $an->where()), 'wherelink' => $an->where() == 1 ? '../forum.php?id=' . $an->forum() : '../', 'by' => $an->byName());
}
$announcements = RMEvents::get()->run_event('bxpress.announcements.list', $announcements);
RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/anuncios/standalone/1/');
bXFunctions::menu_bar();
xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Announcements Management', 'bxpress'));
xoops_cp_header();
RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
RMTemplate::get()->add_style('admin.css', 'bxpress');
RMTemplate::get()->add_local_script('admin.js', 'bxpress');
include RMTemplate::get()->get_template("admin/forums_announcements.php", 'module', 'bxpress');
xoops_cp_footer();
}
示例6: showAnnounces
/**
* @desc Muestra la lista de los anuncios existentes
*/
function showAnnounces()
{
global $db, $xoopsModule, $xoopsSecurity;
$result = $db->query("SELECT * FROM " . $db->prefix("mod_bxpress_announcements") . " ORDER BY date");
$announcements = array();
while ($row = $db->fetchArray($result)) {
$an = new bXAnnouncement();
$an->assignVars($row);
$announcements[] = array('id' => $an->id(), 'text' => TextCleaner::getInstance()->truncate($an->text(), 100), 'date' => formatTimestamp($an->date()), 'expire' => formatTimeStamp($an->expire()), 'where' => constant('BX_FWHERE' . $an->where()), 'wherelink' => $an->where() == 1 ? '../forum.php?id=' . $an->forum() : '../', 'by' => $an->byName());
}
$announcements = RMEvents::get()->run_event('bxpress.announcements.list', $announcements);
RMTemplate::get()->add_help(__('Announcements Help', 'bxpress'), '#');
$bc = RMBreadCrumb::get();
$bc->add_crumb(__('Announcements Management', 'bxpress'));
xoops_cp_header();
RMTemplate::get()->add_script('jquery.checkboxes.js', 'rmcommon', array('directory' => 'include'));
RMTemplate::get()->add_style('admin.css', 'bxpress');
RMTemplate::get()->add_script('admin.js', 'bxpress');
include RMTemplate::get()->get_template("admin/forums-announcements.php", 'module', 'bxpress');
xoops_cp_footer();
}
示例7: b_xoopspoll_show
function b_xoopspoll_show()
{
//echo "a";
global $xoopsUser;
$block = array();
$polls =& XoopsPoll::getAll(array('display=1'), true, 'weight ASC, end_time DESC');
$count = count($polls);
$block['lang_vote'] = _PL_VOTE;
$block['lang_results'] = _PL_RESULTS;
$block['lang_expires'] = _PL_WILLEXPIRE;
$block['lang_expired'] = _PL_HASEXPIRED;
for ($i = 0; $i < $count; $i++) {
$options_arr =& XoopsPollOption::getAllByPollId($polls[$i]->getVar('poll_id'));
$option_type = 'radio';
$option_name = 'option_id';
if ($polls[$i]->getVar('multiple') == 1) {
$option_type = 'checkbox';
$option_name .= '[]';
}
$totalVotes=$polls[$i]->getVar('votes');
$uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
if ( XoopsPollLog::hasVoted($polls[$i]->getVar('poll_id'), xoops_getenv('REMOTE_ADDR'),$uid)){
$hasVoted=1;
}else{
$hasVoted=0;
}
foreach ($options_arr as $option) {
$percent = intval(100 * $option->getVar("option_count") / $totalVotes).'%';
$options[] = array('id' => $option->getVar('option_id'), 'text' => $option->getVar('option_text'), 'count' => $option->getVar('option_count'), 'percent'=>$percent, 'color'=>$option->getVar('option_color'));
}
$poll = array('id' => $polls[$i]->getVar('poll_id'), 'question' => $polls[$i]->getVar('question'), 'option_type' => $option_type, 'option_name' => $option_name, 'options' => $options,'has_expired'=>$polls[$i]->hasExpired(), 'votes' => $polls[$i]->getVar('votes'), 'has_voted'=>$hasVoted, 'end_time'=>formatTimeStamp($polls[$i]->getVar('end_time'), "m"));
$block['polls'][] =& $poll;
unset($options);
unset($poll);
}
return $block;
}
示例8: b_xoopspoll_show
function b_xoopspoll_show()
{
global $xoopsUser;
$block = array();
$polls =& XoopsPoll::getAll(array('display=1'), true, 'weight ASC, end_time DESC');
$count = count($polls);
$block['lang_vote'] = _PL_VOTE;
$block['lang_results'] = _PL_RESULTS;
$block['lang_expires'] = _PL_WILLEXPIRE;
$block['lang_expired'] = _PL_HASEXPIRED;
$block['lang_comments'] = _PL_COMMENTS;
$block['lang_comment'] = _PL_COMMENT;
$block['url'] = "http" . (!empty($_SERVER['HTTPS']) ? "s" : "") . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
for ($i = 0; $i < $count; $i++) {
$options_arr =& XoopsPollOption::getAllByPollId($polls[$i]->getVar('poll_id'));
$option_type = 'radio';
$option_name = 'option_id';
if ($polls[$i]->getVar('multiple') == 1) {
$option_type = 'checkbox';
$option_name .= '[]';
}
$totalVotes = $polls[$i]->getVar('votes');
$uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
if (XoopsPollLog::hasVoted($polls[$i]->getVar('poll_id'), xoops_getenv('REMOTE_ADDR'), $uid)) {
$hasVoted = 1;
} else {
$hasVoted = 0;
}
foreach ($options_arr as $option) {
$percent = intval(100 * $option->getVar("option_count") / $totalVotes) . '%';
$options[] = array('id' => $option->getVar('option_id'), 'text' => $option->getVar('option_text'), 'count' => $option->getVar('option_count'), 'percent' => $percent, 'color' => $option->getVar('option_color'));
}
$poll = array('id' => $polls[$i]->getVar('poll_id'), 'question' => $polls[$i]->getVar('question'), 'option_type' => $option_type, 'option_name' => $option_name, 'options' => $options, 'has_expired' => $polls[$i]->hasExpired(), 'votes' => $polls[$i]->getVar('votes'), 'has_voted' => $hasVoted, 'totalVotes' => sprintf(_PL_TOTALVOTES, $totalVotes), 'comments' => XoopsPoll::getcomments($polls[$i]->getVar('poll_id')), 'end_time' => formatTimeStamp($polls[$i]->getVar('end_time'), "m"), 'comment_mode' => XoopsPollLog::commentMode());
$block['polls'][] =& $poll;
unset($options);
unset($poll);
}
return $block;
}
示例9: printf
$fuser_avatar = $foundusers[$j]->getVar("user_avatar") ? "<img src='" . XOOPS_UPLOAD_URL . "/" . $foundusers[$j]->getVar("user_avatar") . "' alt='' />" : " ";
$fuser_name = $foundusers[$j]->getVar("name") ? $foundusers[$j]->getVar("name") : " ";
echo "<tr class='{$class}'><td align='center'><input type='checkbox' name='memberslist_id[]' id='memberslist_id[]' value='" . $foundusers[$j]->getVar("uid") . "' /><input type='hidden' name='memberslist_uname[" . $foundusers[$j]->getVar("uid") . "]' id='memberslist_uname[]' value='" . $foundusers[$j]->getVar("uname") . "' /></td>";
echo "<td>{$fuser_avatar}</td><td><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $foundusers[$j]->getVar("uid") . "'>" . $foundusers[$j]->getVar("uname") . "</a></td><td>" . $fuser_name . "</td><td align='center'><a href='mailto:" . $foundusers[$j]->getVar("email") . "'><img src='" . XOOPS_URL . "/images/icons/email.gif' border='0' alt='";
printf(_SENDEMAILTO, $foundusers[$j]->getVar("uname", "E"));
echo "' /></a></td><td align='center'><a href='javascript:openWithSelfMain(\"" . XOOPS_URL . "/pmlite.php?send2=1&to_userid=" . $foundusers[$j]->getVar("uid") . "\",\"pmlite\",450,370);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' border='0' alt='";
printf(_SENDPMTO, $foundusers[$j]->getVar("uname", "E"));
echo "' /></a></td><td align='center'>";
if ($foundusers[$j]->getVar("url", "E") != "") {
echo "<a href='" . $foundusers[$j]->getVar("url", "E") . "' target='_blank'><img src='" . XOOPS_URL . "/images/icons/www.gif' border='0' alt='" . _VISITWEBSITE . "' /></a>";
} else {
echo " ";
}
echo "</td><td align='center'>" . formatTimeStamp($foundusers[$j]->getVar("user_regdate"), "s") . "</td><td align='center'>";
if ($foundusers[$j]->getVar("last_login") != 0) {
echo formatTimeStamp($foundusers[$j]->getVar("last_login"), "m");
} else {
echo " ";
}
echo "</td><td align='center'>" . $foundusers[$j]->getVar("posts") . "</td>";
echo "<td align='center'><a href='" . XOOPS_URL . "/modules/system/admin.php?fct=users&uid=" . $foundusers[$j]->getVar("uid") . "&op=modifyUser'>" . _EDIT . "</a></td></tr>\n";
}
echo "<tr class='foot'><td><select name='fct'><option value='users'>" . _DELETE . "</option><option value='mailusers'>" . _AM_SENDMAIL . "</option>";
$group = !empty($_POST['group']) ? intval($_POST['group']) : 0;
if ($group > 0) {
$member_handler =& xoops_gethandler('member');
$add2group =& $member_handler->getGroup($group);
echo "<option value='groups' selected='selected'>" . sprintf(_AM_ADD2GROUP, $add2group->getVar('name')) . "</option>";
}
echo "</select> ";
if ($group > 0) {
示例10: cleanMessage
}
$message = cleanMessage($_POST['message'], $max_chars, $userid);
if (!is_numeric($message) || $message > 5) {
$fields = array('userid' => $userid, 'message' => $message, 'img' => $img, 'time_start' => $_POST['time_start'], 'time_end' => $_POST['time_end'], 'days' => $_POST['days'], 'hour' => $_POST['hour'], 'publish_fb' => $_POST['publish_fb'], 'publish_tw' => $_POST['publish_tw'], 'publish_fbp' => $_POST['publish_fbp'], 'publish_fbgp' => $_POST['publish_group']);
if (is_array($fields = makeTimes($fields))) {
if ($_POST['edit'] == true) {
unset($fields['userid']);
if ($hdb->doUpdate($table, $fields, " id=" . $hdb->quote($_POST['mes_id']) . " AND userid=" . $hdb->quote($userid))) {
$return = array("e" => 0, "c" => array("i" => $_POST['mes_id'], "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp']));
} else {
error_log($hdb->errorInfo());
$return = array("e" => 2);
}
} else {
if ($hdb->doInsert($table, $fields)) {
$return = array("e" => 0, "c" => array("i" => $hdb->lastInsertId(), "m" => $fields['message'], "p" => $fields['img'], "ts_es" => formatTimeStamp($fields['time_start']), "ts_en" => date('Y-m-d', $fields['time_start']), "te_es" => formatTimeStamp($fields['time_end']), "te_en" => date('Y-m-d', $fields['time_end']), "t_p" => $fields['img'], "d" => $fields['days'], "h" => formatHour($fields['hour']), "tw" => $fields['publish_tw'], "fb" => $fields['publish_fb'], "fbp" => $fields['publish_fbp'], "gp" => $fields['publish_fbgp']));
} else {
error_log($hdb->errorInfo());
$return = array("e" => 2);
}
}
} else {
$return = array("e" => $fields);
}
} else {
$return = array("e" => $message);
}
} else {
$return = array("e" => 1);
}
} else {
示例11: get_works
/**
* Get works based on given parameters
*/
public function get_works($limit, $category = null, $public = 1, $object = true, $order = "created DESC")
{
global $xoopsModule, $xoopsModuleConfig;
include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php';
include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php';
include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT * FROM " . $db->prefix('pw_works') . " WHERE public={$public}";
$sql .= $category > 0 ? " AND catego='{$category}'" : '';
$sql .= $order != '' ? " ORDER BY {$order}" : '';
$sql .= " LIMIT 0,{$limit}";
if ($xoopsModule && $xoopsModule->dirname() == 'works') {
$mc =& $xoopsModuleConfig;
} else {
$mc = RMUtilities::module_config('works');
}
$result = $db->query($sql);
$works = array();
while ($row = $db->fetchArray($result)) {
$work = new PWWork();
$work->assignVars($row);
$ret = array();
if (!isset($categos[$work->category()])) {
$categos[$work->category()] = new PWCategory($work->category());
}
if (!isset($clients[$work->client()])) {
$clients[$work->client()] = new PWClient($work->client());
}
$ret = array('id' => $work->id(), 'title' => $work->title(), 'desc' => $work->descShort(), 'catego' => $categos[$work->category()]->name(), 'client' => $clients[$work->client()]->name(), 'link' => $work->link(), 'created' => formatTimeStamp($work->created(), 's'), 'created_time' => $work->created(), 'image' => XOOPS_UPLOAD_URL . '/works/ths/' . $work->image(), 'rating' => PWFunctions::rating($work->rating()), 'featured' => $work->mark(), 'linkcat' => $categos[$work->category()]->link(), 'metas' => $work->get_metas());
if ($object) {
$w = new stdClass();
foreach ($ret as $var => $value) {
$w->{$var} = $value;
}
$works[] = $w;
} else {
$works[] = $ret;
}
}
return $works;
}
示例12: while
while ($fila = $result->fetch_assoc()) {
?>
<tr>
<td><a target="_blank" href="articulo.php?id=<?php
echo $fila['articulo_id'];
?>
" title="Ver más"><?php
echo ucfirst($fila['articulo_titulo']);
?>
</a></td>
<td><?php
echo ucfirst($fila['cat_nombre']);
?>
</td>
<td><?php
echo formatTimeStamp($fila['articulo_fecha_creacion']);
?>
</td>
</tr>
<?php
}
// echo $query;
?>
</table>
</div>
<div class="paginacion">
<?php
if ($p_actual > 2) {
?>
示例13: ucfirst
<tr>
<td><?php
echo ucfirst($fila['usuario_nombre']);
?>
</td>
<td><?php
echo ucfirst($fila['usuario_apellido']);
?>
</td>
<td><?php
echo ucwords($fila['usuario_correo']);
?>
</td>
<td><?php
echo formatTimeStamp($fila['usuario_fecha_registro']);
?>
</td>
<td class="eliminar"><?php
echo '<a href="eliminarUsuarios.php?usuario_id=' . $fila[usuario_id] . '&usuario_nombre=' . $fila[usuario_nombre] . '&usuario_apellido=' . $fila[usuario_apellido] . '">×</a>';
?>
</td>
</tr>
<?php
}
?>
</table>
</div>
<div class="paginacion">
示例14: ucfirst
<td><?php
echo ucfirst($fila['cat_nombre']);
?>
</td>
<td><?php
echo ucwords($fila['usuario_nombre'] . ' ' . $fila['usuario_apellido']);
?>
</td>
<td><?php
echo formatTimeStamp($fila['articulo_fecha_creacion']);
?>
</td>
<td><?php
//es posible que la imagen no registre modificaciones hasta el momento:
if ($fila['articulo_fecha_modificacion'] != '') {
echo formatTimeStamp($fila['articulo_fecha_modificacion']);
} else {
echo 'Sin modificar';
}
?>
</td>
<td><?php
if ($fila['articulo_estado'] == 1) {
echo 'Visible';
} elseif ($fila['articulo_estado'] == 2) {
echo 'Oculta';
}
?>
</td>
<td class="eliminar"><?php
echo '<a href="eliminarArticulos.php?id=' . $fila[articulo_id] . '&articulo_url=' . $fila[articulo_url] . '&articulo_titulo=' . $fila[articulo_titulo] . '">×</a>';
示例15: array
$months = array("Enero" => "January", "Febrero" => "February", "Marzo" => "March", "Abril" => "April", "Mayo" => "May", "Junio" => "June", "Julio" => "July", "Agosto" => "August", "Septiembre" => "September", "Octubre" => "October", "Noviembre" => "November", "Diciembre" => "December");
$day = date("d", $timestamp);
$year = date("Y", $timestamp);
$month = date("F", $timestamp);
$month = array_search($month, $months);
return "{$day} {$month}, {$year}";
}
function formatHour($hour)
{
$hour = explode(":", $hour);
if ($hour[0] > 12) {
$h = $hour[0] - 12;
$t = " PM";
} else {
$h = $hour[0];
$t = " AM";
}
return $h . ":" . $hour[1] . $t;
}
$query = "SELECT * FROM manager_messages_scheduled WHERE userid = {$uid}";
if ($res = $db->query($query)) {
while ($pub = $res->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) {
$pub_object = new publicaciones($pub['id']);
$pubi = array("i" => $pub['id'], "m" => $pub['message'], "p" => $pub['img'], "ts_es" => formatTimeStamp($pub['time_start'], true), "ts_en" => date('Y-m-d', $pub['time_start']), "te_es" => formatTimeStamp($pub['time_end'], true), "te_en" => date('Y-m-d', $pub['time_end']), "t_p" => $pub['img'], "d" => $pub['days'], "h" => formatHour($pub['hour']), "tw" => $pub['publish_tw'], "fb" => $pub['publish_fb'], "fbp" => $pub['publish_fbp'], "gp" => $pub['publish_fbgp']);
$sn[] = $pubi;
}
$return = array("e" => 0, "sn" => $sn);
} else {
$return = array("e" => 1);
}
echo json_encode($return);