News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Trikovi za poboljsanje vaseg foruma

Started by Dzonny, May 31, 2009, 08:54:29 AM

Previous topic - Next topic

Ravac

Quote from: [̲̅J̲̅][̲̅U̲̅][̲̅R̲̅][̲̅E̲̅][̲̅K̲̅] ٩(×̯×)۶ on June 04, 2009, 03:49:31 PM
Zasto se ovo ne stavi ko sticky? Mozda bi bilo dobro..posto ima dobrih stvari..a s vremenom ce tema otic na kraj foruma..pa ce se teze naci..

Spamuj temu da ne ode na kraj :P

NikolaSN

Kad ste vec spomenuli privatne poruke, zeleo bih da znam da li postoji nacin da se privatne poruke ogranice korisnicima ( tipa na 50 privatnih poruka ukupno, sto u inbox-u, sto u sent-u )?

Na taj nacin bi sami sebe naterali da brisu nepotrebne poruke, a ne da ih gomilaju bezveze!?

pozdrav
;)

Bob Marley

Quote from: Dzonny on June 04, 2009, 02:18:20 PM
Bob Marley - Svaki iole ozbiljan hosting ima phpMyAdmin...


Verat net nije ozbiljan hosting. Nisam ga ja birao i primoran sam da radim na njemu.

Quote from: Dzonny on June 04, 2009, 02:18:20 PMPreko chega inache pristupash bazi? I radish backup? :/

MySQL - Dumper

Quote from: Dzonny on June 04, 2009, 02:18:20 PM
btw, ima i mod za to, pa probaj ga...
http://custom.simplemachines.org/mods/index.php?mod=1058

Testiracu pa javljam ;) Thx

Sklerozica

Quote from: NikolaSN on June 04, 2009, 09:04:28 PM
zeleo bih da znam da li postoji nacin da se privatne poruke ogranice korisnicima ( tipa na 50 privatnih poruka ukupno, sto u inbox-u, sto u sent-u )?

Da. U admin panelu deo Grupe članova. Tu imaš mogućnost da svaku grupu odrediš maksomalni broj privatnih poruka.

Bob Marley

Quote6. Izbrisite neaktivne korisnike. Neaktivni korisnici zauzimaju mesto u bazi podataka, i time opterecuju server. Brisanje neaktivnih clanova mozete uraditi sa ovim modom. Link

Ako sam dobro shvatio. Salje prvi mail. Posle 21 dan salje drugi mail. I onda posle jos 21 dan ako je na pocetku stiklirano "Auto Delete Members (Except Admins)" brise ne aktivne korisnike? A ako u kucici "Delete Member Post Threshold" ostavim 0 znaci da nece brisati clanove sa 0 postova ili kako? Ja bih da brishem samo one koji se nisu 100 godina log in na forum, a ne i one koji dolaze svaki dan citaju novosti, vesti ali ne pishu. I da li postoji nacin da se smanji vrednost "21 dan" meni bi trebalo nesto mnogo brze. Tipa prvi mail... pa 5 dana kasnije drugi i 5 dana kasnije brisanje.

Dzonny

Pregledaj u admin panelu opcije i podesavanja, trebalo bi da moze da se podesi...

Founder 2008

Quote from: Sklerozica on June 07, 2009, 07:03:59 AM
Da. U admin panelu deo Grupe članova. Tu imaš mogućnost da svaku grupu odrediš maksomalni broj privatnih poruka.

Gde nadje tu opciju?  :o

Quote from: Bob Marley on June 07, 2009, 07:40:34 PM
Quote6. Izbrisite neaktivne korisnike. Neaktivni korisnici zauzimaju mesto u bazi podataka, i time opterecuju server. Brisanje neaktivnih clanova mozete uraditi sa ovim modom. Link

Ako sam dobro shvatio. Salje prvi mail. Posle 21 dan salje drugi mail. I onda posle jos 21 dan ako je na pocetku stiklirano "Auto Delete Members (Except Admins)" brise ne aktivne korisnike? A ako u kucici "Delete Member Post Threshold" ostavim 0 znaci da nece brisati clanove sa 0 postova ili kako? Ja bih da brishem samo one koji se nisu 100 godina log in na forum, a ne i one koji dolaze svaki dan citaju novosti, vesti ali ne pishu. I da li postoji nacin da se smanji vrednost "21 dan" meni bi trebalo nesto mnogo brze. Tipa prvi mail... pa 5 dana kasnije drugi i 5 dana kasnije brisanje.

Pogledaj parse tog moda ali mislim da je subs.php. Promeni 21 days na 5 days  ;)

Bob Marley

