Do not remember me!
Sort articles by: Date | Most Rates | Most Views | Comments | Alphabet

Display newest registered user in your site

+8
This quick tip will show you how to display newest member in your site, this way you can use jquery or any kind message to welcome user in your site

REF: Display newest member in dle website Added by: in PHP Questions on
if you are using DLE 10.3 and older, open index.php
if you are using DLE 10.4, open engine/modules/main.php

Find:
if ( !$user_group[$member_id['user_group']]['allow_admin'] ) $config['admin_path'] = "";

Add after
$row = $db->super_query("SELECT name,user_id FROM " . PREFIX . "_users ORDER BY user_id DESC LIMIT 1") ;
$tpl->set( '{last-user}', stripslashes( $row['name'] ) );

If you want username with link then use
$row = $db->super_query("SELECT name,user_id FROM " . PREFIX . "_users ORDER BY user_id DESC LIMIT 1") ;
$tpl->set( '{last-user}', "<a onclick=\"ShowProfile('" . urlencode( $row['name'] ) . "', '" . urlencode( $row['name'] ) . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\" href=\"" . urlencode( $row['name'] ) . "\">" . $row['name'] . "</a>" );

Now you can use tag in main.tpl or any theme files attached to main.tpl
Welcome our newest member: {last-user}
Answered by: dlefaq

Help with search settings please

+4
I need help with search option I want to have suggestions by entering one character to the quick search like the exemple in the picture below... thanx in advance
Help with search settings please
Added by: in PHP Questions on
This question is marked as answered.
Answered by: dlefaq

Ads by DLEStarter.com

i need help with xfvalue

+3
I want to generate automaticly xf value by sharing a link but i can't as shown in the picture
i need help with xfvalue
Added by: in PHP Questions on
in most cases, the theme should have xfields.txt comes with theme, so hat you need is upload the file to your server /engine/data/ then you should have everything working correctly.

However, you can always create xfield manually one by one, what you need is the name of your xfield in your theme, for example if in your shortstory.tpl using [xfvalue_poster] then you can create new xfield in
http://site.com/admin.php?mod=xfields&xfieldsaction=configure&xfieldssubactionadd=add

and input "poster" for "Field name"
Answered by: dlefaq

Torrent plugins

+4
Please, how can I install it? http://www.dle9.com/moduli/besplatnye-moduli/3470-dle-psevdo-treker.html I need a torrent plugins. Added by: in PHP Questions on
The installation steps is included within the package, so here is English translation for those steps of installation

===========================================================
1) - Rename the folder "{€€’…€}" inside folder "templates" to your actual template name
- Upload all files to your server
===========================================================
2) Open /engine/modules/functions.php and

Find:
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}

Add below
include(ENGINE_DIR.'/modules/torrent/psxtorrent.php');

