Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Joomla Kodları ve Giriş Melancholy Joomla 0 18-08-2009 22:34
Jomla Hataları ve Çözümleri Melancholy Joomla 0 18-08-2009 22:19
Cep Telefonu İşlem Kodları ZeynepCan Teknik Servis 0 18-08-2008 00:39
İl Trafik Plaka Kodları İntizar Gezi Rehberi 0 08-11-2007 19:37
Turkcell Hücre Yayını Kodları *esra* Mobil Cihazlar 1 05-10-2007 19:07

Cevapla
 
Seçenekler Stil
Alt 18-08-2009, 22:38   #1
Melancholy
Teğmen
 
Melancholy - ait Kullanıcı Resmi (Avatar)
 
Üyelik tarihi: Jul 2009
Mesajlar: 538
REP Göstergesi
Seviye: 21 [♥ Bé-Yêu ♥♥ Bé-Yêu ♥♥ Bé-Yêu ♥♥ Bé-Yêu ♥]
Aktiflik: 52 / 509
Güç: 179 / 4176
Deneyim: 36%

Arrow Jomla Kodları-2


Bu yazımızda index.php dosyasına kaldığımız yerden devam ederek bitireceğiz. Daha sonra da ana dizinde bulunan diğer dosyalara teker teker göz atmaya devam edecez.


Ana dizinde bulunan index.php içerisinde kaldığımız kodlar şöyle başlıyor;


if ( $option == 'com_content' && $Itemid === 0 ) {
$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
$Itemid = $mainframe->getItemid( $id );
}

/** do we have a valid Itemid yet?? */
if ( $Itemid === 0 ) {
/** Nope, just use the homepage then. */
$query = "SELECT id"
. "\n FROM #__menu"
. "\n WHERE menutype = 'mainmenu'"
. "\n AND published = 1"
. "\n ORDER BY parent, ordering"
;
$database->setQuery( $query, 0, 1 );
$Itemid = $database->loadResult();
}

// patch to lessen the impact on templates
if ($option == 'search') {
$option = 'com_search';
}


Bu kodlar içerik yazılarımızdaki Itemid değerinin doğru olarak tespit edilmesini sağlıyor.

if ($mosConfig_lang=='') {
$mosConfig_lang = 'english';
}
include_once( $mosConfig_absolute_path .'/language/' . $mosConfig_lang . '.php' );


Bu kodlar sitenin dili tanımlanmamış ise varsayılan olarak ingilizceyi seçiyor.

$return = strval( mosGetParam( $_REQUEST, 'return', NULL ) );
$message = intval( mosGetParam( $_POST, 'message', 0 ) );
if ($option == 'login') {
$mainframe->login();

// JS Popup message
if ( $message ) {
?>

}

if ( $return && !( strpos( $return, 'com_registration' ) || strpos( $return, 'com_login' ) ) ) {
// checks for the presence of a return url
// and ensures that this url is not the registration or login pages
// If a sessioncookie exists, redirect to the given page. Otherwise, take an extra round for a cookiecheck
if (isset( $_COOKIE[mosMainFrame::sessionCookieName()] )) {
mosRedirect( $return );
} else {
mosRedirect( $mosConfig_live_site .'/index.php?option=cookiecheck&return=' . urlencode( $return ) );
}
} else {
// If a sessioncookie exists, redirect to the start page. Otherwise, take an extra round for a cookiecheck
if (isset( $_COOKIE[mosMainFrame::sessionCookieName()] )) {
mosRedirect( $mosConfig_live_site .'/index.php' );
} else {
mosRedirect( $mosConfig_live_site .'/index.php?option=cookiecheck&return=' . urlencode( $mosConfig_live_site .'/index.php' ) );
}
}

} else if ($option == 'logout') {
$mainframe->logout();

// JS Popup message
if ( $message ) {
?>

}

if ( $return && !( strpos( $return, 'com_registration' ) || strpos( $return, 'com_login' ) ) ) {
// checks for the presence of a return url
// and ensures that this url is not the registration or logout pages
mosRedirect( $return );
} else {
mosRedirect( $mosConfig_live_site.'/index.php' );
}
} else if ($option == 'cookiecheck') {
// No cookie was set upon login. If it is set now, redirect to the given page. Otherwise, show error message.
if (isset( $_COOKIE[mosMainFrame::sessionCookieName()] )) {
mosRedirect( $return );
} else {
mosErrorAlert( _ALERT_ENABLED );
}
}


Bu uzunca kod ise siteye giriş ve çıkış yaparken gösterilen çeşitli uyarıları ve çerez (cookie) ayarlarını düzenliyor.

$my = $mainframe->getUser();