#27
1814400 / 60 / 60 * 24 = 21 dan

WHERE dateRegistered < ". ($time - 1814400) ."
AND lastLogin < ". ($time - 1814400) ."
AND aeiou_email < ". ($time - 1814400) ."
AND ID_GROUP != 1
AND NOT FIND_IN_SET(1, additionalGroups)
AND aeiou_count < 2
AND is_activated < 10
AND is_activated != 0
AND is_activated != 4


i

SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE dateRegistered < ". ($time - 1814400) ."
AND lastLogin < ". ($time - 1814400) ."
AND ID_GROUP != 1
AND FIND_IN_SET(1, additionalGroups) = 0
AND aeiou_count > 1
AND aeiou_email < ". ($time - 1814400) ."


Ovo je sto ima u subs.php , a vezano za broj dana tj tacnije za broj sekundi.


Takodje i u ModSettings.php


function ModifyAeiouSettings()
{
global $txt, $scripturl, $context, $settings, $sc, $db_prefix, $modSettings;

// If the mod is enabled and we're not saving, query for mod status information
if (!isset($_GET['save']) && $modSettings['aeiou_enable'])
{
// Current time
$time = time();

// Get the delete band
$request = db_query("
SELECT count(*)
FROM {$db_prefix}members
WHERE lastLogin < ". ($time - 1814400) ."
AND aeiou_email < ". ($time - 1814400) ."
AND aeiou_count > 1
AND posts <= ". (int) $modSettings['aeiou_underposts']. "
", __FILE__, __LINE__);
list($deletion) = mysql_fetch_row($request);

// Create an array for the bands, with default values of 0
$temp = array(0 => 0, 1 => 0, 2 => (int) $deletion);

// Tidy up
unset($deletion);
mysql_free_result($request);

// Get the email bands
$request = db_query("
SELECT count(*) as no, aeiou_count
FROM {$db_prefix}members
WHERE dateRegistered < ". ($time - 1814400) ."
AND lastLogin < ". ($time - 1814400) ."
AND aeiou_email < ". ($time - 1814400) ."
AND ID_GROUP != 1
AND NOT FIND_IN_SET(1, additionalGroups)
AND aeiou_count < 2
AND is_activated < 10
AND is_activated != 0
AND is_activated != 4
GROUP BY aeiou_count
ORDER BY aeiou_count ASC
", __FILE__, __LINE__);

// No further emails, if not set already, stop the mod until tomorrow
if(mysql_num_rows($request) == 0)
{
// If not already, tell the mod to stop
if(!empty($modSettings['aeiou_stop']))
aeiou_update(array('stop' => 1));
// Change the variable for the remainder of this page
$modSettings['aeiou_stop'] = 1;
}
else
{
// Store the bands in the array created earlier
while($row = mysql_fetch_assoc($request))
$temp[$row['aeiou_count']] = $row['no'];
// Tidy up
unset($row);

// The mod is set as stopped, but we discovered some emails, so re-activate us
if(!empty($modSettings['aeiou_stop']))
{
aeiou_update(array('stop' => 0));
// Change the variable for the remainder of this page
$modSettings['aeiou_stop'] = 0;
$reactivated = 1;
}
}

// Prepare rows for the stats table
$items = array();

// Last ran
$items['aeiou_last_ran'] = ($modSettings['aeiou_locktimestamp'] == 0) ? $txt['aeiou_never'] : timeformat($modSettings['aeiou_locktimestamp'], true) ;

$again = ($modSettings['aeiou_locktimestamp'] == 0) ? $time : $modSettings['aeiou_locktimestamp'];
// But if reached daily limit or is stopped we will start/check again tomorrow
if($modSettings['aeiou_day_max'] <= $modSettings['aeiou_day_sent'] || !empty($modSettings['aeiou_stop']))
{
$date = explode('-', date('Y-m-d', $again));
$tomorrow = mktime(0, 0, 0, $date[1], $date[2], $date[0]) + (60*60*24);
$items['aeiou_starts_again'] = timeformat($tomorrow, true);
unset($date, $tomorrow);
}
elseif($modSettings['aeiou_hour_max'] <= $modSettings['aeiou_hour_sent'])
{
// Or reached hourly limit we will start/check again next hour
$date = explode('-', date('Y-m-d-h', $again));
$nexthour = mktime($date[3], 0, 0, $date[1], $date[2], $date[0]) + (60*60);
$items['aeiou_starts_again'] = timeformat($nexthour, true);
unset($date, $nexthour);
}
else
// Else Can start again from previous + 5mins
$items['aeiou_starts_again'] = timeformat($again + 300, true) ;

// Emailed today with max in parenthesis
$items['aeiou_sent_day'] = $modSettings['aeiou_day_sent']
.' <span style="font-weight:normal;font-style:italic">('.$txt['aeiou_max'].': '.$modSettings['aeiou_day_max'].')</span>';
// Emailed this hour with max in parenthesis
$items['aeiou_sent_hour'] = $modSettings['aeiou_hour_sent']
.' <span style="font-weight:normal;font-style:italic">('.$txt['aeiou_max'].': '.$modSettings['aeiou_hour_max'].')</span>';

// Now setup the stats about no.s of email etc
$items['aeiou_awaiting_total'] = $temp[0] + $temp[1];
$items['aeiou_awaiting_initial_email'] = $temp[0];
$items['aeiou_awaiting_final_email'] = $temp[1];
$items['aeiou_awaiting_deletion'] = $temp[2] . (empty($modSettings['aeiou_delete']) ? ' <span style="color:red">'.$txt['aeiou_disabled'].'</span>' : '' ) ;

// Reasons for inactive
if(!empty($modSettings['aeiou_stop']))
$status = $txt['aeiou_nofurtheremails'];
elseif($modSettings['aeiou_day_max'] <= $modSettings['aeiou_day_sent'])
$status = $txt['aeiou_reacheddailylimit'];
elseif($modSettings['aeiou_hour_max'] <= $modSettings['aeiou_hour_sent'])
$status = $txt['aeiou_reachedhourlylimit'];

// Is the mod Active? (even if enabled, it might not be active)
// If the mod was stopped, but on loading this page, we discovered more emails, show as re-activated
if(!empty($reactivated))
$status = '<span style="color:darkgreen">'.$txt['aeiou_reactivated'].'</span>';
elseif(empty($status))
$status = '<span style="color:darkgreen">'.$txt['aeiou_active'].'</span>';
else
// Inactive
$status = '<span style="color:maroon">'.$txt['aeiou_stopped'].'</span> - '. $status;

// Header of the stats chunk and status
$chunk = '<table cellpadding="1" cellspacing="0" border="0" width="100%" class="tborder">
<tr class="titlebg"><td colspan="2">'.$txt['aeiou_status'].': '.$status.'</td></tr>';

// Now build the chunk of html of our stats
foreach($items as $string => $value)
{
// Less emphasis on the sub-totals
$italic = ($string == 'aeiou_awaiting_initial_email' || $string == 'aeiou_awaiting_final_email') ? 1 : 0 ;
// Add more rows to the existing chunk
$chunk .= '<tr class="windowbg"><td'.($italic ? ' style="font-weight:normal;font-style:italic"' : '').' >'.$txt[$string].':</td><td'.($italic ? ' style="font-weight:normal;font-style:italic"' : '').'>'.$value.'</td></tr>';
}
$chunk .= '</table><br />';

// Now for the last 10 people emailed
$request = db_query("
SELECT ID_MEMBER, memberName, aeiou_email, aeiou_count
FROM {$db_prefix}members
WHERE aeiou_email != 0
ORDER BY aeiou_email DESC
LIMIT 10
", __FILE__, __LINE__);

$chunk2 = '<table cellpadding="1" cellspacing="0" border="0" width="100%" class="tborder">
<tr class="titlebg"><td colspan="3">'.$txt['aeiou_last10emailed'].'</td></tr>';
if(mysql_num_rows($request) == 0)
$chunk2 .= '<tr class="windowbg"><td colspan="3">'.$txt['aeiou_never'].'</td></tr>';
else
{
// Add each user as a row in the table
while($row = mysql_fetch_assoc($request))
$chunk2 .= '<tr class="windowbg"><td><a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$row['memberName'].'</a></td><td style="font-weight:normal;">'.timeformat($row['aeiou_email'], true).'</td><td style="font-weight:normal;">'. $txt['aeiou_'.( ($row['aeiou_count'] == 1) ? 'initial' : 'final' )].'</td></tr>';
}
$chunk2 .= '</table><br />';

}
else
// If the mod is not enabled, don't show either as chunks.  use a space to prevent it being shown as a delimiter
$chunk = $chunk2 = ' ';

// Compile/Build some language strings/add to
// Avoids using html in the language files
$temp = array('initial_subject' => 'subject', 'initial_message' => 'message', 'final_subject' => 'subject', 'final_message' => 'message');
$add = '<div class="smalltext">'.$txt['aeiou_email_desc1'].'<br />'.$txt['aeiou_email_desc2'].'<br />'.$txt['aeiou_email_desc3'].'</div>';
foreach($temp as $a => $b)
{
// Add the descriptions to the txt string
$txt['aeiou_'.$a] .= $add;
// Use the default message if we don't have a custom one saved
if(empty($modSettings['aeiou_'.$a]))
$modSettings['aeiou_'.$a] = !empty($txt['aeiou_default_'.$b]) ? $txt['aeiou_default_'.$b] : '' ;
}
// Tidy up
unset($temp, $add, $a);

// More descriptions to add with html
$temp = array('delete', 'underposts', 'hour_max', 'day_max', 'chunksize');
foreach($temp as $a)
$txt['aeiou_'.$a] .= '<div class="smalltext">'.$txt['aeiou_'.$a.'_desc'] .'</div>';

// Now the warning chunk.  Comprises of 4 parts.
$txt['aeiou_warning'] .= '<div class="smalltext">'. $txt['aeiou_warning2'] .'<br />'.$txt['aeiou_warning3'].'<br />'.$txt['aeiou_warning4'].'</div>';

// The important array
$config_vars = array(
$chunk,
array('check', 'aeiou_enable'),
array('text', 'aeiou_initial_subject', '30" style="width:95%'),
array('large_text', 'aeiou_initial_message', '5" style="width:95%'),
array('text', 'aeiou_final_subject', '30" style="width:95%'),
array('large_text', 'aeiou_final_message', '5" style="width:95%'),
'',
array('check', 'aeiou_delete'),
array('int', 'aeiou_underposts'),
'',
$txt['aeiou_warning'],
array('int', 'aeiou_hour_max'),
array('int', 'aeiou_day_max'),
array('int', 'aeiou_chunksize'),
$chunk2,
);

// Saving?
if (isset($_GET['save']))
{
saveDBSettings($config_vars);
redirectexit('action=featuresettings;sa=aeiou');
}

$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=aeiou';
$context['settings_title'] = $txt['aeiou_title'];

prepareDBSettingContext($config_vars);
}


Dakle da kratim SVE 1814400 (21 dan) na 432000 (5 dana) ?

Dzonny

Naravno, mozes skratiti ako tako hoces, ne bi trebalo da bude problema...

Dzonny

Velike sesije na Debian / Ubuntu Linux serverima.

ukoliko se vas forum nalazi na Debian / Ubuntu serveru, brisanje starih sesija se nece primenjivati, i ovakvi podaci se mogu gomilati tokom vremena i opterecivati vas server kao i prostor na disku.
Da bi ovo ispravili uradite sledece:

Load.php
Nadjite:
   if (!empty($modSettings['databaseSession_enable']) && @version_compare(PHP_VERSION, '4.2.0') != -1)
         session_set_save_handler('sessionOpen', 'sessionClose', 'sessionRead', 'sessionWrite', 'sessionDestroy', 'sessionGC');
      elseif (@ini_get('session.gc_maxlifetime') <= 1440 && !empty($modSettings['databaseSession_lifetime']))
[Select]


Zamenite sa:
      if (!empty($modSettings['databaseSession_enable']) && @version_compare(PHP_VERSION, '4.2.0') != -1)
      {
         session_set_save_handler('sessionOpen', 'sessionClose', 'sessionRead', 'sessionWrite', 'sessionDestroy', 'sessionGC');
         ini_set('session.gc_probability', '1');
      }
      elseif (@ini_get('session.gc_maxlifetime') <= 1440 && !empty($modSettings['databaseSession_lifetime']))

Founder 2008

@Bob Marley nije me bilo na forumu nadam se da si resio ovo za dane, prvi put kad sam gledao subs.php, i ovo sam uocio, mozda ti bude od neke pomoci
// Query to get next victims
// - Must have been registered for 21 days
// - Must not have logged in for 21 days
// - Must not have been sent both initial and final email
// - Must not be an admin
// - Must not been emailed in the last 21 days


Bob Marley

Primetio sam... I onda sam stao malo i razmislio.. Posto je studentski forum i sad ce leto... Kapiram da dobar deo redovnih clanova nece biti na forumu... tako da je glupo da primenjujem ovaj mod... sa druge strane rasteretio sam Forum na druge nacine i (makar za sada) ne aktivni clanovi ne prave problem :)

Founder 2008

Moj savet, bez obzira koje je godisnje doba, ipak je bolje da ljudima ostavis neki mesec jer je glupo da neko ko nije redovan mora stalno da se registruje   :P

metaphysic

Quote from: Dzonny on June 02, 2009, 04:55:33 AM
Administratori nemaju ogranicenja za Attachmente...

....
Otvorite /Themes/vasa tema/Post.template.php


ovo oko Upload Image sa tyni pic, ja u
themes/moja tema,
nemam post.tempplate.php, jel da to onda uradim u default temi
=============
postavite ovu temu Sticky

Dzonny

metaphysic, naravno, posto fajlove koje nema tvoja tema forum vuce sa default teme... :)

Bob Marley

Tema je malo "potonula" da je vratimo na vrh... Takotz ^^

[̲̅J̲̅][̲̅U̲̅][̲̅R̲̅][̲̅E̲̅][̲̅K̲̅] ٩(×̯×)۶

Ma bude dzonny uskoro stavio nes novo :) moram priznat da stvarno stavlja super trikove..cak i koristim par i prezadovoljan sam xD

