How to fix "Function eregi() is deprecated in PHP 5.3

Need some help with the script?

Postby marcusmagalhaes » Thu Apr 29, 2010 8:49 pm

you want to use cache?

in head.php try it...

<?php
ini_set('session.use_trans_sid', false);
ini_set('session.use_only_cookies', true);
ini_set('url_rewriter.tags', '');

define('cache', false);
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', true);
define('check_referer', false);



ilyas_88 wrote:it works!! :D sorry I ask to mach, but I really need help to fix those problems :)

in the admin panel when I change samthing or edit the news I gett error inn functions.inc.php file line 744

something is wrong in this code?

////////////////////////////////////////////////////////
// Function: cache_remover
// Description: ??????????????

function cache_remover($alone = ''){

$fdir = opendir(rootpath.'/cache');
while ($file = readdir($fdir)){
if ($file != '.' and $file != '..' and $file != '.htaccess'){
if ($alone){
if (preg_match($alone.'(.*).(short|full).', $file)){
@unlink(rootpath.'/cache/'.$file);
}

if (!preg_match('.(short|full).', $file)){
@unlink(rootpath.'/cache/'.$file);
}
}

if (!$alone){
@unlink(rootpath.'/cache/'.$file);
}
}
}

return true;
}
marcusmagalhaes
 
Posts: 172
Joined: Tue Apr 24, 2007 1:17 pm

Postby ilyas_88 » Thu Apr 29, 2010 9:46 pm

what's the cache? the cache fix this problem? (I can not edit for example one of the news)
test
ilyas_88
 
Posts: 32
Joined: Sun Jul 12, 2009 3:19 am
Location: norway

Postby marcusmagalhaes » Thu Apr 29, 2010 10:03 pm

send me your head.php////
ilyas_88 wrote:what's the cache? the cache fix this problem? (I can not edit for example one of the news)
marcusmagalhaes
 
Posts: 172
Joined: Tue Apr 24, 2007 1:17 pm

Re: try it..

Postby mangomonkey » Thu Apr 29, 2010 10:27 pm

This is for addnews.mdu I have the same problem when going to the edit news page.... Any suggestions? Do you have this for edit news?

marcusmagalhaes wrote:// ********************************************************************************
// Do add News to DB
// ********************************************************************************
if ($action == 'doaddnews'){
if (($added_time = strtotime($day.' '.$month.' '.$year.' '.$hour.':'.$minute.':'.$second)) == -1){
$added_time = (time() + $config_date_adjust * 60);
}

if (!$title){
$title = substr($short_story, 0, 10).'...';
}

$id = $sql->last_insert_id('news', '', 'id') + 1;

run_actions('new-save-entry');

$sql->insert(array(
'table' => 'news',
'values' => array(
'date' => $added_time,
'author' => $member['username'],
'title' => replace_news('add', $title),
'short' => strlen(replace_news('add', $short_story)),
'full' => strlen(replace_news('add', $full_story)),
'avatar' => $avatar,
'category' => $category,
'url' => ($url ? url_namespace($url) : url_namespace(totranslit($title))),
'hidden' => (($config_approve_news == 'yes' and $member['level'] > 2) ? true : false)
)
));

$sql->insert(array(
'table' => 'story',
'values' => array(
'post_id' => $id,
'short' => replace_news('add', $short_story),
'full' => replace_news('add', $full_story)
)
));

run_actions('new-save-entry');

foreach($sql->select(array('table' => 'users')) as $row){
$sql->update(array(
'table' => 'users',
'where' => array("username = $member[username]"),
'values' => array('publications' => $row['publications'] + 1)
));
}


if ($config_send_mail_upon_new == 'yes' and $config_admin_mail){
cute_mail($config_admin_mail, 'New article on '.$config_home_title,
langdate($config_timestamp_comment, $added_time).
' A new article was added by '.$member['username']."\n\n".
$title."\n\n".
replace_news('admin', $short_story)."\n\n".
'--'."\n".
$config_http_home_url.'?id='.$id
);
}

msg('info', $echo['headerAdded'], sprintf($echo['headerAddedComplete'], $title, $PHP_SELF.'?mod=editnews&amp;id='.$id));
}