Find and REMOVE:
function show_attach($story, $id, $static = false) {
global $db, $config, $lang, $user_group, $member_id;

$find_1 = array();
$find_2 = array();
$replace_1 = array();
$replace_2 = array();

if( $static ) {

if( is_array( $id ) and count( $id ) ) $where = "static_id IN (" . implode( ",", $id ) . ")";
else $where = "static_id = '".intval($id)."'";

$db->query( "SELECT id, name, onserver, dcount FROM " . PREFIX . "_static_files WHERE $where" );

$area = "&amp;area=static";

} else {

if( is_array( $id ) and count( $id ) ) $where = "news_id IN (" . implode( ",", $id ) . ")";
else $where = "news_id = '".intval($id)."'";

$db->query( "SELECT id, name, onserver, dcount FROM " . PREFIX . "_files WHERE $where" );

$area = "";

}

while ( $row = $db->get_row() ) {

$size = formatsize( @filesize( ROOT_DIR . '/uploads/files/' . $row['onserver'] ) );
$row['name'] = explode( "/", $row['name'] );
$row['name'] = end( $row['name'] );

$find_1[] = '[attachment=' . $row['id'] . ']';
$find_2[] = "#\[attachment={$row['id']}:(.+?)\]#i";

if ( ! $user_group[$member_id['user_group']]['allow_files'] ) {

$replace_1[] = "<span class=\"attachment\">{$lang['att_denied']}</span>";
$replace_2[] = "<span class=\"attachment\">{$lang['att_denied']}</span>";

} elseif( $config['files_count'] == 'yes' ) {

$replace_1[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a> [{$size}] ({$lang['att_dcount']} {$row['dcount']})</span>";
$replace_2[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >\\1</a> [{$size}] ({$lang['att_dcount']} {$row['dcount']})</span>";

} else {

$replace_1[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >{$row['name']}</a> [{$size}]</span>";
$replace_2[] = "<span class=\"attachment\"><a href=\"{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}\" >\\1</a> [{$size}]</span>";

}

}

$db->free();

$story = str_replace ( $find_1, $replace_1, $story );
$story = preg_replace( $find_2, $replace_2, $story );

return $story;

}

============================================================
3) Open /engine/inc/files.php
Find:
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}

Add Below:
require_once ENGINE_DIR . '/classes/torrent.class.php';
include_once(ENGINE_DIR . '/data/dcls.config.php');

Find:
      if( @file_exists( ROOT_DIR . "/uploads/files/" . $file_prefix . $image_name ) ) {

Add Below:
if ($dclsconfig[vkl] == "on" ){ //  check if the module is enable
$fidname = '.torrent';
$proverka = strpos($image_name, $fidname);
if ($proverka !== false) {
$torrent = new Torrent( ROOT_DIR . "/uploads/files/" . $file_prefix . $image_name );
if ( $errorss = $torrent->errors() ) { // error checking and if they have nothing do

} else { // if there is no error then do your job with the torrent
if ( $dclsconfig[retreck] == "on" ) { // check whether the need to add tracker
$massivtreck = array_merge_recursive( $torrent->announce() , explode( "," , str_replace( " ", "", $dclsconfig[retrecker] ) ) );
$torrent->announce(false);
$torrent->announce($massivtreck); // add your tracker
}
if ( $dclsconfig[trcomment] = "on" ){ // check whether you need to add comment
if ( $news_id == 0 ) {
$commenttr = 10101 ;
$torrent->comment($commenttr); // add comment
} else {
$commenttr = str_replace("%link%", $config[http_home_url] . "index.php?newsid=" . /*$_REQUEST['news_id']*/$news_id, $dclsconfig[commenttr]); // forming comment
$torrent->comment($commenttr); // add comment
}
}
$torrent->save( ROOT_DIR . "/uploads/files/" . $file_prefix . $image_name ); // Save the changes in torrent
}
}
}

===========================================================
4) Open /engine/download.php
Find:
$id = intval ( $_REQUEST['id'] );

Replace with:
if ($_REQUEST['idd'] == "" ){
$id = intval ( $_REQUEST['id'] );
} else {
$idd = base64_decode($_REQUEST['idd']);
$id = intval ( $idd );
}

===========================================================
5) Open the file and main.tpl before </head> insert
<script type="text/javascript" src="{THEME}/dcls.js"></script>

===========================================================
6) Open your style.css file and insert the end of the file
    /*  dcls type  */
.btTbl {
BORDER-RIGHT: #98aab1 0px solid;
BORDER-TOP: #98aab1 0px solid;
BORDER-LEFT: #98aab1 0px solid;
BORDER-BOTTOM: #98aab1 0px solid;
BACKGROUND-COLOR: #6699cc
}
.row1 {
BACKGROUND-COLOR: #f4f8fb
}
.row3 {
BACKGROUND-COLOR: #AACCFF;
font-weight: bold;
}
.gen {
FONT-SIZE: 10pt
}
.genmed {
FONT-SIZE: 9pt
}
.gensmall {
FONT-SIZE: 8pt
}
.spoiler-wrap {
CLEAR: both;
BORDER-RIGHT: #c3cbd1 1px solid;
BORDER-TOP: #c3cbd1 1px solid;
BACKGROUND: #AACCFF;
MARGIN: 6px auto;
BORDER-LEFT: #c3cbd1 2px solid;
WIDTH: 95%;
BORDER-BOTTOM: #c3cbd1 1px solid;
}