Dzonny

#37
Automatski backup foruma


  • Prvi korak

Mysql Backup
Ova skripta uradice svakodnevni Mysql backup.

[/list]#! /bin/sh
DATESTAMP=`date +%m-%d-%Y-%H%M`
cd /home/yourusername/backups/database/
mysqldump --opt -pPASSWORD -uUSERNAME DATABASE | gzip >$DATESTAMP.gz
cd /home/yourusername/
echo $DATESTAMP >> msg.txt
cat msg.txt | /usr/lib/sendmail -t


Sacuvajte kao daily.sh i uploadujte u home direktorijum. Promenite podatke u fajlu, youusername, PASSWORD, USERNAME i DATABASE sa vasim podacima. Napravite direktorijum backups i direktorijum database u okviru njega.

From: [email protected]
To: [email protected]
Subject: Daily Backup Routine

Begin your message here. It is very important to leave a blank line before you start the body of your message.
The Backup Routine has been executed


    Sacuvajte kao
msg.txt i sacuvajte na istu lokaciju kao prethodni fajl. Zamenite [email protected] sa vasom mail adresom kako bi dobijali mail po izvrsenom backupu.

Stavite CHMOD:
daily.sh - 775
msg.txt - 777.



  • Drugi Korak
Cron Jobs
MySQL Backup


