# HG changeset patch # User viric@mandarina # Date 1230204358 0 # Node ID 3773f4677c40abad3b1340167dd915243de44c84 Opiniarbo - versikontrolita. diff -r 000000000000 -r 3773f4677c40 config/auconfig.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/auconfig.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,42 @@ + diff -r 000000000000 -r 3773f4677c40 config/autoload.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/autoload.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,127 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 config/mimes.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/mimes.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,105 @@ + 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), + 'bin' => 'application/macbinary', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/x-photoshop', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => array('application/pdf', 'application/x-download'), + 'ai' => 'application/postscript', + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => array('application/excel', 'application/vnd.ms-excel'), + 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/x-javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => array('audio/mpeg', 'audio/mpg'), + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'bmp' => 'image/bmp', + 'gif' => 'image/gif', + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'png' => array('image/png', 'image/x-png'), + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => array('text/plain', 'text/x-log'), + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'text/xml', + 'xsl' => 'text/xml', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'word' => array('application/msword', 'application/octet-stream'), + 'xl' => 'application/excel', + 'eml' => 'message/rfc822' + ); + + +/* End of file mimes.php */ +/* Location: ./system/application/config/mimes.php */ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 config/routes.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/routes.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,48 @@ + array('grin.gif', '19', '19', 'grin'), + ':lol:' => array('lol.gif', '19', '19', 'LOL'), + ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), + ':)' => array('smile.gif', '19', '19', 'smile'), + ';-)' => array('wink.gif', '19', '19', 'wink'), + ';)' => array('wink.gif', '19', '19', 'wink'), + ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), + ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), + ':-S' => array('confused.gif', '19', '19', 'confused'), + ':wow:' => array('surprise.gif', '19', '19', 'surprised'), + ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), + ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), + '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), + ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), + ':P' => array('raspberry.gif', '19', '19', 'raspberry'), + ':blank:' => array('blank.gif', '19', '19', 'blank stare'), + ':long:' => array('longface.gif', '19', '19', 'long face'), + ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), + ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), + ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), + '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), + ':down:' => array('downer.gif', '19', '19', 'downer'), + ':red:' => array('embarrassed.gif', '19', '19', 'red face'), + ':sick:' => array('sick.gif', '19', '19', 'sick'), + ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), + ':-/' => array('hmm.gif', '19', '19', 'hmmm'), + '>:(' => array('mad.gif', '19', '19', 'mad'), + ':mad:' => array('mad.gif', '19', '19', 'mad'), + '>:-(' => array('angry.gif', '19', '19', 'angry'), + ':angry:' => array('angry.gif', '19', '19', 'angry'), + ':zip:' => array('zip.gif', '19', '19', 'zipper'), + ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), + ':ahhh:' => array('shock.gif', '19', '19', 'shock'), + ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), + ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), + ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), + ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), + ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), + ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), + ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), + ':snake:' => array('snake.gif', '19', '19', 'snake'), + ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), + ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item + + ); + +/* End of file smileys.php */ +/* Location: ./system/application/config/smileys.php */ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 config/user_agents.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/user_agents.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,175 @@ + 'Windows Longhorn', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows' => 'Unknown Windows OS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS' + ); + + +// The order of this array should NOT be changed. Many browsers return +// multiple browser types so we want to identify the sub-type first. +$browsers = array( + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Mozilla' => 'Mozilla', + 'Safari' => 'Safari', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse' + ); + +$mobiles = array( + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', +// 'openwave' => 'Open Wave', +// 'opera mini' => 'Opera Mini', +// 'operamini' => 'Opera Mini', +// 'elaine' => 'Palm', + 'palmsource' => 'Palm', +// 'digital paths' => 'Palm', +// 'avantgo' => 'Avantgo', +// 'xiino' => 'Xiino', + 'palmscape' => 'Palmscape', +// 'nokia' => 'Nokia', +// 'ericsson' => 'Ericsson', +// 'blackberry' => 'BlackBerry', +// 'motorola' => 'Motorola' + + // Phones and Manufacturers + 'motorola' => "Motorola", + 'nokia' => "Nokia", + 'palm' => "Palm", + 'iphone' => "Apple iPhone", + 'ipod' => "Apple iPod Touch", + 'sony' => "Sony Ericsson", + 'ericsson' => "Sony Ericsson", + 'blackberry' => "BlackBerry", + 'cocoon' => "O2 Cocoon", + 'blazer' => "Treo", + 'lg' => "LG", + 'amoi' => "Amoi", + 'xda' => "XDA", + 'mda' => "MDA", + 'vario' => "Vario", + 'htc' => "HTC", + 'samsung' => "Samsung", + 'sharp' => "Sharp", + 'sie-' => "Siemens", + 'alcatel' => "Alcatel", + 'benq' => "BenQ", + 'ipaq' => "HP iPaq", + 'mot-' => "Motorola", + 'playstation portable' => "PlayStation Portable", + 'hiptop' => "Danger Hiptop", + 'nec-' => "NEC", + 'panasonic' => "Panasonic", + 'philips' => "Philips", + 'sagem' => "Sagem", + 'sanyo' => "Sanyo", + 'spv' => "SPV", + 'zte' => "ZTE", + 'sendo' => "Sendo", + + // Operating Systems + 'symbian' => "Symbian", + 'SymbianOS' => "SymbianOS", + 'elaine' => "Palm", + 'palm' => "Palm", + 'series60' => "Symbian S60", + 'windows ce' => "Windows CE", + + // Browsers + 'obigo' => "Obigo", + 'netfront' => "Netfront Browser", + 'openwave' => "Openwave Browser", + 'mobilexplorer' => "Mobile Explorer", + 'operamini' => "Opera Mini", + 'opera mini' => "Opera Mini", + + // Other + 'digital paths' => "Digital Paths", + 'avantgo' => "AvantGo", + 'xiino' => "Xiino", + 'novarra' => "Novarra Transcoder", + 'vodafone' => "Vodafone", + 'docomo' => "NTT DoCoMo", + 'o2' => "O2", + + // Fallback + 'mobile' => "Generic Mobile", + 'wireless' => "Generic Mobile", + 'j2me' => "Generic Mobile", + 'midp' => "Generic Mobile", + 'cldc' => "Generic Mobile", + 'up.link' => "Generic Mobile", + 'up.browser' => "Generic Mobile", + 'smartphone' => "Generic Mobile", + 'cellphone' => "Generic Mobile" + ); + +// There are hundreds of bots but these are the most common. +$robots = array( + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'askjeeves' => 'AskJeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos' + ); + +/* End of file user_agents.php */ +/* Location: ./system/application/config/user_agents.php */ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 controllers/.opiniarbo.php.swp Binary file controllers/.opiniarbo.php.swp has changed diff -r 000000000000 -r 3773f4677c40 controllers/au.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controllers/au.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,384 @@ +load->helper(array('form', 'url')); + $this->load->library('validation'); + $this->load->library('parser'); + $this->load->library('aulib'); + + $this->obj = & get_instance(); + if(!$this->obj->session->flashdata('referer')) + $this->referer_page = (isset($_SERVER['HTTP_REFERER']))? $_SERVER['HTTP_REFERER'] : ''; + else + $this->referer_page = $this->obj->session->flashdata('referer'); + $this->obj->session->set_flashdata('referer', $this->referer_page); + //$this->config->load('auconfig'); + if ($this->config->item('au_language') != '') + $curLang = $this->config->item('au_language'); + else + $curLang = $this->config->item('language'); + $this->lang->load('au', $curLang); + $this->use_cap = $this->config->item('au_capcha_use'); + } + + /* + * All view's call from this function + * You may customize output as you want from one point + */ + function _show_view($view_name) + { + $this->parser->parse($view_name, $this->data); + } + + /* + * Login page + */ + function login() + { + $rules['username'] = "trim|required|min_length[4]|max_length[12]|xss_clean"; + $rules['password'] = "trim|required|md5"; + if($this->use_cap) $rules['captcha'] = "trim|required|callback__captcha_check"; + $this->validation->set_rules($rules); + + $fields['username'] = '"'.$this->lang->line('form_username').'"'; + $fields['password'] = '"'.$this->lang->line('form_password').'"'; + if($this->use_cap) + { + $fields['captcha'] = '"'.$this->lang->line('form_captcha').'"'; + $this->validation->set_message('_captcha_check', $this->lang->line('error_captcha')); + } + $this->validation->set_fields($fields); + + if ($this->validation->run() == FALSE) + { + $this->data['form_title'] = $this->lang->line('title_login'); + $this->data['username_label'] = $this->lang->line('form_username'); + $this->data['username_value'] = $this->validation->username; + $this->data['username_error'] = $this->validation->username_error; + $this->data['password_label'] = $this->lang->line('form_password'); + $this->data['password_error'] = $this->validation->password_error; + $this->data['autologin_label'] = $this->lang->line('form_check_autologin'); + if($this->use_cap) + { + $cap = $this->aulib->getCaptcha(); + $this->session->set_userdata('captcha', $cap['word']); + $this->data['captcha_label'] = $this->lang->line('form_captcha'); + $this->data['captcha'] = $cap['image']; + $this->data['captcha_value'] = ''; + $this->data['captcha_error'] = $this->validation->captcha_error; + } + else + { + $this->data['captcha_label'] = ''; + $this->data['captcha'] = ''; + $this->data['captcha_error'] = ''; + $this->data['captcha_value'] = ''; + } + $this->data['submit_label'] = $this->lang->line('form_ok'); + $this->data['registers_link'] = anchor('au/registers', $this->lang->line('form_registers')); + $this->data['pass_change_link'] = anchor('au/change', $this->lang->line('form_pass_change')); + $this->data['pass_forgot_link'] = anchor('au/forgotten', $this->lang->line('form_pass_forgot')); + $this->_show_view('au/login.php'); + } + else + { + $name = $this->input->post('username'); + $pass = $this->input->post('password'); + $autologin = $this->input->post('autologin'); + $user_id = $this->aumodel->login($name, $pass, $autologin); + $this->aulib->setSessionId($user_id, $autologin); + if( $user_id ) + { + header('Location: '.$this->referer_page); + } + else + { + $this->data['message'] = $this->lang->line('error_login'); + $this->_show_view('au/blank.php'); + } + } + } + + /* + * Terminate user's session and show index page + */ + function logout() + { + $this->aulib->setSessionId(-1, FALSE); + redirect(index_page(), 'refresh'); + } + + /* + * Page for registers new user + */ + function registers() + { + $rules['username'] = "trim|required|min_length[4]|max_length[12]|xss_clean|callback__username_check"; + $rules['password'] = "trim|required|matches[passconf]|md5"; + $rules['passconf'] = "trim|required|md5"; + $rules['email'] = "trim|required|valid_email"; + if($this->use_cap) $rules['captcha'] = "trim|required|callback__captcha_check"; + $this->validation->set_rules($rules); + + $fields['username'] = '"'.$this->lang->line('form_username').'"'; + $fields['password'] = '"'.$this->lang->line('form_password').'"'; + $fields['passconf'] = '"'.$this->lang->line('form_password_confirm').'"'; + $fields['email'] = '"'.$this->lang->line('form_email').'"'; + $this->validation->set_message('_username_check', $this->lang->line('error_name_exist')); + if($this->use_cap) + { + $fields['captcha'] = '"'.$this->lang->line('form_captcha').'"'; + $this->validation->set_message('_captcha_check', $this->lang->line('error_captcha')); + } + $this->validation->set_fields($fields); + + if ($this->validation->run() == FALSE) + { + $this->data['form_title'] = $this->lang->line('title_registers'); + $this->data['username_label'] = $this->lang->line('form_username'); + $this->data['username_value'] = $this->validation->username; + $this->data['username_error'] = $this->validation->username_error; + $this->data['password_label'] = $this->lang->line('form_password'); + $this->data['password_error'] = $this->validation->password_error; + $this->data['password_confirm_label'] = $this->lang->line('form_password_confirm'); + $this->data['password_confirm_error'] = $this->validation->passconf_error; + $this->data['email_label'] = $this->lang->line('form_email'); + $this->data['email_value'] = $this->validation->email; + $this->data['email_error'] = $this->validation->email_error; + if($this->use_cap) + { + $cap = $this->aulib->getCaptcha(); + $this->session->set_userdata('captcha', $cap['word']); + $this->data['captcha_label'] = $this->lang->line('form_captcha'); + $this->data['captcha'] = $cap['image']; + $this->data['captcha_error'] = $this->validation->captcha_error; + $this->data['captcha_value'] = ''; + } + else + { + $this->data['captcha_label'] = ''; + $this->data['captcha'] = ''; + $this->data['captcha_error'] = ''; + $this->data['captcha_value'] = ''; + } + $this->data['submit_label'] = $this->lang->line('form_ok'); + $this->_show_view('au/registers.php'); + } + else + { + $confirm = $this->config->item('registers_via_email'); + $name = $this->input->post('username'); + $pass = $this->input->post('password'); + $email = $this->input->post('email'); + if( $this->aumodel->registers($name, $pass, $email, $confirm) ) + { + if($confirm) + { + $this->data['message'] = $this->lang->line('confirm_registers_message'); + $this->_show_view('au/blank.php'); + } + else + header('Location: '.$this->referer_page); + } + else + { + $this->data['message'] = $this->lang->line('registers_failure_message'); + $this->_show_view('au/blank.php'); + } + } + } + + /* + * Satellite function for register new user + * Check if user name is present in DB + */ + function _username_check($new_name=NULL) + { + return !$this->aumodel->check_name($new_name); + } + + /* + * Check for correct captcha input + */ + function _captcha_check($captcha) + { + return ($captcha == $this->session->userdata('captcha')); + } + + /* + * Page for confirmation from e-mail letter + */ + function confirm() + { + $id = $this->uri->segment(3); + $mess = $this->uri->segment(4); + if($this->aumodel->confirmEmail($id, $mess)) + $this->data['message'] = $this->lang->line('registers_confirmed'); + else + $this->data['message'] = $this->lang->line('registers_fail'); + $this->_show_view('au/blank.php'); + } + + /* + * Show deny access page + */ + function denyaccess() + { + $this->data['message'] = $this->lang->line('deny_access'); + $this->_show_view('au/blank.php'); + } + + /* + * Change password page + */ + function change() + { + $rules['username'] = "trim|required|min_length[4]|max_length[12]|xss_clean"; + $rules['password'] = "trim|required|md5"; + $rules['new_password'] = "trim|required|matches[new_password_conf]|md5"; + $rules['new_password_conf'] = "trim|required|md5"; + if($this->use_cap) $rules['captcha'] = "trim|required|callback__captcha_check"; + $this->validation->set_rules($rules); + + $fields['username'] = '"'.$this->lang->line('form_username').'"'; + $fields['password'] = '"'.$this->lang->line('form_old_password').'"'; + $fields['new_password'] = '"'.$this->lang->line('form_new_password').'"'; + $fields['new_password_conf'] = '"'.$this->lang->line('form_password_confirm').'"'; + if($this->use_cap) + { + $fields['captcha'] = '"'.$this->lang->line('form_captcha').'"'; + $this->validation->set_message('_captcha_check', $this->lang->line('error_captcha')); + } + $this->validation->set_fields($fields); + + if ($this->validation->run() == FALSE) + { + $this->data['form_title'] = $this->lang->line('title_login'); + $this->data['username_label'] = $this->lang->line('form_username'); + $this->data['username_value'] = $this->validation->username; + $this->data['username_error'] = $this->validation->username_error; + $this->data['password_label'] = $this->lang->line('form_old_password'); + $this->data['password_error'] = $this->validation->password_error; + $this->data['new_password_label'] = $this->lang->line('form_new_password'); + $this->data['new_password_error'] = $this->validation->new_password_error; + $this->data['new_password_conf_label'] = $this->lang->line('form_password_confirm'); + $this->data['new_password_conf_error'] = $this->validation->new_password_conf_error; + $this->data['autologin_label'] = $this->lang->line('form_check_autologin'); + if($this->use_cap) + { + $cap = $this->aulib->getCaptcha(); + $this->session->set_userdata('captcha', $cap['word']); + $this->data['captcha_label'] = $this->lang->line('form_captcha'); + $this->data['captcha'] = $cap['image']; + $this->data['captcha_error'] = $this->validation->captcha_error; + $this->data['captcha_value'] = ''; + } + else + { + $this->data['captcha_label'] = ''; + $this->data['captcha'] = ''; + $this->data['captcha_error'] = ''; + $this->data['captcha_value'] = ''; + } + $this->data['submit_label'] = $this->lang->line('form_ok'); + $this->_show_view('au/change.php'); + } + else + { + $name = $this->input->post('username'); + $pass = $this->input->post('password'); + $new_pass = $this->input->post('new_password'); + $autologin = $this->input->post('autologin'); + $user_id = $this->aumodel->login($name, $pass, $autologin); + $this->aulib->setSessionId($user_id, $autologin); + if( $user_id ) + { + $data = array('password' => $new_pass); + $this->aumodel->change($user_id, $data); + $this->data['message'] = $this->lang->line('confirm_password_change'); + $this->_show_view('au/blank.php'); + } + else + { + $this->data['message'] = $this->lang->line('error_password_change'); + $this->_show_view('au/blank.php'); + } + } + } + + /* + * Forgotten pasword page + */ + function forgotten() + { + $rules['username'] = "trim|required|min_length[4]|max_length[12]|xss_clean"; + $rules['email'] = "trim|required|valid_email"; + if($this->use_cap) $rules['captcha'] = "trim|required|callback__captcha_check"; + $this->validation->set_rules($rules); + + $fields['username'] = '"'.$this->lang->line('form_username').'"'; + $fields['email'] = '"'.$this->lang->line('form_email').'"'; + $this->validation->set_message('_username_check', $this->lang->line('error_name_exist')); + if($this->use_cap) + { + $fields['captcha'] = '"'.$this->lang->line('form_captcha').'"'; + $this->validation->set_message('_captcha_check', $this->lang->line('error_captcha')); + } + $this->validation->set_fields($fields); + + if ($this->validation->run() == FALSE) + { + $this->data['form_title'] = $this->lang->line('title_registers'); + $this->data['username_label'] = $this->lang->line('form_username'); + $this->data['username_value'] = $this->validation->username; + $this->data['username_error'] = $this->validation->username_error; + $this->data['email_label'] = $this->lang->line('form_email'); + $this->data['email_value'] = $this->validation->email; + $this->data['email_error'] = $this->validation->email_error; + if($this->use_cap) + { + $cap = $this->aulib->getCaptcha(); + $this->session->set_userdata('captcha', $cap['word']); + $this->data['captcha_label'] = $this->lang->line('form_captcha'); + $this->data['captcha'] = $cap['image']; + $this->data['captcha_error'] = $this->validation->captcha_error; + $this->data['captcha_value'] = ''; + } + else + { + $this->data['captcha_label'] = ''; + $this->data['captcha'] = ''; + $this->data['captcha_error'] = ''; + $this->data['captcha_value'] = ''; + } + $this->data['submit_label'] = $this->lang->line('form_ok'); + $this->_show_view('au/forgotten.php'); + } + else + { + $name = $this->input->post('username'); + $email = $this->input->post('email'); + if( $this->aumodel->forgotten($name, $email) ) + { + $this->data['message'] = $this->lang->line('confirm_forgotten_message'); + $this->_show_view('au/blank.php'); + } + else + { + $this->data['message'] = $this->lang->line('forgotten_failure_message'); + $this->_show_view('au/blank.php'); + } + + } + } +} +?> diff -r 000000000000 -r 3773f4677c40 controllers/aumanager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controllers/aumanager.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,242 @@ +load->library('aulib'); + if ( !$this->aulib->isRole('admin') ) $this->aulib->denyAccess(); + $this->config->load('auconfig'); + if ($this->config->item('au_language') != '') + $curLang = $this->config->item('au_language'); + else + $curLang = $this->config->item('language'); + $this->lang->load('au', $curLang); + $this->load->helper(array('form', 'url')); + $this->load->library('validation'); + $this->load->library('parser'); + $this->load->model('aumodel'); + } + + /* + * Start point for manager + */ + function index() + { + $this->load->library('table'); + $tmpl = array ( 'table_open' => 'table->set_template($tmpl); + + $view_table = $this->uri->segment(3, 'user'); + switch($view_table) + { + case 'user': + $field_caption = explode("; ", $this->lang->line('field_name_user')); + $table_caption = $this->lang->line('table_name_user'); + $this->data['add_new'] = ''; + $sql_str = sprintf("SELECT + CONCAT('',auser.name,'') as _edit, + email, + created, + last_visit, + aurole.name as arole, + augroup.name as agroup, + CONCAT('%s') as _delete + FROM auser, aurole, augroup + WHERE (auser.role_id = aurole.id) and (auser.group_id = augroup.id)", + $this->lang->line('request_confirm_delete'), + $this->lang->line('field_delete')); + break; + case 'group': $field_caption = explode("; ", $this->lang->line('field_name_group')); + $table_caption = $this->lang->line('table_name_group'); + $this->data['add_new'] = sprintf("%s", + $this->lang->line('add_new_link')); + $sql_str = sprintf("select + CONCAT('',augroup.name,'') as _edit, + CONCAT('%s') as _delete + from augroup", + $this->lang->line('request_confirm_delete'), + $this->lang->line('field_delete')); + break; + case 'role': $field_caption = explode("; ", $this->lang->line('field_name_role')); + $table_caption = $this->lang->line('table_name_role'); + $this->data['add_new'] = sprintf("%s", + $this->lang->line('add_new_link')); + $sql_str = sprintf("select + CONCAT('',aurole.name,'') as _edit, + CONCAT('%s') as _delete + from aurole", + $this->lang->line('request_confirm_delete'), + $this->lang->line('field_delete')); + break; + default: redirect('aumanager'); break; + } + $this->table->set_caption("