mangomonkey wrote:Hi, I have carried out the procedure listed in the first post, and everything is working well except for when I am in the admin panel. When I go to add news, or edit news, I get the following error. Any help appreciated!

Code: Select all
Parse error: syntax error, unexpected '(', expecting T_NS_SEPARATOR in /home/domainuser/public_html/news/inc/mod/addnews.mdu on line 114
mangomonkey
 
Posts: 8
Joined: Tue May 13, 2008 9:53 am

Postby ilyas_88 » Thu Apr 29, 2010 10:47 pm

Yes, i have no problem with addnews, but when I edit a feed and click save/edit, it will not save/ edit, it shows a white page with no text

her is my head.php (i can change it, but I ask because I did not know what is the cache)



Code: Select all
<?php
define('cache', true);
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', false);
define('check_referer', false);

#-------------------------------------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);


if (global_cache and !$_POST){
   $global_cache_file = dirname(__FILE__).'/cache/__'.md5(($_SERVER['REQUEST_URI'] ? $_SERVER

['REQUEST_URI'] : 'main')).'.tmp';

   if ($_POST['action'] == 'addcomment'){
      @unlink($global_cache_file);
   }

   if (!file_exists($global_cache_file)){
      function cute_global_cache($buffer){
      global $global_cache_file;

         $buffer = preg_replace('/\[if-logged\](.*?)\[\/if-logged\]/si', '', $buffer);
         $buffer = str_replace('[not-logged]', '', $buffer);
         $buffer = str_replace('[/not-logged]', '', $buffer);

         $fp = @fopen($global_cache_file, 'wb+');
         @fwrite($fp, $buffer);
         @fclose($fp);

      return $buffer;
      }

      ob_start('cute_global_cache');
   } else {
      exit(file_get_contents($global_cache_file));
   }
}