.spoiler-wrap-title a{
color: #3030BB;
}
.spoiler-wrap-title a:visited{
color: #3030BB;
}
.spoiler-wrap-title a:active{
color: #3030BB;
}


.spoiler-head {
PADDING-RIGHT: 14px;
PADDING-LEFT: 14px;
FONT-SIZE: 11px;
PADDING-BOTTOM: 3px;
MARGIN-LEFT: 6px;
LINE-HEIGHT: 15px;
PADDING-TOP: 1px;
}
.spoiler-body {
PADDING-RIGHT: 6px;
BORDER-TOP: #c3cbd1 1px solid;
DISPLAY: none;
PADDING-LEFT: 6px;
BACKGROUND: #f5f5f5;
PADDING-BOTTOM: 2px;
PADDING-TOP: 1px;
}

.nik_images {max-width:150px; vertical-align: bottom; margin-top:-6px}

/* search rutor */
.restable {


border-left: 1px solid #ebebeb;
border-right: 1px solid #ebebeb;
}

.restable th {
width: 100px;
padding: 6px;
text-align: left;
}

.restable thead tr {

cursor: pointer;
background: #AACCFF;
border: 1px solid #98aab1;
border-radius: 5px;
color: #fff;
text-shadow: 1px 1px 2px black;
}

.restable a {
text-decoration:none;
}

.restable a:hover {
text-decoration:underline;
}

.restable tr:nth-child(2n) {
background-color:#f7f7f7;
}

.restable tr {
background-color:#fefefe;
}

.restable tbody tr:hover {
background-color:#e7e7e7;
}

.restable td {
padding:6px;
vertical-align:middle;
border-bottom: 1px solid #cccccc;
color: #333333;
font-size:12px;
}

#pselect {
display: inline;
padding: 5px 12px;
background: #ebebeb;
border-bottom: 1px solid rgba(0, 0, 0, 0.251);
cursor: pointer;
border-radius: 5px;
color: #808080;
text-shadow: white 0px 1px 2px;
margin: 3px;
font-size: 15px;
}

#pselect.active, #pselect:hover {
background: #97d234 !important;
border-bottom: 1px solid rgba(0, 0, 0, 0.251);
text-shadow: 1px 1px 2px black;
color: #fff !important;
}

.restable th {

white-space: inherit;
}

.restable th > span {
background: url("../images/torrent/nosorted.gif") 0px 50% no-repeat;
padding-left: 8px;
}
.restable .up > span {
background: url("../images/torrent/down.gif") 0px 50% no-repeat;
padding-left: 8px;
}
.restable .down > span {
background: url("../images/torrent/up.gif") 0px 50% no-repeat;
padding-left: 8px;
}

.restable b {
background: #e4ffb5;
}

.restable a:hover {
color: #5f8f0b;
}

==============================================================
7) Run Query to the database (usually you can go to PHPMyAdmin and click on "SQL" tab)
INSERT INTO `PREFIX_admin_sections` (`name`, `title`, `descr`, `icon`, `allow_groups`) VALUES
('dclsinc', 'Working with DCLS and Torrent files', 'Module to display the contents dcls and torrent files', 'dc.png', '1');

where "PREFIX" is replaced by the prefix of your database. (default is "dle" so you should use "dle_admin_sections")
==============================================================
8) Go to Admin "Module settings" of "Working with DCLS and Torrent files" and enable "Download torrent files and dcls"
Answered by: dlefaq

I would like to limit not allow links in comments, how can I do that?

