/** * @desc Visualiza la lista de amigos del usuario **/ function showFriends() { global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig; $xoopsOption['template_main'] = 'gs_panel_friends.html'; include 'header.php'; $mc =& $xoopsModuleConfig; GSFunctions::makeHeader(); //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'"; $page = isset($pag) ? $pag : ''; $limit = 30; list($num) = $db->fetchRow($db->query($sql)); if ($page > 0) { $page -= 1; } $start = $page * $limit; $tpages = (int) ($num / $limit); if ($num % $limit > 0) { $tpages++; } $pactual = $page + 1; if ($pactual > $tpages) { $rest = $pactual - $tpages; $pactual = $pactual - $rest + 1; $start = ($pactual - 1) * $limit; } if ($tpages > 1) { if ($mc['urlmode']) { $urlnav = 'cpanel/friends'; } else { $urlnav = 'cpanel.php?by=cpanel/friends'; } $nav = new GsPageNav($num, $limit, $start, 'pag', $urlnav, 0); $tpl->assign('friendsNavPage', $nav->renderNav(4, 1)); } $showmax = $start + $limit; $showmax = $showmax > $num ? $num : $showmax; $tpl->assign('lang_showing', sprintf(__('Sowing friends %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num)); $tpl->assign('limit', $limit); $tpl->assign('pag', $pactual); //Fin de barra de navegación $sql = "SELECT * FROM " . $db->prefix('gs_friends') . " WHERE gsuser='******'"; $sql .= " LIMIT {$start},{$limit}"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $xu = new XoopsUser($row['uid']); $tpl->append('users', array('uid' => $xu->uid(), 'uname' => $xu->uname(), 'link' => XOOPS_URL . "/modules/galleries/" . ($mc['urlmode'] ? "usr/" . $xu->uname() . "/" : "user.php?id=usr/" . $xu->uname()), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $xu->email(), 0, $xu->user_avatar() != '' ? XOOPS_URL . '/uploads/avatars/' . $xu->user_avatar() : GS_URL . '/images/avatar.png'))); } $tpl->assign('lang_uname', __('User name', 'galleries')); $tpl->assign('lang_newfriend', __('New Friend', 'galleries')); $tpl->assign('lang_del', __('Delete', 'galleries')); $tpl->assign('lang_confirm', __('Do you really wish to delete specified friend?', 'galleries')); $tpl->assign('lang_confirms', __('Do you really wish to delete selected friends?', 'galleries')); $tpl->assign('form_action_add', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/add/' : '?cp=add')); $tpl->assign('form_action_del', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/' : '?cp=delete')); $tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deletefriend/pag/' . $pactual . '/id/' : '?cp=deletefriend&page=' . $pactual . '&id=')); RMTemplate::get()->add_style('panel.css', 'galleries'); createLinks(); include 'footer.php'; }
echo $result['address']; ?> </td> <td><?php echo $result['fone']; ?> </td> <td><?php echo $result['created_by']; ?> </td> <td><?php echo $result['date']; ?> </td> <td><a href="delete.php?id=<?php echo $result['id']; ?> " btn="btn btn-warning">Delete</a></td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php echo createLinks($links, 'pagination pagination-sm', $query, $limit, $page);
/** * @desc Visualiza todas la imágenes de favoritos **/ function showBookMarks() { global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig; $xoopsOption['template_main'] = 'gs_panel_bookmarks.html'; include 'header.php'; $mc =& $xoopsModuleConfig; GSFunctions::makeHeader(); //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_favourites') . " a INNER JOIN " . $db->prefix('gs_images') . " b ON ("; $sql .= " a.id_image=b.id_image AND a.uid='" . $xoopsUser->uid() . "')"; $page = isset($pag) ? $pag : ''; $limit = 10; list($num) = $db->fetchRow($db->query($sql)); if ($page > 0) { $page -= 1; } $start = $page * $limit; $tpages = (int) ($num / $limit); if ($num % $limit > 0) { $tpages++; } $pactual = $page + 1; if ($pactual > $tpages) { $rest = $pactual - $tpages; $pactual = $pactual - $rest + 1; $start = ($pactual - 1) * $limit; } if ($tpages > 1) { if ($mc['urlmode']) { $urlnav = 'cpanel/bookmarks/'; } else { $urlnav = '?cpanel=bookmarks'; } $nav = new RMPageNav($num, $limit, $pactual, 5); $nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? 'pag/{PAGE_NUM}/' : '&pag={PAGE_NUM}')); $tpl->assign('bookmarksNavPage', $nav->render(false)); } $showmax = $start + $limit; $showmax = $showmax > $num ? $num : $showmax; if ($num > 0) { $tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u from %u'), $start + 1, $showmax, $num)); } $tpl->assign('limit', $limit); $tpl->assign('pag', $pactual); //Fin de barra de navegación $sql = "SELECT * FROM " . $db->prefix('gs_favourites') . " a INNER JOIN " . $db->prefix('gs_images') . " b ON ("; $sql .= " a.id_image=b.id_image AND a.uid='" . $xoopsUser->uid() . "')"; $sql .= " LIMIT {$start},{$limit}"; $result = $db->query($sql); $users = array(); while ($rows = $db->fetchArray($result)) { $img = new GSImage(); $img->assignVars($rows); if (!isset($users[$img->owner()])) { $users[$img->owner()] = new GSUser($img->owner(), 1); } $urlimg = $users[$img->owner()]->filesURL() . '/ths/' . $img->image(); $link = $users[$img->owner()]->userURL() . 'img/' . $img->id() . '/'; $tpl->append('images', array('id' => $img->id(), 'title' => $img->title(false), 'desc' => $img->desc(), 'public' => $img->isPublic(), 'image' => $urlimg, 'created' => formatTimeStamp($img->created(), 's'), 'owner' => $img->owner(), 'uname' => $users[$img->owner()]->uname(), 'link' => $link)); } $tpl->assign('lang_exist', __('Existing Bookmarks', 'galleries')); $tpl->assign('lang_id', __('ID', 'galleries')); $tpl->assign('lang_title', __('Title', 'galleries')); $tpl->assign('lang_date', __('Created', 'galleries')); $tpl->assign('lang_owner', __('by user', 'galleries')); $tpl->assign('lang_image', __('Picture', 'galleries')); $tpl->assign('lang_public', __('Public', 'galleries')); $tpl->assign('lang_options', __('Options', 'galleries')); $tpl->assign('lang_edit', __('Edit', 'galleries')); $tpl->assign('lang_del', __('Delete', 'galleries')); $tpl->assign('lang_confirm', __('Do you really wish to deleted selected favorite?', 'galleries')); $tpl->assign('lang_confirms', __('Do you really wish to deleted selected favorites?', 'galleries')); $tpl->assign('delete_link', GSFunctions::get_url() . $xoopsModuleConfig['urlmode'] ? 'cp/delbookmarks/' : '?cp=delbookmarks'); RMTemplate::get()->add_style('panel.css', 'galleries'); createLinks(); include 'footer.php'; }
?> style="width:300px;height:300px;"> </div> <div class="adZone"> <?php writeAdArea(); ?> </div> <div class="adZone"> <?php writeAdArea(); ?> </div> <div class="links"> <?php createLinks(); ?> </div> </td> <td class="rightSideBar"> <div class="infoDiv"><h2>Whats New!</h2></div> <div class="infoDiv"> <?php writeWhatsNew(); ?> </div> </td> </table> <div class="footer"> <h4 class="footerText"> JMAT GAMES </h4> <span>Last Updated: <?php getDateMod();
/** * @desc Visualiza todos los albumes existentes del usuario **/ function showSets($edit = 0) { global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $page, $xoopsConfig, $id; $xoopsOption['template_main'] = 'gs_panel_sets.html'; include 'header.php'; $mc =& $xoopsModuleConfig; $limit = rmc_server_var($_REQUEST, 'limit', 15); GSFunctions::makeHeader(); $link = GSFunctions::get_url() . ($mc['urlmode'] ? '/cpanel/sets/pag/' . $page : '/cpanel.php?s=cpanel/sets/' . $page); if ($edit) { //Verificamos que el album sea válido if ($id <= 0) { redirect_header($link, 1, __('Album ID is not valid!', 'galleries')); die; } //Verificamos que el album exista $set = new GSSet($id); if ($set->isNew()) { redirect_header($link, 1, __('Specified album does not exists!', 'galleries')); die; } $tpl->assign('title', $set->title()); $tpl->assign('public', $set->isPublic()); $tpl->assign('edit', $edit); $tpl->assign('id', $id); $tpl->assign('action_editset', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/saveeditset/pag/' . $page . '/' : '?cp=saveeditset&pag=' . $page)); } //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'"; list($num) = $db->fetchRow($db->query($sql)); $page = $page <= 0 ? 1 : $page; list($num) = $db->fetchRow($db->query($sql)); $start = $num <= 0 ? 0 : ($page - 1) * $limit; $tpages = ceil($num / $limit); $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url(GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/sets/pag/{PAGE_NUM}/' : '?cp=sets&pag={PAGE_NUM}')); //Fin de barra de navegación $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'"; $sql .= " LIMIT {$start},{$limit}"; $result = $db->query($sql); while ($rows = $db->fetchArray($result)) { $set = new GSSet(); $set->assignVars($rows); $tpl->append('sets', array('id' => $set->id(), 'name' => $set->title(), 'owner' => $set->owner(), 'uname' => $set->uname(), 'public' => $set->isPublic(), 'date' => formatTimeStamp($set->date(), 's'), 'pics' => $set->pics(), 'link' => $set->url())); } $tpl->assign('lang_setexists', __('My Albums', 'galleries')); $tpl->assign('lang_id', __('ID', 'galleries')); $tpl->assign('lang_name', __('Name', 'galleries')); $tpl->assign('lang_date', __('Date', 'galleries')); $tpl->assign('lang_public', __('Privacy:', 'galleries')); $tpl->assign('lang_options', _OPTIONS); $tpl->assign('lang_edit', _EDIT); $tpl->assign('lang_del', _DELETE); $tpl->assign('lang_confirm', __('Do you really wish to delete specified album?', 'galleries')); $tpl->assign('lang_confirms', __('Do you really wish to delete selected albums?', 'galleries')); $tpl->assign('lang_newset', __('Add Album', 'galleries')); $tpl->assign('lang_editset', __('Edit Album', 'galleries')); $tpl->assign('lang_yes', __('Yes', 'galleries')); $tpl->assign('lang_no', __('No', 'galleries')); $tpl->assign('lang_pics', __('Pictures', 'galleries')); $tpl->assign('lang_privateme', __('Private', 'galleries')); $tpl->assign('lang_privatef', __('Friends', 'galleries')); $tpl->assign('lang_publicset', __('Public', 'galleries')); RMTemplate::get()->add_style('panel.css', 'galleries'); $tpl->assign('action_addset', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/saveset/pag/' . $page . '/' : '?cp=saveset')); $tpl->assign('pag', $page); $tpl->assign('action_delset', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deleteset/pag/' . $page . '/' : '?cp=deleteset')); $tpl->assign('edit_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/editset/pag/' . $page . '/id/' : '?cp=editset&pag=' . $page . '&id=')); createLinks(); include 'footer.php'; }
function generate_data_table($sqlQuery) { // $sqlQuery = "Select users.username as 'User Name', users.email as Email, job_seekers.contact_number as 'Contact No.', users.first_name, users.last_name, job_seekers.location, users.id From users Inner Join job_seekers On users.id = job_seekers.id"; $mysqli = new mysqli("localhost", "root", "", "rigsphere"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $whereSql = null; $and_or = 'and'; $currentQueryString = null; /* Generate where condition */ foreach ($_REQUEST as $key => $val) { if (!empty($key) && !($key == "order-by" || $key == "order-type" || $key == "limit" || $key == "page") && !empty($val)) { $s = explode('+', $key); if ($s[sizeof($s) - 1] == "STR") { $whereSql = $whereSql . '' . $s[0] . '.' . $s[1] . '=\'' . $val . '\' ' . $and_or . ' '; } else { $whereSql = $whereSql . '' . $s[0] . '.' . $s[1] . '=' . $val . ' ' . $and_or . ' '; } $val2 = urlencode($val); $key = urlencode($key); $currentQueryString = $currentQueryString . '&' . $key . '=' . $val2; } } if ($whereSql) { $whereSql = 'where ' . $whereSql; } $whereSql = rtrim($whereSql, " " . $and_or . " "); $currentQueryString = ltrim($currentQueryString, "&"); // ORDER BY /////////////////////////////////////////////////////////////////////////////////////////////////////////// $order_sql = ""; $orderBy = null; $orderType = "ASC"; if (isset($_REQUEST['order-by'])) { $orderBy = $_REQUEST['order-by']; $orderBy = str_replace(" ", "+", $orderBy); //echo "<hr/>Order by values = ".$orderBy; if (isset($_REQUEST['order-type'])) { $orderType = $_REQUEST['order-type']; $order_sql = "order by " . str_replace("+", ".", $orderBy) . ' ' . $orderType; $currentQueryString = $currentQueryString . '&order-by=' . $orderBy . '&order-type=' . $orderType; } } // LIMIT ///////////////////////////////////////////////////////////////////////////////////////////////////////////// /*Pagination ------------------------------------- */ $limit = 10; $page = 0; $limit_sql = ""; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 0; $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 10; $page = $page - 1; if ($limit <= 0) { $limit = 10; } if ($page < 0) { $page = 0; } $limit_sql = "LIMIT " . $limit * $page . ',' . $limit; //$currentQueryString=$currentQueryString.'&page='.$page.'&limit='.$limit; /*Pagination --------------------------------------*/ /*This is the original sql command to be passed as parameters*/ /* Now modify the actual sql with search parameters*/ if (strpos(strtolower($sqlQuery), 'where') == true && !empty($whereSql)) { $sqlQuery = $sqlQuery . ' ' . $and_or . '' . ltrim($whereSql, "where") . ' ' . $order_sql; } else { $sqlQuery = $sqlQuery . ' ' . $whereSql . ' ' . $order_sql; } // Retrieve total records against this query $sqlTotalRecords = 'select count(*) from ' . explode("from", strtolower($sqlQuery))[1]; $stmt = $mysqli->prepare($sqlTotalRecords); $stmt->execute(); $res1 = $stmt->get_result(); $totalRecordsFound = $res1->fetch_all()[0][0]; // Add limit for pagnation $sqlQuery = $sqlQuery . ' ' . $limit_sql; // Execute actual query for fetching the records. $stmt = $mysqli->prepare($sqlQuery); $stmt->execute(); $res = $stmt->get_result(); $totalRows = $res->num_rows; //Retrieve number of rows $rows = $res->fetch_all(); //total records $cols = $res->fetch_fields(); $cols_name = array(); $cols_name_with_table_name = array(); $html_name_with_table_name = array(); $cols_alias = array(); $pk_col = ""; foreach ($cols as $c) { var_dump($c); array_push($cols_name, $c->orgname); array_push($cols_alias, $c->name); array_push($cols_name_with_table_name, $c->orgtable . '.' . $c->orgname); array_push($html_name_with_table_name, $c->orgtable . '+' . $c->orgname); if ($c->flags == MYSQLI_PRI_KEY_FLAG) { $pk_col = $c->orgname; var_dump($pk_col); } } /* Started creating dynamic search form */ ////////////////////////////////////// echo '<form class="search" action="">'; $input_fields = array(); foreach ($cols as $c) { $type = "STR"; if ($c->type == MYSQLI_TYPE_DECIMAL || $c->type == MYSQLI_TYPE_NEWDECIMAL || $c->type == MYSQLI_TYPE_BIT || $c->type == MYSQLI_TYPE_TINY || $c->type == MYSQLI_TYPE_SHORT || $c->type == MYSQLI_TYPE_LONG || $c->type == MYSQLI_TYPE_LONGLONG || $c->type == MYSQLI_TYPE_INT24 || $c->type == MYSQLI_TYPE_FLOAT || $c->type == MYSQLI_TYPE_DOUBLE) { $type = "NUM"; } $input_field_name = $c->orgtable . '+' . $c->orgname . '+' . $type; $value = !isset($_REQUEST[$input_field_name]) ? "" : $_REQUEST[$input_field_name]; $label = '<label for="' . $input_field_name . '">' . $c->name . '</label>'; $input_field = '<input type="text" name="' . $input_field_name . '" value="' . $value . '"/>'; //array_push($input_fields,$label.'.'.$input_field); echo '<div>' . $label . ' : ' . $input_field . '</div>'; } echo '<div><input type="submit" value="Search"</div>'; echo "</form>"; /*Ends creating dynamic search form*/ /*Started Creating table*/ /////////////////////////////////////////////////////////////////////////////////////// // Prepare header row of table $html_table_header_row = "<tr>"; $count = 0; foreach ($cols_name as $cn) { $queryString = explode("&page=", $currentQueryString)[0]; if ($orderBy == $html_name_with_table_name[$count]) { if ($orderType == "ASC") { $html_table_header_row = $html_table_header_row . '<th class="asc"><a href="?' . $queryString . '&order-by=' . $html_name_with_table_name[$count] . '&order-type=DESC">' . $cols_alias[$count] . '</a></th>'; } else { $html_table_header_row = $html_table_header_row . '<th class="desc"><a href="?' . $queryString . '&order-by=' . $html_name_with_table_name[$count] . '&order-type=ASC">' . $cols_alias[$count] . '</a></th>'; } } else { $html_table_header_row = $html_table_header_row . '<th class=""><a href="?' . $queryString . '&order-by=' . $html_name_with_table_name[$count] . '&order-type=ASC">' . $cols_alias[$count] . '</a></th>'; } $count++; } $html_table_header_row = $html_table_header_row . '</tr>'; echo '<table class="ol-datagrid">'; echo $html_table_header_row; // Prepare rows of table foreach ($rows as $r) { $html_table__row = "<tr>"; $count = 0; foreach ($r as $d) { $html_table__row = $html_table__row . '<td>' . $d . '</td>'; $count++; } $html_table__row = $html_table__row . '</tr>'; echo $html_table__row; } echo "</table>"; /*Ended creating table*/ /*start pagination*/ //echo createLinks($links, $list_class,$_total,$_limit,$_page ); echo createLinks(5, $totalRecordsFound, $limit, $page, $currentQueryString); /*End pagination*/ }
"> <img src="<?php echo $image['src']; ?> " /> <figure><?php echo $image['caption']; ?> </figure> </a> <?}?> </div> <?if($lastPage > 1){?> <div class="col s12"> <?php echo createLinks($total, $page, $perPage); ?> </div> <?} } else { errorView($data['error_message']); }?> </div> </div> <div id="footer" class="section"> © 2015 <a class="<?php echo $config['theme_text']; ?> " href="http://alashov.com" target="_blank">by Alashov</a> </div> </div>
function module_flashforum() { echo "<!-- start module flashforum -->"; global $flashformid; $thisdate = ""; if (isset($_REQUEST['quickpassword'])) { $quickpassword = $_REQUEST['quickpassword']; } else { $quickpassword = ""; } if (isset($_REQUEST['message'])) { $message = $_REQUEST['message']; } if (isset($_REQUEST['deleteflash'])) { $deleteflash = $_REQUEST['deleteflash']; } if (isset($_REQUEST['deleteflash'])) { if (isset($_SESSION['valid_admin']) && isset($_REQUEST['dfc'])) { $query = "DELETE FROM flashforum WHERE postid=" . $_REQUEST['deleteflash'] . ";"; $result = DB_update($query); if ($result) { global $logtype; write_log_entry($_REQUEST['deleteflash'], $logtype['flashforum'], "del_flashpost,"); } } else { echo '<a href="index.php?deleteflash=' . $_REQUEST['deleteflash'] . '&dfc=1">Bekreft sletting</a><br/>'; } } echo '<div class="flashforum"><div class="flashforumheader">Lynforum</div>'; echo '<div class="flashforumlist">'; // Insert new message into the database if the spampassword is correct if (isset($message) && !isset($REQUEST['showall']) && $flashformid == $_REQUEST['flashformidvar']) { if (stristr($quickpassword, "hurra") == FALSE) { echo "<b>Du må fylle inn spampassordet.</b>"; if (isset($_REQUEST['author'])) { $author = $_REQUEST['author']; } else { $author = "Ditt navn"; } $retry = $message; } else { $flashformid++; $_SESSION['flashformid'] = $flashformid; if ($_REQUEST['author'] != "Ditt navn" && strlen($_REQUEST['message']) > 5 && strlen($_REQUEST['author']) > 1) { // Insert new msg into DB if possible $author = $_REQUEST['author']; $message = $_REQUEST['message']; if (strlen($author) > 15) { $author = substr($author, 0, 15); } if (strlen($message) > 200) { $message = substr($message, 0, 200); } if (isset($_SESSION['valid_user'])) { $query = "INSERT INTO flashforum VALUES ('', '" . strip_tags($author) . "', '', '" . strip_tags($message, "<a>") . "', NOW(),'" . $_SESSION['valid_user'] . "');"; } else { $query = "INSERT INTO flashforum VALUES ('', '" . strip_tags($author) . "', '', '" . strip_tags($message, "<a>") . "', NOW(),'');"; } $result = DB_insert($query); if (!$result) { echo "Whups, melding ikke lagret.<br/>"; } else { global $logtype; write_log_entry(mysql_insert_id(), $logtype['flashforum'], "new_flashpost,"); } } else { echo "<b>Navn og beskjed må fylles inn.</b><br/>"; } } } if (isset($_REQUEST['showall'])) { // Display current articles $query = "SELECT postid, author,message,UNIX_TIMESTAMP(time_posted) as time_posted FROM flashforum ORDER BY time_posted DESC"; $result = DB_get_table($query); $num_results = DB_rows_affected($result); if (!$num_results > 0) { echo "Tomt for øyeblikket.<hr/>"; } else { $i = 0; while ($num_results > 0 && ($row = DB_next_row($result)) && $i < 100) { if (date("d/m", $row['time_posted']) != $thisdate) { if (date("d/m", $row['time_posted']) == date("d/m")) { $thisdate = date("d/m", $row['time_posted']); echo '<div class="flashdate">I dag:</div>'; } else { $thisdate = date("d/m", $row['time_posted']); echo '<div class="flashdate">' . $thisdate . '</div>'; } } $i++; echo '<div class="flashpost"><span class="flashauthor">' . $row['author'] . ': </span>' . htmlwrap($row['message'], 20) . ' (' . date("H:i", $row['time_posted']); if (isset($_SESSION['valid_admin'])) { echo ', <a href="index.php?deleteflash=' . $row['postid'] . '">slett</a>'; } echo ")</div>"; } } } else { // Display current articles $query = "SELECT postid, author,message,UNIX_TIMESTAMP(time_posted) as time_posted FROM flashforum ORDER BY time_posted DESC"; $result = DB_get_table($query); $num_results = DB_rows_affected($result); if (!$num_results > 0) { echo "Tomt for øyeblikket.<br/>"; } else { $i = 0; while ($num_results > 0 && ($row = DB_next_row($result)) && $i < 10) { if (date("d/m", $row['time_posted']) != $thisdate) { if (date("d/m", $row['time_posted']) == date("d/m")) { $thisdate = date("d/m", $row['time_posted']); echo '<div class="flashdate">I dag:</div>'; } else { $thisdate = date("d/m", $row['time_posted']); echo '<div class="flashdate">' . $thisdate . '</div>'; } } $i++; echo '<div class="flashpost"><span class="flashauthor">' . $row['author'] . ': </span>' . htmlwrap(createLinks($row['message']), 20) . ' (' . date("H:i", $row['time_posted']); if (isset($_SESSION['valid_admin'])) { echo ', <a href="index.php?deleteflash=' . $row['postid'] . '">slett</a>'; } echo ")</div>"; } } } ?> </div> <form method="get" action="index.php"> <?php if (isset($_SESSION['valid_user'])) { echo '<input style="width:140px" type="text" name="author" value=' . $_SESSION['user_firstname'] . ' /><br/>'; echo 'Hipp, hipp, <input size="5" readonly type="textfield" name="quickpassword" value="hurra"/>!'; } else { if (isset($retry)) { echo '<input style="width:140px" type="text" name="author" onFocus="this.value=wipeOut(this.value);" value="' . $author . '" /><br/>'; } else { echo '<input style="width:140px" type="text" name="author" onFocus="this.value=wipeOut(this.value);" value="Ditt navn" /><br/>'; } echo 'Hipp, hipp, <input size="5" type="textfield" name="quickpassword" />!'; } ?> <?php if (isset($retry)) { ?> <input onKeyDown="limitText(this.form.message,this.form.countdown,180);" onKeyUp="limitText(this.form.message,this.form.countdown,180);" style="width:140px" type="text" name="message" onFocus="this.value=wipeOut(this.value);" value="<?php echo $retry; ?> " /> <?php } else { ?> <input onKeyDown="limitText(this.form.message,this.form.countdown,180);" onKeyUp="limitText(this.form.message,this.form.countdown,180);" style="width:140px" type="text" name="message" onFocus="this.value=wipeOut(this.value);" value="Maks 180 tegn" /> <?php } ?> <input class="nice1" type="submit" name="submit" value="Post" style="width:80px"> <input readonly type="text" name="countdown" size="3" value="180" style="width:30px"> <input type="hidden" value="<?php echo $flashformid; ?> " name="flashformidvar"> </form> <br/><a href="index.php?showall=1">Vis siste 100</a> <br/><a href="index.php?m_c=mfa">Arkiv</a> <br/><a href="rss.xml?type=flash">RSS</a> </div> <?php }
/** * @desc Formulario de imágenes **/ function formImages($edit = 0) { global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $xoopsUser, $xoopsConfig, $id, $referer, $page; $mc =& $xoopsModuleConfig; if (!$referer) { $referer = GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/images/pag/' . $page . '/' : '?cp=images&pag=' . $page); } else { $referer = base64_decode($referer); } if ($edit) { //Verificamos si la imagen es válida if ($id <= 0) { redirect_header($referer, 1, __('Sepecified images is not valid!', 'galleries')); die; } //Verificamos si la imagen existe $img = new GSImage($id); if ($img->isNew()) { redirect_header($referer, 1, __('Sepecified image does not exists!', 'galleries')); die; } //Verificamos que el usuario se el dueño de la imagen if ($img->owner() != $xoopsUser->uid()) { redirect_header($referer, 1, __('You are not authorized!', 'galleries')); die; } } $xoopsOption['template_main'] = 'gs_formpics.html'; include 'header.php'; GSFunctions::makeHeader(); $form = new RMForm($edit ? __('Edit Image', 'galleries') : __('New Image', 'galleries'), 'frmimg', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/saveedit/' : '?cp=saveedit')); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Image title', 'galleries'), 'title', 50, 100, $edit ? $img->title(false) : '')); if ($edit) { $user = new GSUser($img->owner(), 1); $url = $user->filesURL(); $form->addElement(new RMFormLabel(__('Current picture', 'galleries'), "<img src='" . $url . "/ths/" . $img->image() . "' />")); } else { $form->addElement(new RMFormFile(__('Image file', 'galleries'), 'image', 45, $mc['size_image'] * 1024)); } $form->addElement(new RMFormTextArea(__('Description', 'galleries'), 'desc', 4, 50, $edit ? $img->desc() : '')); $ele = new RMFormSelect(__('Access level', 'galleries'), 'public'); $ele->addOption(0, __('Private', 'galleries'), $edit ? $img->isPublic() == 0 ? 1 : 0 : 0); $ele->addOption(1, __('Public for friends', 'galleries'), $edit ? $img->isPublic() == 1 ? 1 : 0 : 0); $ele->addOption(2, __('Public for all', 'galleries'), $edit ? $img->isPublic() == 2 ? 1 : 0 : 0); $form->addElement($ele, true); //Albumes if ($edit) { $albums = $img->sets(false); foreach ($albums as $k => $v) { $sets[] = $v['id_set']; } } $ele = new RMFormSelect(__('Albums', 'galleries'), 'albums[]', 1, $edit ? $sets : ''); $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'"; $result = $db->query($sql); while ($rows = $db->fetchArray($result)) { $ele->addOption($rows['id_set'], $rows['title']); } $form->addElement($ele); $ele = new RMFormText(__('Tags', 'galleries'), 'tags', 50, 255, $edit ? implode(", ", $img->tags(false, 'tag')) : ''); $ele->setDescription(__('Separe each tag with commas.', 'galleries')); $form->addElement($ele, true); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('referer', $referer)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes', 'galleries') : __('Create Image', 'galleries'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'' . $referer . '\'"'); $form->addElement($buttons); $tpl->assign('form_pics', $form->render()); createLinks(); RMTemplate::get()->add_style('panel.css', 'galleries'); include 'footer.php'; }