@extract($_SESSION, EXTR_SKIP);
@extract($_COOKIE, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
@extract($_ENV, EXTR_SKIP);
@extract($_POST, EXTR_SKIP);

$vars = array(
'skip',
'page',
'action',
'id',
'ucat',
'category',
'number',
'template',
'static',
'year',
'month',
'day',
'title',
'sort',
'user',
'author',
'time'
);

$default = array(
'cutepath'         => dirname(__FILE__),
'phpversion'      => @phpversion(),
'HTTP_REFERER'      => $_SERVER['HTTP_REFERER'],
'DOCUMENT_ROOT'      => $_SERVER['DOCUMENT_ROOT'],
'PHP_SELF'         => htmlentities($_SERVER['PHP_SELF']),
'is_logged_in'      => false,
'cookie_logged'      => false,
'session_logged'   => false,
'a7f89abdcf9324b3' => '',
'cache_uniq'      => 0
);

foreach ($default as $k => $v){
   unset($_GET[$k], $_POST[$k], $_SESSION[$k], $_COOKIE[$k], $_ENV[$k], $_CUTE[$k]);
   $$k = $v;
}

include_once $cutepath.'/data/config.php';

$config_database = ($config_database ? $config_database : 'txtsql');
$config_lang    = ($config_lang ? $config_lang : 'en');

include_once $cutepath.'/inc/lang/'.$config_lang.'/functions.php';
include_once $cutepath.'/inc/db/'.$config_database.'.inc.php';

foreach ($vars as $k => $v){
   $$k = @htmlspecialchars($v);
}

foreach ($sql->select(array('table' => 'categories', 'orderby' => array('id', 'ASC'))) as $row){
   $cat_name[$row['id']]     = $row['name'];
   $cat_icon[$row['id']]     = $row['icon'];
   $cat_url[$row['id']]     = $row['url'];
   $cat_template[$row['id']] = $row['template'];
   $cat_parent[$row['id']]     = $row['parent'];
}

foreach ($sql->select(array('table' => 'users')) as $row){
   if (!$row['hide_mail'] and $row['mail']){
      $user_name[$row['username']] = '<a href="mailto:'.str_replace('@', ' at ', str_replace('.',

' dot ', $row['mail'])).'">'.($row['name'] ? $row['name'] : $row['username']).'</a>';
   } else {
      $user_name[$row['username']] = ($row['name'] ? $row['name'] : $row['username']);
   }

   $user_id[$row['username']] = $row['id'];
   $user_avatar[$row['username']] = ($row['avatar'] ? '<img src="'.$config_path_userpic_upload.'/'.

$row['username'].'.'.$row['avatar'].'" alt="" border="0">' : '');
   $members[] = $row;
}

include_once $cutepath.'/inc/functions.inc.php';
include_once $cutepath.'/inc/plugins.inc.php';

$echo = cute_lang();

if (session){
   @session_start();
   @header('Cache-control: private');
}

if (substr($HTTP_REFERER, -1) == '/'){
   $HTTP_REFERER .= $PHP_SELF;
}

if (cookie){
   if ($username){
      if ($_COOKIE['md5_password']){
         $cmd5_password = $_COOKIE['md5_password'];
      } else {
         $cmd5_password = md5x($password);
      }

      if (check_login($username, $cmd5_password)){
         $cookie_logged = true;

         @setcookie('lastusername', $username, time() + 1012324305, '/');
         @setcookie('username', $username, time() + 3600 * 24 * 365, '/');
         @setcookie('md5_password', $cmd5_password, time() + 3600 * 24 * 365, '/');

      } else {
         $result = '<font color="red">'.$echo['loginError'].'</font>';
         $cookie_logged = false;
      }
   }
}

if (session){
   if ($action == 'dologin'){
      $md5_password = md5x($password);

      if (check_login($username, $md5_password)){
         $session_logged = true;

         @session_register('username');
         @session_register('md5_password');
         @session_register('ip');
         @session_register('login_referer');

         $_SESSION['username']      = $username;
         $_SESSION['md5_password']  = $md5_password;
         $_SESSION['ip']            = $_SERVER['REMOTE_ADDR'];
         $_SESSION['login_referer'] = $HTTP_REFERER;

      } else {
         $result = '<font color="red">'.$echo['loginError'].'</font>';
         $session_logged = false;
      }
   } elseif ($_SESSION['username']){
      if (check_login($_SESSION['username'], $_SESSION['md5_password'])){
         if ($_SESSION['ip'] != $ip){
            $session_logged = false;
            $result = $echo['sessionError'];
         } else {
            $session_logged = true;
         }
      } else {
         $result = '<font color="red">'.$echo['loginError'].'</font>';
         $session_logged = false;
      }
   }

   if (!$username){
      $username = $_SESSION['username'];
   }
}

if ($session_logged or $cookie_logged){
   $is_logged_in = true;

   if ($action == 'dologin'){
      $sql->update(array(
      'table'    => 'users',
      'where'    => array("username = $username"),
      'values' => array('last_visit' => (time() + $config_date_adjust * 60))
      ));
   }
}

LoadActivePlugins();
run_actions('head');

@extract($_CUTE, EXTR_SKIP);
?>
test
ilyas_88
 
Posts: 32
Joined: Sun Jul 12, 2009 3:19 am
Location: norway

Postby marcusmagalhaes » Thu Apr 29, 2010 11:26 pm

cahnge it...
<?php
define('cache', true); <------
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', false); <-----
define('check_referer', false);


to it..
<?php
ini_set('session.use_trans_sid', false);
ini_set('session.use_only_cookies', true);
ini_set('url_rewriter.tags', '');

define('cache', false); <-----
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', true); <------
define('check_referer', false);


ilyas_88 wrote:Yes, i have no problem with addnews, but when I edit a feed and click save/edit, it will not save/ edit, it shows a white page with no text

her is my head.php (i can change it, but I ask because I did not know what is the cache)



Code: Select all
<?php
define('cache', true);
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', false);
define('check_referer', false);

#-------------------------------------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);


if (global_cache and !$_POST){
   $global_cache_file = dirname(__FILE__).'/cache/__'.md5(($_SERVER['REQUEST_URI'] ? $_SERVER

['REQUEST_URI'] : 'main')).'.tmp';

   if ($_POST['action'] == 'addcomment'){
      @unlink($global_cache_file);
   }

   if (!file_exists($global_cache_file)){
      function cute_global_cache($buffer){
      global $global_cache_file;

         $buffer = preg_replace('/\[if-logged\](.*?)\[\/if-logged\]/si', '', $buffer);
         $buffer = str_replace('[not-logged]', '', $buffer);
         $buffer = str_replace('[/not-logged]', '', $buffer);

         $fp = @fopen($global_cache_file, 'wb+');
         @fwrite($fp, $buffer);
         @fclose($fp);

      return $buffer;
      }

      ob_start('cute_global_cache');
   } else {
      exit(file_get_contents($global_cache_file));
   }
}

@extract($_SESSION, EXTR_SKIP);
@extract($_COOKIE, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
@extract($_ENV, EXTR_SKIP);
@extract($_POST, EXTR_SKIP);

$vars = array(
'skip',
'page',
'action',
'id',
'ucat',
'category',
'number',
'template',
'static',
'year',
'month',
'day',
'title',
'sort',
'user',
'author',
'time'
);

$default = array(
'cutepath'         => dirname(__FILE__),
'phpversion'      => @phpversion(),
'HTTP_REFERER'      => $_SERVER['HTTP_REFERER'],
'DOCUMENT_ROOT'      => $_SERVER['DOCUMENT_ROOT'],
'PHP_SELF'         => htmlentities($_SERVER['PHP_SELF']),
'is_logged_in'      => false,
'cookie_logged'      => false,
'session_logged'   => false,
'a7f89abdcf9324b3' => '',
'cache_uniq'      => 0
);

foreach ($default as $k => $v){
   unset($_GET[$k], $_POST[$k], $_SESSION[$k], $_COOKIE[$k], $_ENV[$k], $_CUTE[$k]);
   $$k = $v;
}

include_once $cutepath.'/data/config.php';

$config_database = ($config_database ? $config_database : 'txtsql');
$config_lang    = ($config_lang ? $config_lang : 'en');

include_once $cutepath.'/inc/lang/'.$config_lang.'/functions.php';
include_once $cutepath.'/inc/db/'.$config_database.'.inc.php';

foreach ($vars as $k => $v){
   $$k = @htmlspecialchars($v);
}

foreach ($sql->select(array('table' => 'categories', 'orderby' => array('id', 'ASC'))) as $row){
   $cat_name[$row['id']]     = $row['name'];
   $cat_icon[$row['id']]     = $row['icon'];
   $cat_url[$row['id']]     = $row['url'];
   $cat_template[$row['id']] = $row['template'];
   $cat_parent[$row['id']]     = $row['parent'];
}

foreach ($sql->select(array('table' => 'users')) as $row){
   if (!$row['hide_mail'] and $row['mail']){
      $user_name[$row['username']] = '<a href="mailto:'.str_replace('@', ' at ', str_replace('.',

' dot ', $row['mail'])).'">'.($row['name'] ? $row['name'] : $row['username']).'</a>';
   } else {
      $user_name[$row['username']] = ($row['name'] ? $row['name'] : $row['username']);
   }

   $user_id[$row['username']] = $row['id'];
   $user_avatar[$row['username']] = ($row['avatar'] ? '<img src="'.$config_path_userpic_upload.'/'.

$row['username'].'.'.$row['avatar'].'" alt="" border="0">' : '');
   $members[] = $row;
}

include_once $cutepath.'/inc/functions.inc.php';
include_once $cutepath.'/inc/plugins.inc.php';

$echo = cute_lang();

if (session){
   @session_start();
   @header('Cache-control: private');
}

if (substr($HTTP_REFERER, -1) == '/'){
   $HTTP_REFERER .= $PHP_SELF;
}

if (cookie){
   if ($username){
      if ($_COOKIE['md5_password']){
         $cmd5_password = $_COOKIE['md5_password'];
      } else {
         $cmd5_password = md5x($password);
      }

      if (check_login($username, $cmd5_password)){
         $cookie_logged = true;

         @setcookie('lastusername', $username, time() + 1012324305, '/');
         @setcookie('username', $username, time() + 3600 * 24 * 365, '/');
         @setcookie('md5_password', $cmd5_password, time() + 3600 * 24 * 365, '/');

      } else {
         $result = '<font color="red">'.$echo['loginError'].'</font>';
         $cookie_logged = false;
      }
   }
}

if (session){
   if ($action == 'dologin'){
      $md5_password = md5x($password);

      if (check_login($username, $md5_password)){
         $session_logged = true;

         @session_register('username');
         @session_register('md5_password');
         @session_register('ip');
         @session_register('login_referer');

         $_SESSION['username']      = $username;
         $_SESSION['md5_password']  = $md5_password;
         $_SESSION['ip']            = $_SERVER['REMOTE_ADDR'];
         $_SESSION['login_referer'] = $HTTP_REFERER;

      } else {
         $result = '<font color="red">'.$echo['loginError'].'</font>';
         $session_logged = false;
      }
   } elseif ($_SESSION['username']){
      if (check_login($_SESSION['username'], $_SESSION['md5_password'])){
         if ($_SESSION['ip'] != $ip){
            $session_logged = false;
            $result = $echo['sessionError'];
         } else {
            $session_logged = true;
         }
      } else {
         $result = '<font color="red">'.$echo['loginError'].'</font>';
         $session_logged = false;
      }
   }

   if (!$username){
      $username = $_SESSION['username'];
   }
}

if ($session_logged or $cookie_logged){
   $is_logged_in = true;

   if ($action == 'dologin'){
      $sql->update(array(
      'table'    => 'users',
      'where'    => array("username = $username"),
      'values' => array('last_visit' => (time() + $config_date_adjust * 60))
      ));
   }
}

LoadActivePlugins();
run_actions('head');

@extract($_CUTE, EXTR_SKIP);
?>
marcusmagalhaes
 
Posts: 172
Joined: Tue Apr 24, 2007 1:17 pm

Postby ilyas_88 » Fri Apr 30, 2010 7:53 am

Ok, i have change it, but i cant stell not edit news :(
When I'm in the edit and Click on a news that works fine, but when I edit / save news so it only shows a white page with no text :?:
test
ilyas_88
 
Posts: 32
Joined: Sun Jul 12, 2009 3:19 am
Location: norway

Postby marcusmagalhaes » Fri Apr 30, 2010 1:10 pm

folder cache - chmod 777

my head.php


<?php
ini_set('session.use_trans_sid', false);
ini_set('session.use_only_cookies', true);
ini_set('url_rewriter.tags', '');

define('cache', false);
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', false);
define('check_referer', false);
#-------------------------------------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);


if (global_cache and !$_POST){
$global_cache_file = dirname(__FILE__).'/cache/__'.md5(($_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : 'main')).'.tmp';

if ($_POST['action'] == 'addcomment'){
@unlink($global_cache_file);
}

if (!file_exists($global_cache_file)){
function cute_global_cache($buffer){
global $global_cache_file;

$buffer = preg_replace('/\[if-logged\](.*?)\[\/if-logged\]/si', '', $buffer);
$buffer = str_replace('[not-logged]', '', $buffer);
$buffer = str_replace('[/not-logged]', '', $buffer);

$fp = @fopen($global_cache_file, 'wb+');
@fwrite($fp, $buffer);
@fclose($fp);

return $buffer;
}

ob_start('cute_global_cache');
} else {
exit(file_get_contents($global_cache_file));
}
}

@extract($_SESSION, EXTR_SKIP);
@extract($_COOKIE, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
@extract($_ENV, EXTR_SKIP);
@extract($_POST, EXTR_SKIP);

$vars = array(
'skip',
'page',
'action',
'id',
'ucat',
'category',
'number',
'template',
'static',
'year',
'month',
'day',
'title',
'sort',
'user',
'author',
'time'
);

$default = array(
'cutepath' => dirname(__FILE__),
'phpversion' => @phpversion(),
'HTTP_REFERER' => $_SERVER['HTTP_REFERER'],
'DOCUMENT_ROOT' => $_SERVER['DOCUMENT_ROOT'],
'PHP_SELF' => $_SERVER['PHP_SELF'],
'is_logged_in' => false,
'cookie_logged' => false,
'session_logged' => false,
'a7f89abdcf9324b3' => '',
'cache_uniq' => 0
);

foreach ($default as $k => $v){
unset($_GET[$k], $_POST[$k], $_SESSION[$k], $_COOKIE[$k], $_ENV[$k], $_CUTE[$k]);
$$k = $v;
}

include_once $cutepath.'/data/config.php';

$config_database = ($config_database ? $config_database : 'txtsql');
$config_lang = ($config_lang ? $config_lang : 'en');

include_once $cutepath.'/inc/lang/'.$config_lang.'/functions.php';
include_once $cutepath.'/inc/db/'.$config_database.'.inc.php';

foreach ($vars as $k => $v){
$$k = @htmlspecialchars($v);
}

foreach ($sql->select(array('table' => 'categories', 'orderby' => array('id', 'ASC'))) as $row){
$cat_name[$row['id']] = $row['name'];
$cat_icon[$row['id']] = $row['icon'];
$cat_url[$row['id']] = $row['url'];
$cat_template[$row['id']] = $row['template'];
$cat_parent[$row['id']] = $row['parent'];
}

foreach ($sql->select(array('table' => 'users')) as $row){
if (!$row['hide_mail'] and $row['mail']){

$user_name[$row['username']] = '<a href="mailto:'.$row['mail'].'">'.($row['name'] ? $row['name'] : $row['username']).'</a>';
//$user_name[$row['username']] = '<a href="mailto:'.str_replace('@', '@', str_replace('.', '.', $row['mail'])).'">'.($row['name'] ? $row['name'] : $row['username']).'</a>';
} else {
$user_name[$row['username']] = ($row['name'] ? $row['name'] : $row['username']);
}

$user_id[$row['username']] = $row['id'];
$user_avatar[$row['username']] = ($row['avatar'] ? '<img src="'.$config_path_userpic_upload.'/'.$row['username'].'.'.$row['avatar'].'" alt="" border="0">' : '');
$members[] = $row;
}

include_once $cutepath.'/inc/functions.inc.php';
include_once $cutepath.'/inc/plugins.inc.php';

$echo = cute_lang();

if (session){
@session_start();
@header('Cache-control: private');
}

if (substr($HTTP_REFERER, -1) == '/'){
$HTTP_REFERER .= $PHP_SELF;
}

if (cookie){
if ($username){
if ($_COOKIE['md5_password']){
$cmd5_password = $_COOKIE['md5_password'];
} else {
$cmd5_password = md5x($password);
}

if (check_login($username, $cmd5_password)){
$cookie_logged = true;

@setcookie('lastusername', $username, time() + 1012324305, '/');
@setcookie('username', $username, time() + 3600 * 24 * 365, '/');
@setcookie('md5_password', $cmd5_password, time() + 3600 * 24 * 365, '/');

} else {
$result = '<font color="red">'.$echo['loginError'].'</font>';
$cookie_logged = false;
}
}
}

if (session){
if ($action == 'dologin'){
$md5_password = md5x($password);

if (check_login($username, $md5_password)){
$session_logged = true;

@session_register('username');
@session_register('md5_password');
@session_register('ip');
@session_register('login_referer');

$_SESSION['username'] = $username;
$_SESSION['md5_password'] = $md5_password;
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['login_referer'] = $HTTP_REFERER;

} else {
$result = '<font color="red">'.$echo['loginError'].'</font>';
$session_logged = false;
}
} elseif ($_SESSION['username']){
if (check_login($_SESSION['username'], $_SESSION['md5_password'])){
if ($_SESSION['ip'] != $ip){
$session_logged = false;
$result = $echo['sessionError'];
} else {
$session_logged = true;
}
} else {
$result = '<font color="red">'.$echo['loginError'].'</font>';
$session_logged = false;
}
}

if (!$username){
$username = $_SESSION['username'];
}
}

if ($session_logged or $cookie_logged){
$is_logged_in = true;

/* if ($action == 'dologin'){
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60))
));
}*/

/* usuario online */

if ($action == 'logout'){
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60 - 301))
));
}

else{
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60))
));
}

}

