public function testTemplate() { newConf('tpl', "\ncomponents:\n tpl:\n template_dir: " . dirname(__FILE__) . "/view\n compile_dir: " . dirname(__FILE__) . "/view/_compile\n config_dir: " . dirname(__FILE__) . "/view/_config\n cache_dir: " . dirname(__FILE__) . "/view/_cache\n"); $site = new Site(getConf('tpl')); $site->tpl->display('test.tpl'); killConf('tpl'); }
/** * main cron function * @return string */ function cron_main() { global $config; // always send reminders and reminders churchcore_sendReminders(); churchcore_sendMails(); if (getVar("standby")) { // email with feedback image if ($id = getVar("mailqueue_id")) { db_query("UPDATE {cc_mail_queue} \n SET reading_count = reading_count + 1 \n WHERE id=:id", array(":id" => $id)); } // Check if it's time to do a normal cron job if (getConf("cronjob_delay") > 0) { $last_cron = db_query("SELECT value old, UNIX_TIMESTAMP() act \n FROM {cc_config} \n WHERE name='last_cron'")->fetch(); if ($last_cron) { if ($last_cron->act - $config["cronjob_delay"] > $last_cron->old) { db_query("UPDATE {cc_config} \n SET VALUE= UNIX_TIMESTAMP() \n WHERE name='last_cron'"); do_cron(); } } } header('Content-Type: image/gif'); //tiniest transparent GIF, credit: http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever echo base64_decode('R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); } else { do_cron(); if (getVar("manual")) { addInfoMessage(t("cronjob.succeed")); return " "; } } }
/** * @see CTModuleInterface::getMasterData() */ public function getMasterData() { global $user; $res = array(); include_once CHURCHCAL . '/churchcal_db.php'; $res = $this->getMasterDataTables(); $res["masterDataTables"] = $this->getMasterDataTablenames(); $res["entriesLastDays"] = getConf("churchresource_entries_last_days", 90); $res["auth"] = churchresource_getAuthForAjax(); $res["status"] = churchcore_getTableData("cr_status"); $res["minutes"] = churchcore_getTableData("cr_minutes"); $res["hours"] = churchcore_getTableData("cr_hours"); $res["repeat"] = churchcore_getTableData("cc_repeat"); $res["cdb_bereich"] = churchcore_getTableData("cdb_bereich"); $res["cdb_status"] = churchcore_getTableData("cdb_status"); $res["cdb_station"] = churchcore_getTableData("cdb_station"); $res["modulename"] = $this->getModuleName(); $res["modulespath"] = $this->getModulePath(); $res["userid"] = $user->cmsuserid; // CMS Username# $res["user_pid"] = $user->id; $res["user_name"] = "{$user->vorname} {$user->name}"; $res["settings"] = $this->getSettings(); $res["lastLogId"] = churchresource_getLastLogId(); $res["churchcal_name"] = getConf('churchcal_name'); $res["category"] = churchcore_getTableData("cc_calcategory", null, null, "id, color, bezeichnung"); $res["views"] = array("WeekView" => array("filename" => "cr_weekview"), "MaintainView" => array("filename" => "cr_maintainview")); return $res; }
public function testDataFiles() { newConf('df', "components:\n df:\n files_path: /var/www/imagineapuddle.com/www/siteplay/site/test/files/\n"); if (!file_exists(dirname(__FILE__) . '/files/')) { mkdir(dirname(__FILE__) . '/files/'); } if (!file_exists(dirname(__FILE__) . '/files/test/')) { mkdir(dirname(__FILE__) . '/files/test/'); } file_put_contents(dirname(__FILE__) . '/files/test/testfile', 'Title: A Bing-a-bong Bar Biz: Bang Content '); $site = new Site(getConf('df')); $this->assertType('SiteDataFilesController', $site->df); $this->assertType('SiteDataFiles', $site->df->test); $f = $site->df->test->get(array('title' => 'A Bing-a-bong')); $this->assertType('SiteDataFile', $f); $this->assertEquals($f->title, 'A Bing-a-bong'); $this->assertEquals($f->bar_biz, 'Bang'); $this->assertEquals($f->content, "Content\n"); $f = $site->df->test->get(array('title' => 'Not-a-Title')); $this->assertNull($f); unlink(dirname(__FILE__) . '/files/test/.index'); unlink(dirname(__FILE__) . '/files/test/testfile'); rmdir(dirname(__FILE__) . '/files/test/'); rmdir(dirname(__FILE__) . '/files/'); killConf('df'); }
/** * * @see CTModuleInterface::getMasterData() */ public function getMasterData() { global $user, $base_url, $files_dir, $config; include_once CHURCHCAL . '/churchcal_db.php'; $auth = churchservice_getAuthorization(); $res = $this->getMasterDataTables(); $res["masterDataTables"] = $this->getMasterDataTablenames(); $res["auth"] = $auth; $res["modulespath"] = churchservice_getModulesPath(); $res["base_url"] = $base_url; $res["files_url"] = $base_url . $files_dir; $res["files_dir"] = $files_dir; $res["modulename"] = "churchservice"; $res["adminemail"] = getConf('site_mail', ''); $res["user_pid"] = $user->id; $res["user_name"] = $user->vorname . " " . $user->name; $res["userid"] = $user->cmsuserid; $res["settings"] = churchservice_getUserSettings($user->id); $res["notification"] = churchcore_getMyNotifications(); $res["notificationtype"] = churchcore_getTableData("cc_notificationtype"); $res["lastLogId"] = churchservice_getLastLogId(); $res["eventtemplate"] = churchcore_getTableData("cs_eventtemplate", "sortkey"); $res["category"] = churchcal_getAllowedCategories(false); $res["repeat"] = churchcore_getTableData("cc_repeat"); $res["eventtemplate_services"] = churchservice_getEventtemplateServices($auth); $res["churchcal_name"] = $config["churchcal_name"]; $res["churchservice_name"] = $config["churchservice_name"]; $res["songwithcategoryasdir"] = getConf("churchservice_songwithcategoryasdir", "0"); $res["songcategory"] = churchcore_getTableData("cs_songcategory", "sortkey"); $res["views"] = array("ListView" => array("filename" => "cs_listview"), "SettingsView" => array("filename" => "cs_settingsview"), "CalView" => array("filename" => "cs_calview"), "SongView" => array("filename" => "cs_songview"), "AgendaView" => array("filename" => "cs_agendaview"), "FactView" => array("filename" => "cs_factview"), "MaintainView" => array("filename" => "cs_maintainview")); return $res; }
public function testAddons() { newConf('addons', "\naddon_path: " . dirname(__FILE__) . "/addons1/:" . dirname(__FILE__) . "/addons2/\n"); if (!file_exists(dirname(__FILE__) . '/addons1/')) { mkdir(dirname(__FILE__) . '/addons1/'); } if (!file_exists(dirname(__FILE__) . '/addons2/')) { mkdir(dirname(__FILE__) . '/addons2/'); } file_put_contents(dirname(__FILE__) . '/addons1/addon1.php', ' <?php class SiteAddon1 extends SiteComponent { } ?> '); file_put_contents(dirname(__FILE__) . '/addons2/addon2.php', ' <?php class SiteAddon2 extends SiteComponent { } ?> '); $site = new Site(getConf('addons')); $this->assertType('SiteAddon1', $site->addon1); $this->assertType('SiteAddon2', $site->addon2); unlink(dirname(__FILE__) . '/addons1/addon1.php'); unlink(dirname(__FILE__) . '/addons2/addon2.php'); rmdir(dirname(__FILE__) . '/addons1/'); rmdir(dirname(__FILE__) . '/addons2/'); killConf('addons'); }
/** * get MasterData * * @return array with objects * */ public function getMasterData() { global $config; $res = array(); $res["auth_table_plain"] = getAuthTable(); foreach ($res["auth_table_plain"] as $auth) { if ($auth->datenfeld && !isset($res[$auth->datenfeld])) { $res[$auth->datenfeld] = churchcore_getTableData($auth->datenfeld); } } $res["modules"] = churchcore_getModulesSorted(true, false); $res["person"] = churchcore_getTableData("cdb_person", "name, vorname", null, "id, concat(name, ', ', vorname) as bezeichnung"); $res["person"][-1] = new stdClass(); $res["person"][-1]->id = -1; $res["person"][-1]->bezeichnung = "- " . t("public.user") . " -"; $res["publiccalendar_name"] = getConf("churchcal_maincalname", "Church Calendar"); $res["gruppe"] = churchcore_getTableData("cdb_gruppe", null, null, "id, bezeichnung"); $res["status"] = churchcore_getTableData("cdb_status"); $res["category"] = churchcore_getTableData("cc_calcategory", null, null, "id, bezeichnung, privat_yn, oeffentlich_yn"); $res["modulename"] = "churchcore"; $res["admins"] = $config["admin_ids"]; $auths = churchcore_getTableData("cc_domain_auth"); if ($auths) { foreach ($auths as $auth) { $domaintype = array(); // initalize $res[domain_tye] if (isset($res[$auth->domain_type])) { $domaintype = $res[$auth->domain_type]; } $object = new stdClass(); if (isset($domaintype[$auth->domain_id])) { $object = $domaintype[$auth->domain_id]; } else { $object->id = $auth->domain_id; if (isset($db[$auth->domain_type][$auth->domain_id])) { $object->bezeichnung = $db[$auth->domain_type][$auth->domain_id]->bezeichnung; } else { $object->bezeichnung = t("non.existent"); } } if ($auth->daten_id == null) { $object->auth[$auth->auth_id] = $auth->auth_id; } else { if (!isset($object->auth[$auth->auth_id])) { $object->auth[$auth->auth_id] = array(); } $object->auth[$auth->auth_id][$auth->daten_id] = $auth->daten_id; } $domaintype[$auth->domain_id] = $object; $res[$auth->domain_type] = $domaintype; } } foreach (churchcore_getModulesSorted() as $name) { if (isset($config[$name . "_name"])) { $res["names"][$name] = $config[$name . "_name"]; } } return $res; }
/** * Get overloaded configuration value * * @param string $path Config path * * @return null|string */ function getOverloadConf($path) { include __DIR__ . "/../includes/config_overload.php"; if (empty($dPconfig)) { return null; } return getConf($path, $dPconfig); }
public function __construct() { $application = getConf(); $database = getConf()['database']; $host = getConf()['host']; $port = getConf()['port']; parent::__construct("mysql:dbname={$database};" . "host={$host};" . "port={$port};", getConf()['user'], getConf()['password']); }
function parseaddons($addonspath, $filename, $shop_lang) { global $modx, $modulea, $moduleid, $tables, $tsvshop; $out = ""; $tmp = ""; $temp = ""; $num = 1; $lang = isset($lang) ? $lang : $modx->config['manager_language']; //$filename=$modx->config['base_path'].'assets/snippets/tsvshop/admin/tpl/addonstable.tpl'; $tpl = get_file_contents($filename); if (!empty($addonspath) && !empty($filename)) { $folders = scandir($addonspath, 1); foreach ($folders as $folder) { if ($folder != "." && $folder != ".." && file_exists($addonspath . $folder . "/main.inc.php")) { $temp = str_replace('[+moduleid+]', $_GET['id'], $tpl); $temp = str_replace('[+lang+]', $lang, $temp); $temp = str_replace('[+num+]', $num++, $temp); $temp = str_replace('[+addon+]', $shop_lang[$folder . '_title'], $temp); if (is_install($folder)) { if ($tables[$folder] == "system") { $temp = str_replace('[+actions+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/system.png" alt="" />', $temp); } else { $temp = str_replace('[+actions+]', '<a href="/' . MGR_DIR . '/index.php?id=' . $moduleid . '&a=' . $modulea . '&act=addonuninstall&addon=' . $folder . '" title="' . $shop_lang['addons_uninstall'] . '" onclick="uninstall(\'' . $shop_lang['addons_uninstall_question'] . '\');return false"><img src="' . TSVSHOP_SURL . 'addons/addons/img/uninstall.png" alt="' . $shop_lang['addons_uninstall'] . '" /></a>', $temp); } if (getConf("addons", $folder . "_active") == "yes") { if ($tables[$folder] == "system") { $temp = str_replace('[+status+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="" /> <img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="" />', $temp); } else { $temp = str_replace('[+status+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_on.png" alt="' . $shop_lang['addons_on'] . '" title="' . $shop_lang['addons_on'] . '" /> <a href="/' . MGR_DIR . '/index.php?id=' . $moduleid . '&a=' . $modulea . '&act=addonoff&addon=' . $folder . '" title="' . $shop_lang['addons_off_act'] . '"><img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="' . $shop_lang['addons_off_act'] . '" /></a>', $temp); } } else { if ($tables[$folder] == "system") { $temp = str_replace('[+status+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="" /> <img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="" />', $temp); } else { $temp = str_replace('[+status+]', '<a href="/' . MGR_DIR . '/index.php?id=' . $moduleid . '&a=' . $modulea . '&act=addonon&addon=' . $folder . '" title="' . $shop_lang['addons_on_act'] . '"><img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="' . $shop_lang['addons_on_act'] . '" /></a> <img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_off.png" alt="' . $shop_lang['addons_off'] . '" title="' . $shop_lang['addons_off'] . '" />', $temp); } } } else { if ($tables[$folder] == "system") { $temp = str_replace('[+actions+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/system.png" alt="" />', $temp); $temp = str_replace('[+status+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="' . $shop_lang['addons_on'] . '" title="' . $shop_lang['addons_on'] . '" /> <img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="' . $shop_lang['addons_on'] . '" title="' . $shop_lang['addons_on'] . '" />', $temp); } else { $temp = str_replace('[+actions+]', '<a href="/' . MGR_DIR . '/index.php?id=' . $moduleid . '&a=' . $modulea . '&act=addoninstall&addon=' . $folder . '" title="' . $shop_lang['addons_install'] . '"><img src="' . TSVSHOP_SURL . 'addons/addons/img/install.png" alt="' . $shop_lang['addons_install'] . '" /></a>', $temp); $temp = str_replace('[+status+]', '<img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="' . $shop_lang['addons_on'] . '" title="' . $shop_lang['addons_on'] . '" /> <img src="' . TSVSHOP_SURL . 'addons/addons/img/addon_un.png" alt="' . $shop_lang['addons_on'] . '" title="' . $shop_lang['addons_on'] . '" />', $temp); } } $temp = str_replace('[+description+]', $shop_lang[$folder . '_desc'], $temp); $out .= $temp; } } $out = preg_replace('/(\\[\\+.*?\\+\\])/', '', $out); return $out; } else { return ""; } }
public function __construct($modulename) { global $config; parent::__construct("AdminForm_{$modulename}", "admin_saveSettings"); if ($m = getConf($modulename . "_name")) { $this->addField($modulename . "_inmenu", "", "CHECKBOX", t("add.to.menu", $m))->setValue(getConf($modulename . "_inmenu", "0")); $this->addField($modulename . "_startbutton", "", "CHECKBOX", t('show.as.button.on.home', $m))->setValue(getConf($modulename . "_startbutton", "0")); $this->addField($modulename . "_sortcode", "", "INPUT_REQUIRED", t('sortorder.in.menu'))->setValue(getConf($modulename . "_sortcode", "0")); } }
function getDatabaseConnection() { $conf = getConf(); $db = $conf['db']; $databaseConnection = new mysqli($db['host'], $db['username'], $db['password'], $db['name']); if ($databaseConnection->connect_error) { throw new Exception("Could not connect to database."); } return $databaseConnection; }
/** * form for admin seddings * @return CTModuleForm */ function churchresource_getAdminForm() { global $config; $model = new CTModuleForm("churchresource"); $model->addField("churchresource_entries_last_days", "", "INPUT_REQUIRED", t('data.from.x.how.many.days.in.the.past.to.load', 'ChurchResource'))->setValue($config["churchresource_entries_last_days"]); if (getConf("churchresource_send_emails", null) == null) { $config["churchresource_send_emails"] = true; } $model->addField("churchresource_send_emails", "", "CHECKBOX", t('enable.sending.emails'))->setValue($config["churchresource_send_emails"]); return $model; }
function logout_main() { logout_current_user(); // When called per tool (api), then offer a JSEND-answer if (isset($_POST['directtool'])) { include_once CHURCHCORE . '/churchcore_db.php'; drupal_json_output(jsend()->success()); } else { header("Location: ?q=" . getConf("site_startpage", "home")); } }
public function testDBs() { newConf('dbs', "\ncomponents:\n dbs:\n rw:\n model: true\n pool:\n - host: localhost\n username: fake\n password: fake\n database: fake\n - host: localhost\n username: sitetest\n password: st123\n database: sitetest_rw2\n ro:\n model: true\n host: localhost\n username: sitetest\n password: st123\n database: sitetest_ro1\n\n rw1:\n model: true\n host: localhost\n username: sitetest\n password: st123\n database: sitetest_rw1\n ro1:\n model: true\n host: localhost\n username: sitetest\n password: st123\n database: sitetest_ro1\n"); $site = new Site(getConf('dbs')); $this->assertType('SiteDatabase', $site->dbs->rw); $this->assertType('SiteDatabase', $site->dbs->ro); $this->assertFalse($site->dbs->rw === $site->dbs->ro); $this->assertType('null', $site->dbs->notadb); $site->dbs->ro1->ro1->all(1); $site->dbs->rw1->rw1->all(1); killConf('dbs'); }
/** * get master data * @see CTModuleInterface::getMasterData() */ public function getMasterData() { global $user, $base_url, $files_dir, $config; $data["wikicategory"] = churchcore_getTableData("cc_wikicategory"); $data["auth"] = churchwiki_getAuthForAjax(); $data["settings"] = array(); $data["masterDataTables"] = $this->getMasterDataTablenames(); $data["files_url"] = $base_url . $files_dir; $data["files_dir"] = $files_dir; $data["modulename"] = "churchwiki"; $data["modulespath"] = CHURCHWIKI; $data["adminemail"] = getConf('site_mail', ''); return $data; }
public function POST() { $flag_pode_votar = TRUE; $message = ''; $d1start = getConf()['dia1_inicio']; $d1end = getConf()['dia1_fim']; $d2start = getConf()['dia2_inicio']; $d2end = getConf()['dia2_fim']; $ctime = (new DateTime())->getTimestamp(); $day = $d1start < $ctime and $ctime < $d1end ? 1 : $d2start < $ctime and $ctime < $d2end ? 2 : FALSE; //Fazer verificacoes if (!$day) { $flag_pode_votar = FALSE; $error = "NOTOPEN"; $message = "Votações fechadas ou encerradas."; } elseif (!isset($_POST['idmusica']) or !isset($_POST['uuid'])) { $flag_pode_votar = FALSE; $error = "MISSING_PARAM"; $message = "Parâmetros insuficientes."; } elseif (!Application::checkAuth()) { $flag_pode_votar = FALSE; $error = "NOT_AUTH"; $message = "Dispositivo não autorizado para votação"; } elseif (!podeVotar($_POST['uuid'], $day)) { //O uuid tem 0 votos no dia? $flag_pode_votar = FALSE; $error = "CANTVOTE"; $message = "Dispositivo já votou em uma música hoje."; } elseif (!podeSerVotada($_POST['idmusica'], $day)) { $flag_pode_votar = FALSE; $error = "CANTVOTE"; $message = "Esta música não existe ou não está disponÃvel para votação"; } if ($flag_pode_votar) { if (Database::getDatabase()->insert('votacao', array('idmusica'), array($_POST['idmusica']), array(PDO::PARAM_INT))) { $message = "Voto computado com sucesso!"; } else { $flag_pode_votar = FALSE; $error = "SQLERR"; $message = "Ocorreu um erro ao computar o voto."; } } $result['status'] = $flag_pode_votar ? 'OK' : 'ERROR'; $result['message'] = $message; if (isset($error)) { $result['error'] = $error; } $this->setResult($result); }
/** * get master data * @see CTModuleInterface::getMasterData() * * @return array */ public function getMasterData() { global $user, $base_url, $files_dir, $config; $res = churchdb_getMasterDataTables(); $res["feldtyp"] = churchcore_getTableData("cdb_feldtyp"); $res["fields"] = getAllFields(); $res["groups"] = getAllGroups(); $res["tags"] = getAllTags(); $res["FUNachfolgeDomains"] = array("0" => array("id" => "0", "bezeichnung" => "Kein"), "1" => array("id" => "1", "bezeichnung" => $res["fields"]["f_group"]["fields"]["gruppentyp_id"]["text"]), "2" => array("id" => "2", "bezeichnung" => $res["fields"]["f_group"]["fields"]["distrikt_id"]["text"]), "3" => array("id" => "3", "bezeichnung" => t("group"))); $res["groupMemberTypes"] = getGroupMemberTypes(); $res["groupFilterTypes"] = churchdb_getGroupFilterTypes(); // master data information for maintain masterdata and statistics if (user_access("edit masterdata", "churchdb") || user_access("view statistics", "churchdb")) { $res["masterDataTables"] = churchdb_getMasterDataTablenames(); } $res["user_pid"] = $user->id; $res["userid"] = $user->vorname . " " . $user->cmsuserid . " [" . $user->id . "]"; $res["auth"] = churchdb_getAuthForAjax(); $res["site_name"] = getConf('site_name'); $res["modulespath"] = churchdb_getModulesPath(); $res["files_url"] = $base_url . $files_dir; $res["modulename"] = "churchdb"; $res["max_uploadfile_size_kb"] = getConf('max_uploadfile_size_kb'); $res["adminemail"] = getConf('site_mail', ''); $res["max_exporter"] = getConf('churchdb_maxexporter', '150'); $res["groupnotchoosable"] = getConf('churchdb_groupnotchoosable', 30); $res["home_lat"] = getConf('churchdb_home_lat', '53.568537'); $res["home_lng"] = getConf('churchdb_home_lng', '10.03656'); $res["settings"] = churchdb_getUserSettings($user->id); $res["last_log_id"] = churchdb_getLastLogId(); $res["mailchimp"] = getConf('churchdb_mailchimp_apikey') != ""; $res["views"] = array("ArchiveView" => array("filename" => "cdb_archiveview"), "MapView" => array("filename" => "cdb_mapview"), "StatisticView" => array("filename" => "cdb_statisticview"), "SettingsView" => array("filename" => "cdb_settingsview"), "MaintainView" => array("filename" => "cdb_maintainview"), "WeekView" => array("filename" => "../churchresource/cr_weekview")); if (user_access("administer persons", "churchcore")) { $res["auth_table"] = churchdb_getAuthTable(); } if (isset($res["auth"]["edit newsletter"])) { $nl = churchdb_getTableData("cdb_newsletter"); $newsletter = array(); foreach ($res["auth"]["edit newsletter"] as $n) { $newsletter = $nl[$n]; } $res["newsletter"] = $newsletter; } return $res; }
/** * * @see CTModuleInterface::getMasterData() */ public function getMasterData() { global $user, $base_url, $files_dir, $config; $data["auth"] = $this->getAuthForAjax(); $data["settings"] = array(); $data["masterDataTables"] = $this->getMasterDataTablenames(); $data["files_url"] = $base_url . $files_dir; $data["files_dir"] = $files_dir; $data["modulename"] = "churchreport"; $data["modulespath"] = CHURCHREPORT; $data["adminemail"] = getConf('site_mail', '*****@*****.**'); $queries = churchcore_getTableData("crp_query"); $data["query"] = array(); foreach ($queries as $query) { $data["query"][$query->id] = array("id" => $query->id, "sortkey" => $query->sortkey, "query_sql" => $query->query_sql, "bezeichnung" => $query->bezeichnung); } $data["report"] = churchcore_getTableData("crp_report"); return $data; }
/** * get getMasterData */ public function getMasterData() { global $user, $base_url; $ret = array(); $ret["modulename"] = "churchcal"; $ret["modulespath"] = CHURCHCAL; $ret["churchservice_name"] = getConf("churchservice_name"); $ret["churchcal_name"] = getConf("churchcal_name"); $ret["churchresource_name"] = getConf("churchresource_name"); $ret["maincal_name"] = getConf("churchcal_maincalname", "Gemeindekalender"); $ret["firstDayInWeek"] = getConf("churchcal_firstdayinweek", 1); $ret["notification"] = churchcore_getMyNotifications(); $ret["notificationtype"] = churchcore_getTableData("cc_notificationtype"); $ret["reminder"] = ct_getMyReminders($user->id, "event"); $ret["base_url"] = $base_url; $ret["user_pid"] = $user->id; if (user_access("view", "churchdb")) { $ret["cdb_bereich"] = churchcore_getTableData("cdb_bereich"); $ret["cdb_status"] = churchcore_getTableData("cdb_status"); $ret["cdb_station"] = churchcore_getTableData("cdb_station"); $ret["absent_reason"] = churchcore_getTableData("cs_absent_reason"); foreach ($ret["absent_reason"] as $key => $reason) { if (isset($reason->color)) { $ret["absent_reason"][$key]->textColor = getContrastYIQ($reason->color); } } } if (user_access("view", "churchresource") || user_access("create bookings", "churchresource")) { $ret["resources"] = churchcore_getTableData("cr_resource"); $ret["resourceTypes"] = churchcore_getTableData("cr_resourcetype"); $ret["bookingStatus"] = churchcore_getTableData("cr_status"); } $ret["category"] = churchcal_getAllowedCategories(true); $ret["settings"] = churchcore_getUserSettings("churchcal", $user->id); $ret["repeat"] = churchcore_getTableData("cc_repeat"); if (count($ret["settings"]) == 0) { $arr["checkboxEvents"] = "true"; $ret["settings"] = $arr; } $ret["auth"] = churchcal_getAuthForAjax(); $ret["views"] = array("WeekView" => array("filename" => "../churchresource/cr_weekview")); return $ret; }
public function GET() { $flag_pode_votar = FALSE; $d1start = getConf()['dia1_inicio']; $d1end = getConf()['dia1_fim']; $d2start = getConf()['dia2_inicio']; $d2end = getConf()['dia2_fim']; $datetime = new DateTime(); $ctime = $datetime->getTimestamp(); $day = $d1start < $ctime and $ctime < $d1end ? 1 : $d2start < $ctime and $ctime < $d2end ? 2 : FALSE; if (isset($_GET['uuid'])) { $uuid = $_GET['uuid']; $resultSet = Database::getDatabase()->select('dispositivos', "uuid = '{$uuid}'")->fetch(PDO::FETCH_ASSOC); if ($resultSet) { $v1 = (bool) $resultSet['dia1']; $v2 = (bool) $resultSet['dia2']; $votou = $day == 1 ? $v1 : $day == 2 ? $v2 : FALSE; $podeVotar = $day != FALSE and $votou == FALSE; $result['cadastrado'] = TRUE; } elseif (isset($_GET['plataforma']) and isset($_GET['modelo'])) { if (Database::getDatabase()->insert('dispositivos', array('uuid', 'plataforma', 'modelo'), array($_GET['uuid'], $_GET['plataforma'], $_GET['modelo']), array(PDO::PARAM_STR, PDO::PARAM_STR, PDO::PARAM_STR))) { $result['cadastrado'] = TRUE; } else { $result['cadastrado'] = FALSE; } } } $result['status'] = 'OK'; $result['date_time'] = $datetime; $result['time'] = $ctime; if ($day) { $result['votacao'] = 'aberta'; $result['dia'] = $day; $result['pode_votar'] = $podeVotar; } else { $result['votacao'] = $d2end < $ctime ? 'encerrada' : 'fechada'; } $this->setResult($result); }
/** * upload file * * TODO: if this is included only to execute churchcore__uploadfile why not remove the surrounding function and include the code only? */ function churchcore__uploadfile() { global $files_dir, $config; // list of valid extensions, ex. array("jpeg", "xml", "bmp") $allowedExtensions = array(); // max file size in bytes $sizeLimit = ($s = getConf('max_uploadfile_size_kb')) ? $s * 1024 : 10 * 1024 * 1024; $result = null; try { $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); } catch (Exception $e) { $result = 'Entweder POST_MAX_SIZE und UPLOAD_MAX_SIZE erhöhen oder Zahl erniedrigen.'; } if ($result == null) { $file_dir = $files_dir . "/blobs/"; if (!file_exists($file_dir)) { mkdir($file_dir, 0777, true); } $result = $uploader->handleUpload($file_dir); } // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
public static function checkAuth() { return isset($_GET['secret']) and $_GET['secret'] != getConf()['security']; }
function showForm($option) { $http_host = substr(JURI::base(), 0, strpos(JURI::base(), "administrator")); $folder = parse_url($http_host); if ($folder['path'] != "/administrator") { $subfolder = substr($folder['path'], 0, strpos($folder['path'], "administrator")); $http_host = $http_host . $subfolder; } $jcrawlerconf = getConf(JPATH_SITE . "/administrator/components/com_jcrawler/config.xml"); $jcrawlerconf['sitemapurl'] == "" ? $sitemap_url = "/sitemap.xml" : ($sitemap_url = $jcrawlerconf['sitemapurl']); $jcrawlerconf['docroot'] == "" ? $docroot = JPATH_SITE : ($docroot = $jcrawlerconf['docroot']); $jcrawlerconf['priority'] == "" ? $priority = 0.5 : ($priority = $jcrawlerconf['priority']); $str_exclude_names = $jcrawlerconf['excludelist']; if ($jcrawlerconf['forbiddentypes'] == "") { $forbidden_types = array(".jpg", ".jpeg", ".gif", ".png"); $str_forbidden_types = join($forbidden_types, '\\n'); } else { $str_forbidden_types = $jcrawlerconf['forbiddentypes']; } $freq = $jcrawlerconf['changefreq']; $crawlmethod = $jcrawlerconf['method']; $level = $jcrawlerconf['level']; $maxconn = $jcrawlerconf['maxconn']; $timeout = $jcrawlerconf['timeout']; ?> <script type="text/javascript"> <!-- function MM_showHideLayers() { //v9.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; } obj.visibility=v; } } //--> </script> <form action="index.php" id="crawler_form" method="post" name="crawler_form"> <fieldset style="padding: 10px; width:680px; border:2px solid #000099;"> <legend style="color:#000099;"><b>Adapt this to your site</b></legend> <table border="0" cellpadding="5" cellspacing="0" width="670"> <tr> <td width="250" valign="top"><label for="idocument_root" accesskey="D"><b>Document root</b></label><br /> <small>path on server</small></td> <td width="240"> <input class="required" type="Text" name="document_root" id="idocument_root" align="LEFT" size="70" value="<?php echo $docroot; ?> "/> </td> </tr> <tr> <td width="250" valign="top"><label for="ihttp_host" accesskey="H"><strong>HTTP host (readonly)</strong></label><br /> <small>the url of your website</small></td> <td width="240"> <input class="required" type="Text" name="http_host" id="ihttp_host" align="LEFT" size="70" readonly="readonly" value="<?php echo $http_host; ?> "/> </td> </tr> <tr> <td width="250" valign="top"><label for="forbidden_types" accesskey="F"><strong>Forbidden file types</strong></label><br /> <small>files containing this file type will not be added to site index; use line break to separate entries</small></td> <td width="240"> <textarea name="forbidden_types" cols="40" rows="10" id="forbidden_types"><?php echo utf8_decode($str_forbidden_types); ?> </textarea> </td> </tr> <tr> <td width="250" valign="top"><label for="exclude_names" accesskey="e"><strong>Exclude list</strong></label><br /> <small>URLs and their urls (recursive) containing this string will not be added to site index; use line break (no html) to separate entries<br /><br />Ensure that no "ö", "ü", "ä "ï" etc. are in your url's, else add them to the exclude list<br /><br />Your <a href="<?php echo $http_host; ?> robots.txt">robots.txt</a> directory entries will be added automatically</small></td> <td width="340"> <textarea name="exclude_names" cols="60" rows="10" id="exclude_names"><?php echo $str_exclude_names; ?> </textarea> </td> </tr> <tr> <td width="250" valign="top"><label for="isitemap_file" accesskey="S"><strong>Sitemap url</strong></label><br /> <small>Where to store sitemap file - relative to your document root; this must exist, be <font color="red"><strong>writetable</strong></font> and accessible for the google bot!</small></td> <td width="240"> <input type="Text" name="sitemap_url" id="isitemap_url" align="LEFT" size="50" value="<?php echo $sitemap_url; ?> "/> </td> </tr> <tr> <td width="250" valign="top"><label for="ipriority" accesskey="P"><strong>Priority</strong></label><br /> <small>from 0.0 to 1.0, e.g. 0.5</small></td> <td width="240"> <select type="select" name="priority" id="ipriority" align="LEFT" size="1"> <option value="auto" <?php if ($priority == "auto") { echo "selected=\"selected\""; } ?> >Automatic (experimental)</option> <option value="1.0" <?php if ($priority == 1.0) { echo "selected=\"selected\""; } ?> >1.0</option> <option value="0.9" <?php if ($priority == 0.9) { echo "selected=\"selected\""; } ?> >0.9</option> <option value="0.8" <?php if ($priority == 0.8) { echo "selected=\"selected\""; } ?> >0.8</option> <option value="0.7" <?php if ($priority == 0.7) { echo "selected=\"selected\""; } ?> >0.7</option> <option value="0.6" <?php if ($priority == 0.6) { echo "selected=\"selected\""; } ?> >0.6</option> <option value="0.5" <?php if ($priority == 0.5) { echo "selected=\"selected\""; } ?> >0.5</option> <option value="0.4" <?php if ($priority == 0.4) { echo "selected=\"selected\""; } ?> >0.4</option> <option value="0.3" <?php if ($priority == 0.3) { echo "selected=\"selected\""; } ?> >0.3</option> <option value="0.2" <?php if ($priority == 0.2) { echo "selected=\"selected\""; } ?> >0.2</option> <option value="0.1" <?php if ($priority == 0.1) { echo "selected=\"selected\""; } ?> >0.1</option> </select> </td> </tr> <tr> <td width="250" valign="top"><label for="ifreq" accesskey="F"><strong>Change frequency</strong></label><br /> <small>How frequently the page is likely to change</small></td> <td width="240"> <select name="freq"> <option value="always" <?php $freq == "always" ? print "selected=\"selected\"" : null; ?> >Always</option> <option value="hourly" <?php $freq == "hourly" ? print "selected=\"selected\"" : null; ?> >Hourly</option> <option value="daily" <?php $freq == "daily" ? print "selected=\"selected\"" : null; ?> >Daily</option> <option value="weekly" <?php $freq == "weekly" ? print "selected=\"selected\"" : null; ?> >Weekly</option> <option value="monthly" <?php $freq == "monthly" ? print "selected=\"selected\"" : null; ?> >Monthly</option> <option value="yearly" <?php $freq == "yearly" ? print "selected=\"selected\"" : null; ?> >Yearly</option> <option value="never" <?php $freq == "never" ? print "selected=\"selected\"" : null; ?> >Never</option> </select> </td> </tr> <tr> <td width="250" valign="top"><label for="irobots" accesskey="R"><strong>Modify <a href="<?php echo $http_host; ?> robots.txt">robots.txt</a></strong></label><br /> <small>file in joomla root, which contains the sitemap location. robots.txt must be <font color="red"><strong>writetable</strong></font> </small></td> <td width="240"> <input type="checkbox" name="robots" id="irobots" align="LEFT" value="1"/> </td> </tr> <tr> <td width="250" valign="top"><label for="imethod" accesskey="M"><strong>Method</strong></label><br /> <small>Select your favorite method to crawl with, if you don't now what it means, leave it on curl</small></td> <td width="240"><?php !CURL_LOADED ? print "<small><font color=\"red\"><strong>Notice: Curl is not available</strong></font></small><br />" : null; ?> <?php !checkFopen() ? print "<small><font color=\"red\"><strong>Notice: fopen cannot connect to urls (PHP parameter <a href=\"http://www.php.net/manual/filesystem.configuration.php#ini.allow-url-fopen\" target=\"_blank\">allow_url_fopen</a> is set to Off)</strong></font></small><br />" : null; ?> <select name="method"> <option value="curl" <?php $crawlmethod == "curl" ? print "selected=\"selected\"" : null; ?> onclick="MM_showHideLayers('maxconnections','','show','timeout','','show')">curl</option> <option value="fopen" <?php $crawlmethod == "fopen" ? print "selected=\"selected\"" : null; ?> onclick="MM_showHideLayers('maxconnections','','hide','timeout','','hide')">fopen</option> </select> </td> </tr> <tr> <td width="250" valign="top"><label for="ilevel" accesskey="L"><strong>Levels</strong></label><br /> <small>How many levels the crawler crawls, more than 3 can cause a huge execution time and is not recommended for large sites</small></td> <td width="240"> <select name="levels"> <option value="1" <?php $level == "1" ? print "selected=\"selected\"" : null; ?> >1</option> <option value="2" <?php $level == "2" ? print "selected=\"selected\"" : null; ?> >2</option> <option value="3" <?php $level == "3" ? print "selected=\"selected\"" : null; ?> >3</option> <option value="4" <?php $level == "4" ? print "selected=\"selected\"" : null; ?> >4</option> <option value="5" <?php $level == "5" ? print "selected=\"selected\"" : null; ?> >5</option> <option value="6" <?php $level == "6" ? print "selected=\"selected\"" : null; ?> >6</option> </select> </td> </tr> <?php if (is_readable(JPATH_ADMINISTRATOR . '/components/com_sh404sef/config/config.sef.php')) { ?> <tr> <td width="250" valign="top"><label for="iwhitelist" accesskey="L"><strong>Whitelist</strong></label><br /> <small>Add your Website's IP to the Whitelist of sh404SEF. (<strong>Recommended, when flooding-check is enabled, else JCrawler cannot crawl properly</strong>)</small></td> <td width="240"> <input type="checkbox" name="whitelist" id="iwhitelist" value="yes" checked="checked"> </td> </tr> <?php } ?> <tr id="maxconnections" <?php $crawlmethod == "fopen" ? print "style=\"visibility:hidden;\"" : null; ?> > <td width="250" valign="top"><label for="imaxcon" accesskey="M"><strong>Max parallel connections</strong></label><br /> <small>How many parallel connections are allowed. <strong>More connections need more memory. Only valid with curl</strong></small></td> <td width="240"> <select name="maxcon"> <option value="1" <?php $maxconn == "5" ? print "selected=\"selected\"" : null; ?> >1</option> <option value="5" <?php $maxconn == "5" ? print "selected=\"selected\"" : null; ?> >5</option> <option value="10" <?php $maxconn == "10" ? print "selected=\"selected\"" : null; ?> >10</option> <option value="20" <?php $maxconn == "20" ? print "selected=\"selected\"" : null; ?> >20</option> <option value="30" <?php $maxconn == "30" ? print "selected=\"selected\"" : null; ?> >30</option> <option value="40" <?php $maxconn == "40" ? print "selected=\"selected\"" : null; ?> >40</option> <option value="50" <?php $maxconn == "50" ? print "selected=\"selected\"" : null; ?> >50</option> <option value="80" <?php $maxconn == "80" ? print "selected=\"selected\"" : null; ?> >80</option> <option value="100" <?php $maxconn == "100" ? print "selected=\"selected\"" : null; ?> >100</option> <option value="150" <?php $maxconn == "150" ? print "selected=\"selected\"" : null; ?> >150</option> <option value="200" <?php $maxconn == "200" ? print "selected=\"selected\"" : null; ?> >200</option> <option value="250" <?php $maxconn == "250" ? print "selected=\"selected\"" : null; ?> >250</option> </select> </td> </tr> <tr id="timeout" <?php $crawlmethod == "fopen" ? print "style=\"visibility:hidden;\"" : null; ?> > <td width="250" valign="top"><label for="itimeout" accesskey="P"><strong>Timeout</strong></label><br /> <small>Connection timeout in seconds for each connection <strong>Only valid with curl</strong></small></td> <td width="240"> <input type="text" name="timeout" id="itimeout" align="left" size="10" value="<?php echo $timeout; ?> "/> </td> </tr> <tr><td colspan="2"> <div class="info_message" id="info_message" style="visibility:hidden; width:40%; position:absolute; top:60%; left:40%; width:20%; height:20%; background-color:#E6E6E6; border:2px solid #e3e3e3; z-index:2;"><h1 style="padding:10px">Crawling ...</h1><br /><img style="padding:10px;" src="<?php echo $http_host; ?> administrator/components/com_jcrawler/images/activity.gif" /></div></td></tr> <tr> <td> </td> <td><input name="submit" type="Submit" onclick="MM_showHideLayers('info_message','','show')" value="Start"> <small>Please be patient, this can take a while</small></td> </tr> </table> </fieldset> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="task" value="submit" /> <input type="hidden" name="hidemainmenu" value="0" /> <!-- <input type="hidden" name="client" value="<?php //echo $client; ?> " /--> </form> <?php HTML_jcrawler::footer($option); }
/** * * @param array $params * @throws CTException */ public function sendEMail($params) { global $user; include_once './' . CHURCHDB . '/churchdb_db.php'; $groups = churchdb_getMyGroups($user->id, true, false); if (empty($groups[$params["groupid"]])) { throw new CTException("Group is not allowed!"); } $ids = churchdb_getAllPeopleIdsFromGroups(array($params["groupid"])); churchcore_sendEMailToPersonIDs(implode(",", $ids), "[" . getConf('site_name') . "] " . t('message.from.x', "{$user->vorname} {$user->name}"), $params["message"], null, true); }
function is_install($addon) { global $tables, $modx; $inst = getConf("addons", $addon . "_active"); if ($inst == "yes" || $inst == "no" || $tables[$addon] == "system") { return "1"; } else { return "0"; } }
/** * Get html or txt template. If no data is specified, return content (to eval later). * Otherwise replace variables with data and return eval'ed content * * Always available variables are: * $user from globals and $name, $surename, $nickname of $user * $sitename * $modulename * They will be overwritten by variables of $data. * * @param string $template, may include an folder like email/filename * @param string $module * @param array $data; default: false * @param string $type; default: html, txt or any other file extension */ function getTemplateContent($template, $module, $data = false, $type = 'html', $language = null) { if (!$language) { $language = getConf("language"); } if (!$type) { $type = 'html'; } $lang = '_' . $language; $defaultLang = '_en'; $template = constant(strtoupper($module)) . TEMPLATES . "/{$template}"; $filename = "{$template}{$lang}.{$type}"; // try to find template file for current or default lang or lang independently or as plain text with or without lang if (file_exists("{$template}{$lang}.{$type}")) { $filename = "{$template}{$lang}.{$type}"; } elseif (file_exists("{$template}{$defaultLang}.{$type}")) { $filename = "{$template}{$defaultLang}.{$type}"; } elseif (file_exists("{$template}.{$type}")) { $filename = "{$template}.{$type}"; } elseif (file_exists("{$template}{$lang}.{$type}")) { $filename = "{$template}{$lang}.txt"; } elseif (file_exists("{$template}{$defaultLang}.{$type}")) { $filename = "{$template}{$defaultLang}.txt"; } elseif (file_exists("{$template}.{$type}")) { $filename = "{$template}.txt"; } if (!file_exists($filename)) { throw new CTFail(t('template.x.not.found', "{$template}.{$type}")); } //get template prefixed with closing php tag to prevent eval take content as php code $content = '?>' . file_get_contents($filename); // if no data specified return content if (empty($data)) { return $content; } // else extract data into current symbole table and eval content to populate variables $user = getCurrentUser(); // Get $user not through globals, otherwise it could overloaded through extract()!! $nickname = isset($user->spitzname) ? $user->spitzname : $user->vorname; $surname = $user->vorname; $name = $user->name; $sitename = getConf('site_name'); $modulename = getConf($module . '_name', $module); if (count($data)) { extract($data); } ob_start(); eval($content); $content = ob_get_contents(); ob_end_clean(); if (!$content) { throw new CTFail(t('error.occured')); } //TODO: refine error message return $content; }
echo deleteLogFile($_GET['bssid']); } else { echo "No BSSID provided"; } } else { if ($action == "check") { if (isVariableValable($_GET['bssid'])) { echo logFileExists($_GET['bssid']); } else { echo "No BSSID provided"; } } else { if ($action == "move") { if (isVariableValable($_GET["dest"])) { $dest = $_GET['dest']; $logPath = getConf('logPath'); if ($dest == "usb") { if (isUsbMounted()) { if (strstr($logPath, 'usb')) { echo "Already on usb"; } else { $newPath = "/usb/data/reaver/logs/"; if (!is_dir($newPath)) { if (!exec("mkdir -p {$newPath}")) { echo "Error while creating usb log directory !"; } } if (exec('mv ' . $logPath . 'reaver-* ' . $newPath) == "") { setConf('logPath', $newPath); echo 'Logs moved to usb'; } else {
function intiliSearch($searchString = FALSE, $config = FALSE) { if ($searchString == FALSE || $config == FALSE) { return FALSE; } //type DBName='Name', typed='name:', format='str', pri=0 //type DBName='Vorname', typed='vname:', format='str', pri=1 //type DBName='Name', typed='name:', format='str', pri=0 //$searchString = 'hallo, ich, 12, 23.02.2001'; $result = ''; $opterator = ' AND '; $cnt = 0; $anzahl = 0; $cnt_conf = count($config); $searchString = trim($searchString); $last = $searchString[strlen($searchString) - 1]; if ($last == ',' || $last == ';') { $searchString = substr($searchString, 0, -1); } $kPos = strpos($searchString, ','); $sPos = strpos($searchString, ';'); if ($kPos !== FALSE and $sPos !== FALSE) { if ($kPos < $sPos) { $searchString = str_replace(';', ',', $searchString); } else { $searchString = str_replace(',', ';', $searchString); } } $explode_komma = explode(',', $searchString); $explode_simmi = explode(';', $searchString); $anzahl = count($explode_komma); if (count($explode_simmi) > $anzahl) { $opterator = ' OR '; $explode_komma = $explode_simmi; $anzahl = count($explode_simmi); unset($explode_simmi); } foreach ($explode_komma as $key => $value) { if ($cnt == $cnt_conf) { return $result; } $isset = FALSE; $value = trim($value); foreach ($config as $key2 => $value2) { if ($value2['prio'] == $cnt) { $conf = $value2; break; } } if (strlen($value) < 1) { switch ($conf['format']) { case 'str': $value = '*'; break; case 'number': break; default: break; } $value = '*'; } if (strpos($value, ':')) { if ($cnt != 0) { $result .= $opterator; } $ex = explode(':', $value); $conf = getConf($config, $ex[0]); $result = $result . getIntili($ex[1], $conf); } else { if ($cnt != 0) { $result .= $opterator; } $result = $result . getIntili($value, $conf); $isset = TRUE; } $cnt++; } if (empty($result)) { return FALSE; } else { return $result; } }
function surroundWithVCALENDER($txt) { global $config; return "BEGIN:VCALENDAR" . NL . "VERSION:2.0" . NL . "PRODID:-//ChurchTools//DE" . NL . "CALSCALE:GREGORIAN" . NL . "X-WR-CALNAME:" . getConf('site_name') . " ChurchCal-Kalender" . NL . "X-WR-TIMEZONE:" . $config["timezone"] . NL . "METHOD:PUSH" . NL . $txt . "END:VCALENDAR" . NL; }