".$table_caption.'

'); + $this->table->set_heading($field_caption); + $this->table->set_empty("---"); + $sql = $this->db->query($sql_str); + + $this->data['table'] = $this->table->generate($sql); + $this->data['table_name_user'] = $this->lang->line('table_name_user'); + $this->data['table_name_group'] = $this->lang->line('table_name_group'); + $this->data['table_name_role'] = $this->lang->line('table_name_role'); + $this->_show_view('au/manager'); + } + + /* + * Edit page + */ + function edit() + { + $mode = $this->uri->segment(3, 'user'); + switch($mode) + { + case 'user' : $this->showUserEdit(); break; + case 'group': $this->showRefEdit(); break; + case 'role' : $this->showRefEdit(); break; + default: redirect('aumanager'); break; + } + } + + /* + * Delete page + */ + function delete() + { + if(FALSE === $this->uri->segment(3)) return; + $mode = $this->uri->segment(3); + if(FALSE === $this->uri->segment(4)) return; + $id = $this->uri->segment(4); + switch($mode) + { + case 'user' : + $this->aumodel->delete('auser', $id); + redirect('aumanager/index/user'); + break; + case 'group': + $this->aumodel->updateUsersRef('group', $id, 1); + $this->aumodel->delete('augroup', $id); + redirect('aumanager/index/group'); + break; + case 'role' : + $this->aumodel->updateUsersRef('role', $id, 1); + $this->aumodel->delete('aurole', $id); + redirect('aumanager/index/role'); + break; + default: redirect('aumanager'); break; + } + } + + /* + * Add new + */ + function append() + { + if(FALSE === $this->uri->segment(3)) return; + $mode = $this->uri->segment(3); + switch($mode) + { + case 'group': $this->aumodel->append('augroup');redirect('aumanager/index/group');break; + case 'role' : $this->aumodel->append('aurole'); redirect('aumanager/index/role'); break; + default: redirect('aumanager'); break; + } + } +/* + * Service function + */ + function showRefEdit() + { + $ref = $this->uri->segment(3); + $id = $this->uri->segment(4); + $rules['name'] = "trim|required|min_length[4]|xss_clean"; + $this->validation->set_rules($rules); + if($ref == 'group') + $fields['name'] = '"'.$this->lang->line('form_group').'"'; + else + $fields['name'] = '"'.$this->lang->line('form_role').'"'; + $this->validation->set_fields($fields); + + if ($this->validation->run() == FALSE) + { + $name = $this->aumodel->getRefName('au'.$ref,$id); + $this->data['name_label'] = $this->lang->line('form_'.$ref); + $this->data['form_title'] = $this->lang->line('table_name_'.$ref); + $this->data['name_value'] = ($this->input->post('name_value') ? $this->validation->name : $name); + $this->data['name_error'] = $this->validation->name_error; + $this->data['submit_label'] = $this->lang->line('form_ok'); + $this->data['id'] = $ref.'/'.$id; + $this->_show_view('au/group_role_edit.php'); + } + else + { + $this->aumodel->setRefName('au'.$ref, $id, $this->input->post('name')); + redirect('aumanager/index/'.$ref); + } + } + function showUserEdit() + { + $id = $this->uri->segment(4); + $rules['username'] = "trim|required|min_length[4]|max_length[12]|xss_clean"; + $rules['email'] = "trim|required|valid_email"; + $this->validation->set_rules($rules); + + $fields['username'] = '"'.$this->lang->line('form_username').'"'; + $fields['email'] = '"'.$this->lang->line('form_email').'"'; + $this->validation->set_fields($fields); + + if ($this->validation->run() == FALSE) + { + $user = $this->aumodel->userFullInfo($id); + $this->data['form_title'] = $this->lang->line('table_name_user'); + $this->data['username_label'] = $this->lang->line('form_username'); + $this->data['username_value'] = ($this->input->post('username_value') ? $this->validation->username : $user['name']); + $this->data['username_error'] = $this->validation->username_error; + $this->data['email_label'] = $this->lang->line('form_email'); + $this->data['email_value'] = ($this->input->post('email_value') ? $this->validation->email : $user['email']); + $this->data['email_error'] = $this->validation->email_error; + $this->data['group_label'] = $this->lang->line('form_group'); + $group_list = $this->aumodel->getRefList('augroup'); + $this->data['group_value'] = form_dropdown('group_value', $group_list, ($this->input->post('group_value') ? $this->input->post('group_value') : $user['group_id'])); + $this->data['role_label'] = $this->lang->line('form_role'); + $role_list = $this->aumodel->getRefList('aurole'); + $this->data['role_value'] = form_dropdown('role_value', $role_list, ($this->input->post('role_value') ? $this->input->post('role_value') : $user['role_id'])); + + $this->data['submit_label'] = $this->lang->line('form_ok'); + $this->data['id'] = $id; + $this->_show_view('au/user_edit.php'); + } + else + { + $newdata['name'] = $this->input->post('username'); + $newdata['email'] = $this->input->post('email'); + $newdata['group_id'] = $this->input->post('group_value'); + $newdata['role_id'] = $this->input->post('role_value'); + $this->aumodel->change($id, $newdata); + redirect('aumanager/index/user'); + } + } + + /* + * All view's call from this point + * You may customize it as you need + */ + function _show_view($view_name) + { + $this->parser->parse($view_name, $this->data); + } +} +?> \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 controllers/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controllers/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 controllers/opiniarbo.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controllers/opiniarbo.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,14 @@ +load->library('aulib'); + $this->load->library('parser'); + $this->load->helper('form'); + + $data['logindata'] = $this->aulib->getLoginLink(); + $this->parser->parse('arbo', $data); + } +} diff -r 000000000000 -r 3773f4677c40 controllers/welcome.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controllers/welcome.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,17 @@ +load->view('welcome_message'); + } +} + +/* End of file welcome.php */ +/* Location: ./system/application/controllers/welcome.php */ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 errors/error_404.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/errors/error_404.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,35 @@ + + + +404 Page Not Found + + + +
+

+ +
+ + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 errors/error_db.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/errors/error_db.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,34 @@ + + +Database Error + + + +
+

+ +
+ + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 errors/error_general.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/errors/error_general.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,34 @@ + + +Error + + + +
+

+ +
+ + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 errors/error_php.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/errors/error_php.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ +
+ +

A PHP Error was encountered

+ +

Severity:

+

Message:

+

Filename:

+

Line Number:

+ +
\ No newline at end of file diff -r 000000000000 -r 3773f4677c40 errors/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/errors/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 helpers/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/helpers/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 hooks/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hooks/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 language/english/au_lang.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/language/english/au_lang.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,60 @@ +Please,login with you name and password'; +$lang['deny_access'] = 'Access forbidden.'; +$lang['login_link_name'] = 'Login'; +$lang['logout_link_name'] = 'Logout'; +$lang['registers_link_name'] = 'Registers'; +$lang['manager_link_name'] = 'Users manager'; +$lang['welcome_string'] = 'Hello, %name%.
%logoff%'; +$lang['login_string'] = '%login%
%registers%'; +$lang['error_name_exist'] = 'User with such name already registered in the system'; +$lang['error_login'] = 'Login failed.'; +$lang['error_password_change'] = 'Error password change'; +$lang['error_captcha'] = 'Wrong verification code'; + +$lang['confirm_password_change'] = 'Password succesfull changed'; +$lang['confirm_registers_message'] = 'Registers need confirmation.
Notification is send on you e-mail.'; +$lang['confirm_forgotten_message'] = 'Notification with new password is send on you e-mail.'; +$lang['forgotten_failure_message'] = 'Unidentified error. Please, repeat a query.'; + +$lang['table_name_user'] = 'Users'; +$lang['field_name_user'] = 'Name; e-mail; Created; Last visit; Role; Group'; +$lang['table_name_group'] = 'Users group'; +$lang['field_name_group'] = 'Name group'; +$lang['table_name_role'] = 'Users role'; +$lang['field_name_role'] = 'Name role'; +//$lang['field_edit'] = 'Изменить'; +$lang['field_delete'] = 'Delete'; +$lang['request_confirm_delete'] = 'Are you sure?'; +$lang['add_new_link'] = 'Append new'; +?> \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 language/english/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/language/english/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 language/russian/au_lang.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/language/russian/au_lang.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,60 @@ +Пожалуйста, введите логин и пароль'; +$lang['deny_access'] = 'Доступ запрещен.'; +$lang['login_link_name'] = 'Вход'; +$lang['logout_link_name'] = 'Выход'; +$lang['registers_link_name'] = 'Регистрация'; +$lang['manager_link_name'] = 'Управление пользователями'; +$lang['welcome_string'] = 'Здравствуйте, %name%.
%logoff%'; +$lang['login_string'] = '%login%
%registers%'; +$lang['error_name_exist'] = 'Пользователь с таким именем уже зарегистрирован в системе'; +$lang['error_login'] = 'Вход не выполнен.'; +$lang['error_password_change'] = 'Ошибка смены пароля'; +$lang['error_captcha'] = 'Неправильный проверочный код'; + +$lang['confirm_password_change'] = 'Пароль успешно изменен'; +$lang['confirm_registers_message'] = 'Регистрацию необходимо подтвердить.
На Ваш электронный адрес выслано уведомление.'; +$lang['confirm_forgotten_message'] = 'Новый пароль сгенерирован.
На Ваш электронный адрес выслано уведомление.'; +$lang['forgotten_failure_message'] = 'Неопознанная ошибка. Пожалуйста, повторите запрос.'; + +$lang['table_name_user'] = 'Пользователи'; +$lang['field_name_user'] = 'Имя; e-mail; Дата создания; Последний визит; Роль; Группа'; +$lang['table_name_group'] = 'Группы пользователей'; +$lang['field_name_group'] = 'Имя группы'; +$lang['table_name_role'] = 'Роли пользователей'; +$lang['field_name_role'] = 'Имя роли'; +//$lang['field_edit'] = 'Изменить'; +$lang['field_delete'] = 'Удалить'; +$lang['request_confirm_delete'] = 'Действительно удалить?'; +$lang['add_new_link'] = 'Добавить'; +?> \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 language/russian/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/language/russian/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 libraries/aulib.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libraries/aulib.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,165 @@ +obj =& get_instance(); + $this->obj->load->model('aumodel'); + $this->obj->config->load('auconfig'); + if ($this->obj->config->item('au_language') != '') + $curLang = $this->obj->config->item('au_language'); + else + $curLang = $this->obj->config->item('language'); + $this->obj->lang->load('au', $curLang); + } + + /* + * Return "welcome" string with link to login page + * Call this function every time on you main page + */ + function getLoginLink() + { + $id = $this->getSessionId(); + if($id) + { + $logoff_link = $this->obj->lang->line('logout_link_name'); + $welcome_str = $this->obj->lang->line('welcome_string'); + if($welcome_str != '') + { + $welcome_str = str_replace('%name%', $this->obj->aumodel->userInfo($id, 'name'), $welcome_str); + $welcome_str = str_replace('%logoff%', anchor('au/logout',$logoff_link), $welcome_str); + } + return $welcome_str; + } + else + { + $login_link = $this->obj->lang->line('login_link_name'); + $registers_link = $this->obj->lang->line('registers_link_name'); + $login_str = $this->obj->lang->line('login_string'); + if($login_str != '') + { + $login_str = str_replace('%registers%', anchor('au/registers',$registers_link), $login_str); + $login_str = str_replace('%login%', anchor('au/login',$login_link), $login_str); + } + + return $login_str; + } + } + + /* + * Return link for call back-end system + * This back-end can help you manage users & groups + */ + function getManagerLink() + { + return anchor('aumanager', $this->obj->lang->line('manager_link_name')); + } + + /* + * function block for set/get session userID + */ + function setSessionId($id, $storable = FALSE) + { + if( $id < 1 ) + { + $this->obj->session->unset_userdata('id'); + $this->obj->session->unset_userdata('flash'); + } + else + { + $this->obj->session->set_userdata('flash', !$storable); + $offset = (int) $this->obj->config->item('id_offset'); + + if($storable) + $this->obj->session->set_userdata('id', $id * $offset); + else + { + $this->obj->session->set_flashdata('id', $id * $offset); + $this->obj->session->set_flashdata('expire', time()+$this->obj->config->item('autologin_timeout')); + } + } + } +function getSessionId() +{ + $this->keepSession(); + if($this->obj->session->userdata('flash')) + { + if( !$this->obj->session->flashdata('id') ) + return 0; + } + $offset = (int) $this->obj->config->item('id_offset'); + if(!$this->obj->session->userdata('flash')) + $real_id = ($this->obj->session->userdata('id') / $offset); + else + $real_id = ($this->obj->session->flashdata('id') / $offset); + if(ceil($real_id) != floor($real_id)) + { + $this->logout(); + return 0; + } + else + return $real_id; + } + function keepSession() + { + if( ($this->obj->session->userdata('flash')) && ($this->obj->session->flashdata('expire') >= time()) ) + { + $this->obj->session->keep_flashdata('id'); + $this->obj->session->set_flashdata('expire', time()+$this->obj->config->item('autologin_timeout')); + } + } + + /* + * Return TRUE if user is logged on + */ + function isLogged() { return (bool) $this->getSessionId(); } + + /* + * Return TRUE if user is in group + */ + function isGroup($group_name) + { + return ($this->obj->aumodel->getRefId('augroup', $group_name) == $this->obj->aumodel->userInfo($this->getSessionId(), 'group_id')); + } + + /* + * Return TRUE if user has specified role + */ + function isRole($role_name) + { + return ( $this->obj->aumodel->getRefId('aurole', $role_name) == $this->obj->aumodel->userInfo($this->getSessionId(), 'role_id') ); + } + + /* + * Show "deny access" page + */ + function denyAccess() + { + $this->obj->load->helper('url'); + redirect('au/denyaccess'); + } + + /* + * Create and return captcha + * Use standart CI plugin + */ + function getCaptcha() + { + $this->obj->load->helper('url'); + $this->obj->load->plugin('captcha'); + $vals = array( + 'word' => '', + 'img_path' => $this->obj->config->item('au_captcha_store_path'), + 'img_url' => $this->obj->config->item('au_captcha_img_url'), + 'font_path' => '/system/fonts/texb.ttf', + 'img_width' => '120', + 'img_height' => '40', + 'expiration' => '7200' + ); + $cap = create_captcha($vals); + return $cap; + } +} +?> diff -r 000000000000 -r 3773f4677c40 libraries/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libraries/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,15 @@ + + + + +403 Forbidden + + + + + +