LoadActivePlugins();
run_actions('head');

@extract($_CUTE, EXTR_SKIP);
?>




ilyas_88 wrote:Ok, i have change it, but i cant stell not edit news :(
When I'm in the edit and Click on a news that works fine, but when I edit / save news so it only shows a white page with no text :?:
marcusmagalhaes
 
Posts: 172
Joined: Tue Apr 24, 2007 1:17 pm

Postby ilyas_88 » Fri Apr 30, 2010 6:41 pm

I cant stell edit news :(
test
ilyas_88
 
Posts: 32
Joined: Sun Jul 12, 2009 3:19 am
Location: norway

Postby marcusmagalhaes » Fri May 21, 2010 12:42 am

Alternatively, you can also replace the php call with an analog; to remove the deprecated feature. You can replace the ereg() call with a call to mb_ereg(). The latter function is a direct replacement for the former, and is not deprecated.

mb_ereg()
mb_eregi()
marcusmagalhaes
 
Posts: 172
Joined: Tue Apr 24, 2007 1:17 pm

Postby ilyas_88 » Wed May 26, 2010 11:41 am

there are many problems, I do not think I bothered more :( I do not know what you mean? like I said I have not used cutenews before, I know little about the system :(
test
ilyas_88
 
Posts: 32
Joined: Sun Jul 12, 2009 3:19 am
Location: norway

Postby mark99 » Sat Jun 12, 2010 4:09 pm

I'm sure my dedicated server will be getting an upgrade from PHP5.2 to 5.3 very soon now and from some of the posts in this topic I am worried that my CuteNewsRU will simply stop working and throw out errors when that happens, or does it only occur in CNRU when certain features are enabled? From the posts above it seems like a lot of problems remain unresolved, so 5.3 could kill CNRU for a lot of people.
mark99
 
Posts: 123
Joined: Mon Feb 09, 2009 6:01 pm

Postby ilyas_88 » Fri Jun 25, 2010 12:25 am

cutenews system will fix the problem or what? , or should we start with installing other system? :!:
test
ilyas_88
 
Posts: 32
Joined: Sun Jul 12, 2009 3:19 am
Location: norway

Re: How to fix "Function eregi() is deprecated in PHP 5.3

Postby johnlu » Mon Jan 03, 2011 7:12 am

So you have changed it all in your CNR installation and
it solved your problems with newer PHP versions?






learn spanish
johnlu
 
Posts: 1
Joined: Mon Jan 03, 2011 4:24 am

Re: How to fix "Function eregi() is deprecated in PHP 5.3

Postby Mania » Tue Jan 04, 2011 2:15 am

Code: Select all

<?php
ini_set
('session.use_trans_sid', false);
ini_set('session.use_only_cookies', true);
ini_set('url_rewriter.tags', '');

define('cache', false);
define('global_cache', false);
define('chmod', 0777);
define('cookie', true);
define('session', false);
define('check_referer', false);
#-------------------------------------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);


if (global_cache and !$_POST){
$global_cache_file = dirname(__FILE__).'/cache/__'.md5(($_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : 'main')).'.tmp';

if ($_POST['action'] == 'addcomment'){
@
unlink($global_cache_file);
}

if (!file_exists($global_cache_file)){
function cute_global_cache($buffer){
global $global_cache_file;

$buffer = preg_replace('/\[if-logged\](.*?)\[\/if-logged\]/si', '', $buffer);
$buffer = str_replace('[not-logged]', '', $buffer);
$buffer = str_replace('[/not-logged]', '', $buffer);

$fp = @fopen($global_cache_file, 'wb+');
@
fwrite($fp, $buffer);
@
fclose($fp);

return $buffer;
}

ob_start('cute_global_cache');
}
 else {
exit(
file_get_contents($global_cache_file));
}
}

@
extract($_SESSION, EXTR_SKIP);
@
extract($_COOKIE, EXTR_SKIP);
@
extract($_GET, EXTR_SKIP);
@
extract($_ENV, EXTR_SKIP);
@
extract($_POST, EXTR_SKIP);

$vars = array(
'skip',
'page',
'action',
'id',
'ucat',
'category',
'number',
'template',
'static',
'year',
'month',
'day',
'title',
'sort',
'user',
'author',
'time'
);

$default = array(
'cutepath' => dirname(__FILE__),
'phpversion' => @phpversion(),
'HTTP_REFERER' => $_SERVER['HTTP_REFERER'],
'DOCUMENT_ROOT' => $_SERVER['DOCUMENT_ROOT'],
'PHP_SELF' => $_SERVER['PHP_SELF'],
'is_logged_in' => false,
'cookie_logged' => false,
'session_logged' => false,
'a7f89abdcf9324b3' => '',
'cache_uniq' => 0
);

foreach ($default as $k => $v){
unset(
$_GET[$k], $_POST[$k], $_SESSION[$k], $_COOKIE[$k], $_ENV[$k], $_CUTE[$k]);
$
$k = $v;
}

include_once $cutepath.'/data/config.php';

$config_database = ($config_database ? $config_database : 'txtsql');
$config_lang = ($config_lang ? $config_lang : 'en');

include_once $cutepath.'/inc/lang/'.$config_lang.'/functions.php';
include_once $cutepath.'/inc/db/'.$config_database.'.inc.php';

foreach ($vars as $k => $v){
$
$k = @htmlspecialchars($v);
}

foreach ($sql->select(array('table' => 'categories', 'orderby' => array('id', 'ASC'))) as $row){
$cat_name[$row['id']] = $row['name'];
$cat_icon[$row['id']] = $row['icon'];
$cat_url[$row['id']] = $row['url'];
$cat_template[$row['id']] = $row['template'];
$cat_parent[$row['id']] = $row['parent'];
}

foreach ($sql->select(array('table' => 'users')) as $row){
if (!$row['hide_mail'] and $row['mail']){

$user_name[$row['username']] = '<a href="mailto:'.$row['mail'].'">'.($row['name'] ? $row['name'] : $row['username']).'</a>';
//$user_name[$row['username']] = '<a href="mailto:'.str_replace('@', '@', str_replace('.', '.', $row['mail'])).'">'.($row['name'] ? $row['name'] : $row['username']).'</a>';
} else {
$user_name[$row['username']] = ($row['name'] ? $row['name'] : $row['username']);
}

$user_id[$row['username']] = $row['id'];
$user_avatar[$row['username']] = ($row['avatar'] ? '<img src="'.$config_path_userpic_upload.'/'.$row['username'].'.'.$row['avatar'].'" alt="" border="0">' : '');
$members[] = $row;
}

include_once $cutepath.'/inc/functions.inc.php';
include_once $cutepath.'/inc/plugins.inc.php';

$echo = cute_lang();

if (session){
@
session_start();
@
header('Cache-control: private');
}

if (substr($HTTP_REFERER, -1) == '/'){
$HTTP_REFERER .= $PHP_SELF;
}

if (cookie){
if ($username){
if ($_COOKIE['md5_password']){
$cmd5_password = $_COOKIE['md5_password'];
}
 else {
$cmd5_password = md5x($password);
}

if (check_login($username, $cmd5_password)){
$cookie_logged = true;

@
setcookie('lastusername', $username, time() + 1012324305, '/');
@
setcookie('username', $username, time() + 3600 * 24 * 365, '/');
@
setcookie('md5_password', $cmd5_password, time() + 3600 * 24 * 365, '/');

}
 else {
$result = '<font color="red">'.$echo['loginError'].'</font>';
$cookie_logged = false;
}
}
}

if (session){
if ($action == 'dologin'){
$md5_password = md5x($password);

if (check_login($username, $md5_password)){
$session_logged = true;

@
session_register('username');
@
session_register('md5_password');
@
session_register('ip');
@
session_register('login_referer');

$_SESSION['username'] = $username;
$_SESSION['md5_password'] = $md5_password;
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['login_referer'] = $HTTP_REFERER;

}
 else {
$result = '<font color="red">'.$echo['loginError'].'</font>';
$session_logged = false;
}
}
 elseif ($_SESSION['username']){
if (check_login($_SESSION['username'], $_SESSION['md5_password'])){
if ($_SESSION['ip'] != $ip){
$session_logged = false;
$result = $echo['sessionError'];
}
 else {
$session_logged = true;
}
}
 else {
$result = '<font color="red">'.$echo['loginError'].'</font>';
$session_logged = false;
}
}

if (!$username){
$username = $_SESSION['username'];
}
}

if ($session_logged or $cookie_logged){
$is_logged_in = true;

/* if ($action == 'dologin'){
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60))
));
}*/

/* usuario online */

if ($action == 'logout'){
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60 - 301))
));
}

else{
$sql->update(array(
'table' => 'users',
'where' => array("username = $username"),
'values' => array('last_visit' => (time() + $config_date_adjust * 60))
));
}

}

LoadActivePlugins();
run_actions('head');

@
extract($_CUTE, EXTR_SKIP);
?>

the nice thing in phpbb 3.x is highlighting php code with adding =php in BBcode
Code: Select all
[code=php]
<?php
print "some  highlighted cods ...";
?>
[/code]
User avatar
Mania
 
Posts: 178
Joined: Sat Feb 03, 2007 1:12 pm

PreviousNext

Return to Help



Who is online

Users browsing this forum: No registered users and 0 guests

cron