Cron jobs mozete naci u cPanelu hosta koji koristite. Kliknite na cron jobs zatim na advanced (unix style).

Sada trebate napraviti novi "cron job", a za nasu skriptu to bi trebalo biti ovako:
minute : 00
hour : 01
day : *
month : *
weekday : *
command : /home/username/daily.sh


Ova skripta govori vreme kada se radi backup, u ovom primeru jednom dnevno, a to mozete promeniti prema svojim potrebama.
Samo pazite da se fajlovi ne nagomilaju, tako da preporucujem da povremeno ispraznite database direktorijum, tj da izbrisete stare backupove...

Dzonny

#38
Loadscreen

Slika ce vam reci sve.. :)
Dakle dok se stranica foruma ne ucita pikazuje se 'load' slicica....koja potom nestaje... :P
Demo: http://crazy.phpnet.us/blah/index.php




Otvorite fajl ./Themes/{vasa tema}/style.css.
Dodajte kod na kraj fajla:

/* Loadingscreen while actually loading :P */
.loadingscreen
{
    display: block;
    position: absolute;
    top: 40%;
    left: 45%;
   width: 150px;
    text-align: center;
   -moz-border-radius: 20px;
   -webkit-border-radius: 20px;
   border: 1px dashed #cccccc;
   padding: 20px;
    background: #fff;
    _background: none; /*this line removes the background in IE*/
    opacity: .75;
}
/* Loadingscreen while invisible */
.loadingscreen_hidden
{
    display:none;
}




./Themes/{vasa tema}/index.template.php.
Nadjite:
function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

Zamenite sa ovim:
function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo'
   <div id="loading" class="loadingscreen">
  <p><img src="', $settings['images_url'], '/loading.gif" alt="', $txt['loading'], '" /><br /></p>
</div>
<script type="text/javascript">
  document.getElementById("loading").className = "loadingscreen";
  var finishLoading = function(){document.getElementById("loading").className = "loadingscreen_hidden";};
  var oldLoad = window.onload;
  var newLoad = oldLoad ? function(){finishLoading.call(this);oldLoad.call(this);} : finishLoading;
  window.onload = newLoad;
</script>';




/Themes/{vasa tema}/languages/Modifications.{jezik}.php.
Napomena: Ako languages direktorijuma nema u vasoj temi potrazite ga u direktorijumu default teme.)
Kod dodajte na kraj fajla pre ?>
$txt['loading'] = 'Loading...';


I poslednji korak.
Uploadujte slicicu iz posta u /Themes/{vasa tema}/images/.

Bob Marley

Meni ovo ne radi kako treba. Ispratio sam "how to" doslovce i rezultat je "pucanje" fonta Foruma i loading.gif koji "bleji" gore levo :D

Advertisement: