system/application/assets/css/admin-style.css | 3
system/application/assets/css/style.css | 7
system/application/assets/css/thickbox.css | 156 ++++++++++
system/application/assets/images/thickbox/loadingAnimation.gif |binary
system/application/assets/images/thickbox/macFFBgHack.png |binary
system/application/assets/js/thickbox-compressed.js | 10
system/application/controllers/admin/status.php | 24 +
system/application/controllers/admin/welcome.php | 73 ----
system/application/controllers/log.php | 3
system/application/controllers/setting.php | 44 ++
system/application/controllers/voucher.php | 20 +
system/application/controllers/welcome.php | 4
system/application/libraries/Statuscheck.php | 76 ++++
system/application/models/tag_model.php | 6
system/application/views/admin/status.php | 19 +
system/application/views/admin/welcome.php | 8
system/application/views/log/index.php | 3
system/application/views/setting/change.php | 34 ++
system/application/views/tag/index.php | 2
system/application/views/template.php | 13
20 files changed, 420 insertions(+), 85 deletions(-)
New commits:
commit ccbed5a17aae0dcb657155963615c4af76e188ef
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 21 22:23:19 2010 +0530
Added Change active account thickbox
- Using the jQuery Thickbox Plugin
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/admin-style.css
b/system/application/assets/css/admin-style.css
index 8c7c565..9b51bd3 100644
--- a/system/application/assets/css/admin-style.css
+++ b/system/application/assets/css/admin-style.css
@@ -115,7 +115,6 @@ body {
border:solid 1px #787878;
background:#F0F0F0;
color:#222222;
- padding:0 10px 0 10px;
margin:0 0 10px 0;
text-align:left;
}
@@ -124,7 +123,6 @@ body {
border:solid 1px #C34A2C;
background:#FFBABA;
color:#222222;
- padding:0 10px 0 10px;
margin:0 0 10px 0;
text-align:left;
}
@@ -133,7 +131,6 @@ body {
border:solid 1px #FFEC8B;
background:#FFF8C6;
color:#222222;
- padding:0 10px 0 10px;
margin:0 0 10px 0;
text-align:left;
}
diff --git a/system/application/assets/css/style.css
b/system/application/assets/css/style.css
index 7bf6cb8..7cda02a 100644
--- a/system/application/assets/css/style.css
+++ b/system/application/assets/css/style.css
@@ -121,7 +121,6 @@ body {
border:solid 1px #787878;
background:#F0F0F0;
color:#222222;
- padding:0 10px 0 10px;
margin:0 0 10px 0;
text-align:left;
}
@@ -130,7 +129,6 @@ body {
border:solid 1px #C34A2C;
background:#FFBABA;
color:#222222;
- padding:0 10px 0 10px;
margin:0 0 10px 0;
text-align:left;
}
@@ -139,7 +137,6 @@ body {
border:solid 1px #FFEC8B;
background:#FFF8C6;
color:#222222;
- padding:0 10px 0 10px;
margin:0 0 10px 0;
text-align:left;
}
@@ -153,6 +150,10 @@ body {
font-weight:bold;
}
+.hidden-element {
+ display:none;
+}
+
a.no-underline {
text-decoration:none;
}
diff --git a/system/application/assets/css/thickbox.css
b/system/application/assets/css/thickbox.css
new file mode 100644
index 0000000..f4bf673
--- /dev/null
+++ b/system/application/assets/css/thickbox.css
@@ -0,0 +1,156 @@
+/*
----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox specific link and font settings
<<<------------------------------------------------------*/
+/*
----------------------------------------------------------------------------------------------------------------*/
+#TB_window {
+ font-size:14px;
+}
+
+#TB_secondLine {
+ color:#666666;
+}
+
+#TB_window a:link {color: #666666;}
+#TB_window a:visited {color: #666666;}
+#TB_window a:hover {color: #000;}
+#TB_window a:active {color: #666666;}
+#TB_window a:focus{color: #666666;}
+
+/*
----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox settings
<<<-----------------------------------------------------------------------------*/
+/*
----------------------------------------------------------------------------------------------------------------*/
+#TB_overlay {
+ position: fixed;
+ z-index:100;
+ top: 0px;
+ left: 0px;
+ height:100%;
+ width:100%;
+}
+
+.TB_overlayMacFFBGHack {background: url(../images/thickbox/macFFBgHack.png) repeat;}
+.TB_overlayBG {
+ background-color:#000;
+ filter:alpha(opacity=75);
+ -moz-opacity: 0.75;
+ opacity: 0.75;
+}
+
+* html #TB_overlay { /* ie6 hack */
+ position: absolute;
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ?
document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_window {
+ position: fixed;
+ background: #ffffff;
+ z-index: 102;
+ color:#000000;
+ display:none;
+ border: 4px solid #525252;
+ text-align:left;
+ top:50%;
+ left:50%;
+}
+
+* html #TB_window { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin =
document.documentElement && document.documentElement.scrollTop ||
document.body.scrollTop) + 'px');
+}
+
+#TB_window img#TB_Image {
+ display:block;
+ margin: 15px 0 0 15px;
+ border-right: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+ border-top: 1px solid #666;
+ border-left: 1px solid #666;
+}
+
+#TB_caption{
+ height:25px;
+ padding:7px 30px 10px 25px;
+ float:left;
+}
+
+#TB_closeWindow{
+ height:25px;
+ padding:11px 25px 10px 0;
+ float:right;
+}
+
+#TB_closeAjaxWindow{
+ padding:7px 10px 5px 0;
+ margin-bottom:1px;
+ text-align:right;
+ float:right;
+}
+
+#TB_ajaxWindowTitle{
+ float:left;
+ padding:7px 0 5px 10px;
+ margin-bottom:1px;
+}
+
+#TB_title{
+ background-color:#e8e8e8;
+ height:27px;
+}
+
+#TB_ajaxContent{
+ clear:both;
+ padding:2px 15px 15px 15px;
+ overflow:auto;
+ text-align:left;
+ line-height:1.4em;
+}
+
+#TB_ajaxContent.TB_modal{
+ padding:15px;
+}
+
+#TB_ajaxContent p{
+ padding:5px 0px 5px 0px;
+}
+
+#TB_load{
+ position: fixed;
+ display:none;
+ height:13px;
+ width:208px;
+ z-index:103;
+ top: 50%;
+ left: 50%;
+ margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+}
+
+* html #TB_load { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin =
document.documentElement && document.documentElement.scrollTop ||
document.body.scrollTop) + 'px');
+}
+
+#TB_HideSelect{
+ z-index:99;
+ position:fixed;
+ top: 0;
+ left: 0;
+ background-color:#fff;
+ border:none;
+ filter:alpha(opacity=0);
+ -moz-opacity: 0;
+ opacity: 0;
+ height:100%;
+ width:100%;
+}
+
+* html #TB_HideSelect { /* ie6 hack */
+ position: absolute;
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ?
document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_iframeContent{
+ clear:both;
+ border:none;
+ margin-bottom:-1px;
+ margin-top:1px;
+ _margin-bottom:1px;
+}
diff --git a/system/application/assets/images/thickbox/loadingAnimation.gif
b/system/application/assets/images/thickbox/loadingAnimation.gif
new file mode 100644
index 0000000..82290f4
Binary files /dev/null and
b/system/application/assets/images/thickbox/loadingAnimation.gif differ
diff --git a/system/application/assets/images/thickbox/macFFBgHack.png
b/system/application/assets/images/thickbox/macFFBgHack.png
new file mode 100644
index 0000000..c6473b3
Binary files /dev/null and b/system/application/assets/images/thickbox/macFFBgHack.png
differ
diff --git a/system/application/assets/js/thickbox-compressed.js
b/system/application/assets/js/thickbox-compressed.js
new file mode 100644
index 0000000..28364be
--- /dev/null
+++ b/system/application/assets/js/thickbox-compressed.js
@@ -0,0 +1,10 @@
+/*
+ * Thickbox 3 - One Box To Rule Them All.
+ * By Cody Lindley (
http://www.codylindley.com)
+ * Copyright (c) 2007 cody lindley
+ * Licensed under the MIT License:
http://www.opensource.org/licenses/mit-license.php
+*/
+
+var tb_pathToImage = "images/loadingAnimation.gif";
+
+eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return
r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new
RegExp('\\b'+e(c)+'\\b','g'),k[c]);return
p}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9
1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9
19(d,f,g){3m{3(2t
o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U
5=\'1F\'></U><4 5=\'B\'></4><4
5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4
5=\'B\'></4><4
5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4
5=\'K\'><1I L=\'"+1w.L+"\'
/></4>");$(\'#K\').2y();6
h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6
i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6
j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[(a)1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6
k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e
5=\'1X\'>&1d;&1d;<a u=\'#\'>2T
&2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e
5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O;
2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L
"+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6
c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n
3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a
u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\'
L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\'
23=\'"+d+"\'/></a>"+"<4
5=\'2D\'>"+d+"<4
5=\'2C\'>"+1n+14+R+"</4></4><4
5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a>
1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9
12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4
5=\'8\'></4>");19(1D,1G,g);H
P}$("#1U").s(12)}3(!(R==="")){9
1i(){$("#8").C();$("v").q("<4
5=\'8\'></4>");19(1z,1x,g);H
P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n
3(I==3k){3(!(R=="")){o.1h="";1i()}}n
3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6
l=f.2r(/^[^\\?]+\\??/,\'\');6
m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4
5=\'2f\'><4 5=\'1H\'>"+d+"</4><4
5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a>
1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\'
L=\'"+1E[0]+"\' 5=\'15\'
1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\'
J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' >
</U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\'
2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\'
1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\'
J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'>
</U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4
5=\'2f\'><4 5=\'1H\'>"+d+"</4><4
5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j
1s</4></4><4 5=\'F\'
J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4
5=\'F\' 3c=\'3b\'
J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n
3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p
33().32()),9(){16();$("#K").C();1u("#F
a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9
1m(){$("#K").C();$("#8").r({Y:"T"})}9
G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t
o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H
P}9
16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9
2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6
d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\'
\');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6
h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6
a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H
1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}))
\ No newline at end of file
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index f6af99a..3595c09 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -891,6 +891,50 @@ class Setting extends Controller {
}
return;
}
+
+ /* Change Active Account */
+ function change()
+ {
+ /* Form validations */
+ $this->form_validation->set_rules('select_account', 'Select
Account', 'trim|required');
+
+ /* Validating form : only if label name is not set from URL */
+ if ($this->form_validation->run() == FALSE)
+ {
+ $this->messages->add(validation_errors(), 'error');
+ redirect("");
+ return;
+ } else {
+ /* Unsetting all database configutaion */
+ $this->session->unset_userdata('db_active_label');
+
+ $data_select_account = $this->input->post('select_account', TRUE);
+ $ini_file = $this->config->item('config_path') . "accounts/" .
$data_select_account . ".ini";
+
+ /* Check if database ini file exists */
+ if ( ! get_file_info($ini_file))
+ {
+ $this->messages->add("Account setting file is missing.",
'error');
+ redirect("");
+ return;
+ }
+
+ /* Parsing database ini file */
+ $active_accounts = parse_ini_file($ini_file);
+ if ( ! $active_accounts)
+ {
+ $this->messages->add("Invalid account setting file.",
'error');
+ redirect("");
+ return;
+ }
+
+ /* Setting new account database details in session */
+ $this->session->set_userdata('db_active_label', $data_select_account);
+ $this->messages->add('Active account changed.', 'success');
+ redirect("");
+ }
+ return;
+ }
}
/* End of file setting.php */
diff --git a/system/application/views/setting/change.php
b/system/application/views/setting/change.php
new file mode 100644
index 0000000..63e9eda
--- /dev/null
+++ b/system/application/views/setting/change.php
@@ -0,0 +1,34 @@
+<?php
+ /* Getting list of files in the config - accounts directory */
+ $accounts_list = get_filenames($this->config->item('config_path') .
'accounts');
+ $select_account_options = array();
+ if ($accounts_list)
+ {
+ foreach ($accounts_list as $row)
+ {
+ /* Only include file ending with .ini */
+ if (substr($row, -4) == ".ini")
+ {
+ $ini_label = substr($row, 0, -4);
+ $select_account_options[$ini_label] = $ini_label;
+ }
+ }
+ }
+
+ echo form_open('setting/change');
+
+ echo "<p>";
+ echo form_label('Select account', 'select_account');
+ echo "<br />";
+ echo form_dropdown('select_account', $select_account_options);
+ echo "</p>";
+
+ echo "<p>";
+ echo form_submit('submit', 'Change');
+ echo "</p>";
+ echo "<p>";
+ echo anchor('admin/manage', 'Manage Accounts', 'Manage
Accounts');
+ echo "</p>";
+
+ echo form_close();
+
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index dfec3e2..7ecb824 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -10,6 +10,8 @@
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/custom.css">
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/menu.css">
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/jquery.datepick.css">
+<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/thickbox.css">
+
<?php
/* Dynamically adding css files from controllers */
if (isset($add_css))
@@ -27,6 +29,7 @@ if (isset($add_css))
<script type="text/javascript" src="<?php echo asset_url();
?>js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/superfish.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/supersubs.js"></script>
+<script type="text/javascript" src="<?php echo asset_url();
?>js/thickbox-compressed.js"></script>
<?php
/* Dynamically adding javascript files from controllers */
if (isset($add_javascript))
@@ -68,7 +71,10 @@ $(document).ready(function() {
<div id="info">
<?php
echo $this->config->item('account_name');
- echo "<br />";
+ echo " (";
+ echo "<a
href=\"#TB_inline?height=300&width=300&inlineId=changeActiveAccount\"
class=\"thickbox anchor-link-a\" title=\"Change Active
Account\">change</a>";
+ echo ")<br />";
+ echo "FY : ";
echo
date_mysql_to_php_display($this->config->item('account_fy_start'));
echo " - ";
echo date_mysql_to_php_display($this->config->item('account_fy_end'));
@@ -182,5 +188,10 @@ $(document).ready(function() {
<?php if (isset($page_footer)) echo $page_footer ?>
<a href="http://webzash.wordpress.com"
target="_blank">Webzash<a/> is licensed under <a
href="http://www.gnu.org/licenses/agpl-3.0.txt" target="_blank">GNU
Affero General Public License, version 3</a> as published by the Free Software
Foundation.
</div>
+<div id="account_change" class="hidden-element">
+ <div id="changeActiveAccount">
+ <?php $this->load->view("setting/change"); ?>
+ </div>
+</div>
</body>
</html>
commit f44b8cae6686360d08284c92d231bd9171ee55ab
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 21 15:52:00 2010 +0530
Converted active record to simple database query
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/log.php
b/system/application/controllers/log.php
index 5416c8c..9d24beb 100644
--- a/system/application/controllers/log.php
+++ b/system/application/controllers/log.php
@@ -33,8 +33,7 @@ class Log extends Controller {
$data['page_language'] = 'en-en';
$data['creator_email'] = $this->config->item('account_email');
- $this->db->order_by("id", "desc");
- $data['feed_data'] = $this->db->get('logs');
+ $data['feed_data'] = $this->db->query('SELECT * FROM logs ORDER BY id
DESC');
header("Content-Type: application/rss+xml");
$this->load->view('rss', $data);
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 50dd36e..9d37292 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -467,7 +467,7 @@ class Voucher extends Controller {
$voucher_success_links .= " it.";
$this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' added successfully. ' .
$voucher_success_links, 'success');
- $this->logger->write_message("success", "Added " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number);
+ $this->logger->write_message("success", "Added " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " [id:" . $voucher_id .
"]");
redirect('voucher/show/' . $voucher_type);
$this->template->load('template', 'voucher/add', $data);
return;
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index 846c096..5f947ac 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -17,11 +17,11 @@ class Welcome extends Controller {
$this->template->set('add_javascript', array("raphael.js",
"jquery.enumerable.js", "jquery.tufte-graph.js"));
/* Draft voucher count */
- $draft_q = $this->db->get_where('vouchers', array('draft' =>
1));
+ $draft_q = $this->db->query("SELECT * FROM vouchers WHERE draft = 1");
$data['draft_count'] = $draft_q->num_rows();
/* Bank and Cash Ledger accounts */
- $bank_q = $this->db->get_where('ledgers', array('type' =>
'B'));
+ $bank_q = $this->db->query("SELECT * FROM ledgers WHERE type = ?",
array('B'));
if ($bank_q->num_rows() > 0)
{
foreach ($bank_q->result() as $row)
diff --git a/system/application/models/tag_model.php
b/system/application/models/tag_model.php
index 7a75042..15d1510 100644
--- a/system/application/models/tag_model.php
+++ b/system/application/models/tag_model.php
@@ -24,7 +24,7 @@ class Tag_model extends Model {
{
if ($tag_id < 1)
return "";
- $tag_q = $this->db->get_where('tags', array('id' =>
$tag_id));
+ $tag_q = $this->db->query("SELECT * FROM tags WHERE id = ?",
array($tag_id));
if ($tag = $tag_q->row())
{
return "<span class=\"tags\" style=\"color:#" .
$tag->color . "; background-color:#" . $tag->background .
"\">" . $tag->title . "</span>";
@@ -36,7 +36,7 @@ class Tag_model extends Model {
{
if ($tag_id < 1)
return "";
- $tag_q = $this->db->get_where('tags', array('id' =>
$tag_id));
+ $tag_q = $this->db->query("SELECT * FROM tags WHERE id = ?",
array($tag_id));
if ($tag = $tag_q->row())
{
return "<span class=\"tags\" style=\"color:#" .
$tag->color . "; background-color:#" . $tag->background .
"\">" . anchor("voucher/show/tag/" . $tag->id ,
$tag->title, array('style' => 'text-decoration:none;color:#' .
$tag->color . ';')) . "</span>";
@@ -48,7 +48,7 @@ class Tag_model extends Model {
{
if ($tag_id < 1)
return "";
- $tag_q = $this->db->get_where('tags', array('id' =>
$tag_id));
+ $tag_q = $this->db->query("SELECT * FROM tags WHERE id = ?",
array($tag_id));
if ($tag = $tag_q->row())
{
return $tag->title;
diff --git a/system/application/views/log/index.php
b/system/application/views/log/index.php
index a1c4777..99d9b66 100644
--- a/system/application/views/log/index.php
+++ b/system/application/views/log/index.php
@@ -1,6 +1,5 @@
<?php
- $this->db->order_by("id", "desc");
- $logs_q = $this->db->get('logs');
+ $logs_q = $this->db->query('SELECT * FROM logs ORDER BY id DESC');
echo "<table border=0 class=\"simple-table\">";
echo "<thead><tr><th
width=\"90\">Date</th><th>Host
IP</th><th>Message</th><th
width=\"30\">URL</th><th>Browser</th></tr></thead>";
foreach ($logs_q->result() as $row)
diff --git a/system/application/views/tag/index.php
b/system/application/views/tag/index.php
index bb3db1d..a67ea9f 100644
--- a/system/application/views/tag/index.php
+++ b/system/application/views/tag/index.php
@@ -1,5 +1,5 @@
<?php
- $tags_q = $this->db->get("tags");
+ $tags_q = $this->db->query("SELECT * FROM tags ORDER BY title ASC");
echo "<table border=0 cellpadding=5 class=\"simple-table
tag-table\">";
echo
"<thead><tr><th>Title</th><th>Color</th><th></th></tr></thead>";
echo "<tbody>";
commit e52001e58db1f302ec5e84544639d1d53976074e
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 21 15:12:25 2010 +0530
Added Voucher actions after add and edit voucher
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 1cf8be4..50dd36e 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -459,7 +459,14 @@ class Voucher extends Controller {
/* Success */
$this->db->trans_complete();
- $this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' added successfully.',
'success');
+
+ /* Voucher Actions */
+ $voucher_success_links = "You can ";
+ $voucher_success_links .= anchor('voucher/view/' . strtolower($voucher_type) .
"/" . $voucher_id, 'View', array('class' =>
'anchor-link-a')) . " or ";
+ $voucher_success_links .= anchor('voucher/download/' .
strtolower($voucher_type) . "/" . $voucher_id, 'Download',
array('class' => 'anchor-link-a'));
+ $voucher_success_links .= " it.";
+
+ $this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' added successfully. ' .
$voucher_success_links, 'success');
$this->logger->write_message("success", "Added " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number);
redirect('voucher/show/' . $voucher_type);
$this->template->load('template', 'voucher/add', $data);
@@ -722,7 +729,14 @@ class Voucher extends Controller {
/* Success */
$this->db->trans_complete();
- $this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' updated successfully.',
'success');
+
+ /* Voucher Actions */
+ $voucher_success_links = "You can ";
+ $voucher_success_links .= anchor('voucher/view/' . strtolower($voucher_type) .
"/" . $voucher_id, 'View', array('class' =>
'anchor-link-a')) . " or ";
+ $voucher_success_links .= anchor('voucher/download/' .
strtolower($voucher_type) . "/" . $voucher_id, 'Download',
array('class' => 'anchor-link-a'));
+ $voucher_success_links .= " it.";
+
+ $this->messages->add(ucfirst($voucher_type) . ' Voucher number ' .
voucher_number_prefix($voucher_type) . $data_number . ' updated successfully. ' .
$voucher_success_links, 'success');
$this->logger->write_message("success", "Updated " .
ucfirst($voucher_type) . " Voucher number " .
voucher_number_prefix($voucher_type) . $data_number . " [id:" . $voucher_id .
"]");
redirect('voucher/show/' . $voucher_type);
return;
commit 3bb2a5c0b20bf4f4e7053989898ac46d14d306ea
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 21 14:17:07 2010 +0530
Added Status report
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/status.php
b/system/application/controllers/admin/status.php
new file mode 100644
index 0000000..5485bcb
--- /dev/null
+++ b/system/application/controllers/admin/status.php
@@ -0,0 +1,24 @@
+<?php
+
+class Status extends Controller {
+
+ function Status()
+ {
+ parent::Controller();
+ return;
+ }
+
+ function index()
+ {
+ $this->load->library('statuscheck');
+ $this->template->set('page_title', 'Status report');
+ $statuscheck = new Statuscheck();
+ $statuscheck->check_permissions();
+ $data['error_messages'] = $statuscheck->error_messages;
+ $this->template->load('admin_template', 'admin/status', $data);
+ return;
+ }
+}
+
+/* End of file status.php */
+/* Location: ./system/application/controllers/admin/status.php */
diff --git a/system/application/controllers/admin/welcome.php
b/system/application/controllers/admin/welcome.php
index a32238d..cc4ed1e 100644
--- a/system/application/controllers/admin/welcome.php
+++ b/system/application/controllers/admin/welcome.php
@@ -139,74 +139,17 @@ class Welcome extends Controller {
if ($data['current_account'] == "")
$data['current_account'] = "No account is currently active. You can
" . anchor('admin/create', 'create', array('title' =>
'Create a new account', 'style' => 'color:#000000')) . " a
new account or " . anchor('admin/active', 'activate',
array('title' => 'Activate a existing account', 'style' =>
'color:#000000')) . " an existing account";
- /* check for permissions */
- $this->_check_permissions();
-
- $this->template->load('admin_template', 'admin/welcome', $data);
- return;
- }
-
- /* Check application file permissions for any security related issues */
- function _check_permissions()
- {
- $check_path = $this->config->item('config_path') .
"settings/";
- if (! is_writable($check_path))
- {
- $this->messages->add('Application settings directory "' .
$check_path . '" is not writable. You will not able to save or edit any
application related settings.', 'error');
- }
-
- $check_path = $this->config->item('config_path') .
"accounts/";
- if (! is_writable($check_path))
- {
- $this->messages->add('Account settings directory "' . $check_path .
'" is not writable. You will not able to save or edit any account related
settings.', 'error');
- }
-
- $check_path = $this->config->item('backup_path');
- if (! is_writable($check_path))
- {
- $this->messages->add('Backup directory "' . $check_path .
'" is not writable. You will not able to save or download any backups.',
'error');
- }
-
- /* Security checks */
- $check_path = $this->config->item('config_path');
- if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
- {
- $this->messages->add('Security Risk ! The application config directory
"' . $check_path . '" is world readable.', 'error');
- }
- if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
+ /* check status report */
+ $this->load->library('statuscheck');
+ $statuscheck = new Statuscheck();
+ $statuscheck->check_permissions();
+ if (count($statuscheck->error_messages) > 0)
{
- $this->messages->add('Security Risk ! The application config directory
"' . $check_path . '" is world writeable.', 'error');
+ $this->messages->add('One or more problems were detected with your
installation. Check the ' . anchor('admin/status', 'Status report',
array('title' => 'Check Status report', 'class' =>
'anchor-link-a')) . ' for more information.', 'error');
}
- $check_path = $this->config->item('config_path') .
"accounts/";
- if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
- {
- $this->messages->add('Security Risk ! The application accounts directory
"' . $check_path . '" is world readable.', 'error');
- }
- if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
- {
- $this->messages->add('Security Risk ! The application accounts directory
"' . $check_path . '" is world writeable.', 'error');
- }
-
- $check_path = $this->config->item('config_path') .
"settings/";
- if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
- {
- $this->messages->add('Security Risk ! The application settings directory
"' . $check_path . '" is world readable.', 'error');
- }
- if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
- {
- $this->messages->add('Security Risk ! The application settings directory
"' . $check_path . '" is world writeable.', 'error');
- }
-
- $check_path = $this->config->item('backup_path');
- if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
- {
- $this->messages->add('Security Risk ! The application backup directory
"' . $check_path . '" is world readable.', 'error');
- }
- if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
- {
- $this->messages->add('Security Risk ! The application backup directory
"' . $check_path . '" is world writeable.', 'error');
- }
+ $this->template->load('admin_template', 'admin/welcome', $data);
+ return;
}
}
diff --git a/system/application/libraries/Statuscheck.php
b/system/application/libraries/Statuscheck.php
new file mode 100644
index 0000000..f81acf0
--- /dev/null
+++ b/system/application/libraries/Statuscheck.php
@@ -0,0 +1,76 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access
allowed');
+
+class Statuscheck {
+ var $error_messages = array();
+
+ function Statuscheck()
+ {
+ $this->error_messages = array();
+ }
+
+ function check_permissions()
+ {
+ $CI =& get_instance();
+ $check_path = $CI->config->item('config_path') . "settings/";
+ if (! is_writable($check_path))
+ {
+ $this->error_messages[] = 'Application settings directory "' .
$check_path . '" is not writable. You will not able to save or edit any
application related settings.';
+ }
+
+ $check_path = $CI->config->item('config_path') . "accounts/";
+ if (! is_writable($check_path))
+ {
+ $this->error_messages[] = 'Account settings directory "' . $check_path
. '" is not writable. You will not able to save or edit any account related
settings.';
+ }
+
+ $check_path = $CI->config->item('backup_path');
+ if (! is_writable($check_path))
+ {
+ $this->error_messages[] = 'Backup directory "' . $check_path .
'" is not writable. You will not able to save or download any backups.';
+ }
+
+ /* Security checks */
+ $check_path = $CI->config->item('config_path');
+ if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
+ {
+ $this->error_messages[] = 'Security Risk ! The application config directory
"' . $check_path . '" is world readable.';
+ }
+ if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
+ {
+ $this->error_messages[] = 'Security Risk ! The application config directory
"' . $check_path . '" is world writeable.';
+ }
+
+ $check_path = $CI->config->item('config_path') . "accounts/";
+ if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
+ {
+ $this->error_messages[] = 'Security Risk ! The application accounts directory
"' . $check_path . '" is world readable.';
+ }
+ if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
+ {
+ $this->error_messages[] = 'Security Risk ! The application accounts directory
"' . $check_path . '" is world writeable.';
+ }
+
+ $check_path = $CI->config->item('config_path') . "settings/";
+ if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
+ {
+ $this->error_messages[] = 'Security Risk ! The application settings directory
"' . $check_path . '" is world readable.';
+ }
+ if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
+ {
+ $this->error_messages[] = 'Security Risk ! The application settings directory
"' . $check_path . '" is world writeable.';
+ }
+
+ $check_path = $CI->config->item('backup_path');
+ if (substr(symbolic_permissions(fileperms($check_path)), -3, 1) == "r")
+ {
+ $this->error_messages[] = 'Security Risk ! The application backup directory
"' . $check_path . '" is world readable.';
+ }
+ if (substr(symbolic_permissions(fileperms($check_path)), -2, 1) == "W")
+ {
+ $this->error_messages[] = 'Security Risk ! The application backup directory
"' . $check_path . '" is world writeable.';
+ }
+ }
+}
+
+/* End of file Template.php */
+/* Location: ./system/application/libraries/Template.php */
diff --git a/system/application/views/admin/status.php
b/system/application/views/admin/status.php
new file mode 100644
index 0000000..f40be1d
--- /dev/null
+++ b/system/application/views/admin/status.php
@@ -0,0 +1,19 @@
+<?php
+ if (is_array($error_messages))
+ {
+ if (count($error_messages) > 0)
+ {
+ echo "<div id=\"error-box\">";
+ echo "<ul>";
+ foreach ($error_messages as $message)
+ {
+ echo ('<li>' . $message . '</li>');
+ }
+ echo "</ul>";
+ echo "</div>";
+ }
+ }
+
+ echo "<p>";
+ echo anchor('admin', 'Back', 'Back to admin');
+ echo "</p>";
diff --git a/system/application/views/admin/welcome.php
b/system/application/views/admin/welcome.php
index d6f34de..625ac24 100644
--- a/system/application/views/admin/welcome.php
+++ b/system/application/views/admin/welcome.php
@@ -38,6 +38,14 @@
General application settings
</div>
</div>
+ <div class="settings-container">
+ <div class="settings-title">
+ <?php echo anchor('admin/status', 'Status Report',
array('title' => 'Status Report')); ?>
+ </div>
+ <div class="settings-desc">
+ Status report of the application
+ </div>
+ </div>
</div>
</div>
<div class="clear">