function simple_tests() { echo "Testing sscanf with standard ANSI syntax (values returned by\nreference)-<br>"; $decimal = -1; $string = ""; $hex = 0; $float = 0.0; $octal = 0.0; $int = -1; echo "<h3><em><br>Simple Test<br></em></h3>"; echo "sscanf('10','%d',&\$decimal) <br>"; echo "<br>BEFORE : <br> decimal = {$decimal}."; $foo = sscanf("10", "%d", &$decimal); echo "<br>AFTER : <br> decimal = {$decimal} <br>"; echo "<h3><em><br>Simple Test 2<br></em></h3>"; echo "sscanf(\"ghost 0xface\",\"%s %x\",&\$string, &\$int)<br>"; echo "<br>BEFORE : <br> string = {$string}, int = {$int}<br>"; $foo = sscanf("ghost 0xface", "%s %x", &$string, &$int); echo "<br>AFTER : <br> string = {$string}, int = {$int}<br>"; echo " sscan reports : "; print_value($foo, ""); echo " conversions <br>"; echo "<h3><em><br>Multiple specifiers<br></em></h3>"; echo "sscanf(\"jabberwocky 1024 0xFF 1.024 644 10\",\n\t\t\t\"%s %d %x %f %o %i\",\n\t\t\t&\$string,&\$decimal,&\$hex,&\$float,&\$octal,&\$int);<br>"; echo "<br>BEFORE : <br>"; echo "Decimal = {$decimal}, String = {$string}, Hex = {$hex}<br>"; echo "Octal = {$octal} , Float = {$float}, Int = {$int}<br>"; $foo = sscanf("jabberwocky 1024 0xFF 1.024 644 10", "%s %d %x %f %o %i", &$string, &$decimal, &$hex, &$float, &$octal, &$int); echo "<br>AFTER :<br>"; echo "decimal = {$decimal}, string = {$string}, hex = {$hex}<br>"; echo "octal = {$octal} , float = {$float}, int = {$int}<br>"; echo " sscan reports : "; print_value($foo, ""); echo " conversions <br>"; echo "----------------------------------------<br>"; }
function index() { $this->template->set('page_title', 'Account Settings'); $account_data = $this->Setting_model->get_current(); $default_start = '01/04/'; $default_end = '31/03/'; if (date('n') > 3) { $default_start .= date('Y'); $default_end .= date('Y') + 1; } else { $default_start .= date('Y') - 1; $default_end .= date('Y'); } /* Form fields */ $data['account_name'] = array('name' => 'account_name', 'id' => 'account_name', 'maxlength' => '100', 'size' => '40', 'value' => ''); $data['account_address'] = array('name' => 'account_address', 'id' => 'account_address', 'rows' => '4', 'cols' => '47', 'value' => ''); $data['account_email'] = array('name' => 'account_email', 'id' => 'account_email', 'maxlength' => '100', 'size' => '40', 'value' => ''); $data['fy_start'] = ''; $data['fy_end'] = ''; $data['account_currency'] = array('name' => 'account_currency', 'id' => 'account_currency', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['account_date_options'] = array('dd/mm/yyyy' => 'Day / Month / Year', 'mm/dd/yyyy' => 'Month / Day / Year', 'yyyy/mm/dd' => 'Year / Month / Day'); $data['account_date'] = 'dd/mm/yyyy'; $data['account_timezone'] = 'UTC'; $data['account_locked'] = FALSE; /* Current account settings */ if ($account_data) { $data['account_name']['value'] = print_value($account_data->name); $data['account_address']['value'] = print_value($account_data->address); $data['account_email']['value'] = print_value($account_data->email); $data['account_currency']['value'] = print_value($account_data->currency_symbol); $data['account_date'] = print_value($account_data->date_format); $data['account_timezone'] = print_value($account_data->timezone); $data['fy_start'] = date_mysql_to_php(print_value($account_data->fy_start)); $data['fy_end'] = date_mysql_to_php(print_value($account_data->fy_end)); $data['account_locked'] = print_value($account_data->account_locked); } /* Form validations */ $this->form_validation->set_rules('account_name', 'Account Name', 'trim|required|min_length[2]|max_length[100]'); $this->form_validation->set_rules('account_address', 'Account Address', 'trim|max_length[255]'); $this->form_validation->set_rules('account_email', 'Account Email', 'trim|valid_email'); $this->form_validation->set_rules('account_currency', 'Currency', 'trim|max_length[10]'); $this->form_validation->set_rules('account_date', 'Date', 'trim|max_length[10]'); $this->form_validation->set_rules('account_timezone', 'Timezone', 'trim|max_length[6]'); $this->form_validation->set_rules('account_locked', 'Account Locked', 'trim'); /* Repopulating form */ if ($_POST) { $data['account_name']['value'] = $this->input->post('account_name', TRUE); $data['account_address']['value'] = $this->input->post('account_address', TRUE); $data['account_email']['value'] = $this->input->post('account_email', TRUE); $data['account_currency']['value'] = $this->input->post('account_currency', TRUE); $data['account_date'] = $this->input->post('account_date', TRUE); $data['account_timezone'] = $this->input->post('account_timezone', TRUE); $data['account_locked'] = $this->input->post('account_locked', TRUE); } /* Validating form */ if ($this->form_validation->run() == FALSE) { $this->messages->add(validation_errors(), 'error'); $this->template->load('template', 'setting/account', $data); return; } else { $data_account_name = $this->input->post('account_name', TRUE); $data_account_address = $this->input->post('account_address', TRUE); $data_account_email = $this->input->post('account_email', TRUE); $data_account_currency = $this->input->post('account_currency', TRUE); $data_account_date_form = $this->input->post('account_date', TRUE); /* Checking for valid format */ if ($data_account_date_form == "dd/mm/yyyy") { $data_account_date = "dd/mm/yyyy"; } else { if ($data_account_date_form == "mm/dd/yyyy") { $data_account_date = "mm/dd/yyyy"; } else { if ($data_account_date_form == "yyyy/mm/dd") { $data_account_date = "yyyy/mm/dd"; } else { $data_account_date = "dd/mm/yyyy"; } } } $data_account_timezone = $this->input->post('timezones', TRUE); $data_account_locked = $this->input->post('account_locked', TRUE); if ($data_account_locked != 1) { $data_account_locked = 0; } /* Update settings */ $this->db->trans_start(); $update_data = array('name' => $data_account_name, 'address' => $data_account_address, 'email' => $data_account_email, 'currency_symbol' => $data_account_currency, 'date_format' => $data_account_date, 'timezone' => $data_account_timezone, 'account_locked' => $data_account_locked); if (!$this->db->where('id', 1)->update('settings', $update_data)) { $this->db->trans_rollback(); $this->messages->add('Error updating account settings.', 'error'); $this->logger->write_message("error", "Error updating account settings"); $this->template->load('template', 'setting/account', $data); return; } else { $this->db->trans_complete(); $this->messages->add('Account settings updated.', 'success'); $this->logger->write_message("success", "Updated account settings"); redirect('setting'); return; } } return; }
function print_rows_nosp($wt) { global $dbhandle; $types = get_column_types($wt['table'], $wt['columns']); $class = 'wttr2'; $quote = identifier_quote($GLOBALS['s_login']['dialect']); $sql = 'SELECT '; $sql .= $quote . implode($quote . ',' . $quote, $wt['columns']) . $quote . ' FROM ' . $quote . $wt['table'] . $quote; $sql .= $wt['condition'] != '' ? ' WHERE ' . $wt['condition'] : ''; if (!empty($wt['order'])) { $sql .= ' ORDER BY ' . $wt['order'] . ' ' . $wt['direction']; } $sql .= ' ROWS ' . $wt['start'] . ' TO ' . ($wt['start'] + $wt['rows'] - 1); $res = @fbird_query($dbhandle, $sql) or ib_error(__FILE__, __LINE__, $sql); $col_count = count($wt['columns']); echo " <tbody>\n"; for ($i = 0; $i < $wt['rows']; $i++) { $obj = fbird_fetch_object($res); // stop, if there are no more rows if (!is_object($obj)) { break; } $class = $class == 'wttr1' ? 'wttr2' : 'wttr1'; echo ' <tr class="wttr ' . $class . '">'; $arr = get_object_vars($obj); for ($k = 0; $k < $col_count; $k++) { if (!isset($arr[$wt['columns'][$k]])) { print_value($wt, NULL, NULL); } else { print_value($wt, $arr[$wt['columns'][$k]], $types[$wt['columns'][$k]], $wt['columns'][$k], $obj); } } // get parameter for the edit and/or del link if ($wt['edit'] == TRUE || $wt['delete'] == TRUE) { build_editdel_links($obj, $wt['edit'], $wt['delete']); } echo " </tr>\n"; } echo " </tbody>\n"; fbird_free_result($res); }
function index() { $this->template->set('page_title', 'Printer Settings'); $account_data = $this->Setting_model->get_current(); /* Form fields */ $data['paper_height'] = array('name' => 'paper_height', 'id' => 'paper_height', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['paper_width'] = array('name' => 'paper_width', 'id' => 'paper_width', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['margin_top'] = array('name' => 'margin_top', 'id' => 'margin_top', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['margin_bottom'] = array('name' => 'margin_bottom', 'id' => 'margin_bottom', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['margin_left'] = array('name' => 'margin_left', 'id' => 'margin_left', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['margin_right'] = array('name' => 'margin_right', 'id' => 'margin_right', 'maxlength' => '10', 'size' => '10', 'value' => ''); $data['orientation_potrait'] = array('name' => 'orientation', 'id' => 'orientation_potrait', 'value' => 'P', 'checked' => TRUE); $data['orientation_landscape'] = array('name' => 'orientation', 'id' => 'orientation_landscape', 'value' => 'L', 'checked' => FALSE); $data['output_format_html'] = array('name' => 'output_format', 'id' => 'output_format_html', 'value' => 'H', 'checked' => TRUE); $data['output_format_text'] = array('name' => 'output_format', 'id' => 'output_format_text', 'value' => 'T', 'checked' => FALSE); if ($account_data) { $data['paper_height']['value'] = $account_data->print_paper_height ? print_value($account_data->print_paper_height) : ''; $data['paper_width']['value'] = $account_data->print_paper_width ? print_value($account_data->print_paper_width) : ''; $data['margin_top']['value'] = $account_data->print_margin_top ? print_value($account_data->print_margin_top) : ''; $data['margin_bottom']['value'] = $account_data->print_margin_bottom ? print_value($account_data->print_margin_bottom) : ''; $data['margin_left']['value'] = $account_data->print_margin_left ? print_value($account_data->print_margin_left) : ''; $data['margin_right']['value'] = $account_data->print_margin_right ? print_value($account_data->print_margin_right) : ''; if ($account_data->print_orientation) { if ($account_data->print_orientation == "P") { $data['orientation_potrait']['checked'] = TRUE; $data['orientation_landscape']['checked'] = FALSE; } else { $data['orientation_potrait']['checked'] = FALSE; $data['orientation_landscape']['checked'] = TRUE; } } if ($account_data->print_page_format) { if ($account_data->print_page_format == "H") { $data['output_format_html']['checked'] = TRUE; $data['output_format_text']['checked'] = FALSE; } else { $data['output_format_html']['checked'] = FALSE; $data['output_format_text']['checked'] = TRUE; } } } /* Form validations */ $this->form_validation->set_rules('paper_height', 'Paper Height', 'trim|required|numeric'); $this->form_validation->set_rules('paper_width', 'Paper Width', 'trim|required|numeric'); $this->form_validation->set_rules('margin_top', 'Top Margin', 'trim|required|numeric'); $this->form_validation->set_rules('margin_bottom', 'Bottom Margin', 'trim|required|numeric'); $this->form_validation->set_rules('margin_left', 'Left Margin', 'trim|required|numeric'); $this->form_validation->set_rules('margin_right', 'Right Margin', 'trim|required|numeric'); /* Repopulating form */ if ($_POST) { $data['paper_height']['value'] = $this->input->post('paper_height', TRUE); $data['paper_width']['value'] = $this->input->post('paper_width', TRUE); $data['margin_top']['value'] = $this->input->post('margin_top', TRUE); $data['margin_bottom']['value'] = $this->input->post('margin_bottom', TRUE); $data['margin_left']['value'] = $this->input->post('margin_left', TRUE); $data['margin_right']['value'] = $this->input->post('margin_right', TRUE); $data['orientation'] = $this->input->post('orientation', TRUE); if ($data['orientation'] == "P") { $data['orientation_potrait']['checked'] = TRUE; $data['orientation_landscape']['checked'] = FALSE; } else { $data['orientation_potrait']['checked'] = FALSE; $data['orientation_landscape']['checked'] = TRUE; } $data['output_format'] = $this->input->post('output_format', TRUE); if ($data['output_format'] == "H") { $data['output_format_html']['checked'] = TRUE; $data['output_format_text']['checked'] = FALSE; } else { $data['output_format_html']['checked'] = FALSE; $data['output_format_text']['checked'] = TRUE; } } /* Validating form */ if ($this->form_validation->run() == FALSE) { $this->messages->add(validation_errors(), 'error'); $this->template->load('template', 'setting/printer', $data); return; } else { $data_paper_height = $this->input->post('paper_height', TRUE); $data_paper_width = $this->input->post('paper_width', TRUE); $data_margin_top = $this->input->post('margin_top', TRUE); $data_margin_bottom = $this->input->post('margin_bottom', TRUE); $data_margin_left = $this->input->post('margin_left', TRUE); $data_margin_right = $this->input->post('margin_right', TRUE); if ($this->input->post('orientation', TRUE) == "P") { $data_orientation = "P"; } else { $data_orientation = "L"; } if ($this->input->post('output_format', TRUE) == "H") { $data_output_format = "H"; } else { $data_output_format = "T"; } /* Update settings */ $this->db->trans_start(); $update_data = array('print_paper_height' => $data_paper_height, 'print_paper_width' => $data_paper_width, 'print_margin_top' => $data_margin_top, 'print_margin_bottom' => $data_margin_bottom, 'print_margin_left' => $data_margin_left, 'print_margin_right' => $data_margin_right, 'print_orientation' => $data_orientation, 'print_page_format' => $data_output_format); if (!$this->db->where('id', 1)->update('settings', $update_data)) { $this->db->trans_rollback(); $this->messages->add('Error updating printer settings.', 'error'); $this->logger->write_message("error", "Error updating printer settings"); $this->template->load('template', 'setting/printer'); return; } else { $this->db->trans_complete(); $this->messages->add('Printer settings updated.', 'success'); $this->logger->write_message("success", "Updated printer settings"); redirect('setting'); return; } } return; }
?> <!-- End DBG Install instructions --> <!-- Begin Project settings instructions --> <div class="text_desc"> <h1> How to setup your PhpED Project Properties </h1> <p> I can suggest the following settings for your Project to debug PHP scripts on Server <?php print server('SERVER_NAME'); ?> :<br> You can create new Project by selecting File->New Project or by selecting New Project in the Workspace Pop up Menu<br> In the Project Properties Dialog set: </p> <ul class="plain"> <?php foreach ($proj_settings as $value) { $cap = $value['caption']; echo "<li>{$cap} " . print_value($value) . "</li>\n"; } ?> </ul> </div> <!-- End of Project Settings --> <h5><div> All rights reserved. Copyright © 2000-2014 NuSphere Corp <a href="http://www.nusphere.com">http://www.nusphere.com</a><br></div> </h5> </body> </html>
function graph_draw_impl($stat, $canvas, $c_width, $c_height, $names, $value_set, $start, $end, $step, $start_times) { global $g_colors; global $g_label_width; $l_margin = 50; $r_margin = 20; $width = $c_width - $l_margin - $r_margin; $col = floor($width / $g_label_width); if ($col == 0) { $col = 1; } $label_height = 10 * floor((count($value_set) + $col - 1) / $col); $b_margin = 30 + $label_height; $t_margin = 10; $height = $c_height - $b_margin - $t_margin; foreach ($value_set as $name => $values) { $bounds = calculate_bounds($bounds, $values); } list($x1, $y1, $x2, $y2) = $bounds; $x1 = $start * 1000; $x0 = $x1; $x2 = $end * 1000; $dx = ($x2 - $x1) / $width; $dy = ($y2 - $y1) / $height; if ($dx == 0) { $dx = 1; } if ($dy == 0) { $dy = 1; } echo "<script type='application/x-javascript'>\n"; echo "c = start_bounds('{$canvas}', {$c_width}, {$c_height}, {$l_margin}, {$t_margin});\n"; draw_grid($width, $height, $x1, $y1, $x2, $y2, 0, 0, $dx, $dy, "#c0c0c0", "#c0c0c0"); foreach ($start_times as $time) { echo "c.save();"; echo "c.strokeStyle = '#60c000';\n"; echo "c.lineWidth = 2;\n"; echo "c.beginPath();\n"; echo "c.moveTo(" . ($time - $x0) / $dx . "," . 0 . ");\n"; echo "c.lineTo(" . ($time - $x0) / $dx . "," . $height . ");\n"; echo "c.stroke();\n"; echo "c.restore();"; } $i = 0; foreach ($value_set as $name => $values) { echo "c.save();"; echo "c.strokeStyle = '" . $g_colors[$i] . "';\n"; echo "c.lineWidth = 1;\n"; echo "c.beginPath();\n"; echo "c.moveTo(" . ($values[0]->time - $x0) / $dx . "," . (($dy - $values[0]->value) / $dy + $height) . ");\n"; foreach ($values as $v) { printf("rl(c,%.2f,%.2f);\n", ($v->time - $x0) / $dx, ($dy - $v->value) / $dy + $height); } $l_margin = 40; echo "c.translate(" . ($g_label_width * floor($i % $col) - $l_margin) . ", " . ($height + 25 + 10 * floor($i / $col)) . ");"; echo "c.beginPath();"; //echo "c.strokeStyle = '" . $colors[$i] . "';"; echo "c.lineWidth = 2;"; echo "c.moveTo(0, 10);"; echo "c.lineTo(15, 10);"; echo "c.stroke();"; echo "c.beginPath();"; echo "c.font = '10px Times';\n"; echo "c.fillStyle = '#000000';\n"; $name_seg = preg_split('/[|]/', $name); $server = array_shift($name_seg); array_shift($name_seg); array_shift($name_seg); $name = join('|', $name_seg); $text = sprintf("%s - %s", $server, $name); $text = substr($text, 0, 40); echo "c.fillText('" . $text . "', 20, 13);"; echo "c.restore();"; $i++; } echo "c.beginPath();"; echo "c.strokeStyle ='#000000';\n"; echo "c.font = '10px Monotype';\n"; echo "c.fillStyle ='#000000';\n"; echo "c.fillText('" . print_value($y1) . "', -45, " . $height . ");\n"; echo "c.fillText('" . print_value($y2) . "', -45, " . 10 . ");\n"; echo "</script>\n"; }
function parse($lang, $wikipage) { global $root_path; global $lang_cat_list; $deprecated=false; $emptyline=0; $f=fopen("http://wiki.openstreetmap.org/w/index.php?title=OpenStreetBrowser/Languages/$wikipage&action=raw", "r"); unset($file); while($r=fgets($f)) { $r=trim($r); if(eregi("=== Deprecated strings ===", $r)) { $deprecated=true; } else if(eregi("==== Statistics ====", $r, $m)) { if($w) { print "Done\n"; fclose($w); unset($w); } continue; } else if(eregi("==== (File|Category): ?(.*) ====", $r, $m)) { if($m[1]=="File") { $file_type=1; $file=$m[2]; if(eregi("^(.*)en\.(.*)$", $file, $m)) { $file="$m[1]$lang.$m[2]"; } } else { $file_type=2; $file=$m[2]; } if(isset($w)) { fclose($w); unset($w); } if($file_type==1) { print "Writing to $file\n"; if($deprecated) { if(!($w=fopen("$root_path/$file", "a"))) { print "Can't write to file $file\n"; exit; } fwrite($w, "// The following \$lang_str were not defined in the English language file and might be deprecated or wrong:\n"); } else { if(!($w=fopen("$root_path/$file", "w"))) { print "Can't write to file $file\n"; exit; } } } $emptyline=0; } elseif(eregi("<\/?syntaxhigh", $r)) { } else { if(eregi("^(.*)\\\$lang_str\[\"([^\"]*)\"\]\s*=\s*\"(.*)\";", $r, $m)) { $str=rewrite_str($m[2]); if($file_type==1) $r="$m[1]\$lang_str[\"$str\"]=\"".strtr($m[3], array("\""=>"\\\""))."\";"; else { if(substr($m[1], 0, 1)!="#") $lang_cat_list[$lang][$str]=$m[3]; } } elseif(eregi("^(.*)\\\$lang_str\[\"([^\"]*)\"\]\s*=\s*array\( *(.*) *\);", $r, $m)) { if(preg_match("/\"?([MFN])\"?\s*,?\s*\"(.*)\"\s*,\s*\"(.*)\"/", $m[3], $m1)) { $m[3]=array($m1[1], $m1[2], $m1[3]); } elseif(preg_match("/\"(.*)\"\s*,\s*\"(.*)\"/", $m[3], $m1)) { $m[3]=array($m1[1], $m1[2]); } elseif(preg_match("/\"(.*)\"/", $m[3], $m1)) { $m[3]=array($m1[1]); } else { print "Can't parse \"$m[3]\"\n"; } foreach($m[3] as $mk=>$mv) { $m[3][$mk]=strtr($mv, array("\""=>"\\\"")); } $str=rewrite_str($m[2]); if($file_type==1) { $s=print_value($m[3]); $r="$m[1]\$lang_str[\"$str\"]=$s;"; } else { if(substr($m[1], 0, 1)!="#") $lang_cat_list[$lang][$str]=$m[3]; } } if($r=="") { $emptyline++; } elseif(isset($w)) { while($emptyline>0) { fwrite($w, "\n"); $emptyline--; } fwrite($w, "$r\n"); } } } if(isset($w)) fclose($w); }
function index() { $this->template->set('page_title', 'Email Settings'); $account_data = $this->Setting_model->get_current(); /* Form fields */ $data['email_protocol_options'] = array('mail' => 'mail', 'sendmail' => 'sendmail', 'smtp' => 'smtp'); $data['email_host'] = array('name' => 'email_host', 'id' => 'email_host', 'maxlength' => '100', 'size' => '40', 'value' => ''); $data['email_port'] = array('name' => 'email_port', 'id' => 'email_port', 'maxlength' => '5', 'size' => '5', 'value' => ''); $data['email_username'] = array('name' => 'email_username', 'id' => 'email_username', 'maxlength' => '100', 'size' => '40', 'value' => ''); $data['email_password'] = array('name' => 'email_password', 'id' => 'email_password', 'maxlength' => '100', 'size' => '40', 'value' => ''); if ($account_data) { $data['email_protocol'] = $account_data->email_protocol ? print_value($account_data->email_protocol) : 'smtp'; $data['email_host']['value'] = $account_data->email_host ? print_value($account_data->email_host) : ''; $data['email_port']['value'] = $account_data->email_port ? print_value($account_data->email_port) : ''; $data['email_username']['value'] = $account_data->email_username ? print_value($account_data->email_username) : ''; } /* Form validations */ $this->form_validation->set_rules('email_protocol', 'Email Protocol', 'trim|required|min_length[2]|max_length[10]'); $this->form_validation->set_rules('email_host', 'Mail Server Hostname', 'trim|max_length[255]'); $this->form_validation->set_rules('email_port', 'Mail Server Port', 'trim|is_natural'); $this->form_validation->set_rules('email_username', 'Email Username', 'trim|max_length[255]'); $this->form_validation->set_rules('email_password', 'Email Password', 'trim|max_length[255]'); /* Repopulating form */ if ($_POST) { $data['email_protocol'] = $this->input->post('email_protocol', TRUE); $data['email_host']['value'] = $this->input->post('email_host', TRUE); $data['email_port']['value'] = $this->input->post('email_port', TRUE); $data['email_username']['value'] = $this->input->post('email_username', TRUE); $data['email_password']['value'] = $this->input->post('email_password', TRUE); } /* Validating form */ if ($this->form_validation->run() == FALSE) { $this->messages->add(validation_errors(), 'error'); $this->template->load('template', 'setting/email', $data); return; } else { $data_email_protocol = $this->input->post('email_protocol', TRUE); $data_email_host = $this->input->post('email_host', TRUE); $data_email_port = $this->input->post('email_port', TRUE); $data_email_username = $this->input->post('email_username', TRUE); $data_email_password = $this->input->post('email_password', TRUE); /* if password is blank then use the current password */ if ($data_email_password == "") { $data_email_password = $account_data->email_password; } /* Update settings */ $this->db->trans_start(); $update_data = array('email_protocol' => $data_email_protocol, 'email_host' => $data_email_host, 'email_port' => $data_email_port, 'email_username' => $data_email_username, 'email_password' => $data_email_password); if (!$this->db->where('id', 1)->update('settings', $update_data)) { $this->db->trans_rollback(); $this->messages->add('Error updating email settings.', 'error'); $this->logger->write_message("error", "Error updating email settings"); $this->template->load('template', 'setting/email', $data); return; } else { $this->db->trans_complete(); $this->messages->add('Email settings updated.', 'success'); $this->logger->write_message("success", "Updated email settings"); redirect('setting'); return; } } return; }