function get_current_theme() { if ($this->theme == null) { CODOF\Util::get_config($this->db); $theme = CODOF\Util::get_opt('theme'); $this->theme = $theme; } return $this->theme; }
function add_login_as($dom) { $container = $dom->getElementById('codo_login_container'); $sso_name = CODOF\Util::get_opt('sso_name'); $html = <<<EOD <div class="row codo_sso"> <div class="codo_sso_login_btn codo_sso_login_btn" id="codo_login_with_sso">with <span>{$sso_name}</span></div> </div> EOD; //prepend our code $container->innertext = $html . $container->innertext; }
<?php $smarty = \CODOF\Smarty\Single::get_instance(); $db = \DB::getPDO(); if (isset($_POST['captcha_public_key']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { if (!isset($_POST['captcha'])) { $_POST['captcha'] = 'no'; } foreach ($_POST as $key => $value) { if ($key == 'captcha') { $value = "on" == $value ? "enabled" : "disabled"; } $query = "UPDATE " . PREFIX . "codo_config SET option_value=:value WHERE option_name=:key"; $ps = $db->prepare($query); $ps->execute(array(':key' => $key, ':value' => htmlentities($value, ENT_QUOTES, 'UTF-8'))); } } CODOF\Util::get_config($db); $content = $smarty->fetch('spam/recaptcha.tpl');
$u = CODOF\User\User::get($user_id); $res = $u->getInfo(); $res['avatar'] = str_replace("admin/", "", $res['avatar']); $sroles = get_roles(); $smarty->assign('prole_selected', $u->rid); $smarty->assign('role_options', $sroles); $role = $u->rids; $smarty->assign('role_selected', $role); $smarty->assign('user', $res); $content = $smarty->fetch('user_edit.tpl'); } else { //NEW if (isset($_POST['a_username']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { if (CODOF\Util::is_field_present($_POST['a_username'], 'username') === TRUE) { } else { if (CODOF\Util::is_field_present($_POST['a_email'], 'mail') === TRUE) { } else { if (CODOF\User\User::usernameExists($_POST['a_username']) || CODOF\User\User::mailExists($_POST['a_email'])) { $msg = 'username or email already exists!'; } else { $reg = new CODOF\User\Register($db); $reg->username = $_POST['a_username']; $reg->name = $_POST['a_username']; $reg->mail = $_POST['a_email']; $reg->password = $_POST['a_password']; $reg->user_status = 1; $errors = $reg->register_user(); $msg = implode('<br>', $errors); } //$msg = $errors[0]; $err = 1;
$smarty = \CODOF\Smarty\Single::get_instance(); $db = \DB::getPDO(); if (isset($_POST['theme']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { $cfgs = array(); foreach ($_POST as $key => $value) { $query = "UPDATE " . PREFIX . "codo_config SET option_value=:value WHERE option_name=:key"; $ps = $db->prepare($query); $ps->execute(array(':key' => $key, ':value' => $value)); //echo $query."<br>\n"; } } CODOF\Util::get_config($db); $files = array(); if ($handle = opendir(THEME_DIR)) { $i = 0; $curr_theme = CODOF\Util::get_opt('theme'); while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry != "index.html" && $entry != "default") { $entry = str_replace(".php", "", $entry); include DATA_PATH . 'themes/' . $entry . '/info.php'; if ($curr_theme == $entry) { $files[$i]['active'] = true; } else { $files[$i]['active'] = false; } $files[$i]['name'] = $entry; $files[$i]['description'] = $info['description']; $files[$i]['thumb'] = A_DURI . 'themes/' . $entry . '/thumbnail.png'; $i++; } }