+8
There are a lot of spammers running around the internet and they try to add spam and links in to my website, so how can I limit them not to allow to add comments with link? and if it's possible to limit by usergroup? Added by: in PHP Questions on
Yes you can do that without problem by follow steps below:
- Open file: engine/modules/addcomments.php, and find:
		if( $update_comments ) {

$comments = $db->safesql( $row['text'] ) . "<br /><br />" . $db->safesql( $comments );
Add above
if( preg_match ("/href|url|http|www|\.ru|\.com|\.net|\.info|\.org|\.ua|\.biz|\.mobi|\.name|\.pro|\.xxx|\.cc|\.au|\.ch|\.ws|\.de/i", $comments) AND ($member_id['user_group'] > 3) ) {
if( $update_comments ) {
if( $row['approve'] ) $update_comments = false;
}
$where_approve = 0;
$stop[] = $lang['news_err_31'];
$CN_HALT = TRUE;
msgbox( $lang['all_info'], implode( "<br />", $stop ) . "<br /><br /><a href=\"javascript:history.go(-1)\">" . $lang['all_prev'] . "</a>" );
}

This will limit group 1,2,3 but if you want to add mroe groups or specify group individually then please use this code instead.
$groups = array(1,2,3,7,15,20); // group IDs for which to apply this action
if( preg_match ("/href|url|http|www|\.ru|\.com|\.net|\.info|\.org|\.ua|\.biz|\.mobi|\.name|\.pro|\.xxx|\.cc|\.au|\.ch|\.ws|\.de/i", $comments) AND in_array($member_id['user_group'], $groups) ) {
if( $update_comments ) {
if( $row['approve'] ) $update_comments = false;
}
$where_approve = 0;
$stop[] = $lang['news_err_31'];
$CN_HALT = TRUE;
msgbox( $lang['all_info'], implode( "<br />", $stop ) . "<br /><br /><a href=\"javascript:history.go(-1)\">" . $lang['all_prev'] . "</a>" );
}
You can specify usergroup ID on array(1,2,3,7,15,20); // group IDs for which to apply this action

The example above is for some domain names only, You can add specific domain LTD as you want, you can find full list of top level domain LTD from: http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
Answered by: yorismith

Ads by DLEStarter.com

How to change search to search title only?

+17
Be default Datalife Engine search will search all criteria of the website including short and full story, but how can I change the search function to search keywords from "title" only? Added by: in PHP Questions on
Open: /engine/modules/search.php
Find:
else $titleonly = 0;
Replace with:
else $titleonly = 3;
Answered by: dlefaq

How to display xfield image (poster) in quick search?

+5
Hello, I run DLE website for movies/films and I use xfield to add movie posters, is there any way I can show xfield image in quick search drop down list? Added by: in PHP Questions on
Yes you can easily add xfield image in quick search, simply open /engine/ajax/search.php and find:
$db->query("SELECT id, short_story, title, date, alt_name, category FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1".$this_date." AND (short_story LIKE '%{$query}%' OR full_story LIKE '%{$query}%' OR xfields LIKE '%{$query}%' OR title LIKE '%{$query}%') ORDER by date DESC LIMIT 5");
Replace with:
$db->query("SELECT id, short_story, title, date, xfields, alt_name, category FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1".$this_date." AND (short_story LIKE '%{$query}%' OR full_story LIKE '%{$query}%' OR xfields LIKE '%{$query}%' OR title LIKE '%{$query}%') ORDER by date DESC LIMIT 5");
Find:
$description = preg_replace( "'\[attachment=(.*?)\]'si", "", $description );
Add below:
$xfieldsdata = xfieldsdataload( $row['xfields'] );

Now you can add image tag in quick search by find the line:
$buffer .= "<span>".$description."</span></a>";
Replace with:
$buffer .= "<span><img src=\"".$xfieldsdata['Name of your additional fields']."\" class=\"poster\" style=\"float:left;margin:5px;width:"50px;height:50px\" />".$description."</span></a>";
You must replace "Name of your additional fields" with your actual xfield name and adjust the size of your choice...

This hack has been tested with DLE 9.8 and newer.
Answered by: dlefaq