This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class RulesMerger | |
| { | |
| public static function merge() | |
| { | |
| $urlManager = Yii::app()->getUrlManager(); | |
| $path = Yii::getPathOfAlias('application.modules'); | |
| foreach(Yii::app()->getModules() as $k => $v) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * LoginForm class. | |
| * LoginForm is the data structure for keeping | |
| * user login form data. It is used by the 'login' action of 'SiteController'. | |
| */ | |
| class LoginForm extends CFormModel | |
| { | |
| public $username; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * UserIdentity represents the data needed to identity a user. | |
| * It contains the authentication method that checks if the provided | |
| * data can identity the user. | |
| */ | |
| class UserIdentity extends CUserIdentity | |
| { | |
| const ERROR_LIMIT_REACHED = 666; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| with open(sys.argv[1]) as the_file: | |
| websites = [line.rstrip('\n') for line in the_file] | |
| print websites |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require 'Config.php'; | |
| Config::load('config/main.php'); | |
| Config::set('timezone', 'Asia/Jakarta'); | |
| echo Config::get('base_url'); | |
| echo '<br />'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| return array( | |
| 'base_url' => 'http://localhost/myapp/', | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Config { | |
| private static $items = array(); | |
| public static function load($config_file){ | |
| self::$items = require $config_file; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while True: | |
| nama = raw_input('Nama: ') | |
| if not nama: continue | |
| alamat = raw_input('Alamat: ') | |
| if not alamat: continue | |
| hobi = raw_input('Hobi: ') | |
| if not hobi: continue | |
| break; | |
| print '\n\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| month_placeholder = { | |
| 'Jan' : 1, | |
| 'Feb' : 2, | |
| 'Mar' : 3, | |
| 'Apr' : 4, | |
| 'Mei' : 5, | |
| 'Jun' : 6, | |
| 'Jul' : 7, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php class EWebUser extends CWebUser{ | |
| // ini buat pengecekan level akses tiap user | |
| function getLevel(){ | |
| $level = Yii::app()->user->getState('level'); | |
| return $level; | |
| } | |
| function isAdmin(){ // apakah user adalah admin? | |
| return Yii::app()->user->getState('level') == 1; |