Directory access is forbidden.

+ + + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 models/.opiniarbo.php.swp Binary file models/.opiniarbo.php.swp has changed diff -r 000000000000 -r 3773f4677c40 models/aumodel.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/models/aumodel.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,259 @@ +obj =& get_instance(); + $this->config->load('auconfig'); + if ( $this->obj->config->item('check_if_tables_exist') ) + $this->CheckTablesExist(); + if ($this->obj->config->item('au_language') != '') + $curLang = $this->obj->config->item('au_language'); + else + $curLang = $this->obj->config->item('language'); + $this->obj->lang->load('au', $curLang); + } + /* + * Function for process login/logout etc + */ + function login($name, $pass, $autologin=FALSE) + { + $this->db->where('name', $name); + $this->db->where('password', $pass); + $success = $this->db->count_all_results('auser'); + if($success) + { + $this->db->where('name', $name); + $this->db->where('password', $pass); + $user_info = $this->db->get('auser')->result_array(); + $user_data = $user_info[0]; + if(!$user_data['activate_code']) + { + $data = array('last_visit' => date("Y-m-d H:i:s")); + $this->db->update('auser', $data, array('id' => $user_data['id'])); + return $user_data['id']; + } + } + return FALSE; + } + function registers($name, $pass, $email, $confirm) + { + $activation_code = ($confirm)? $this->makeConfirmationCode() : NULL; + $data = array( + 'name' => $name , + 'password' => $pass, + 'email' => $email, + 'activate_code' => $activation_code + ); + $this->db->insert('auser', $data); + if(!$confirm) return $this->login($name, $pass, FALSE); + else + { + $this->db->where('name', $name); + $this->db->where('password', $pass); + $user_info = $this->db->get('auser')->result_array(); + $user_data = $user_info[0]; + $this->_sendConfirmEmail($name, $email, $user_data['id'], $activation_code, NULL); + return TRUE; + } + } + function change($id, $data) + { + $this->db->update('auser', $data, array('id' => $id)); + } + function confirmEmail($id, $mess) + { + $this->db->where('id', $id); + $this->db->where('activate_code', $mess); + $success = $this->db->count_all_results('auser'); + if($success) + { + $data = array('activate_code' => NULL); + $this->db->update('auser', $data, array('id' => $id)); + } + return $success; + } + function forgotten($name, $email) + { + $this->db->where('name', $name); + $this->db->where('email', $email); + $is_exist = $this->db->count_all_results('auser'); + if(!$is_exist) return FALSE; + $activation_code = $this->makeConfirmationCode(); + $new_pass = $this->makeConfirmationCode(); + + $this->db->where('name', $name); + $this->db->where('email', $email); + $user_info = $this->db->get('auser')->result_array(); + $user_data = $user_info[0]; + + $data = array( + 'password' => md5($new_pass), + 'activate_code' => $activation_code + ); + $this->db->update('auser', $data, array('id' => $user_data['id'])); + + $this->_sendConfirmEmail($name, $email, $user_data['id'], $activation_code, $new_pass); + return TRUE; + } + function userInfo($id, $field) + { + $this->db->where('id', $id); + $this->db->select($field); + $user_info = $this->db->get('auser')->result_array(); + return (isset($user_info[0][$field])) ? $user_info[0][$field] : ''; + } + function userFullInfo($id) + { + $this->db->where('id', $id); + $sql = $this->db->get('auser')->result_array(); + return $sql[0]; + + } + function getRefId($table, $name) + { + $this->db->where('name', $name); + $rez = $this->db->get($table)->result_array(); + return $rez[0]['id']; + } + function getRefName($table, $id) + { + $this->db->where('id', $id); + $rez = $this->db->get($table)->result_array(); + return $rez[0]['name']; + } + function setRefName($table, $id, $new_name) + { + $data = array('name' => $new_name); + $this->db->update($table, $data, array('id' => $id)); + } + function getRefList($table) + { + $result = array(); + $sql = $this->db->get($table)->result_array(); + foreach($sql as $row) $result[$row['id']] = $row['name']; + return $result; + } + function setRefIdToUser($table, $user_id, $new_value) + { + if($table == 'augroup') + $data = array('group_id' => getRefId($table, $new_value)); + else + $data = array('role_id' => getRefId($table, $new_value)); + $this->db->update('auser', $data, array('id' => $user_id)); + } + + /* + * + */ + function delete($table_name, $id) + { + $this->db->delete($table_name, array('id' => $id)); + } + function append($table_name) + { + $data = array('name' => 'new...'); + $this->db->insert($table_name, $data); + } + function updateUsersRef($ref_name, $old_ref, $new_ref) + { + $this->db->update('auser', array($ref_name.'_id' => $new_ref), array($ref_name.'_id' => $old_ref)); + } + /* + * service function + */ + function check_name($name) + { + $this->db->where('name', $name); + return (bool) $this->db->count_all_results('auser'); + } + function makeConfirmationCode() + { + $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + $length = mt_rand(5, 10); + $result = ''; + for ($i = 0; $i < $length; $i++) + $result .= $chars[(mt_rand(0, (strlen($chars)-1)))]; + return $result; + } + function _sendConfirmEmail($name, $email, $id, $activation_code, $new_pass = NULL) + { + $this->load->library('email'); + $this->config->load('email'); + $this->email->clear(); + $this->email->from($this->obj->config->item('admin_email')); + $this->email->to($email); + $this->email->subject($this->lang->line('email_confirm_sabject')); + $activation_url = site_url('au/confirm/'.$id.'/'.$activation_code); + if(!$new_pass) + $mess_body = str_replace('%name%', $name, $this->lang->line('email_confirm_body')); + else + { + $mess_body = str_replace('%name%', $name, $this->lang->line('email_confirm_pass_body')); + $mess_body = str_replace('%new_pass%', $new_pass, $mess_body); + } + $mess_body = str_replace('%link%', $activation_url, $mess_body); + $this->email->message($mess_body); + $this->email->send(); + } + function CheckTablesExist() + { + $this->db->trans_start(); + if(!$this->db->table_exists('augroup')) + { + $sql = "CREATE TABLE `augroup` ( `id` int(11) NOT NULL auto_increment, + `name` varchar(128) default NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8"; + $this->db->query($sql); + + $sql = "INSERT INTO `augroup` VALUES (1,'users')"; + $this->db->query($sql); + $sql = "INSERT INTO `augroup` VALUES (2,'admins')"; + $this->db->query($sql); + } + + if(!$this->db->table_exists('aurole')) + { + $sql = "CREATE TABLE `aurole` (`id` int(11) NOT NULL auto_increment, + `name` varchar(50) default NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8"; + $this->db->query($sql); + $sql = "INSERT INTO `aurole` VALUES (1,'baned')"; + $this->db->query($sql); + $sql = "INSERT INTO `aurole` VALUES (2,'user')"; + $this->db->query($sql); + $sql = "INSERT INTO `aurole` VALUES (3,'moderator')"; + $this->db->query($sql); + $sql = "INSERT INTO `aurole` VALUES (4,'admin')"; + $this->db->query($sql); + } + + if(!$this->db->table_exists('auser')) + { + $sql = "CREATE TABLE `auser` (`id` int(11) NOT NULL auto_increment, + `name` varchar(50) default NULL, + `password` varchar(50) default NULL, + `email` varchar(50) default NULL, + `activate_code` varchar(50) default NULL, + `created` timestamp NULL default CURRENT_TIMESTAMP, + `last_visit` datetime default NULL, + `role_id` int(11) unsigned default '1', + `group_id` int(11) unsigned default '1', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=utf8"; + $this->db->query($sql); +/* $sql = "INSERT INTO `auser` VALUES (1,'serg','76419c58730d9f35de7ac538c2fd6737','serg.kosij@list.ru',NULL,'2008-10-12 19:01:03','2008-10-17 23:20:13',4,2)"; + $this->db->query($sql); + $sql = "INSERT INTO `auser` VALUES (2,'Сергей','96e79218965eb72c92a549dd5a330112','serg.kosij@list.ru',NULL,'2008-10-17 19:24:39','2008-10-17 22:38:02',1,1)"; + $this->db->query($sql); +*/ + } + $this->db->trans_complete(); + } +} +?> \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 models/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/models/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 models/opiniarbo.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/models/opiniarbo.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,85 @@ +db->get_where('asertoj', + array('user' => $user, 'parent' => NULL)); + return $query->result(); + } + + function get_other_heads($user) + { + $query = $this->db->get_where('asertoj', + array('user !=' => $user, 'parent' => NULL)); + return $query->result(); + } + + function get_my_subasserts($parent, $user) + { + $query = $this->db->get_where('asertoj', + array('user' => $user, + 'parent' => $parent)); + return $query->result(); + } + + function get_other_subasserts($parent, $user) + { + $query = $this->db->get_where('asertoj', + array('user !=' => $user, + 'parent' => $parent)); + return $query->result(); + } + + function get_calc_value($assert, $orig_value) + { + $query = $this->db->get_where('asertoj', + array('parent' => $assert)); + + if ($query->num_rows() > 0) + { + $val = 0; + foreach($query->result() as $row) + { + $val += get_calc_value($row->id, $row->value); + } + $query2 = $this->db->where('id', $row->id); + $query2->update('asertoj', array( + 'calc_value' => $val)); + + return $val; + } + + return $orig_value; + } + + function recalculate() + { + // Get all heads + get_calc_value(NULL, 0); + } + + function insert_assertion() + { + if (isset($_POST['parent'])) + { + $data['parent'] = $_POST['parent']; + $data['influence'] = $_POST['influence']; + } + else + { + $data['parent'] = NULL; + $data['influence'] = $_POST['influence']; + } + $data['assert'] = $_POST['assert']; + $data['context'] = $_POST['context']; + $data['value'] = float($_POST['value']); + } +} + +?> diff -r 000000000000 -r 3773f4677c40 views/arbo.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/arbo.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,132 @@ + + +Opiniarbo + + + + + + +

Opiniarbo

+ +

Uzantoj

+ +{logindata} + +

Antaŭasertoj

+ +
+ + +
Valoro +Influo +Kalkulita +Teksto +{preasserts} +
{value} +{influence} +{calculation} +{text} +{/preasserts} +
+ +

Ĉefaserto

+ + + + +
Valoro +Influo +Kalkulita +Aserto +{preasserts} +
{value} +{influence} +{calculation} +{assert} +{/preasserts} +
+ +

Kunteksto

+

{context}

+ +

Subasertoj

+ + + + +
Valoro +Influo +Kalkulita +Aserto +Ŝanĝi +{subasserts} + + + +
+ +{calculation} +{assert} + + +{/subasserts} +
+ +

Nova subaserto

+ + + + + +

Kunteksto

+

+ +

+ + +


Page rendered in {elapsed_time} seconds

+ + + diff -r 000000000000 -r 3773f4677c40 views/arbo_end.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/arbo_end.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,4 @@ +


Page rendered in {elapsed_time} seconds

+ + + diff -r 000000000000 -r 3773f4677c40 views/arbo_start.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/arbo_start.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,48 @@ + + +Opiniarbo + + + + + +

Opiniarbo

+ +

Uzantoj

diff -r 000000000000 -r 3773f4677c40 views/au/blank.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/blank.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,2 @@ +

+

{message}

\ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/au/change.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/change.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,47 @@ + +
+

{form_title}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{username_label}{username_error}
{password_label}{password_error}
{new_password_label}{new_password_error}
{new_password_conf_label}{new_password_conf_error}
{autologin_label}
{captcha}
{captcha_label}{captcha_value}{captcha_error}



 
+ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/au/forgotten.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/forgotten.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,31 @@ + +
+

{form_title}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{username_label}{username_error}
{email_label}{email_error}
{captcha}
{captcha_label}{captcha_value}{captcha_error}

 
+ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/au/group_role_edit.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/group_role_edit.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,19 @@ + +
+

{form_title}

+
+ + + + + + + + + + + +
{name_label}
{name_error}
+ +
 
+ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/au/login.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/login.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,48 @@ + + + + + + +
+

{form_title}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{username_label}{username_error}
{password_label}{password_error}
{autologin_label}
{captcha}
{captcha_label}{captcha_value}{captcha_error}



 
{registers_link}{pass_change_link}{pass_forgot_link}
+ + diff -r 000000000000 -r 3773f4677c40 views/au/manager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/manager.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,21 @@ +
{table}
+
+ + + + + + + + + + + + + + + + +
{add_new}


{table_name_user}{table_name_group}{table_name_role}
+
+
diff -r 000000000000 -r 3773f4677c40 views/au/registers.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/registers.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,41 @@ + +
+

{form_title}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{username_label}{username_error}
{password_label}{password_error}
{password_confirm_label}{password_confirm_error}
{email_label}{email_error}
{captcha}
{captcha_label}{captcha_value}{captcha_error}

 
+ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/au/user_edit.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/au/user_edit.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,35 @@ + +
+

{form_title}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
{username_label}
{username_error}
{email_label}
{email_error}
{group_label}
{group_value}
{role_label}
{role_value}
+ +
 
+ \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/index.html Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff -r 000000000000 -r 3773f4677c40 views/welcome_message.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/views/welcome_message.php Thu Dec 25 11:25:58 2008 +0000 @@ -0,0 +1,62 @@ + + +Welcome to CodeIgniter + + + + + +

Welcome to CodeIgniter!

+ +

The page you are looking at is being generated dynamically by CodeIgniter.

+ +

If you would like to edit this page you'll find it located at:

+system/application/views/welcome_message.php + +

The corresponding controller for this page is found at:

+system/application/controllers/welcome.php + +

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

+ + +


Page rendered in {elapsed_time} seconds

+ + + \ No newline at end of file