İşte bu kod biz kodlamacı arkadaşlar için önemli kodlardan bir tanesi. $my değeri ile sitedeki herhangi birisinin kullanıcı adı, adı, üye numarası, oturum değeri gibi birçok bilgiyi çekebiliriz. Mesela;

$my->id ile üyenin veritabanındaki sıra numarasını,
$my->username ile üyenin veritabanındaki kullanıcı adını,
$my->usertype ile üyenin üyelik statüsünü,
$my->gid ile de üyenin üyelik seviyesini (0, 1, 2 olmak üzere) belirtebiliriz. 0 = ziyaretçi, 1 = ön yüz yetkileri (Kayıtlı, Yazar, Editör gibi...), 2 = arka yüz yetkileri (Yönetici, Yayıncı ve Admin gibi...) belirtilir.

$my->name ile üyenin adını,
$my->email ile üyenin e posta adresini,
$my->block ile üyenin sitede yasaklanıp yasaklanmadığını (0 = yasaklanMAmış, 1 = yasaklanmış),
$my->registerDate ile üyenin siteye kayıt olma tarihini,
$my->lastvisitDate ile üyenin siteye son giriş yapma tarihini,
$my->activation ile de üyenin aktivasyon kodunu


göstermek mümkündür.

$mainframe->detect();

bu kod siteyi ziyaret eden üyenin tarayıcısı, ip adresi gibi çeşitli bilgilerini toplar.

$cur_template = $mainframe->getTemplate();

bu kod sitede kullanılan varsayılan temayı belirler.

require_once( $mosConfig_absolute_path . '/editor/editor.php' );

bu kod sitemizde kullanacağımız metin editörünü belirler.


ob_start();

if ($path = $mainframe->getPath( 'front' )) {
$task = strval( mosGetParam( $_REQUEST, 'task', '' ) );
$ret = mosMenuCheck( $Itemid, $option, $task, $gid );

if ($ret) {
require_once( $path );
} else {
mosNotAuth();
}
} else {
header( 'HTTP/1.0 404 Not Found' );
echo _NOT_EXIST;
}

$_MOS_OPTION['buffer'] = ob_get_contents();

ob_end_clean();


Bu kodlar ile output buffering fonksiyonu çalıştırılır. Türkçeye çevirecek olursak gösterilecek içerik tamponlanır, yani düzene sokulur diyebiliriz.

initGzip();

Bu kod ile Gzip desteğini aktive ediyoruz.

header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
header( 'Cache-Control: post-check=0, pre-check=0', false );
header( 'Pragma: no-cache' );


Sitemizin header bölümünü oluşturuyoruz.

if (defined( '_ADMIN_OFFLINE' )) {
include( $mosConfig_absolute_path .'/offlinebar.php' );
}


Bu kod, eğer site kapalı fakat siteye giriş yapan bir admin ise sitemizin üst bölümünde kırmızı bir alanda site kapalı gibi bir uyarı ile siteyi bize gösteriyor.

if ( !file_exists( $mosConfig_absolute_path .'/templates/'. $cur_template .'/index.php' ) ) {
echo _TEMPLATE_WARN . $cur_template;
} else {
require_once( $mosConfig_absolute_path .'/templates/'. $cur_template .'/index.php' );
echo '';
}


Bu kod kullandığımız temanın index.php dosyasını aktarıyor. Böylece sitemiz gösterime hazır hale geldi.

if ($mosConfig_debug) {
echo $database->_ticker . ' queries executed';
echo '


';
foreach ($database->_log as $k=>$sql) {
echo $k+1 . "\n" . $sql . '

';
}
echo '
';
}

Bu kod gösterilen sayfadaki tüm veritabanı sorgulamalarını ve sorgulama süresini gösteriyor. $mosConfig_debug değeri ile (ki bu değer configuration.php içerisinde bulunur ve Genel yapılandırmadan değiştirilebilir) bu fonksiyonu çalıştırabiliriz.


Buraya kadar ki yazımızda joomlanın index.php dosyasını anlatmaya çalıştım. Kodlamada kullanılabilecek en önemli değer burada $my değeridir ki bu değer, sitedeki üyenin yukarıda saydığım birçok bilgisini içerisinde barındırmaktadır
İmzası

HαkkıмDα ßiLqin YoKsα..Fikяinde OLмαsıN..

Melancholy isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Cevapla

Seçenekler
Stil

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Açık
Trackbacks are Kapalı
Pingbacks are Kapalı
Refbacks are Kapalı
Hizli Erisim


WEZ Format +2. Şuan Saat: 09:58.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright ©2005 - 2009 Ondokuz.Net